Showing preview only (585K chars total). Download the full file or copy to clipboard to get everything.
Repository: oslabs-beta/TotalRecoilJS
Branch: master
Commit: 2d5dff2e62c5
Files: 26
Total size: 565.9 KB
Directory structure:
gitextract_aahahm3e/
├── .gitignore
├── README.md
├── __test__/
│ ├── __snapshots__/
│ │ └── demo.test.js.snap
│ └── demo.test.js
├── babel.config.js
├── extension/
│ ├── backend/
│ │ ├── background.js
│ │ ├── content_script.js
│ │ └── hook.ts
│ ├── frontend/
│ │ ├── create-panel.js
│ │ ├── devtools-root.html
│ │ └── view/
│ │ ├── Components/
│ │ │ ├── left-view/
│ │ │ │ ├── GraphPanel.js
│ │ │ │ ├── SelectorTree.js
│ │ │ │ └── treeView.js
│ │ │ └── right-view/
│ │ │ ├── History.js
│ │ │ ├── Navbar.js
│ │ │ └── atomView.js
│ │ ├── Container.js
│ │ ├── style.css
│ │ ├── view.html
│ │ └── view.js
│ ├── libraries/
│ │ └── d3.js
│ └── manifest.json
├── mock/
│ └── snapshot.js
├── package.json
├── tsconfig.json
└── webpack.config.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
build
node_modules
.DS_Store
================================================
FILE: README.md
================================================
<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
<!-- [![Contributors][contributors-shield]][contributors-url] -->
<!-- [![Stargazers][stars-shield]][stars-url]
[![LinkedIn][linkedin-shield]][linkedin-url] -->
<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://github.com/oslabs-beta/TotalRecoilJS">
<img src="src/icons/Recoil-PNG-Gray.png" alt="Logo" width="200" >
</a>
<!-- <h3 align="center">TotalRecoilJS</h3> -->
<p align="center">
A tool for Recoil developers
<br />
<a href="https://chrome.google.com/webstore/detail/recoil-dev-tools/dhjcdlmklldodggmleehadpjephfgflc"><strong>Download Chrome Extension»</strong></a>
<br />
<br />
<a href="https://github.com/silvia-miranda/RecoilTravel">View Demo App (Recoil Application)</a>
</p>
</p>
<!-- TABLE OF CONTENTS -->
## Table of Contents
* [About the Project](#about-the-project)
* [Built With](#built-with)
* [Getting Started](#getting-started)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Usage](#usage)
* [License](#license)
* [Authors](#authors)
* [Acknowledgements](#acknowledgements)
<!-- ABOUT THE PROJECT -->
## About The Project
Total RecoilJS is a tool created to help developers visualize and track their Recoil state via a Chrome extension.
### Built With
* [React](https://reactjs.org/)
* [D3](https://d3js.org/)
* [TypeScript](https://www.typescriptlang.org/)
* [Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools)
<!-- GETTING STARTED -->
## Getting Started
To get a local copy up and running, follow these simple steps.
### Prerequisites
Install React DevTools
```sh
https://chrome.google.com/webstore/detail/react-developer-tools/
```
### Installation
1. Clone the TotalRecoilJS github
```sh
git clone https://github.com/oslabs-beta/TotalRecoilJS.git
```
2. Install NPM packages
```sh
npm install
```
3. Start development server
```sh
npm run dev
```
4. Unpack to Google Chrome Extensions
5. Navigate to Extensions -> Load Unpacked -> Select Total-Recoil/build/extension

<!-- USAGE EXAMPLES -->
## Usage
Visualize your component tree and see which components are subscribed to which atoms. When you click on an atom’s name, all components that are subscribed to that piece of state will light up.
Troubleshoot by seeing the current state held in each atom.

<insert gif of atom state>
View list of previous states to track changes.
On the history tab, you can see up to 10 previous state snapshots.

<insert gif of history>
View all selector-atom subscriptions using our interactive sunburst and click on any selector to see all subscribed atoms.
<insert gif of sunburst image>

<!-- CONTRIBUTING -->
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
<!-- LICENSE -->
## License
Distributed under the MIT License. See `LICENSE` for more information.
<!-- CONTACT -->
## Authors
<strong>Anthony Lee - [@linkedIn](https://www.linkedin.com/in/anthony-lee27/) - [@GitHub](https://github.com/anthonylee2797)
<strong>Khizar Rehman - [@linkedIn](https://www.linkedin.com/in/khizar-rehman-a125711b4/) - [@GitHub](https://github.com/keyz-man)
<strong>Silvia Miranda - [@linkedIn](https://www.linkedin.com/in/silviakempmiranda/) - [@GitHub](https://github.com/silvia-miranda)
<strong>Zi Hao He - [@linkedIn](https://www.linkedin.com/in/zi-hao-he/) - [@GitHub](https://github.com/exquizzle)
<strong>Kevin Ruan - [@linkedIn](https://www.linkedin.com/in/kevin-ruan-7799711b1/) - [@GitHub](https://github.com/kevinr108)
<!-- ACKNOWLEDGEMENTS -->
## Acknowledgements
Denys Dekhtiarenko - [@linkedIn](https://www.linkedin.com/in/denysdekhtiarenko/) - [@GitHub](https://github.com/denskarlet)
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://github.com/oslabs-beta/TotalRecoilJS/graphs/contributors
[contributors-url]: https://github.com/oslabs-beta/TotalRecoilJS/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=flat-square
[forks-url]: https://github.com/othneildrew/Best-README-Template/network/members
[stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=flat-square
[stars-url]: https://github.com/oslabs-beta/TotalRecoilJS/stargazers
[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=flat-square
[license-url]: https://github.com/othneildrew/Best-README-Template/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/othneildrew
[product-screenshot]: images/screenshot.png
================================================
FILE: __test__/__snapshots__/demo.test.js.snap
================================================
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders & matches snapshot - componetAtomTree props 1`] = `
<DocumentFragment>
<div
class="graph-container"
>
<h1
class="h1-absolute"
>
Component Tree
</h1>
<button
class="graph-button-1"
>
Change View
</button>
<div
id="canvas"
>
<svg
height="768"
width="512"
>
<g
transform="translate(100, -60)"
>
<g
class="node"
transform="translate(0,256)"
>
<circle
fill="steelblue"
r="6"
/>
<text
dy="0.31em"
text-anchor="start"
x="6"
>
test App
</text>
</g>
<g
class="node"
transform="translate(95,256)"
>
<circle
fill="steelblue"
r="6"
/>
<text
dy="0.31em"
text-anchor="start"
x="6"
>
test Recoil Root
</text>
</g>
<g
class="node"
transform="translate(190,128)"
>
<circle
fill="steelblue"
r="6"
/>
<text
dy="0.31em"
text-anchor="start"
x="6"
>
Body
</text>
</g>
<g
class="node"
transform="translate(190,384)"
>
<circle
fill="steelblue"
r="6"
/>
<text
dy="0.31em"
text-anchor="start"
x="6"
>
List
</text>
</g>
<path
class="link"
d="M0,256C0,256,95,256,95,256"
fill="none"
stroke="green"
stroke-opacity="0.4"
stroke-width="1.5"
/>
<path
class="link"
d="M95,256C95,192,190,192,190,128"
fill="none"
stroke="green"
stroke-opacity="0.4"
stroke-width="1.5"
/>
<path
class="link"
d="M95,256C95,320,190,320,190,384"
fill="none"
stroke="green"
stroke-opacity="0.4"
stroke-width="1.5"
/>
</g>
</svg>
</div>
</div>
</DocumentFragment>
`;
exports[`renders & matches snapshot - no props 1`] = `
<DocumentFragment>
<div
class="graph-container"
>
<h1
class="h1-absolute"
>
Component Tree
</h1>
<button
class="graph-button-1"
>
Change View
</button>
<div
id="canvas"
/>
</div>
</DocumentFragment>
`;
================================================
FILE: __test__/demo.test.js
================================================
import React from 'react';
import GraphPanel from '../extension/frontend/view/Components/GraphPanel';
import { tree } from '../mock/snapshot.js';
import {
render,
cleanup,
} from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import '@babel/polyfill';
afterEach(cleanup);
it('renders & matches snapshot - no props', () => {
const {asFragment} = render(<GraphPanel />);
expect(asFragment()).toMatchSnapshot();
});
it('renders & matches snapshot - Tree props', () => {
const {asFragment} = render(
<GraphPanel
tree={ tree }
/>,
);
expect(asFragment()).toMatchSnapshot();
});
================================================
FILE: babel.config.js
================================================
module.exports = {
presets: [
'@babel/preset-env',
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins: ['@babel/plugin-proposal-class-properties'],
};
================================================
FILE: extension/backend/background.js
================================================
const connectedTabs = {};
//opens a long-running port connection between background script and content script
//adds tab info for any tab that has our extension open
//executes content script on connect (aka adding hook.js script)cd ..
chrome.runtime.onConnect.addListener((port) => {
const panelListener = (request, sender, sendResponse) => {
if (request.name === 'connect' && request.tabID) {
connectedTabs[request.tabID] = port;
}
chrome.tabs.executeScript({
file: './content_script.js'
});
}
//keeps listening on open port
port.onMessage.addListener(panelListener);
//when the port is disconnected it removes the tabID from the connectedTabs object and removes panelListener
port.onDisconnect.addListener(function(port) {
port.onMessage.removeListener(panelListener);
const tabs = Object.keys(connectedTabs);
for (let k = 0; k < tabs.length; k++) {
if (connectedTabs[tabs[k]] === port){
delete connectedTabs[tabs[k]];
break;
}
}
});
});
//runs after receiving message from the content script, it keeps track of the tab.id data when the recoil function in currently running on for reference
function handleMessage(request, sender, sendResponse) {
if(sender.tab) {
const tabID = sender.tab.id;
if (tabID in connectedTabs) {
connectedTabs[tabID].postMessage(request);
}
}
return Promise.resolve('Filler resolution for the browser');
}
//listens for messages from content script
chrome.runtime.onMessage.addListener(handleMessage);
//on every refresh this listener injects the content script
chrome.tabs.onUpdated.addListener(function(tabID, changeInfo, tab) {
if(connectedTabs[tabID]) {
chrome.tabs.executeScript({
file: './content_script.js'
});
}
})
================================================
FILE: extension/backend/content_script.js
================================================
//this will inject the hook file in the application after 500 milliseconds after the application starts to make sure the hook script is appended when the DOM is loaded
const time = 500;
setTimeout (() => {
const script = document.createElement('script');
script.src = chrome.extension.getURL('hook.js');
document.head.appendChild(script);
}, time);
//this is listening for the message from the hook file
window.addEventListener('message', handleMessage);
//handle message function runs when a message is received from the hook file and if it has the tree data it will fire the sendMessage function
function handleMessage(request, sender, sendResponse) {
if (request.data && request.data.tree) {
sendMessage(request.data.tree);
}
}
//the sendMessage function sends the backend tree and atom/selector data to the background script
function sendMessage(tree) {
chrome.runtime.sendMessage(tree);
}
================================================
FILE: extension/backend/hook.ts
================================================
const throttle = require('lodash.throttle')
//the export exists to indicate that the file is a module for typescript to allow the code to use global object
export {};
//define variable types for typscript here
declare global {
interface devTools {
renderers: { size?: number };
// onCommitFiberRoot(any?);
}
interface Window {
__REACT_DEVTOOLS_GLOBAL_HOOK__: devTools;
}
interface Component {
name: any;
state?: any;
children?: any;
atoms?: any;
}
}
function patcher() {
// grabs the React DevTools from the browser
const devTools:any = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
// if conditions to check if devTools is running or the user application is react
if (!devTools) {
sendToContentScript('React DevTools is not activated, please activate React DevTools!')
}
if (devTools.renderers && devTools.renderers.size < 1) {
sendToContentScript('The page is not using React or if it is using React please trigger a state change!')
}
// adding/patching functionality to capture fiberTree data to the onCommitFiberRoot method in devTools
devTools.onCommitFiberRoot = (function (original) {
function newFunc(...args:any) {
const fiberDOM = args[1];
console.log(fiberDOM);
const rootNode = fiberDOM.current.stateNode.current;
//create a new array that will be sent to the frontend after being populated with necessary data
const treeArr: any[] = [];
try {
//this function collects the data for the component tree and stores atom names and state data
recurseThrottle(rootNode.child, treeArr);
//this function below gets the atom value data for the right panel in UI
treeArr.push(getAtomValues(treeArr[0], 'atomValues'));
//this function gets the link between selectors and atom for the selector/atom tree
treeArr.push(getSelectorAtomLink(treeArr[0], 'nodeToNodeSubscriptions'))
//if the data is populated correctly, the array will be sent to the content_script file in the backend
console.log('treearr sent to frontend', treeArr)
if (treeArr.length > 0) sendToContentScript(treeArr);
} catch (err) {
console.log('Error at onCommitFiberRoot:', err)
sendToContentScript('Error: something went wrong with our application, please submit the issue on https://github.com/oslabs-beta/TotalRecoilJS')
}
return original(...args);
}
return newFunc;
// Below syntax devTools.onCommitFiberRoot runs immediately after adding our new functionality to devTools.onCommitFiberRoot (and the input is the original function of onCommitFiberRoot)
})(devTools.onCommitFiberRoot)
}
//throttling the recusrive function getComponentData to run only once in 300 milliseconds, to improve performance as changes are made in the user application
const recurseThrottle = throttle(getComponentData, 300);
//recursive function (getComponentData) below traverses through the fiber tree and collects certain component,state, and atom data
function getComponentData(node: any, arr: any[]) {
const component: Component = {name: ''};
if (getName(node, component, arr) === -1) return;
getState(node, component)
getAtom(component)
arr.push(component)
//getchildren calls getComponentData (name, state, atom), pushes into nested "children" array
getChildren(node, component, arr)
}
//this function will get the same of the React components
function getName(node: any, component: any, arr: Array<any>) {
if (!node.type || !node.type.name) {
// if this is an HTML tag just keep recursing without saving the name
if (node.child) getComponentData(node.child, arr);
if (node.sibling) getComponentData(node.sibling, arr);
return -1;
} else {
component.name = node.type.name;
}
}
//this functions gets all the data related to state in React fiber (and the data stored here is used later in other functions)
function getState(node: any, component: any) {
//checking for 3 conditions (if state exists, if its a linkedlist with state, if its not a linkedlist with state)
//check if state exists in the node, if not just return and exit out of the function
if (!node.memoizedState) return;
// check if the state is stored as a linkedlist
if (node.memoizedState.memoizedState !== undefined) {
//check if you're at the end of the linked list chain (.next = null)
if (node.memoizedState.next === null) {
component.state = cleanState(node.memoizedState.memoizedState)
return;
}
// initialize array because state is a linkedlist so you can store multiple states in the array
component.state = [];
linkedListRecurse(node.memoizedState, component.state);
return;
}
// if the state is not stored as a linkedlist, then run the clean state function
component.state = cleanState(node.memoizedState)
function linkedListRecurse(node: any, treeArr: any[]) {
treeArr.push(cleanState(node.memoizedState))
if (node.next && node.memoizedState !== node.next.memoizedState) {
linkedListRecurse(node.next, treeArr)
}
}
}
//this function traverses through component.state property collected in the function getState and stores atom names
function getAtom(component: Component) {
// if component has no state there is not atom for it so just exit from the function;
if (!component.state) {
return;
}
// Make a new empty Set
const atomArr = new Set();
// this will loop through component.state to get the atom data
for (let i = 0; i < component.state.length; i++) {
if (component.state[i]['current'] instanceof Set || component.state[i]['current'] instanceof Map) {
// this code will give us the value from the existing set/map in component.state to add to our newly created set
const it = component.state[i]['current'].values();
let first = it.next();
atomArr.add(first.value);
}
//below code will convert the data in the create set to an array in component.atoms property, take out any duplicates, and delete the propert if no atoms exists for the component
component.atoms = Array.from(atomArr);
if (component.atoms.length === 0) {
delete component.atoms;
} else {
for (const el of component.atoms) {
if (typeof el !== 'string') {
let index = component.atoms.indexOf(el);
component.atoms.splice(index, 1);
}
}
}
}
}
//this is will get all the children and sibling components linked to the current component node and then run the recursive function getComponentData again on each child/sibling node
function getChildren(node: any, component: Component, arr: any[]) {
const children: any[] = [];
//check if the node has a child, if so then run the getComponentData on that child node(s)
if (node.child) {
getComponentData(node.child, children);
}
// check if the node has a sibling, if so then run the getComponentData on that sibling node(s)
if (node.sibling) getComponentData(node.sibling, arr);
//if no more child or sibling nodes then return the children array
if (children.length > 0) component.children = children;
}
//this function populates atom values in the second position of the array that is sent to the front end
function getAtomValues(obj: object, prop: string) {
const arr: any = [];
//this function populates the array with the data as map object that is found in tree
function recursivelyFindProp(o: any, keyToBeFound: string) {
if (typeof o !== 'object' || !o) {
return;
}
Object.keys(o).forEach(function (key) {
if (key === keyToBeFound) {
arr.push(o[key])
} else {
if (typeof o[key] === 'object') {
recursivelyFindProp(o[key], keyToBeFound);
}
}
});
}
//it recurses throught nested objects and arary to find the key 'atomValues' where the atom value data is stored (the atom values are in a map object)
recursivelyFindProp(obj, prop);
//the skeleton structure of how the data object will look stored in the array to send to the frontend
interface Result {
atomVal: any
}
const result: Result = {
atomVal: {}
}
//converting map objects where the atom value is found into the result object with a key value pair
for (let i = 0; i < arr.length; i++) {
let mapData = arr[i]
if (mapData) {
for (let [key, value] of mapData) {
result.atomVal[key] = value.contents;
}
}
}
return result;
}
//this function creates and stores the data for the selector/atom tree and stores in the 3rd position in the array sent to the frontend
function getSelectorAtomLink(obj: any, prop: string) {
let arr: any[] = [];
function recursivelyFindProp(o: any, keyToBeFound: string) {
if (typeof o !== 'object' || !o) {
return;
}
Object.keys(o).forEach(function (key) {
if (key === keyToBeFound) {
arr.push(o[key])
} else {
if (typeof o[key] === 'object') {
recursivelyFindProp(o[key], keyToBeFound);
}
}
});
}
//this function recursively finds the key 'nodeToNodeSubscriptions' which has the data for atom to selector connections
recursivelyFindProp(obj, prop);
//skeleton structure of how the data will be stored in the array
interface SelectorTree {
name: string;
children: any[];
}
const result: SelectorTree = {
name: 'Selector Tree',
children: []
}
interface NonSelectorAtoms {
name: string;
children: any[];
}
const tempObj: NonSelectorAtoms = {name: 'nonSelectorAtoms', children: []}
result.children.push(tempObj)
//converting map data into object data to be stored
const newArr = arr.filter((item, index) => arr.indexOf(item) === index)
for (let i = 0; i < newArr.length; i++) {
let mapData = newArr[i]
if (mapData) {
for (let [key, value] of mapData) {
let tempArr = [...value]
for (let el of tempArr) {
let tempObj: SelectorTree = {
name: '',
children: []
}
tempObj.name = el;
interface TreeValObj {
name: string;
value: number;
}
const treeValObj = {
name: key,
value: 100
}
tempObj.children.push(treeValObj);
result.children.push(tempObj);
}
}
}
}
let atomsAndSelectors: any = [];
//finds all the atoms with selector connetions and compares if there are any atom names that exist in the component tree that do not show up in the 'nodeToComponentSubscriptions' because those are the atoms with no selectors
function getNonSelectorAtoms(result: any, obj: any) {
//below function finds the atom/selector data found in 'nodeToComponentSubscriptions' key
findNested(obj, 'nodeToComponentSubscriptions')
if(atomsAndSelectors.length > 0) {
let atomsAndSelectorsArr = Array.from(atomsAndSelectors[0].keys());
for (const el of atomsAndSelectorsArr) {
if (!doesNestedValueExist(result, el)) {
result.children[0].children.push({name: el, value: 100});
}
}
}
}
//checks if a value exits in a nested object
function doesNestedValueExist(obj: any, text: any): boolean {
let exists = false;
let keys = Object.keys(obj);
for(let i = 0; i < keys.length; i++) {
let key = keys[i];
let type = typeof obj[key];
if(type === 'object') {
exists = doesNestedValueExist(obj[key], text);
}
else if(type === 'string') {
exists = obj[key].indexOf(text) > -1;
}
if(exists) {
break;
}
}
return exists;
};
//returns the data that exists for the key value that is in keyToBeFound input in a nested object
function findNested(o: any, keyToBeFound: string) {
if (typeof o !== 'object' || !o) {
return;
}
Object.keys(o).forEach(function (key) {
if (key === keyToBeFound) {
atomsAndSelectors.push(o[key]);
} else {
if (typeof o[key] === 'object') {
findNested(o[key], keyToBeFound);
}
}
});
}
//this function recursively finds atoms that have no selectors
getNonSelectorAtoms(result, obj)
return result;
}
//this function cleans the state data for component.state property (this function is run inside getState function)
function cleanState(stateNode: any, depth = 0) {
let result: any;
if (depth > 10) return "Max recursion depth reached!"
//checking if the stateNode is not an object or function, if it is not either return the stateNode
if (typeof stateNode !== 'object' && typeof stateNode !== 'function') return stateNode;
if (stateNode === null) {
return null;
}
if (typeof stateNode === 'object') {
//when using useRecoilValue atoms are saved as set - checking for atom data
if (stateNode instanceof Set) {
return stateNode;
}
if (stateNode instanceof Map) {
return stateNode;
}
if (stateNode.$$typeof && typeof stateNode.$$typeof === 'symbol') {
return stateNode.type && typeof stateNode.type !== 'string' ? `<${stateNode.type.name} />` : 'React component';
}
if (Array.isArray(stateNode)) {
result = [];
stateNode.forEach((el, index) => {
if (el !== null) {
result[index] = cleanState(el, depth + 1)
} else {
result[index] = el;
}
})
} else {
result = {};
Object.keys(stateNode).forEach((key) => {
result[key] = cleanState(stateNode[key], depth + 1)
});
}
return result;
}
if (typeof stateNode === 'function') {
return `function: ${stateNode.name}()`;
}
}
//the function that sends the array with the necessary tree data to the frontend
function sendToContentScript(obj: any) {
const tree = JSON.parse(JSON.stringify(obj));
window.postMessage({ tree }, '*');
}
//the patcher function is invoked one time when the app first runs to modify the onCommitFiberRoot function in React devTools to extract React Fiber
patcher();
================================================
FILE: extension/frontend/create-panel.js
================================================
/* eslint-disable no-use-before-define */
// This creates the dev tools panel using the panel.html file as the template
chrome.devtools.panels.create(
'Recoil', // title
'', // icon
'./view.html' // content
);
================================================
FILE: extension/frontend/devtools-root.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Title</title>
</head>
<body>
<!-- This file is references from manifest.json -->
<!-- Loads script devtools.js where the panel is actually created-->
<!-- ***** This HTML is not used - see view.html instead! **** -->
<h1>MAKE ME THE HTML</h1>
<script src="./create-panel.js"></script>
</body>
</html>
================================================
FILE: extension/frontend/view/Components/left-view/GraphPanel.js
================================================
import React, { useEffect, useState } from 'react';
import {
BrowserRouter as Router,
Switch,
Route,
Link,
Redirect
} from "react-router-dom";
import SelectorTree from './SelectorTree'
import TreeView from './treeView';
const GraphPanel = (props) => {
const [view, setView] = useState(true);
const [viewName, setviewName] = useState('COMPONENT TREE')
const changeView = () => {
setView(!view);
if (viewName === 'COMPONENT TREE') {
setviewName('SELECTOR TREE')
} else {
setviewName('COMPONENT TREE')
}
}
return (
<div className='graph-container'>
<h1 className='h1-absolute' >{viewName}</h1>
<button onClick={changeView} className='graph-button-1'>Change View</button>
{view ? <TreeView tree={props.tree} /> : <SelectorTree tree={props.tree} />}
</div>
)
};
export default GraphPanel;
================================================
FILE: extension/frontend/view/Components/left-view/SelectorTree.js
================================================
import React, { useEffect, useState, useRef } from 'react';
import * as d3 from '../../../../libraries/d3';
/*
instruction to swap trees
change flare to data
change the place it targets on the DOM
*/
export const SelectorTree = (props) => {
useEffect(() => {
if (props.tree) {
console.log('props tree', props.tree[2])
document.querySelector('#canvas').innerHTML = ''
// const colorLegends = document.querySelector('#canvas');
// const title = document.createElement('h1');
// title.innerHTML = 'blue: selectors \n ligherblue: subscribers';
// colorLegends.appendChild(title);
var colorList = {Selectors: '#7289da', Subscribers: '#7289da'};
const colorize = function(colorList) {
var container = document.querySelector('#canvas');
var parentContainer = document.createElement("DIV");
parentContainer.className = 'legend';
for (var key in colorList) {
var boxContainer = document.createElement("DIV");
var box = document.createElement("DIV");
var label = document.createElement("DIV");
label.innerHTML = key;
box.className = "box";
box.style.backgroundColor = colorList[key];
if(key === 'Selectors') {
box.style.opacity = 1;
} else {
box.style.opacity = 0.3;
}
boxContainer.appendChild(box);
boxContainer.appendChild(label);
parentContainer.appendChild(boxContainer);
container.appendChild(parentContainer);
}
}
colorize(colorList);
// -------------------------------------------
// global constant variables that will be used
const partition = data => {
const root = d3.hierarchy(data)
.sum(d => d.value)
// .sort((a, b) => b.value - a.value);
return d3.partition()
.size([2 * Math.PI, root.height + 1])
(root);
}
const myColor = d3.scaleOrdinal().domain(props.tree[2]).range(['#7289da']);
// color number or stringNum input into rgb(num1, num2, num3)
// const color = d3.scaleOrdinal(d3.quantize(d3.interpolateRainbow, props.tree[2].children.length + 1))
// console.log('color: ', color('12'));
// formats number or stringNum input into chunks of 3 digits, 123456 -> '123,456'
const format = d3.format(",d");
// console.log('format: ', format('123456'))
const width = 932; // 932/1200
const radius = width / 6; // always divide by 6
const arc = d3.arc()
.startAngle(d => d.x0)
.endAngle(d => d.x1)
.padAngle(d => Math.min((d.x1 - d.x0) / 2, 0.005))
.padRadius(radius * 1.5)
.innerRadius(d => d.y0 * radius)
.outerRadius(d => Math.max(d.y0 * radius, d.y1 * radius - 1));
// --------------------end of Global Constants-------------------------------
// --------- start here ---------------------
// change flare to data: there are 2 places
const root = partition(props.tree[2]);
// root.attr('value', d => 100);
console.log('root: ', root);
// root.each(d => d.current = d);
root.each(d => {
// console.log('d current: ', d.current);
// this will log undefined
return d.current = d;
});
// ----- creates svg/canvas -----
const svg = d3.select('#canvas')
.append('svg')
// .attr("viewBox", [0, 0, width * 10, width * 10])
.attr("viewBox", [0, 0, width + 70, width + 70])
.style("font", "10px sans-serif")
// g tag allows us to grab a whole of inner tags/elements
// then allowing us to do group transformation with them
// as a 'group'
// const g is the handle/variable name for that group of elements
const g = svg.append("g")
.attr("transform", `translate(${width / 2},${width / 2})`);
// ----- create svg ends -----
// ----- create paths -----
const path = g.append("g")
.selectAll(".patharc")
.data(root.descendants().slice(1))
.join("path")
.attr('class', 'patharc')
.attr("fill", d => { while (d.depth > 1) d = d.parent; return myColor(d.data.name); })
.attr("fill-opacity", d => arcVisible(d.current) ? (d.children ? 1 : 0.35) : 0)
.attr("d", d => arc(d.current));
// ----- filters into inner elements, allows 'zoom' -----
path.filter(d => d.children)
.style("cursor", "pointer")
.on("click", clicked);
path.append("title")
.text(d => `${d.ancestors().map(d => d.data.name).reverse().join("/")}`);
// .text(d => `${d.ancestors().map(d => d.data.name).reverse().join("/")}\n${format(d.value)}`);
// ----- create paths ends -----
// ----- create labels -----
const label = g.append("g")
.attr("pointer-events", "none")
.attr("text-anchor", "middle")
.style("user-select", "none")
.selectAll("text")
.data(root.descendants().slice(1))
.join("text")
.attr("dy", "25") // need dy for text wrapping
.attr("fill-opacity", d => +labelVisible(d.current))
.attr("transform", d => labelTransform(d.current))
.text(d => d.data.name)
.attr('class', 'arclabels') // label for css styling
// .call(wrap, 200)
// .style('font-size', '25px')
// ----- create labels ends -----
// ----- create top most level circle -----
const parent = g.append("circle")
.datum(root)
.attr("r", radius)
.attr('class', 'selectorTreeHomeBtn')
.attr("fill", "steelblue")
.attr("pointer-events", "all")
.on("click", clicked)
// can work on getting name to center of parent circle
// .text(d => d.data.name)
// coming back to work on this
parent.append('title')
.text('Go Back');
// ----- create top most level circle ends -----
// ----- 4 event handling functions -----
function clicked(p) {
parent.datum(p.parent || root);
root.each(d => d.target = {
x0: Math.max(0, Math.min(1, (d.x0 - p.x0) / (p.x1 - p.x0))) * 2 * Math.PI,
x1: Math.max(0, Math.min(1, (d.x1 - p.x0) / (p.x1 - p.x0))) * 2 * Math.PI,
y0: Math.max(0, d.y0 - p.depth),
y1: Math.max(0, d.y1 - p.depth)
});
const t = g.transition().duration(750);
// Transition the data on all arcs, even the ones that aren’t visible,
// so that if this transition is interrupted, entering arcs will start
// the next transition from the desired position.
path.transition(t)
.tween("data", d => {
const i = d3.interpolate(d.current, d.target);
return t => d.current = i(t);
})
.filter(function (d) {
return +this.getAttribute("fill-opacity") || arcVisible(d.target);
})
.attr("fill-opacity", d => arcVisible(d.target) ? (d.children ? 1 : 0.35) : 0)
.attrTween("d", d => () => arc(d.current));
label.filter(function (d) {
return +this.getAttribute("fill-opacity") || labelVisible(d.target);
}).transition(t)
.attr("fill-opacity", d => +labelVisible(d.target))
.attrTween("transform", d => () => labelTransform(d.current));
}
function arcVisible(d) {
return d.y1 <= 3 && d.y0 >= 1 && d.x1 > d.x0;
}
function labelVisible(d) {
return d.y1 <= 3 && d.y0 >= 1 && (d.y1 - d.y0) * (d.x1 - d.x0) > 0.03;
}
function labelTransform(d) {
const x = (d.x0 + d.x1) / 2 * 180 / Math.PI;
const y = (d.y0 + d.y1) / 2 * radius;
return `rotate(${x - 90}) translate(${y},0) rotate(${x < 180 ? 0 : 180})`;
}
// line 230 238 toggle between px or em wrap
// extra personalized wrap util for wrapping text inside circular arc
// function wrap(text, width) {
// text.each(function () {
// let text = d3.select(this),
// // .text().match(/[A-Z][a-z]+|[0-9]+/g).join(" ");
// // words is a string
// words = text.text();
// words = words.replace(words[0], words[0].toUpperCase());
// console.log(words);
// console.log(typeof words);
// words = words
// .match(/[A-Z][a-z]+|[0-9]+/g).join(" ")
// .split(/\s+/).reverse();
// // console.log(words);
// let word,
// line = [],
// lineNumber = 0,
// lineHeight = 1, // ems
// y = text.attr("y"),
// dy = parseFloat(text.attr("dy")),
// tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "px");
// while (word = words.pop()) {
// line.push(word);
// tspan.text(line.join(" "));
// if (tspan.node().getComputedTextLength() > width) {
// line.pop();
// tspan.text(line.join(" "));
// line = [word];
// tspan = text.append("tspan").attr("x", 0).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "px").text(word);
// }
// }
// });
// }
// ----- event handling functions ends -----
// -------------------------------------------------
}
})
return (
<div id='canvas'>
{/* <div id='canvas'></div> */}
</div>
)
}
export default SelectorTree;
================================================
FILE: extension/frontend/view/Components/left-view/treeView.js
================================================
import React, { useEffect, useState, useRef } from 'react';
import * as d3 from '../../../../libraries/d3.js';
import { scaleBand } from 'd3';
export const TreeView = (props) => {
const [atomhover, setatomhover] = useState([])
// on each state change, a tree will be rendered with all its nodes and links
useEffect(() => {
if (props.tree) {
document.querySelector('#canvas').innerHTML = ''
const root = d3.hierarchy(props.tree[0])
const panelWidth = Math.floor(window.innerWidth * 0.5);
// Find out the height of the tree and size the svg accordingly
const dataHeight = root.height;
const treeHeight = dataHeight * 200;
const svgHeight = Math.max(treeHeight, window.innerHeight)
const svg = d3.select('#canvas')
.append('svg')
.attr('width', panelWidth)
.attr('height', svgHeight + 80)
.call(d3.zoom()
.scaleExtent([.25, 8])
// .translateExtent([[-3000, -4000], [3000, 4000]])
.on('zoom', function () {
svg.attr('transform', d3.event.transform)
})
)
.attr('class', 'component-svg')
.append('g')
// if windowheight is greater or less than 600, place tree in different place on screen
if (window.innerHeight > 600) {
svg.attr('transform', 'translate(20,100)scale(.5,.5)')
} else {
svg.attr('transform', 'translate(200,-20)scale(.5,.5)')
}
let tree = d3.tree().size([panelWidth - 80, treeHeight]);
tree(root)
// creates nodes
const nodes = root.descendants()
const node = svg.selectAll('.node')
.data(nodes)
.enter()
.append('g')
.attr('class', 'node')
.attr('transform', (d) => 'translate(' + d.y + ',' + d.x + ')')
.attr('cursor', 'pointer')
// creates circle
node.append('circle')
.attr('class', 'componentTreeNode')
.attr('r', 5)
// .attr('fill', 'steelblue')
.attr('fill', 'rgb(244, 244, 244)')
// creates text
node.append('text')
.attr("dy", "0.31em")
.attr("x", d => d._children ? -6 : 6)
// .attr('fill', '#F0DB4F')
.attr('fill', 'rgb(244, 244, 244)')
.style('font-size', '22px')
.attr("text-anchor", d => d._children ? "end" : "start")
.text(function (d) {
return d.data.name
})
// on mouseover/mouseout set atomhover to an array with name of atoms/component
node.on('mouseover', (e) => {
const atoms = e.data.atoms
const name = e.data.name
setatomhover([atoms, name])
})
node.on('mouseout', (e) => {
setatomhover([])
})
// create links connecting all the nodes
const links = root.links()
const link = svg.selectAll('.link')
.data(links)
.join('path')
.attr('class', 'link')
.attr('d', d3.linkVertical()
// swap places of dx and dy, to change orientation of tree
.x(d => d.y)
.y(d => d.x))
.attr("fill", "none")
.attr("stroke", "white")
.attr("stroke-opacity", 0.4)
.attr("stroke-width", 1.5)
}
}, [props.tree])
return (
<div>
<div id='atom-hover'>
{atomhover[0] ? <h1> Atoms: {JSON.stringify(atomhover[0])}</h1> : <h1> </h1>}
{atomhover[1] ? <h1> Name: {atomhover[1]}</h1> : <h1></h1>}
</div>
<div id='canvas'></div>
</div>
)
}
export default TreeView;
================================================
FILE: extension/frontend/view/Components/right-view/History.js
================================================
import React, { useEffect, useRef } from 'react';
import JSONPretty from 'react-json-pretty';
const History = ({ history }) => {
// scroll to bottom of history
const messagesEnd = useRef(null);
const scrollToBottom = () => {
messagesEnd.current.scrollIntoView({ block: 'end', behavior: 'smooth', inline: 'nearest' })
}
useEffect(() => {
const historyInfo = document.getElementById('history-info');
historyInfo.scrollTop = historyInfo.scrollHeight;
}, []);
useEffect(scrollToBottom, [history]);
const historyMap = history.map((hist) => {
// get the atoms and state data
let snap;
if (hist.tree[1].atomVal) {
snap = hist.tree[1].atomVal;
}
const data = <JSONPretty data={snap}></JSONPretty>
return <summary><p className="blue">History {hist.count}: </p>{data}</summary>
});
return (
<div id="history-tab">
<div id="history-info">
<p id='json'></p>
{historyMap}
<div ref={messagesEnd}></div>
</div>
</div >
)
}
export default History;
================================================
FILE: extension/frontend/view/Components/right-view/Navbar.js
================================================
import React from 'react';
import {
BrowserRouter as Router,
Switch,
Route,
Link,
NavLink
} from "react-router-dom";
import History from './History'
import AtomView from './atomView'
const Navbar = (props) => (
<Router>
<header className='navbar'>
<div id='link-container'>
<NavLink activeClassName='a-right-active' className='a-right' to="/h">ATOM VALUES</NavLink>
<NavLink activeClassName='a-right-active' className='a-right no-border-left' to="/tab2">HISTORY</NavLink>
</div>
<Switch>
<Route path="/tab2">
<History tree={props.tree} history={props.history} />
</Route>\
<Route path="/h">
<AtomView tree={props.tree} />
</Route>
<Route path="/">
<AtomView tree={props.tree} />
</Route>
</Switch>
</header>
</Router>
);
export default Navbar;
================================================
FILE: extension/frontend/view/Components/right-view/atomView.js
================================================
import React from 'react';
import * as d3 from '../../../../libraries/d3.js';
import JSONPretty from 'react-json-pretty';
export const AtomView = ({ tree }) => {
const atomSelectors = []
let originalColor;
let t = d3.transition()
.duration(1000)
.ease(d3.easeLinear);
// traverses through D3 tree and if a node includes the h3 inner html tag, that node will light up
function lightup(e) {
let atom = e.target.innerHTML
d3.selectAll('.componentTreeNode').style('fill', originalColor).attr('r', 5)
d3.select('#canvas').selectAll('.node').each(function (e) {
if (!e.data.atoms) { }
else if (e.data.atoms.includes(atom)) {
d3.select(this).select('.componentTreeNode').transition(t).style('fill', 'rgb(240, 219, 79)').attr('r', 10.5)
}
})
atomValLightup(e);
}
function atomValLightup(e) {
Array.from(document.querySelectorAll('.h3-display-inline')).forEach(el => {
el.style.color = '#f4f4f4';
})
let atom = e.target
console.log('firing function: ', atom)
atom.style.color = '#F0DB4F';
}
// will iterate through atoms object and render it on screen
// each prop render should have its unique key
if (tree) {
const atoms = tree[1].atomVal
for (let prop in atoms) {
const data = <JSONPretty style={{ fontSize: "3px" }} data={atoms[prop]}></JSONPretty>
atomSelectors.push(
<div className='atom-container' >
<h3 className='h3-display-inline' onClick={lightup}>{prop}</h3>
<div className='atom-div'>
<details className='s-margin'>
<summary>State</summary>
<p>{data}</p>
</details>
</div>
</div>
)
}
}
return (
<div className="atom-values-tab">
<div className='atoms'>{atomSelectors}</div>
</div>
)
}
export default AtomView;
================================================
FILE: extension/frontend/view/Container.js
================================================
import React, { useEffect, useState } from 'react';
import Navbar from './Components/right-view/Navbar'
import GraphPanel from './Components/left-view/GraphPanel'
import * as d3 from '../../libraries/d3'
const port = chrome.runtime.connect({ name: 'test' })
const Container = () => {
const [tree, setTree] = useState();
const [history, setHistory] = useState([]);
const [count, setCount] = useState(1);
// function is receiving fibernode state changes from backend and is saving that data to tree hook
useEffect(() => {
port.postMessage({
name: 'connect',
tabID: chrome.devtools.inspectedWindow.tabId,
})
port.onMessage.addListener((message) => {
if (message.length === 3) {
setTree(message)
}
})
}, [])
// parsing information for history tab
useEffect(() => {
let lastHistory;
let stringTree = tree ? JSON.stringify(tree[1].atomVal) : null;
if (history.length) {
lastHistory = JSON.stringify(history[history.length - 1].tree[1].atomVal);
}
if (lastHistory == stringTree) return;
if (history.length === 10) {
const historyCopy = [...history]
historyCopy.shift();
setHistory([...historyCopy, { count, tree }]);
} else {
setHistory([...history, { count, tree }]);
}
setCount(count + 1);
}, [tree])
return (
<div id='main-container'>
<GraphPanel tree={tree} />
<Navbar tree={tree} history={history} />
</div>
)
}
export default Container
================================================
FILE: extension/frontend/view/style.css
================================================
* {
margin: 0px;
padding: 0px;
background-color: rgb(53, 59, 70);
font-size: 18px;
overflow-y: hidden;
overflow-x: hidden;
font-family: 'Roboto', sans-serif;
color: #f4f4f4;
}
.a-right {
text-decoration: none;
color: black;
width: 100%;
border: black solid 2px;
}
svg {
background-color: rgb(53, 59, 70);
width:100%;
height:500px;
margin-top: 10%;
margin-left: 5%;
}
@media (max-height: 800px){
svg {
height: 40%;
font-size: 100px;
margin-top: 2%;
}
.component-svg {
height: 100%;
}
}
@media (max-width: 1300px){
.atoms {
width: 98% !important;
}
}
.component-svg {
background-color: rgb(53, 59, 70);
border-right: solid black 1px;
width:100%;
height:100%;
margin: 0;
}
circle {
fill: #fff;
/* fill: none; */
stroke: #444857;
stroke-width: 1px;
pointer-events: all;
}
/* inside main container: canvas and navbar*
*now its graphDisplays and navbar
basically, the navbar is the info display panel
*/
/* CONTAINER.JS */
#main-container {
display: flex;
}
/* CANVAS */
#canvas {
margin: 0;
width: 100%;
height: 100%;
}
#canvas:hover {
cursor: move;
}
/* LEFT VIEW GRAPHPANEL */
.graph-button-1 {
position: absolute;
top: 2%;
right: 36%;
padding: 2px;
background: none;
background-color: #444857;
font-family: inherit;
font-size: 14px;
border: 2px solid rgb(0, 0, 0);
border-radius: 8px;
color: #f4f4f4;
cursor: pointer;
display: inline-block;
margin: 5px 15px;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 500;
width: 15%;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
box-shadow: 1px 1px black;
}
.graph-button-1:focus {
outline:none;
}
button:hover {
color: #F0DB4F;
}
.graph-container {
width: 65%;
margin: 0;
}
.h1-absolute {
position: absolute;
left: 1%;
top: 2%;
}
/* RIGHT VIEW NAVBAR */
.a-right {
margin: 10px 5px 0px 5px;
text-decoration: none;
color: white;
width: 100%;
border:black solid 2px;
border-radius: 10px;
padding: 4px;
font-size: 25px;
background-color: #444857;
box-shadow: 1px 1px black;
}
.a-right:hover {
color: #F0DB4F;
transition: all .3s;
}
.a-right-active {
color: #F0DB4F;
}
.navbar {
margin: 0;
width: 35%;
border: 2px solid #333642;
border-left: 2px solid black;
}
.navbaritem {
width: 100%;
font-size: 26px;
background-color: rgb(53, 59, 70);
}
.navbaritem:hover {
color: #f4f4f4;
}
.navbaritem:active {
color: black;
}
#link-container {
display: flex;
width: 100%;
text-align: center;
font-size: 20px;
margin: auto;
padding-right: 15px;
justify-content: space-around;
padding-bottom: 10px;
/* border-bottom: 2px solid black; */
}
/* RIGHT VIEW ATOM.JS */
.atom-values-tab {
height: 105vh;
margin: auto;
max-height: 87vh;
overflow-y: scroll;
border-top: 2px solid black;
background-color: #444857;
}
.atom-container {
box-shadow: 1px 1px black;
border: 2px black solid;
border-radius: 10px;
padding: 10px;
margin-top: 10px;
}
.atom-div {
max-height: 50vh;
padding: 8px;
display: flex;
}
.atoms {
width: 80%;
text-align: left;
margin-top: 5px;
margin: auto;
padding-left: 5px;
padding-right: 5px;
background-color: #444857;
}
#atom-hover {
position: absolute;
left: 1%;
top: 8%;
}
.h3-display-inline{
display: inline-block;
}
.h3-display-inline:hover {
cursor: pointer;
color: #F0DB4F;
transition: all .3s;
}
.h3-display-inline:active {
color: #F0DB4F;
}
.s-margin {
width: 100%;
overflow-y: auto;
}
/* RIGHT VIEW HISTORY.JS*/
#history-info {
overflow-x: hidden;
overflow-y: scroll;
height: 80%;
}
#history-tab {
height: 105vh;
margin-top: 10px;
margin-left: 10px;
}
.__json-pretty__ {
font-size: 12px;
}
.__json-key__ {
font-size: 12px;
}
.__json-string__ {
font-size: 12px;
}
.__json-value__ {
font-size: 12px;
}
.__json-boolean__ {
font-size: 12px;
}
.__json-error__ {
font-size: 12px;
}
.__json-main__ {
font-size: 12px;
}
.__json-pretty-error__ {
font-size: 12px;
}
/* SCROLL BAR STYLING */
::-webkit-scrollbar {
width: 12px; /* for vertical scrollbars */
height: 12px; /* for horizontal scrollbars */
}
::-webkit-scrollbar-track {
background: #f4f4f4;
}
::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.5);
}
summary {
list-style-image: url(right-arrow.svg);
outline: none;
}
summary:hover {
cursor: pointer;
}
/* selector tree css vvv */
.patharc {
/* fill: #7289DA; */
/* opacity: 0.3; */
stroke: #f4f4f4;
stroke-width: 3px;
}
.arclabels {
fill: white;
}
.selectorTreeHomeBtn {
fill: none;
stroke: #f4f4f4;
stroke-width: 5px;
}
/* font-size does not work in arclabels */
tspan {
font-size: 1.25em;
}
/* selector tree css ^^^ */
.blue {
color: #F0DB4F;
}
.legend {
position: absolute;
left: 1%;
top: 10%;
}
.box {
width: 15px;
height: 15px;
border: 1px solid black;
}
================================================
FILE: extension/frontend/view/view.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<title>TotalRecoilJS</title>
</head>
<body>
<div id="root"></div>
<script src="bundle.js"></script>
</body>
</html>
================================================
FILE: extension/frontend/view/view.js
================================================
import React from 'react';
import ReactDOM from 'react-dom';
import Container from './Container'
const App = () => {
return (
<div id="container-wrapper">
<Container />
</div>
)
}
ReactDOM.render(<App />, document.getElementById('root'))
================================================
FILE: extension/libraries/d3.js
================================================
// https://d3js.org v5.16.0 Copyright 2020 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.d3 = global.d3 || {}));
}(this, function (exports) { 'use strict';
var version = "5.16.0";
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
function bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
};
}
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
var ascendingBisect = bisector(ascending);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
function pairs(array, f) {
if (f == null) f = pair;
var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = f(p, p = array[++i]);
return pairs;
}
function pair(a, b) {
return [a, b];
}
function cross(values0, values1, reduce) {
var n0 = values0.length,
n1 = values1.length,
values = new Array(n0 * n1),
i0,
i1,
i,
value0;
if (reduce == null) reduce = pair;
for (i0 = i = 0; i0 < n0; ++i0) {
for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {
values[i] = reduce(value0, values1[i1]);
}
}
return values;
}
function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}
function number(x) {
return x === null ? NaN : +x;
}
function variance(values, valueof) {
var n = values.length,
m = 0,
i = -1,
mean = 0,
value,
delta,
sum = 0;
if (valueof == null) {
while (++i < n) {
if (!isNaN(value = number(values[i]))) {
delta = value - mean;
mean += delta / ++m;
sum += delta * (value - mean);
}
}
}
else {
while (++i < n) {
if (!isNaN(value = number(valueof(values[i], i, values)))) {
delta = value - mean;
mean += delta / ++m;
sum += delta * (value - mean);
}
}
}
if (m > 1) return sum / (m - 1);
}
function deviation(array, f) {
var v = variance(array, f);
return v ? Math.sqrt(v) : v;
}
function extent(values, valueof) {
var n = values.length,
i = -1,
value,
min,
max;
if (valueof == null) {
while (++i < n) { // Find the first comparable value.
if ((value = values[i]) != null && value >= value) {
min = max = value;
while (++i < n) { // Compare the remaining values.
if ((value = values[i]) != null) {
if (min > value) min = value;
if (max < value) max = value;
}
}
}
}
}
else {
while (++i < n) { // Find the first comparable value.
if ((value = valueof(values[i], i, values)) != null && value >= value) {
min = max = value;
while (++i < n) { // Compare the remaining values.
if ((value = valueof(values[i], i, values)) != null) {
if (min > value) min = value;
if (max < value) max = value;
}
}
}
}
}
return [min, max];
}
var array = Array.prototype;
var slice = array.slice;
var map = array.map;
function constant(x) {
return function() {
return x;
};
}
function identity(x) {
return x;
}
function sequence(start, stop, step) {
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
while (++i < n) {
range[i] = start + i * step;
}
return range;
}
var e10 = Math.sqrt(50),
e5 = Math.sqrt(10),
e2 = Math.sqrt(2);
function ticks(start, stop, count) {
var reverse,
i = -1,
n,
ticks,
step;
stop = +stop, start = +start, count = +count;
if (start === stop && count > 0) return [start];
if (reverse = stop < start) n = start, start = stop, stop = n;
if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
if (step > 0) {
start = Math.ceil(start / step);
stop = Math.floor(stop / step);
ticks = new Array(n = Math.ceil(stop - start + 1));
while (++i < n) ticks[i] = (start + i) * step;
} else {
start = Math.floor(start * step);
stop = Math.ceil(stop * step);
ticks = new Array(n = Math.ceil(start - stop + 1));
while (++i < n) ticks[i] = (start - i) / step;
}
if (reverse) ticks.reverse();
return ticks;
}
function tickIncrement(start, stop, count) {
var step = (stop - start) / Math.max(0, count),
power = Math.floor(Math.log(step) / Math.LN10),
error = step / Math.pow(10, power);
return power >= 0
? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
: -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
}
function tickStep(start, stop, count) {
var step0 = Math.abs(stop - start) / Math.max(0, count),
step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
error = step0 / step1;
if (error >= e10) step1 *= 10;
else if (error >= e5) step1 *= 5;
else if (error >= e2) step1 *= 2;
return stop < start ? -step1 : step1;
}
function thresholdSturges(values) {
return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
}
function histogram() {
var value = identity,
domain = extent,
threshold = thresholdSturges;
function histogram(data) {
var i,
n = data.length,
x,
values = new Array(n);
for (i = 0; i < n; ++i) {
values[i] = value(data[i], i, data);
}
var xz = domain(values),
x0 = xz[0],
x1 = xz[1],
tz = threshold(values, x0, x1);
// Convert number of thresholds into uniform thresholds.
if (!Array.isArray(tz)) {
tz = tickStep(x0, x1, tz);
tz = sequence(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive
}
// Remove any thresholds outside the domain.
var m = tz.length;
while (tz[0] <= x0) tz.shift(), --m;
while (tz[m - 1] > x1) tz.pop(), --m;
var bins = new Array(m + 1),
bin;
// Initialize bins.
for (i = 0; i <= m; ++i) {
bin = bins[i] = [];
bin.x0 = i > 0 ? tz[i - 1] : x0;
bin.x1 = i < m ? tz[i] : x1;
}
// Assign data to bins by value, ignoring any outside the domain.
for (i = 0; i < n; ++i) {
x = values[i];
if (x0 <= x && x <= x1) {
bins[bisectRight(tz, x, 0, m)].push(data[i]);
}
}
return bins;
}
histogram.value = function(_) {
return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value;
};
histogram.domain = function(_) {
return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain;
};
histogram.thresholds = function(_) {
return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;
};
return histogram;
}
function threshold(values, p, valueof) {
if (valueof == null) valueof = number;
if (!(n = values.length)) return;
if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
if (p >= 1) return +valueof(values[n - 1], n - 1, values);
var n,
i = (n - 1) * p,
i0 = Math.floor(i),
value0 = +valueof(values[i0], i0, values),
value1 = +valueof(values[i0 + 1], i0 + 1, values);
return value0 + (value1 - value0) * (i - i0);
}
function freedmanDiaconis(values, min, max) {
values = map.call(values, number).sort(ascending);
return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3)));
}
function scott(values, min, max) {
return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
}
function max(values, valueof) {
var n = values.length,
i = -1,
value,
max;
if (valueof == null) {
while (++i < n) { // Find the first comparable value.
if ((value = values[i]) != null && value >= value) {
max = value;
while (++i < n) { // Compare the remaining values.
if ((value = values[i]) != null && value > max) {
max = value;
}
}
}
}
}
else {
while (++i < n) { // Find the first comparable value.
if ((value = valueof(values[i], i, values)) != null && value >= value) {
max = value;
while (++i < n) { // Compare the remaining values.
if ((value = valueof(values[i], i, values)) != null && value > max) {
max = value;
}
}
}
}
}
return max;
}
function mean(values, valueof) {
var n = values.length,
m = n,
i = -1,
value,
sum = 0;
if (valueof == null) {
while (++i < n) {
if (!isNaN(value = number(values[i]))) sum += value;
else --m;
}
}
else {
while (++i < n) {
if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value;
else --m;
}
}
if (m) return sum / m;
}
function median(values, valueof) {
var n = values.length,
i = -1,
value,
numbers = [];
if (valueof == null) {
while (++i < n) {
if (!isNaN(value = number(values[i]))) {
numbers.push(value);
}
}
}
else {
while (++i < n) {
if (!isNaN(value = number(valueof(values[i], i, values)))) {
numbers.push(value);
}
}
}
return threshold(numbers.sort(ascending), 0.5);
}
function merge(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
}
function min(values, valueof) {
var n = values.length,
i = -1,
value,
min;
if (valueof == null) {
while (++i < n) { // Find the first comparable value.
if ((value = values[i]) != null && value >= value) {
min = value;
while (++i < n) { // Compare the remaining values.
if ((value = values[i]) != null && min > value) {
min = value;
}
}
}
}
}
else {
while (++i < n) { // Find the first comparable value.
if ((value = valueof(values[i], i, values)) != null && value >= value) {
min = value;
while (++i < n) { // Compare the remaining values.
if ((value = valueof(values[i], i, values)) != null && min > value) {
min = value;
}
}
}
}
}
return min;
}
function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
}
function scan(values, compare) {
if (!(n = values.length)) return;
var n,
i = 0,
j = 0,
xi,
xj = values[j];
if (compare == null) compare = ascending;
while (++i < n) {
if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) {
xj = xi, j = i;
}
}
if (compare(xj, xj) === 0) return j;
}
function shuffle(array, i0, i1) {
var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
t,
i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0];
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return array;
}
function sum(values, valueof) {
var n = values.length,
i = -1,
value,
sum = 0;
if (valueof == null) {
while (++i < n) {
if (value = +values[i]) sum += value; // Note: zero and null are equivalent.
}
}
else {
while (++i < n) {
if (value = +valueof(values[i], i, values)) sum += value;
}
}
return sum;
}
function transpose(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
row[j] = matrix[j][i];
}
}
return transpose;
}
function length(d) {
return d.length;
}
function zip() {
return transpose(arguments);
}
var slice$1 = Array.prototype.slice;
function identity$1(x) {
return x;
}
var top = 1,
right = 2,
bottom = 3,
left = 4,
epsilon = 1e-6;
function translateX(x) {
return "translate(" + (x + 0.5) + ",0)";
}
function translateY(y) {
return "translate(0," + (y + 0.5) + ")";
}
function number$1(scale) {
return function(d) {
return +scale(d);
};
}
function center(scale) {
var offset = Math.max(0, scale.bandwidth() - 1) / 2; // Adjust for 0.5px offset.
if (scale.round()) offset = Math.round(offset);
return function(d) {
return +scale(d) + offset;
};
}
function entering() {
return !this.__axis;
}
function axis(orient, scale) {
var tickArguments = [],
tickValues = null,
tickFormat = null,
tickSizeInner = 6,
tickSizeOuter = 6,
tickPadding = 3,
k = orient === top || orient === left ? -1 : 1,
x = orient === left || orient === right ? "x" : "y",
transform = orient === top || orient === bottom ? translateX : translateY;
function axis(context) {
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$1) : tickFormat,
spacing = Math.max(tickSizeInner, 0) + tickPadding,
range = scale.range(),
range0 = +range[0] + 0.5,
range1 = +range[range.length - 1] + 0.5,
position = (scale.bandwidth ? center : number$1)(scale.copy()),
selection = context.selection ? context.selection() : context,
path = selection.selectAll(".domain").data([null]),
tick = selection.selectAll(".tick").data(values, scale).order(),
tickExit = tick.exit(),
tickEnter = tick.enter().append("g").attr("class", "tick"),
line = tick.select("line"),
text = tick.select("text");
path = path.merge(path.enter().insert("path", ".tick")
.attr("class", "domain")
.attr("stroke", "currentColor"));
tick = tick.merge(tickEnter);
line = line.merge(tickEnter.append("line")
.attr("stroke", "currentColor")
.attr(x + "2", k * tickSizeInner));
text = text.merge(tickEnter.append("text")
.attr("fill", "currentColor")
.attr(x, k * spacing)
.attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
if (context !== selection) {
path = path.transition(context);
tick = tick.transition(context);
line = line.transition(context);
text = text.transition(context);
tickExit = tickExit.transition(context)
.attr("opacity", epsilon)
.attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d) : this.getAttribute("transform"); });
tickEnter
.attr("opacity", epsilon)
.attr("transform", function(d) { var p = this.parentNode.__axis; return transform(p && isFinite(p = p(d)) ? p : position(d)); });
}
tickExit.remove();
path
.attr("d", orient === left || orient == right
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter : "M0.5," + range0 + "V" + range1)
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + ",0.5H" + range1));
tick
.attr("opacity", 1)
.attr("transform", function(d) { return transform(position(d)); });
line
.attr(x + "2", k * tickSizeInner);
text
.attr(x, k * spacing)
.text(format);
selection.filter(entering)
.attr("fill", "none")
.attr("font-size", 10)
.attr("font-family", "sans-serif")
.attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
selection
.each(function() { this.__axis = position; });
}
axis.scale = function(_) {
return arguments.length ? (scale = _, axis) : scale;
};
axis.ticks = function() {
return tickArguments = slice$1.call(arguments), axis;
};
axis.tickArguments = function(_) {
return arguments.length ? (tickArguments = _ == null ? [] : slice$1.call(_), axis) : tickArguments.slice();
};
axis.tickValues = function(_) {
return arguments.length ? (tickValues = _ == null ? null : slice$1.call(_), axis) : tickValues && tickValues.slice();
};
axis.tickFormat = function(_) {
return arguments.length ? (tickFormat = _, axis) : tickFormat;
};
axis.tickSize = function(_) {
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
};
axis.tickSizeInner = function(_) {
return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
};
axis.tickSizeOuter = function(_) {
return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
};
axis.tickPadding = function(_) {
return arguments.length ? (tickPadding = +_, axis) : tickPadding;
};
return axis;
}
function axisTop(scale) {
return axis(top, scale);
}
function axisRight(scale) {
return axis(right, scale);
}
function axisBottom(scale) {
return axis(bottom, scale);
}
function axisLeft(scale) {
return axis(left, scale);
}
var noop = {value: function() {}};
function dispatch() {
for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
_[t] = [];
}
return new Dispatch(_);
}
function Dispatch(_) {
this._ = _;
}
function parseTypenames(typenames, types) {
return typenames.trim().split(/^|\s+/).map(function(t) {
var name = "", i = t.indexOf(".");
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
return {type: t, name: name};
});
}
Dispatch.prototype = dispatch.prototype = {
constructor: Dispatch,
on: function(typename, callback) {
var _ = this._,
T = parseTypenames(typename + "", _),
t,
i = -1,
n = T.length;
// If no callback was specified, return the callback of the given type and name.
if (arguments.length < 2) {
while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
return;
}
// If a type was specified, set the callback for the given type and name.
// Otherwise, if a null callback was specified, remove callbacks of the given name.
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
while (++i < n) {
if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);
else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
}
return this;
},
copy: function() {
var copy = {}, _ = this._;
for (var t in _) copy[t] = _[t].slice();
return new Dispatch(copy);
},
call: function(type, that) {
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
},
apply: function(type, that, args) {
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
}
};
function get(type, name) {
for (var i = 0, n = type.length, c; i < n; ++i) {
if ((c = type[i]).name === name) {
return c.value;
}
}
}
function set(type, name, callback) {
for (var i = 0, n = type.length; i < n; ++i) {
if (type[i].name === name) {
type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
break;
}
}
if (callback != null) type.push({name: name, value: callback});
return type;
}
var xhtml = "http://www.w3.org/1999/xhtml";
var namespaces = {
svg: "http://www.w3.org/2000/svg",
xhtml: xhtml,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
function namespace(name) {
var prefix = name += "", i = prefix.indexOf(":");
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;
}
function creatorInherit(name) {
return function() {
var document = this.ownerDocument,
uri = this.namespaceURI;
return uri === xhtml && document.documentElement.namespaceURI === xhtml
? document.createElement(name)
: document.createElementNS(uri, name);
};
}
function creatorFixed(fullname) {
return function() {
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
};
}
function creator(name) {
var fullname = namespace(name);
return (fullname.local
? creatorFixed
: creatorInherit)(fullname);
}
function none() {}
function selector(selector) {
return selector == null ? none : function() {
return this.querySelector(selector);
};
}
function selection_select(select) {
if (typeof select !== "function") select = selector(select);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
subgroup[i] = subnode;
}
}
}
return new Selection(subgroups, this._parents);
}
function empty() {
return [];
}
function selectorAll(selector) {
return selector == null ? empty : function() {
return this.querySelectorAll(selector);
};
}
function selection_selectAll(select) {
if (typeof select !== "function") select = selectorAll(select);
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
subgroups.push(select.call(node, node.__data__, i, group));
parents.push(node);
}
}
}
return new Selection(subgroups, parents);
}
function matcher(selector) {
return function() {
return this.matches(selector);
};
}
function selection_filter(match) {
if (typeof match !== "function") match = matcher(match);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
subgroup.push(node);
}
}
}
return new Selection(subgroups, this._parents);
}
function sparse(update) {
return new Array(update.length);
}
function selection_enter() {
return new Selection(this._enter || this._groups.map(sparse), this._parents);
}
function EnterNode(parent, datum) {
this.ownerDocument = parent.ownerDocument;
this.namespaceURI = parent.namespaceURI;
this._next = null;
this._parent = parent;
this.__data__ = datum;
}
EnterNode.prototype = {
constructor: EnterNode,
appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },
querySelector: function(selector) { return this._parent.querySelector(selector); },
querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
};
function constant$1(x) {
return function() {
return x;
};
}
var keyPrefix = "$"; // Protect against keys like “__proto__”.
function bindIndex(parent, group, enter, update, exit, data) {
var i = 0,
node,
groupLength = group.length,
dataLength = data.length;
// Put any non-null nodes that fit into update.
// Put any null nodes into enter.
// Put any remaining data into enter.
for (; i < dataLength; ++i) {
if (node = group[i]) {
node.__data__ = data[i];
update[i] = node;
} else {
enter[i] = new EnterNode(parent, data[i]);
}
}
// Put any non-null nodes that don’t fit into exit.
for (; i < groupLength; ++i) {
if (node = group[i]) {
exit[i] = node;
}
}
}
function bindKey(parent, group, enter, update, exit, data, key) {
var i,
node,
nodeByKeyValue = {},
groupLength = group.length,
dataLength = data.length,
keyValues = new Array(groupLength),
keyValue;
// Compute the key for each node.
// If multiple nodes have the same key, the duplicates are added to exit.
for (i = 0; i < groupLength; ++i) {
if (node = group[i]) {
keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);
if (keyValue in nodeByKeyValue) {
exit[i] = node;
} else {
nodeByKeyValue[keyValue] = node;
}
}
}
// Compute the key for each datum.
// If there a node associated with this key, join and add it to update.
// If there is not (or the key is a duplicate), add it to enter.
for (i = 0; i < dataLength; ++i) {
keyValue = keyPrefix + key.call(parent, data[i], i, data);
if (node = nodeByKeyValue[keyValue]) {
update[i] = node;
node.__data__ = data[i];
nodeByKeyValue[keyValue] = null;
} else {
enter[i] = new EnterNode(parent, data[i]);
}
}
// Add any remaining nodes that were not bound to data to exit.
for (i = 0; i < groupLength; ++i) {
if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {
exit[i] = node;
}
}
}
function selection_data(value, key) {
if (!value) {
data = new Array(this.size()), j = -1;
this.each(function(d) { data[++j] = d; });
return data;
}
var bind = key ? bindKey : bindIndex,
parents = this._parents,
groups = this._groups;
if (typeof value !== "function") value = constant$1(value);
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
var parent = parents[j],
group = groups[j],
groupLength = group.length,
data = value.call(parent, parent && parent.__data__, j, parents),
dataLength = data.length,
enterGroup = enter[j] = new Array(dataLength),
updateGroup = update[j] = new Array(dataLength),
exitGroup = exit[j] = new Array(groupLength);
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
// Now connect the enter nodes to their following update node, such that
// appendChild can insert the materialized enter node before this node,
// rather than at the end of the parent node.
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
if (previous = enterGroup[i0]) {
if (i0 >= i1) i1 = i0 + 1;
while (!(next = updateGroup[i1]) && ++i1 < dataLength);
previous._next = next || null;
}
}
}
update = new Selection(update, parents);
update._enter = enter;
update._exit = exit;
return update;
}
function selection_exit() {
return new Selection(this._exit || this._groups.map(sparse), this._parents);
}
function selection_join(onenter, onupdate, onexit) {
var enter = this.enter(), update = this, exit = this.exit();
enter = typeof onenter === "function" ? onenter(enter) : enter.append(onenter + "");
if (onupdate != null) update = onupdate(update);
if (onexit == null) exit.remove(); else onexit(exit);
return enter && update ? enter.merge(update).order() : update;
}
function selection_merge(selection) {
for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
}
}
}
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
return new Selection(merges, this._parents);
}
function selection_order() {
for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
if (node = group[i]) {
if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
next = node;
}
}
}
return this;
}
function selection_sort(compare) {
if (!compare) compare = ascending$1;
function compareNode(a, b) {
return a && b ? compare(a.__data__, b.__data__) : !a - !b;
}
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group[i]) {
sortgroup[i] = node;
}
}
sortgroup.sort(compareNode);
}
return new Selection(sortgroups, this._parents).order();
}
function ascending$1(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
function selection_call() {
var callback = arguments[0];
arguments[0] = this;
callback.apply(null, arguments);
return this;
}
function selection_nodes() {
var nodes = new Array(this.size()), i = -1;
this.each(function() { nodes[++i] = this; });
return nodes;
}
function selection_node() {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
var node = group[i];
if (node) return node;
}
}
return null;
}
function selection_size() {
var size = 0;
this.each(function() { ++size; });
return size;
}
function selection_empty() {
return !this.node();
}
function selection_each(callback) {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
if (node = group[i]) callback.call(node, node.__data__, i, group);
}
}
return this;
}
function attrRemove(name) {
return function() {
this.removeAttribute(name);
};
}
function attrRemoveNS(fullname) {
return function() {
this.removeAttributeNS(fullname.space, fullname.local);
};
}
function attrConstant(name, value) {
return function() {
this.setAttribute(name, value);
};
}
function attrConstantNS(fullname, value) {
return function() {
this.setAttributeNS(fullname.space, fullname.local, value);
};
}
function attrFunction(name, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null) this.removeAttribute(name);
else this.setAttribute(name, v);
};
}
function attrFunctionNS(fullname, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
else this.setAttributeNS(fullname.space, fullname.local, v);
};
}
function selection_attr(name, value) {
var fullname = namespace(name);
if (arguments.length < 2) {
var node = this.node();
return fullname.local
? node.getAttributeNS(fullname.space, fullname.local)
: node.getAttribute(fullname);
}
return this.each((value == null
? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
? (fullname.local ? attrFunctionNS : attrFunction)
: (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
}
function defaultView(node) {
return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|| (node.document && node) // node is a Window
|| node.defaultView; // node is a Document
}
function styleRemove(name) {
return function() {
this.style.removeProperty(name);
};
}
function styleConstant(name, value, priority) {
return function() {
this.style.setProperty(name, value, priority);
};
}
function styleFunction(name, value, priority) {
return function() {
var v = value.apply(this, arguments);
if (v == null) this.style.removeProperty(name);
else this.style.setProperty(name, v, priority);
};
}
function selection_style(name, value, priority) {
return arguments.length > 1
? this.each((value == null
? styleRemove : typeof value === "function"
? styleFunction
: styleConstant)(name, value, priority == null ? "" : priority))
: styleValue(this.node(), name);
}
function styleValue(node, name) {
return node.style.getPropertyValue(name)
|| defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
}
function propertyRemove(name) {
return function() {
delete this[name];
};
}
function propertyConstant(name, value) {
return function() {
this[name] = value;
};
}
function propertyFunction(name, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null) delete this[name];
else this[name] = v;
};
}
function selection_property(name, value) {
return arguments.length > 1
? this.each((value == null
? propertyRemove : typeof value === "function"
? propertyFunction
: propertyConstant)(name, value))
: this.node()[name];
}
function classArray(string) {
return string.trim().split(/^|\s+/);
}
function classList(node) {
return node.classList || new ClassList(node);
}
function ClassList(node) {
this._node = node;
this._names = classArray(node.getAttribute("class") || "");
}
ClassList.prototype = {
add: function(name) {
var i = this._names.indexOf(name);
if (i < 0) {
this._names.push(name);
this._node.setAttribute("class", this._names.join(" "));
}
},
remove: function(name) {
var i = this._names.indexOf(name);
if (i >= 0) {
this._names.splice(i, 1);
this._node.setAttribute("class", this._names.join(" "));
}
},
contains: function(name) {
return this._names.indexOf(name) >= 0;
}
};
function classedAdd(node, names) {
var list = classList(node), i = -1, n = names.length;
while (++i < n) list.add(names[i]);
}
function classedRemove(node, names) {
var list = classList(node), i = -1, n = names.length;
while (++i < n) list.remove(names[i]);
}
function classedTrue(names) {
return function() {
classedAdd(this, names);
};
}
function classedFalse(names) {
return function() {
classedRemove(this, names);
};
}
function classedFunction(names, value) {
return function() {
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
};
}
function selection_classed(name, value) {
var names = classArray(name + "");
if (arguments.length < 2) {
var list = classList(this.node()), i = -1, n = names.length;
while (++i < n) if (!list.contains(names[i])) return false;
return true;
}
return this.each((typeof value === "function"
? classedFunction : value
? classedTrue
: classedFalse)(names, value));
}
function textRemove() {
this.textContent = "";
}
function textConstant(value) {
return function() {
this.textContent = value;
};
}
function textFunction(value) {
return function() {
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
};
}
function selection_text(value) {
return arguments.length
? this.each(value == null
? textRemove : (typeof value === "function"
? textFunction
: textConstant)(value))
: this.node().textContent;
}
function htmlRemove() {
this.innerHTML = "";
}
function htmlConstant(value) {
return function() {
this.innerHTML = value;
};
}
function htmlFunction(value) {
return function() {
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
};
}
function selection_html(value) {
return arguments.length
? this.each(value == null
? htmlRemove : (typeof value === "function"
? htmlFunction
: htmlConstant)(value))
: this.node().innerHTML;
}
function raise() {
if (this.nextSibling) this.parentNode.appendChild(this);
}
function selection_raise() {
return this.each(raise);
}
function lower() {
if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function selection_lower() {
return this.each(lower);
}
function selection_append(name) {
var create = typeof name === "function" ? name : creator(name);
return this.select(function() {
return this.appendChild(create.apply(this, arguments));
});
}
function constantNull() {
return null;
}
function selection_insert(name, before) {
var create = typeof name === "function" ? name : creator(name),
select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
return this.select(function() {
return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
});
}
function remove() {
var parent = this.parentNode;
if (parent) parent.removeChild(this);
}
function selection_remove() {
return this.each(remove);
}
function selection_cloneShallow() {
var clone = this.cloneNode(false), parent = this.parentNode;
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
}
function selection_cloneDeep() {
var clone = this.cloneNode(true), parent = this.parentNode;
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
}
function selection_clone(deep) {
return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
}
function selection_datum(value) {
return arguments.length
? this.property("__data__", value)
: this.node().__data__;
}
var filterEvents = {};
exports.event = null;
if (typeof document !== "undefined") {
var element = document.documentElement;
if (!("onmouseenter" in element)) {
filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"};
}
}
function filterContextListener(listener, index, group) {
listener = contextListener(listener, index, group);
return function(event) {
var related = event.relatedTarget;
if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
listener.call(this, event);
}
};
}
function contextListener(listener, index, group) {
return function(event1) {
var event0 = exports.event; // Events can be reentrant (e.g., focus).
exports.event = event1;
try {
listener.call(this, this.__data__, index, group);
} finally {
exports.event = event0;
}
};
}
function parseTypenames$1(typenames) {
return typenames.trim().split(/^|\s+/).map(function(t) {
var name = "", i = t.indexOf(".");
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
return {type: t, name: name};
});
}
function onRemove(typename) {
return function() {
var on = this.__on;
if (!on) return;
for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.capture);
} else {
on[++i] = o;
}
}
if (++i) on.length = i;
else delete this.__on;
};
}
function onAdd(typename, value, capture) {
var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
return function(d, i, group) {
var on = this.__on, o, listener = wrap(value, i, group);
if (on) for (var j = 0, m = on.length; j < m; ++j) {
if ((o = on[j]).type === typename.type && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.capture);
this.addEventListener(o.type, o.listener = listener, o.capture = capture);
o.value = value;
return;
}
}
this.addEventListener(typename.type, listener, capture);
o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};
if (!on) this.__on = [o];
else on.push(o);
};
}
function selection_on(typename, value, capture) {
var typenames = parseTypenames$1(typename + ""), i, n = typenames.length, t;
if (arguments.length < 2) {
var on = this.node().__on;
if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
for (i = 0, o = on[j]; i < n; ++i) {
if ((t = typenames[i]).type === o.type && t.name === o.name) {
return o.value;
}
}
}
return;
}
on = value ? onAdd : onRemove;
if (capture == null) capture = false;
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
return this;
}
function customEvent(event1, listener, that, args) {
var event0 = exports.event;
event1.sourceEvent = exports.event;
exports.event = event1;
try {
return listener.apply(that, args);
} finally {
exports.event = event0;
}
}
function dispatchEvent(node, type, params) {
var window = defaultView(node),
event = window.CustomEvent;
if (typeof event === "function") {
event = new event(type, params);
} else {
event = window.document.createEvent("Event");
if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
else event.initEvent(type, false, false);
}
node.dispatchEvent(event);
}
function dispatchConstant(type, params) {
return function() {
return dispatchEvent(this, type, params);
};
}
function dispatchFunction(type, params) {
return function() {
return dispatchEvent(this, type, params.apply(this, arguments));
};
}
function selection_dispatch(type, params) {
return this.each((typeof params === "function"
? dispatchFunction
: dispatchConstant)(type, params));
}
var root = [null];
function Selection(groups, parents) {
this._groups = groups;
this._parents = parents;
}
function selection() {
return new Selection([[document.documentElement]], root);
}
Selection.prototype = selection.prototype = {
constructor: Selection,
select: selection_select,
selectAll: selection_selectAll,
filter: selection_filter,
data: selection_data,
enter: selection_enter,
exit: selection_exit,
join: selection_join,
merge: selection_merge,
order: selection_order,
sort: selection_sort,
call: selection_call,
nodes: selection_nodes,
node: selection_node,
size: selection_size,
empty: selection_empty,
each: selection_each,
attr: selection_attr,
style: selection_style,
property: selection_property,
classed: selection_classed,
text: selection_text,
html: selection_html,
raise: selection_raise,
lower: selection_lower,
append: selection_append,
insert: selection_insert,
remove: selection_remove,
clone: selection_clone,
datum: selection_datum,
on: selection_on,
dispatch: selection_dispatch
};
function select(selector) {
return typeof selector === "string"
? new Selection([[document.querySelector(selector)]], [document.documentElement])
: new Selection([[selector]], root);
}
function create(name) {
return select(creator(name).call(document.documentElement));
}
var nextId = 0;
function local() {
return new Local;
}
function Local() {
this._ = "@" + (++nextId).toString(36);
}
Local.prototype = local.prototype = {
constructor: Local,
get: function(node) {
var id = this._;
while (!(id in node)) if (!(node = node.parentNode)) return;
return node[id];
},
set: function(node, value) {
return node[this._] = value;
},
remove: function(node) {
return this._ in node && delete node[this._];
},
toString: function() {
return this._;
}
};
function sourceEvent() {
var current = exports.event, source;
while (source = current.sourceEvent) current = source;
return current;
}
function point(node, event) {
var svg = node.ownerSVGElement || node;
if (svg.createSVGPoint) {
var point = svg.createSVGPoint();
point.x = event.clientX, point.y = event.clientY;
point = point.matrixTransform(node.getScreenCTM().inverse());
return [point.x, point.y];
}
var rect = node.getBoundingClientRect();
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
}
function mouse(node) {
var event = sourceEvent();
if (event.changedTouches) event = event.changedTouches[0];
return point(node, event);
}
function selectAll(selector) {
return typeof selector === "string"
? new Selection([document.querySelectorAll(selector)], [document.documentElement])
: new Selection([selector == null ? [] : selector], root);
}
function touch(node, touches, identifier) {
if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
if ((touch = touches[i]).identifier === identifier) {
return point(node, touch);
}
}
return null;
}
function touches(node, touches) {
if (touches == null) touches = sourceEvent().touches;
for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {
points[i] = point(node, touches[i]);
}
return points;
}
function nopropagation() {
exports.event.stopImmediatePropagation();
}
function noevent() {
exports.event.preventDefault();
exports.event.stopImmediatePropagation();
}
function dragDisable(view) {
var root = view.document.documentElement,
selection = select(view).on("dragstart.drag", noevent, true);
if ("onselectstart" in root) {
selection.on("selectstart.drag", noevent, true);
} else {
root.__noselect = root.style.MozUserSelect;
root.style.MozUserSelect = "none";
}
}
function yesdrag(view, noclick) {
var root = view.document.documentElement,
selection = select(view).on("dragstart.drag", null);
if (noclick) {
selection.on("click.drag", noevent, true);
setTimeout(function() { selection.on("click.drag", null); }, 0);
}
if ("onselectstart" in root) {
selection.on("selectstart.drag", null);
} else {
root.style.MozUserSelect = root.__noselect;
delete root.__noselect;
}
}
function constant$2(x) {
return function() {
return x;
};
}
function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {
this.target = target;
this.type = type;
this.subject = subject;
this.identifier = id;
this.active = active;
this.x = x;
this.y = y;
this.dx = dx;
this.dy = dy;
this._ = dispatch;
}
DragEvent.prototype.on = function() {
var value = this._.on.apply(this._, arguments);
return value === this._ ? this : value;
};
// Ignore right-click, since that should open the context menu.
function defaultFilter() {
return !exports.event.ctrlKey && !exports.event.button;
}
function defaultContainer() {
return this.parentNode;
}
function defaultSubject(d) {
return d == null ? {x: exports.event.x, y: exports.event.y} : d;
}
function defaultTouchable() {
return navigator.maxTouchPoints || ("ontouchstart" in this);
}
function drag() {
var filter = defaultFilter,
container = defaultContainer,
subject = defaultSubject,
touchable = defaultTouchable,
gestures = {},
listeners = dispatch("start", "drag", "end"),
active = 0,
mousedownx,
mousedowny,
mousemoving,
touchending,
clickDistance2 = 0;
function drag(selection) {
selection
.on("mousedown.drag", mousedowned)
.filter(touchable)
.on("touchstart.drag", touchstarted)
.on("touchmove.drag", touchmoved)
.on("touchend.drag touchcancel.drag", touchended)
.style("touch-action", "none")
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
function mousedowned() {
if (touchending || !filter.apply(this, arguments)) return;
var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments);
if (!gesture) return;
select(exports.event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
dragDisable(exports.event.view);
nopropagation();
mousemoving = false;
mousedownx = exports.event.clientX;
mousedowny = exports.event.clientY;
gesture("start");
}
function mousemoved() {
noevent();
if (!mousemoving) {
var dx = exports.event.clientX - mousedownx, dy = exports.event.clientY - mousedowny;
mousemoving = dx * dx + dy * dy > clickDistance2;
}
gestures.mouse("drag");
}
function mouseupped() {
select(exports.event.view).on("mousemove.drag mouseup.drag", null);
yesdrag(exports.event.view, mousemoving);
noevent();
gestures.mouse("end");
}
function touchstarted() {
if (!filter.apply(this, arguments)) return;
var touches = exports.event.changedTouches,
c = container.apply(this, arguments),
n = touches.length, i, gesture;
for (i = 0; i < n; ++i) {
if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {
nopropagation();
gesture("start");
}
}
}
function touchmoved() {
var touches = exports.event.changedTouches,
n = touches.length, i, gesture;
for (i = 0; i < n; ++i) {
if (gesture = gestures[touches[i].identifier]) {
noevent();
gesture("drag");
}
}
}
function touchended() {
var touches = exports.event.changedTouches,
n = touches.length, i, gesture;
if (touchending) clearTimeout(touchending);
touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
for (i = 0; i < n; ++i) {
if (gesture = gestures[touches[i].identifier]) {
nopropagation();
gesture("end");
}
}
}
function beforestart(id, container, point, that, args) {
var p = point(container, id), s, dx, dy,
sublisteners = listeners.copy();
if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
if ((exports.event.subject = s = subject.apply(that, args)) == null) return false;
dx = s.x - p[0] || 0;
dy = s.y - p[1] || 0;
return true;
})) return;
return function gesture(type) {
var p0 = p, n;
switch (type) {
case "start": gestures[id] = gesture, n = active++; break;
case "end": delete gestures[id], --active; // nobreak
case "drag": p = point(container, id), n = active; break;
}
customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
};
}
drag.filter = function(_) {
return arguments.length ? (filter = typeof _ === "function" ? _ : constant$2(!!_), drag) : filter;
};
drag.container = function(_) {
return arguments.length ? (container = typeof _ === "function" ? _ : constant$2(_), drag) : container;
};
drag.subject = function(_) {
return arguments.length ? (subject = typeof _ === "function" ? _ : constant$2(_), drag) : subject;
};
drag.touchable = function(_) {
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$2(!!_), drag) : touchable;
};
drag.on = function() {
var value = listeners.on.apply(listeners, arguments);
return value === listeners ? drag : value;
};
drag.clickDistance = function(_) {
return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
};
return drag;
}
function define(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
}
function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition) prototype[key] = definition[key];
return prototype;
}
function Color() {}
var darker = 0.7;
var brighter = 1 / darker;
var reI = "\\s*([+-]?\\d+)\\s*",
reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
reHex = /^#([0-9a-f]{3,8})$/,
reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
var named = {
aliceblue: 0xf0f8ff,
antiquewhite: 0xfaebd7,
aqua: 0x00ffff,
aquamarine: 0x7fffd4,
azure: 0xf0ffff,
beige: 0xf5f5dc,
bisque: 0xffe4c4,
black: 0x000000,
blanchedalmond: 0xffebcd,
blue: 0x0000ff,
blueviolet: 0x8a2be2,
brown: 0xa52a2a,
burlywood: 0xdeb887,
cadetblue: 0x5f9ea0,
chartreuse: 0x7fff00,
chocolate: 0xd2691e,
coral: 0xff7f50,
cornflowerblue: 0x6495ed,
cornsilk: 0xfff8dc,
crimson: 0xdc143c,
cyan: 0x00ffff,
darkblue: 0x00008b,
darkcyan: 0x008b8b,
darkgoldenrod: 0xb8860b,
darkgray: 0xa9a9a9,
darkgreen: 0x006400,
darkgrey: 0xa9a9a9,
darkkhaki: 0xbdb76b,
darkmagenta: 0x8b008b,
darkolivegreen: 0x556b2f,
darkorange: 0xff8c00,
darkorchid: 0x9932cc,
darkred: 0x8b0000,
darksalmon: 0xe9967a,
darkseagreen: 0x8fbc8f,
darkslateblue: 0x483d8b,
darkslategray: 0x2f4f4f,
darkslategrey: 0x2f4f4f,
darkturquoise: 0x00ced1,
darkviolet: 0x9400d3,
deeppink: 0xff1493,
deepskyblue: 0x00bfff,
dimgray: 0x696969,
dimgrey: 0x696969,
dodgerblue: 0x1e90ff,
firebrick: 0xb22222,
floralwhite: 0xfffaf0,
forestgreen: 0x228b22,
fuchsia: 0xff00ff,
gainsboro: 0xdcdcdc,
ghostwhite: 0xf8f8ff,
gold: 0xffd700,
goldenrod: 0xdaa520,
gray: 0x808080,
green: 0x008000,
greenyellow: 0xadff2f,
grey: 0x808080,
honeydew: 0xf0fff0,
hotpink: 0xff69b4,
indianred: 0xcd5c5c,
indigo: 0x4b0082,
ivory: 0xfffff0,
khaki: 0xf0e68c,
lavender: 0xe6e6fa,
lavenderblush: 0xfff0f5,
lawngreen: 0x7cfc00,
lemonchiffon: 0xfffacd,
lightblue: 0xadd8e6,
lightcoral: 0xf08080,
lightcyan: 0xe0ffff,
lightgoldenrodyellow: 0xfafad2,
lightgray: 0xd3d3d3,
lightgreen: 0x90ee90,
lightgrey: 0xd3d3d3,
lightpink: 0xffb6c1,
lightsalmon: 0xffa07a,
lightseagreen: 0x20b2aa,
lightskyblue: 0x87cefa,
lightslategray: 0x778899,
lightslategrey: 0x778899,
lightsteelblue: 0xb0c4de,
lightyellow: 0xffffe0,
lime: 0x00ff00,
limegreen: 0x32cd32,
linen: 0xfaf0e6,
magenta: 0xff00ff,
maroon: 0x800000,
mediumaquamarine: 0x66cdaa,
mediumblue: 0x0000cd,
mediumorchid: 0xba55d3,
mediumpurple: 0x9370db,
mediumseagreen: 0x3cb371,
mediumslateblue: 0x7b68ee,
mediumspringgreen: 0x00fa9a,
mediumturquoise: 0x48d1cc,
mediumvioletred: 0xc71585,
midnightblue: 0x191970,
mintcream: 0xf5fffa,
mistyrose: 0xffe4e1,
moccasin: 0xffe4b5,
navajowhite: 0xffdead,
navy: 0x000080,
oldlace: 0xfdf5e6,
olive: 0x808000,
olivedrab: 0x6b8e23,
orange: 0xffa500,
orangered: 0xff4500,
orchid: 0xda70d6,
palegoldenrod: 0xeee8aa,
palegreen: 0x98fb98,
paleturquoise: 0xafeeee,
palevioletred: 0xdb7093,
papayawhip: 0xffefd5,
peachpuff: 0xffdab9,
peru: 0xcd853f,
pink: 0xffc0cb,
plum: 0xdda0dd,
powderblue: 0xb0e0e6,
purple: 0x800080,
rebeccapurple: 0x663399,
red: 0xff0000,
rosybrown: 0xbc8f8f,
royalblue: 0x4169e1,
saddlebrown: 0x8b4513,
salmon: 0xfa8072,
sandybrown: 0xf4a460,
seagreen: 0x2e8b57,
seashell: 0xfff5ee,
sienna: 0xa0522d,
silver: 0xc0c0c0,
skyblue: 0x87ceeb,
slateblue: 0x6a5acd,
slategray: 0x708090,
slategrey: 0x708090,
snow: 0xfffafa,
springgreen: 0x00ff7f,
steelblue: 0x4682b4,
tan: 0xd2b48c,
teal: 0x008080,
thistle: 0xd8bfd8,
tomato: 0xff6347,
turquoise: 0x40e0d0,
violet: 0xee82ee,
wheat: 0xf5deb3,
white: 0xffffff,
whitesmoke: 0xf5f5f5,
yellow: 0xffff00,
yellowgreen: 0x9acd32
};
define(Color, color, {
copy: function(channels) {
return Object.assign(new this.constructor, this, channels);
},
displayable: function() {
return this.rgb().displayable();
},
hex: color_formatHex, // Deprecated! Use color.formatHex.
formatHex: color_formatHex,
formatHsl: color_formatHsl,
formatRgb: color_formatRgb,
toString: color_formatRgb
});
function color_formatHex() {
return this.rgb().formatHex();
}
function color_formatHsl() {
return hslConvert(this).formatHsl();
}
function color_formatRgb() {
return this.rgb().formatRgb();
}
function color(format) {
var m, l;
format = (format + "").trim().toLowerCase();
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
: l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
: l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
: l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
: null) // invalid hex
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
: named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
: null;
}
function rgbn(n) {
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
}
function rgba(r, g, b, a) {
if (a <= 0) r = g = b = NaN;
return new Rgb(r, g, b, a);
}
function rgbConvert(o) {
if (!(o instanceof Color)) o = color(o);
if (!o) return new Rgb;
o = o.rgb();
return new Rgb(o.r, o.g, o.b, o.opacity);
}
function rgb(r, g, b, opacity) {
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
}
function Rgb(r, g, b, opacity) {
this.r = +r;
this.g = +g;
this.b = +b;
this.opacity = +opacity;
}
define(Rgb, rgb, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb: function() {
return this;
},
displayable: function() {
return (-0.5 <= this.r && this.r < 255.5)
&& (-0.5 <= this.g && this.g < 255.5)
&& (-0.5 <= this.b && this.b < 255.5)
&& (0 <= this.opacity && this.opacity <= 1);
},
hex: rgb_formatHex, // Deprecated! Use color.formatHex.
formatHex: rgb_formatHex,
formatRgb: rgb_formatRgb,
toString: rgb_formatRgb
}));
function rgb_formatHex() {
return "#" + hex(this.r) + hex(this.g) + hex(this.b);
}
function rgb_formatRgb() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
+ (a === 1 ? ")" : ", " + a + ")");
}
function hex(value) {
value = Math.max(0, Math.min(255, Math.round(value) || 0));
return (value < 16 ? "0" : "") + value.toString(16);
}
function hsla(h, s, l, a) {
if (a <= 0) h = s = l = NaN;
else if (l <= 0 || l >= 1) h = s = NaN;
else if (s <= 0) h = NaN;
return new Hsl(h, s, l, a);
}
function hslConvert(o) {
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Color)) o = color(o);
if (!o) return new Hsl;
if (o instanceof Hsl) return o;
o = o.rgb();
var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
h = NaN,
s = max - min,
l = (max + min) / 2;
if (s) {
if (r === max) h = (g - b) / s + (g < b) * 6;
else if (g === max) h = (b - r) / s + 2;
else h = (r - g) / s + 4;
s /= l < 0.5 ? max + min : 2 - max - min;
h *= 60;
} else {
s = l > 0 && l < 1 ? 0 : h;
}
return new Hsl(h, s, l, o.opacity);
}
function hsl(h, s, l, opacity) {
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
}
function Hsl(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
define(Hsl, hsl, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
},
displayable: function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1)
&& (0 <= this.opacity && this.opacity <= 1);
},
formatHsl: function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "hsl(" : "hsla(")
+ (this.h || 0) + ", "
+ (this.s || 0) * 100 + "%, "
+ (this.l || 0) * 100 + "%"
+ (a === 1 ? ")" : ", " + a + ")");
}
}));
/* From FvD 13.37, CSS Color Module Level 3 */
function hsl2rgb(h, m1, m2) {
return (h < 60 ? m1 + (m2 - m1) * h / 60
: h < 180 ? m2
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
: m1) * 255;
}
var deg2rad = Math.PI / 180;
var rad2deg = 180 / Math.PI;
// https://observablehq.com/@mbostock/lab-and-rgb
var K = 18,
Xn = 0.96422,
Yn = 1,
Zn = 0.82521,
t0 = 4 / 29,
t1 = 6 / 29,
t2 = 3 * t1 * t1,
t3 = t1 * t1 * t1;
function labConvert(o) {
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
if (o instanceof Hcl) return hcl2lab(o);
if (!(o instanceof Rgb)) o = rgbConvert(o);
var r = rgb2lrgb(o.r),
g = rgb2lrgb(o.g),
b = rgb2lrgb(o.b),
y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
if (r === g && g === b) x = z = y; else {
x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
}
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}
function gray(l, opacity) {
return new Lab(l, 0, 0, opacity == null ? 1 : opacity);
}
function lab(l, a, b, opacity) {
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}
function Lab(l, a, b, opacity) {
this.l = +l;
this.a = +a;
this.b = +b;
this.opacity = +opacity;
}
define(Lab, lab, extend(Color, {
brighter: function(k) {
return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
darker: function(k) {
return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
rgb: function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
x = Xn * lab2xyz(x);
y = Yn * lab2xyz(y);
z = Zn * lab2xyz(z);
return new Rgb(
lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
this.opacity
);
}
}));
function xyz2lab(t) {
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
}
function lab2xyz(t) {
return t > t1 ? t * t * t : t2 * (t - t0);
}
function lrgb2rgb(x) {
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
function rgb2lrgb(x) {
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}
function hclConvert(o) {
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
if (!(o instanceof Lab)) o = labConvert(o);
if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
var h = Math.atan2(o.b, o.a) * rad2deg;
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}
function lch(l, c, h, opacity) {
return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}
function hcl(h, c, l, opacity) {
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}
function Hcl(h, c, l, opacity) {
this.h = +h;
this.c = +c;
this.l = +l;
this.opacity = +opacity;
}
function hcl2lab(o) {
if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
var h = o.h * deg2rad;
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}
define(Hcl, hcl, extend(Color, {
brighter: function(k) {
return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
},
darker: function(k) {
return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
},
rgb: function() {
return hcl2lab(this).rgb();
}
}));
var A = -0.14861,
B = +1.78277,
C = -0.29227,
D = -0.90649,
E = +1.97294,
ED = E * D,
EB = E * B,
BC_DA = B * C - D * A;
function cubehelixConvert(o) {
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Rgb)) o = rgbConvert(o);
var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
bl = b - l,
k = (E * (g - l) - C * bl) / D,
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}
function cubehelix(h, s, l, opacity) {
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
}
function Cubehelix(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
define(Cubehelix, cubehelix, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh)),
this.opacity
);
}
}));
function basis(t1, v0, v1, v2, v3) {
var t2 = t1 * t1, t3 = t2 * t1;
return ((1 - 3 * t1 + 3 * t2 - t3) * v0
+ (4 - 6 * t2 + 3 * t3) * v1
+ (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
+ t3 * v3) / 6;
}
function basis$1(values) {
var n = values.length - 1;
return function(t) {
var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
v1 = values[i],
v2 = values[i + 1],
v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
return basis((t - i / n) * n, v0, v1, v2, v3);
};
}
function basisClosed(values) {
var n = values.length;
return function(t) {
var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
v0 = values[(i + n - 1) % n],
v1 = values[i % n],
v2 = values[(i + 1) % n],
v3 = values[(i + 2) % n];
return basis((t - i / n) * n, v0, v1, v2, v3);
};
}
function constant$3(x) {
return function() {
return x;
};
}
function linear(a, d) {
return function(t) {
return a + t * d;
};
}
function exponential(a, b, y) {
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
return Math.pow(a + t * b, y);
};
}
function hue(a, b) {
var d = b - a;
return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$3(isNaN(a) ? b : a);
}
function gamma(y) {
return (y = +y) === 1 ? nogamma : function(a, b) {
return b - a ? exponential(a, b, y) : constant$3(isNaN(a) ? b : a);
};
}
function nogamma(a, b) {
var d = b - a;
return d ? linear(a, d) : constant$3(isNaN(a) ? b : a);
}
var interpolateRgb = (function rgbGamma(y) {
var color = gamma(y);
function rgb$1(start, end) {
var r = color((start = rgb(start)).r, (end = rgb(end)).r),
g = color(start.g, end.g),
b = color(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.r = r(t);
start.g = g(t);
start.b = b(t);
start.opacity = opacity(t);
return start + "";
};
}
rgb$1.gamma = rgbGamma;
return rgb$1;
})(1);
function rgbSpline(spline) {
return function(colors) {
var n = colors.length,
r = new Array(n),
g = new Array(n),
b = new Array(n),
i, color;
for (i = 0; i < n; ++i) {
color = rgb(colors[i]);
r[i] = color.r || 0;
g[i] = color.g || 0;
b[i] = color.b || 0;
}
r = spline(r);
g = spline(g);
b = spline(b);
color.opacity = 1;
return function(t) {
color.r = r(t);
color.g = g(t);
color.b = b(t);
return color + "";
};
};
}
var rgbBasis = rgbSpline(basis$1);
var rgbBasisClosed = rgbSpline(basisClosed);
function numberArray(a, b) {
if (!b) b = [];
var n = a ? Math.min(b.length, a.length) : 0,
c = b.slice(),
i;
return function(t) {
for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
return c;
};
}
function isNumberArray(x) {
return ArrayBuffer.isView(x) && !(x instanceof DataView);
}
function array$1(a, b) {
return (isNumberArray(b) ? numberArray : genericArray)(a, b);
}
function genericArray(a, b) {
var nb = b ? b.length : 0,
na = a ? Math.min(nb, a.length) : 0,
x = new Array(na),
c = new Array(nb),
i;
for (i = 0; i < na; ++i) x[i] = interpolateValue(a[i], b[i]);
for (; i < nb; ++i) c[i] = b[i];
return function(t) {
for (i = 0; i < na; ++i) c[i] = x[i](t);
return c;
};
}
function date(a, b) {
var d = new Date;
return a = +a, b = +b, function(t) {
return d.setTime(a * (1 - t) + b * t), d;
};
}
function interpolateNumber(a, b) {
return a = +a, b = +b, function(t) {
return a * (1 - t) + b * t;
};
}
function object(a, b) {
var i = {},
c = {},
k;
if (a === null || typeof a !== "object") a = {};
if (b === null || typeof b !== "object") b = {};
for (k in b) {
if (k in a) {
i[k] = interpolateValue(a[k], b[k]);
} else {
c[k] = b[k];
}
}
return function(t) {
for (k in i) c[k] = i[k](t);
return c;
};
}
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
reB = new RegExp(reA.source, "g");
function zero(b) {
return function() {
return b;
};
}
function one(b) {
return function(t) {
return b(t) + "";
};
}
function interpolateString(a, b) {
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
am, // current match in a
bm, // current match in b
bs, // string preceding current number in b, if any
i = -1, // index in s
s = [], // string constants and placeholders
q = []; // number interpolators
// Coerce inputs to strings.
a = a + "", b = b + "";
// Interpolate pairs of numbers in a & b.
while ((am = reA.exec(a))
&& (bm = reB.exec(b))) {
if ((bs = bm.index) > bi) { // a string precedes the next number in b
bs = b.slice(bi, bs);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
if (s[i]) s[i] += bm; // coalesce with previous string
else s[++i] = bm;
} else { // interpolate non-matching numbers
s[++i] = null;
q.push({i: i, x: interpolateNumber(am, bm)});
}
bi = reB.lastIndex;
}
// Add remains of b.
if (bi < b.length) {
bs = b.slice(bi);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
// Special optimization for only a single match.
// Otherwise, interpolate each of the numbers and rejoin the string.
return s.length < 2 ? (q[0]
? one(q[0].x)
: zero(b))
: (b = q.length, function(t) {
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
});
}
function interpolateValue(a, b) {
var t = typeof b, c;
return b == null || t === "boolean" ? constant$3(b)
: (t === "number" ? interpolateNumber
: t === "string" ? ((c = color(b)) ? (b = c, interpolateRgb) : interpolateString)
: b instanceof color ? interpolateRgb
: b instanceof Date ? date
: isNumberArray(b) ? numberArray
: Array.isArray(b) ? genericArray
: typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
: interpolateNumber)(a, b);
}
function discrete(range) {
var n = range.length;
return function(t) {
return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
};
}
function hue$1(a, b) {
var i = hue(+a, +b);
return function(t) {
var x = i(t);
return x - 360 * Math.floor(x / 360);
};
}
function interpolateRound(a, b) {
return a = +a, b = +b, function(t) {
return Math.round(a * (1 - t) + b * t);
};
}
var degrees = 180 / Math.PI;
var identity$2 = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function decompose(a, b, c, d, e, f) {
var scaleX, scaleY, skewX;
if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
return {
translateX: e,
translateY: f,
rotate: Math.atan2(b, a) * degrees,
skewX: Math.atan(skewX) * degrees,
scaleX: scaleX,
scaleY: scaleY
};
}
var cssNode,
cssRoot,
cssView,
svgNode;
function parseCss(value) {
if (value === "none") return identity$2;
if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
cssNode.style.transform = value;
value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
cssRoot.removeChild(cssNode);
value = value.slice(7, -1).split(",");
return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
}
function parseSvg(value) {
if (value == null) return identity$2;
if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
svgNode.setAttribute("transform", value);
if (!(value = svgNode.transform.baseVal.consolidate())) return identity$2;
value = value.matrix;
return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
}
function interpolateTransform(parse, pxComma, pxParen, degParen) {
function pop(s) {
return s.length ? s.pop() + " " : "";
}
function translate(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push("translate(", null, pxComma, null, pxParen);
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
} else if (xb || yb) {
s.push("translate(" + xb + pxComma + yb + pxParen);
}
}
function rotate(a, b, s, q) {
if (a !== b) {
if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a, b)});
} else if (b) {
s.push(pop(s) + "rotate(" + b + degParen);
}
}
function skewX(a, b, s, q) {
if (a !== b) {
q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a, b)});
} else if (b) {
s.push(pop(s) + "skewX(" + b + degParen);
}
}
function scale(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
} else if (xb !== 1 || yb !== 1) {
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
}
}
return function(a, b) {
var s = [], // string constants and placeholders
q = []; // number interpolators
a = parse(a), b = parse(b);
translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
rotate(a.rotate, b.rotate, s, q);
skewX(a.skewX, b.skewX, s, q);
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
a = b = null; // gc
return function(t) {
var i = -1, n = q.length, o;
while (++i < n) s[(o = q[i]).i] = o.x(t);
return s.join("");
};
};
}
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
var rho = Math.SQRT2,
rho2 = 2,
rho4 = 4,
epsilon2 = 1e-12;
function cosh(x) {
return ((x = Math.exp(x)) + 1 / x) / 2;
}
function sinh(x) {
return ((x = Math.exp(x)) - 1 / x) / 2;
}
function tanh(x) {
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}
// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
function interpolateZoom(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
dx = ux1 - ux0,
dy = uy1 - uy0,
d2 = dx * dx + dy * dy,
i,
S;
// Special case for u0 ≅ u1.
if (d2 < epsilon2) {
S = Math.log(w1 / w0) / rho;
i = function(t) {
return [
ux0 + t * dx,
uy0 + t * dy,
w0 * Math.exp(rho * t * S)
];
};
}
// General case.
else {
var d1 = Math.sqrt(d2),
b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
S = (r1 - r0) / rho;
i = function(t) {
var s = t * S,
coshr0 = cosh(r0),
u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
return [
ux0 + u * dx,
uy0 + u * dy,
w0 * coshr0 / cosh(rho * s + r0)
];
};
}
i.duration = S * 1000;
return i;
}
function hsl$1(hue) {
return function(start, end) {
var h = hue((start = hsl(start)).h, (end = hsl(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
}
var hsl$2 = hsl$1(hue);
var hslLong = hsl$1(nogamma);
function lab$1(start, end) {
var l = nogamma((start = lab(start)).l, (end = lab(end)).l),
a = nogamma(start.a, end.a),
b = nogamma(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.l = l(t);
start.a = a(t);
start.b = b(t);
start.opacity = opacity(t);
return start + "";
};
}
function hcl$1(hue) {
return function(start, end) {
var h = hue((start = hcl(start)).h, (end = hcl(end)).h),
c = nogamma(start.c, end.c),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.c = c(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
}
var hcl$2 = hcl$1(hue);
var hclLong = hcl$1(nogamma);
function cubehelix$1(hue) {
return (function cubehelixGamma(y) {
y = +y;
function cubehelix$1(start, end) {
var h = hue((start = cubehelix(start)).h, (end = cubehelix(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(Math.pow(t, y));
start.opacity = opacity(t);
return start + "";
};
}
cubehelix$1.gamma = cubehelixGamma;
return cubehelix$1;
})(1);
}
var cubehelix$2 = cubehelix$1(hue);
var cubehelixLong = cubehelix$1(nogamma);
function piecewise(interpolate, values) {
var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
while (i < n) I[i] = interpolate(v, v = values[++i]);
return function(t) {
var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
return I[i](t - i);
};
}
function quantize(interpolator, n) {
var samples = new Array(n);
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
return samples;
}
var frame = 0, // is an animation frame pending?
timeout = 0, // is a timeout pending?
interval = 0, // are any timers active?
pokeDelay = 1000, // how frequently we check for clock skew
taskHead,
taskTail,
clockLast = 0,
clockNow = 0,
clockSkew = 0,
clock = typeof performance === "object" && performance.now ? performance : Date,
setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
function now() {
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}
function clearNow() {
clockNow = 0;
}
function Timer() {
this._call =
this._time =
this._next = null;
}
Timer.prototype = timer.prototype = {
constructor: Timer,
restart: function(callback, delay, time) {
if (typeof callback !== "function") throw new TypeError("callback is not a function");
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
if (!this._next && taskTail !== this) {
if (taskTail) taskTail._next = this;
else taskHead = this;
taskTail = this;
}
this._call = callback;
this._time = time;
sleep();
},
stop: function() {
if (this._call) {
this._call = null;
this._time = Infinity;
sleep();
}
}
};
function timer(callback, delay, time) {
var t = new Timer;
t.restart(callback, delay, time);
return t;
}
function timerFlush() {
now(); // Get the current time, if not already set.
++frame; // Pretend we’ve set an alarm, if we haven’t already.
var t = taskHead, e;
while (t) {
if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
t = t._next;
}
--frame;
}
function wake() {
clockNow = (clockLast = clock.now()) + clockSkew;
frame = timeout = 0;
try {
timerFlush();
} finally {
frame = 0;
nap();
clockNow = 0;
}
}
function poke() {
var now = clock.now(), delay = now - clockLast;
if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
}
function nap() {
var t0, t1 = taskHead, t2, time = Infinity;
while (t1) {
if (t1._call) {
if (time > t1._time) time = t1._time;
t0 = t1, t1 = t1._next;
} else {
t2 = t1._next, t1._next = null;
t1 = t0 ? t0._next = t2 : taskHead = t2;
}
}
taskTail = t0;
sleep(time);
}
function sleep(time) {
if (frame) return; // Soonest alarm already set, or will be.
if (timeout) timeout = clearTimeout(timeout);
var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
if (delay > 24) {
if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
if (interval) interval = clearInterval(interval);
} else {
if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
frame = 1, setFrame(wake);
}
}
function timeout$1(callback, delay, time) {
var t = new Timer;
delay = delay == null ? 0 : +delay;
t.restart(function(elapsed) {
t.stop();
callback(elapsed + delay);
}, delay, time);
return t;
}
function interval$1(callback, delay, time) {
var t = new Timer, total = delay;
if (delay == null) return t.restart(callback, delay, time), t;
delay = +delay, time = time == null ? now() : +time;
t.restart(function tick(elapsed) {
elapsed += total;
t.restart(tick, total += delay, time);
callback(elapsed);
}, delay, time);
return t;
}
var emptyOn = dispatch("start", "end", "cancel", "interrupt");
var emptyTween = [];
var CREATED = 0;
var SCHEDULED = 1;
var STARTING = 2;
var STARTED = 3;
var RUNNING = 4;
var ENDING = 5;
var ENDED = 6;
function schedule(node, name, id, index, group, timing) {
var schedules = node.__transition;
if (!schedules) node.__transition = {};
else if (id in schedules) return;
create$1(node, id, {
name: name,
index: index, // For context during callback.
group: group, // For context during callback.
on: emptyOn,
tween: emptyTween,
time: timing.time,
delay: timing.delay,
duration: timing.duration,
ease: timing.ease,
timer: null,
state: CREATED
});
}
function init(node, id) {
var schedule = get$1(node, id);
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
return schedule;
}
function set$1(node, id) {
var schedule = get$1(node, id);
if (schedule.state > STARTED) throw new Error("too late; already running");
return schedule;
}
function get$1(node, id) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
return schedule;
}
function create$1(node, id, self) {
var schedules = node.__transition,
tween;
// Initialize the self timer when the transition is created.
// Note the actual delay is not known until the first callback!
schedules[id] = self;
self.timer = timer(schedule, 0, self.time);
function schedule(elapsed) {
self.state = SCHEDULED;
self.timer.restart(start, self.delay, self.time);
// If the elapsed delay is less than our first sleep, start immediately.
if (self.delay <= elapsed) start(elapsed - self.delay);
}
function start(elapsed) {
var i, j, n, o;
// If the state is not SCHEDULED, then we previously errored on start.
if (self.state !== SCHEDULED) return stop();
for (i in schedules) {
o = schedules[i];
if (o.name !== self.name) continue;
// While this element already has a starting transition during this frame,
// defer starting an interrupting transition until that transition has a
// chance to tick (and possibly end); see d3/d3-transition#54!
if (o.state === STARTED) return timeout$1(start);
// Interrupt the active transition, if any.
if (o.state === RUNNING) {
o.state = ENDED;
o.timer.stop();
o.on.call("interrupt", node, node.__data__, o.index, o.group);
delete schedules[i];
}
// Cancel any pre-empted transitions.
else if (+i < id) {
o.state = ENDED;
o.timer.stop();
o.on.call("cancel", node, node.__data__, o.index, o.group);
delete schedules[i];
}
}
// Defer the first tick to end of the current frame; see d3/d3#1576.
// Note the transition may be canceled after start and before the first tick!
// Note this must be scheduled before the start event; see d3/d3-transition#16!
// Assuming this is successful, subsequent callbacks go straight to tick.
timeout$1(function() {
if (self.state === STARTED) {
self.state = RUNNING;
self.timer.restart(tick, self.delay, self.time);
tick(elapsed);
}
});
// Dispatch the start event.
// Note this must be done before the tween are initialized.
self.state = STARTING;
self.on.call("start", node, node.__data__, self.index, self.group);
if (self.state !== STARTING) return; // interrupted
self.state = STARTED;
// Initialize the tween, deleting null tween.
tween = new Array(n = self.tween.length);
for (i = 0, j = -1; i < n; ++i) {
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
tween[++j] = o;
}
}
tween.length = j + 1;
}
function tick(elapsed) {
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
i = -1,
n = tween.length;
while (++i < n) {
tween[i].call(node, t);
}
// Dispatch the end event.
if (self.state === ENDING) {
self.on.call("end", node, node.__data__, self.index, self.group);
stop();
}
}
function stop() {
self.state = ENDED;
self.timer.stop();
delete schedules[id];
for (var i in schedules) return; // eslint-disable-line no-unused-vars
delete node.__transition;
}
}
function interrupt(node, name) {
var schedules = node.__transition,
schedule,
active,
empty = true,
i;
if (!schedules) return;
name = name == null ? null : name + "";
for (i in schedules) {
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
active = schedule.state > STARTING && schedule.state < ENDING;
schedule.state = ENDED;
schedule.timer.stop();
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
delete schedules[i];
}
if (empty) delete node.__transition;
}
function selection_interrupt(name) {
return this.each(function() {
interrupt(this, name);
});
}
function tweenRemove(id, name) {
var tween0, tween1;
return function() {
var schedule = set$1(this, id),
tween = schedule.tween;
// If this node shared tween with the previous node,
// just assign the updated shared tween and we’re done!
// Otherwise, copy-on-write.
if (tween !== tween0) {
tween1 = tween0 = tween;
for (var i = 0, n = tween1.length; i < n; ++i) {
if (tween1[i].name === name) {
tween1 = tween1.slice();
tween1.splice(i, 1);
break;
}
}
}
schedule.tween = tween1;
};
}
function tweenFunction(id, name, value) {
var tween0, tween1;
if (typeof value !== "function") throw new Error;
return function() {
var schedule = set$1(this, id),
tween = schedule.tween;
// If this node shared tween with the previous node,
// just assign the updated shared tween and we’re done!
// Otherwise, copy-on-write.
if (tween !== tween0) {
tween1 = (tween0 = tween).slice();
for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
if (tween1[i].name === name) {
tween1[i] = t;
break;
}
}
if (i === n) tween1.push(t);
}
schedule.tween = tween1;
};
}
function transition_tween(name, value) {
var id = this._id;
name += "";
if (arguments.length < 2) {
var tween = get$1(this.node(), id).tween;
for (var i = 0, n = tween.length, t; i < n; ++i) {
if ((t = tween[i]).name === name) {
return t.value;
}
}
return null;
}
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
}
function tweenValue(transition, name, value) {
var id = transition._id;
transition.each(function() {
var schedule = set$1(this, id);
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
});
return function(node) {
return get$1(node, id).value[name];
};
}
function interpolate(a, b) {
var c;
return (typeof b === "number" ? interpolateNumber
: b instanceof color ? interpolateRgb
: (c = color(b)) ? (b = c, interpolateRgb)
: interpolateString)(a, b);
}
function attrRemove$1(name) {
return function() {
this.removeAttribute(name);
};
}
function attrRemoveNS$1(fullname) {
return function() {
this.removeAttributeNS(fullname.space, fullname.local);
};
}
function attrConstant$1(name, interpolate, value1) {
var string00,
string1 = value1 + "",
interpolate0;
return function() {
var string0 = this.getAttribute(name);
return string0 === string1 ? null
: string0 === string00 ? interpolate0
: interpolate0 = interpolate(string00 = string0, value1);
};
}
function attrConstantNS$1(fullname, interpolate, value1) {
var string00,
string1 = value1 + "",
interpolate0;
return function() {
var string0 = this.getAttributeNS(fullname.space, fullname.local);
return string0 === string1 ? null
: string0 === string00 ? interpolate0
: interpolate0 = interpolate(string00 = string0, value1);
};
}
function attrFunction$1(name, interpolate, value) {
var string00,
string10,
interpolate0;
return function() {
var string0, value1 = value(this), string1;
if (value1 == null) return void this.removeAttribute(name);
string0 = this.getAttribute(name);
string1 = value1 + "";
return string0 === string1 ? null
: string0 === string00 && string1 === string10 ? interpolate0
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
};
}
function attrFunctionNS$1(fullname, interpolate, value) {
var string00,
string10,
interpolate0;
return function() {
var string0, value1 = value(this), string1;
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
string0 = this.getAttributeNS(fullname.space, fullname.local);
string1 = value1 + "";
return string0 === string1 ? null
: string0 === string00 && string1 === string10 ? interpolate0
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
};
}
function transition_attr(name, value) {
var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate;
return this.attrTween(name, typeof value === "function"
? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value))
: value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname)
: (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value));
}
function attrInterpolate(name, i) {
return function(t) {
this.setAttribute(name, i.call(this, t));
};
}
function attrInterpolateNS(fullname, i) {
return function(t) {
this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
};
}
function attrTweenNS(fullname, value) {
var t0, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
return t0;
}
tween._value = value;
return tween;
}
function attrTween(name, value) {
var t0, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
return t0;
}
tween._value = value;
return tween;
}
function transition_attrTween(name, value) {
var key = "attr." + name;
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
var fullname = namespace(name);
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
}
function delayFunction(id, value) {
return function() {
init(this, id).delay = +value.apply(this, arguments);
};
}
function delayConstant(id, value) {
return value = +value, function() {
init(this, id).delay = value;
};
}
function transition_delay(value) {
var id = this._id;
return arguments.length
? this.each((typeof value === "function"
? delayFunction
: delayConstant)(id, value))
: get$1(this.node(), id).delay;
}
function durationFunction(id, value) {
return function() {
set$1(this, id).duration = +value.apply(this, arguments);
};
}
function durationConstant(id, value) {
return value = +value, function() {
set$1(this, id).duration = value;
};
}
function transition_duration(value) {
var id = this._id;
return arguments.length
? this.each((typeof value === "function"
? durationFunction
: durationConstant)(id, value))
: get$1(this.node(), id).duration;
}
function easeConstant(id, value) {
if (typeof value !== "function") throw new Error;
return function() {
set$1(this, id).ease = value;
};
}
function transition_ease(value) {
var id = this._id;
return arguments.length
? this.each(easeConstant(id, value))
: get$1(this.node(), id).ease;
}
function transition_filter(match) {
if (typeof match !== "function") match = matcher(match);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
subgroup.push(node);
}
}
}
return new Transition(subgroups, this._parents, this._name, this._id);
}
function transition_merge(transition) {
if (transition._id !== this._id) throw new Error;
for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
}
}
}
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
return new Transition(merges, this._parents, this._name, this._id);
}
function start(name) {
return (name + "").trim().split(/^|\s+/).every(function(t) {
var i = t.indexOf(".");
if (i >= 0) t = t.slice(0, i);
return !t || t === "start";
});
}
function onFunction(id, name, listener) {
var on0, on1, sit = start(name) ? init : set$1;
return function() {
var schedule = sit(this, id),
on = schedule.on;
// If this node shared a dispatch with the previous node,
// just assign the updated shared dispatch and we’re done!
// Otherwise, copy-on-write.
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
schedule.on = on1;
};
}
function transition_on(name, listener) {
var id = this._id;
return arguments.length < 2
? get$1(this.node(), id).on.on(name)
: this.each(onFunction(id, name, listener));
}
function removeFunction(id) {
return function() {
var parent = this.parentNode;
for (var i in this.__transition) if (+i !== id) return;
if (parent) parent.removeChild(this);
};
}
function transition_remove() {
return this.on("end.remove", removeFunction(this._id));
}
function transition_select(select) {
var name = this._name,
id = this._id;
if (typeof select !== "function") select = selector(select);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
subgroup[i] = subnode;
schedule(subgroup[i], name, id, i, subgroup, get$1(node, id));
}
}
}
return new Transition(subgroups, this._parents, name, id);
}
function transition_selectAll(select) {
var name = this._name,
id = this._id;
if (typeof select !== "function") select = selectorAll(select);
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
for (var children = select.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) {
if (child = children[k]) {
schedule(child, name, id, k, children, inherit);
}
}
subgroups.push(children);
parents.push(node);
}
}
}
return new Transition(subgroups, parents, name, id);
}
var Selection$1 = selection.prototype.constructor;
function transition_selection() {
return new Selection$1(this._groups, this._parents);
}
function styleNull(name, interpolate) {
var string00,
string10,
interpolate0;
return function() {
var string0 = styleValue(this, name),
string1 = (this.style.removeProperty(name), styleValue(this, name));
return string0 === string1 ? null
: string0 === string00 && string1 === string10 ? interpolate0
: interpolate0 = interpolate(string00 = string0, string10 = string1);
};
}
function styleRemove$1(name) {
return function() {
this.style.removeProperty(name);
};
}
function styleConstant$1(name, interpolate, value1) {
var string00,
string1 = value1 + "",
interpolate0;
return function() {
var string0 = styleValue(this, name);
return string0 === string1 ? null
: string0 === string00 ? interpolate0
: interpolate0 = interpolate(string00 = string0, value1);
};
}
function styleFunction$1(name, interpolate, value) {
var string00,
string10,
interpolate0;
return function() {
var string0 = styleValue(this, name),
value1 = value(this),
string1 = value1 + "";
if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
return string0 === string1 ? null
: string0 === string00 && string1 === string10 ? interpolate0
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
};
}
function styleMaybeRemove(id, name) {
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
return function() {
var schedule = set$1(this, id),
on = schedule.on,
listener = schedule.value[key] == null ? remove || (remove = styleRemove$1(name)) : undefined;
// If this node shared a dispatch with the previous node,
// just assign the updated shared dispatch and we’re done!
// Otherwise, copy-on-write.
if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
schedule.on = on1;
};
}
function transition_style(name, value, priority) {
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
return value == null ? this
.styleTween(name, styleNull(name, i))
.on("end.style." + name, styleRemove$1(name))
: typeof value === "function" ? this
.styleTween(name, styleFunction$1(name, i, tweenValue(this, "style." + name, value)))
.each(styleMaybeRemove(this._id, name))
: this
.styleTween(name, styleConstant$1(name, i, value), priority)
.on("end.style." + name, null);
}
function styleInterpolate(name, i, priority) {
return function(t) {
this.style.setProperty(name, i.call(this, t), priority);
};
}
function styleTween(name, value, priority) {
var t, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
return t;
}
tween._value = value;
return tween;
}
function transition_styleTween(name, value, priority) {
var key = "style." + (name += "");
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
}
function textConstant$1(value) {
return function() {
this.textContent = value;
};
}
function textFunction$1(value) {
return function() {
var value1 = value(this);
this.textContent = value1 == null ? "" : value1;
};
}
function transition_text(value) {
return this.tween("text", typeof value === "function"
? textFunction$1(tweenValue(this, "text", value))
: textConstant$1(value == null ? "" : value + ""));
}
function textInterpolate(i) {
return function(t) {
this.textContent = i.call(this, t);
};
}
function textTween(value) {
var t0, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
return t0;
}
tween._value = value;
return tween;
}
function transition_textTween(value) {
var key = "text";
if (arguments.length < 1) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
return this.tween(key, textTween(value));
}
function transition_transition() {
var name = this._name,
id0 = this._id,
id1 = newId();
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
var inherit = get$1(node, id0);
schedule(node, name, id1, i, group, {
time: inherit.time + inherit.delay + inherit.duration,
delay: 0,
duration: inherit.duration,
ease: inherit.ease
});
}
}
}
return new Transition(groups, this._parents, name, id1);
}
function transition_end() {
var on0, on1, that = this, id = that._id, size = that.size();
return new Promise(function(resolve, reject) {
var cancel = {value: reject},
end = {value: function() { if (--size === 0) resolve(); }};
that.each(function() {
var schedule = set$1(this, id),
on = schedule.on;
// If this node shared a dispatch with the previous node,
// just assign the updated shared dispatch and we’re done!
// Otherwise, copy-on-write.
if (on !== on0) {
on1 = (on0 = on).copy();
on1._.cancel.push(cancel);
on1._.interrupt.push(cancel);
on1._.end.push(end);
}
schedule.on = on1;
});
});
}
var id = 0;
function Transition(groups, parents, name, id) {
this._groups = groups;
this._parents = parents;
this._name = name;
this._id = id;
}
function transition(name) {
return selection().transition(name);
}
function newId() {
return ++id;
}
var selection_prototype = selection.prototype;
Transition.prototype = transition.prototype = {
constructor: Transition,
select: transition_select,
selectAll: transition_selectAll,
filter: transition_filter,
merge: transition_merge,
selection: transition_selection,
transition: transition_transition,
call: selection_prototype.call,
nodes: selection_prototype.nodes,
node: selection_prototype.node,
size: selection_prototype.size,
empty: selection_prototype.empty,
each: selection_prototype.each,
on: transition_on,
attr: transition_attr,
attrTween: transition_attrTween,
style: transition_style,
styleTween: transition_styleTween,
text: transition_text,
textTween: transition_textTween,
remove: transition_remove,
tween: transition_tween,
delay: transition_delay,
duration: transition_duration,
ease: transition_ease,
end: transition_end
};
function linear$1(t) {
return +t;
}
function quadIn(t) {
return t * t;
}
function quadOut(t) {
return t * (2 - t);
}
function quadInOut(t) {
return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
}
function cubicIn(t) {
return t * t * t;
}
function cubicOut(t) {
return --t * t * t + 1;
}
function cubicInOut(t) {
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
var exponent = 3;
var polyIn = (function custom(e) {
e = +e;
function polyIn(t) {
return Math.pow(t, e);
}
polyIn.exponent = custom;
return polyIn;
})(exponent);
var polyOut = (function custom(e) {
e = +e;
function polyOut(t) {
return 1 - Math.pow(1 - t, e);
}
polyOut.exponent = custom;
return polyOut;
})(exponent);
var polyInOut = (function custom(e) {
e = +e;
function polyInOut(t) {
return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
}
polyInOut.exponent = custom;
return polyInOut;
})(exponent);
var pi = Math.PI,
halfPi = pi / 2;
function sinIn(t) {
return 1 - Math.cos(t * halfPi);
}
function sinOut(t) {
return Math.sin(t * halfPi);
}
function sinInOut(t) {
return (1 - Math.cos(pi * t)) / 2;
}
function expIn(t) {
return Math.pow(2, 10 * t - 10);
}
function expOut(t) {
return 1 - Math.pow(2, -10 * t);
}
function expInOut(t) {
return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;
}
function circleIn(t) {
return 1 - Math.sqrt(1 - t * t);
}
function circleOut(t) {
return Math.sqrt(1 - --t * t);
}
function circleInOut(t) {
return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
}
var b1 = 4 / 11,
b2 = 6 / 11,
b3 = 8 / 11,
b4 = 3 / 4,
b5 = 9 / 11,
b6 = 10 / 11,
b7 = 15 / 16,
b8 = 21 / 22,
b9 = 63 / 64,
b0 = 1 / b1 / b1;
function bounceIn(t) {
return 1 - bounceOut(1 - t);
}
function bounceOut(t) {
return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
}
function bounceInOut(t) {
return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
}
var overshoot = 1.70158;
var backIn = (function custom(s) {
s = +s;
function backIn(t) {
return t * t * ((s + 1) * t - s);
}
backIn.overshoot = custom;
return backIn;
})(overshoot);
var backOut = (function custom(s) {
s = +s;
function backOut(t) {
return --t * t * ((s + 1) * t + s) + 1;
}
backOut.overshoot = custom;
return backOut;
})(overshoot);
var backInOut = (function custom(s) {
s = +s;
function backInOut(t) {
return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
}
backInOut.overshoot = custom;
return backInOut;
})(overshoot);
var tau = 2 * Math.PI,
amplitude = 1,
period = 0.3;
var elasticIn = (function custom(a, p) {
var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
function elasticIn(t) {
return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);
}
elasticIn.amplitude = function(a) { return custom(a, p * tau); };
elasticIn.period = function(p) { return custom(a, p); };
return elasticIn;
})(amplitude, period);
var elasticOut = (function custom(a, p) {
var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
function elasticOut(t) {
return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);
}
elasticOut.amplitude = function(a) { return custom(a, p * tau); };
elasticOut.period = function(p) { return custom(a, p); };
return elasticOut;
})(amplitude, period);
var elasticInOut = (function custom(a, p) {
var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
function elasticInOut(t) {
return ((t = t * 2 - 1) < 0
? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p)
: 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
}
elasticInOut.amplitude = function(a) { return custom(a, p * tau); };
elasticInOut.period = function(p) { return custom(a, p); };
return elasticInOut;
})(amplitude, period);
var defaultTiming = {
time: null, // Set on use.
delay: 0,
duration: 250,
ease: cubicInOut
};
function inherit(node, id) {
var timing;
while (!(timing = node.__transition) || !(timing = timing[id])) {
if (!(node = node.parentNode)) {
return defaultTiming.time = now(), defaultTiming;
}
}
return timing;
}
function selection_transition(name) {
var id,
timing;
if (name instanceof Transition) {
id = name._id, name = name._name;
} else {
id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
}
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
schedule(node, name, id, i, group, timing || inherit(node, id));
}
}
}
return new Transition(groups, this._parents, name, id);
}
selection.prototype.interrupt = selection_interrupt;
selection.prototype.transition = selection_transition;
var root$1 = [null];
function active(node, name) {
var schedules = node.__transition,
schedule,
i;
if (schedules) {
name = name == null ? null : name + "";
for (i in schedules) {
if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {
return new Transition([[node]], root$1, name, +i);
}
}
}
return null;
}
function constant$4(x) {
return function() {
return x;
};
}
function BrushEvent(target, type, selection) {
this.target = target;
this.type = type;
this.selection = selection;
}
function nopropagation$1() {
exports.event.stopImmediatePropagation();
}
function noevent$1() {
exports.event.preventDefault();
exports.event.stopImmediatePropagation();
}
var MODE_DRAG = {name: "drag"},
MODE_SPACE = {name: "space"},
MODE_HANDLE = {name: "handle"},
MODE_CENTER = {name: "center"};
function number1(e) {
return [+e[0], +e[1]];
}
function number2(e) {
return [number1(e[0]), number1(e[1])];
}
function toucher(identifier) {
return function(target) {
return touch(target, exports.event.touches, identifier);
};
}
var X = {
name: "x",
handles: ["w", "e"].map(type),
input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },
output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }
};
var Y = {
name: "y",
handles: ["n", "s"].map(type),
input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },
output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }
};
var XY = {
name: "xy",
handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
input: function(xy) { return xy == null ? null : number2(xy); },
output: function(xy) { return xy; }
};
var cursors = {
overlay: "crosshair",
selection: "move",
n: "ns-resize",
e: "ew-resize",
s: "ns-resize",
w: "ew-resize",
nw: "nwse-resize",
ne: "nesw-resize",
se: "nwse-resize",
sw: "nesw-resize"
};
var flipX = {
e: "w",
w: "e",
nw: "ne",
ne: "nw",
se: "sw",
sw: "se"
};
var flipY = {
n: "s",
s: "n",
nw: "sw",
ne: "se",
se: "ne",
sw: "nw"
};
var signsX = {
overlay: +1,
selection: +1,
n: null,
e: +1,
s: null,
w: -1,
nw: -1,
ne: +1,
se: +1,
sw: -1
};
var signsY = {
overlay: +1,
selection: +1,
n: -1,
e: null,
s: +1,
w: null,
nw: -1,
ne: -1,
se: +1,
sw: +1
};
function type(t) {
return {type: t};
}
// Ignore right-click, since that should open the context menu.
function defaultFilter$1() {
return !exports.event.ctrlKey && !exports.event.button;
}
function defaultExtent() {
var svg = this.ownerSVGElement || this;
if (svg.hasAttribute("viewBox")) {
svg = svg.viewBox.baseVal;
return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];
}
return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];
}
function defaultTouchable$1() {
return navigator.maxTouchPoints || ("ontouchstart" in this);
}
// Like d3.local, but with the name “__brush” rather than auto-generated.
function local$1(node) {
while (!node.__brush) if (!(node = node.parentNode)) return;
return node.__brush;
}
function empty$1(extent) {
return extent[0][0] === extent[1][0]
|| extent[0][1] === extent[1][1];
}
function brushSelection(node) {
var state = node.__brush;
return state ? state.dim.output(state.selection) : null;
}
function brushX() {
return brush$1(X);
}
function brushY() {
return brush$1(Y);
}
function brush() {
return brush$1(XY);
}
function brush$1(dim) {
var extent = defaultExtent,
filter = defaultFilter$1,
touchable = defaultTouchable$1,
keys = true,
listeners = dispatch("start", "brush", "end"),
handleSize = 6,
touchending;
function brush(group) {
var overlay = group
.property("__brush", initialize)
.selectAll(".overlay")
.data([type("overlay")]);
overlay.enter().append("rect")
.attr("class", "overlay")
.attr("pointer-events", "all")
.attr("cursor", cursors.overlay)
.merge(overlay)
.each(function() {
var extent = local$1(this).extent;
select(this)
.attr("x", extent[0][0])
.attr("y", extent[0][1])
.attr("width", extent[1][0] - extent[0][0])
.attr("height", extent[1][1] - extent[0][1]);
});
group.selectAll(".selection")
.data([type("selection")])
.enter().append("rect")
.attr("class", "selection")
.attr("cursor", cursors.selection)
.attr("fill", "#777")
.attr("fill-opacity", 0.3)
.attr("stroke", "#fff")
.attr("shape-rendering", "crispEdges");
var handle = group.selectAll(".handle")
.data(dim.handles, function(d) { return d.type; });
handle.exit().remove();
handle.enter().append("rect")
.attr("class", function(d) { return "handle handle--" + d.type; })
.attr("cursor", function(d) { return cursors[d.type]; });
group
.each(redraw)
.attr("fill", "none")
.attr("pointer-events", "all")
.on("mousedown.brush", started)
.filter(touchable)
.on("touchstart.brush", started)
.on("touchmove.brush", touchmoved)
.on("touchend.brush touchcancel.brush", touchended)
.style("touch-action", "none")
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
brush.move = function(group, selection) {
if (group.selection) {
group
.on("start.brush", function() { emitter(this, arguments).beforestart().start(); })
.on("interrupt.brush end.brush", function() { emitter(this, arguments).end(); })
.tween("brush", function() {
var that = this,
state = that.__brush,
emit = emitter(that, arguments),
selection0 = state.selection,
selection1 = dim.input(typeof selection === "function" ? selection.apply(this, arguments) : selection, state.extent),
i = interpolateValue(selection0, selection1);
function tween(t) {
state.selection = t === 1 && selection1 === null ? null : i(t);
redraw.call(that);
emit.brush();
}
return selection0 !== null && selection1 !== null ? tween : tween(1);
});
} else {
group
.each(function() {
var that = this,
args = arguments,
state = that.__brush,
selection1 = dim.input(typeof selection === "function" ? selection.apply(that, args) : selection, state.extent),
emit = emitter(that, args).beforestart();
interrupt(that);
state.selection = selection1 === null ? null : selection1;
redraw.call(that);
emit.start().brush().end();
});
}
};
brush.clear = function(group) {
brush.move(group, null);
};
function redraw() {
var group = select(this),
selection = local$1(this).selection;
if (selection) {
group.selectAll(".selection")
.style("display", null)
.attr("x", selection[0][0])
.attr("y", selection[0][1])
.attr("width", selection[1][0] - selection[0][0])
.attr("height", selection[1][1] - selection[0][1]);
group.selectAll(".handle")
.style("display", null)
.attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })
.attr("y", function(d) { return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })
.attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })
.attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });
}
else {
group.selectAll(".selection,.handle")
.style("display", "none")
.attr("x", null)
.attr("y", null)
.attr("width", null)
.attr("height", null);
}
}
function emitter(that, args, clean) {
return (!clean && that.__brush.emitter) || new Emitter(that, args);
}
function Emitter(that, args) {
this.that = that;
this.args = args;
this.state = that.__brush;
this.active = 0;
}
Emitter.prototype = {
beforestart: function() {
if (++this.active === 1) this.state.emitter = this, this.starting = true;
return this;
},
start: function() {
if (this.starting) this.starting = false, this.emit("start");
else this.emit("brush");
return this;
},
brush: function() {
this.emit("brush");
return this;
},
end: function() {
if (--this.active === 0) delete this.state.emitter, this.emit("end");
return this;
},
emit: function(type) {
customEvent(new BrushEvent(brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [type, this.that, this.args]);
}
};
function started() {
if (touchending && !exports.event.touches) return;
if (!filter.apply(this, arguments)) return;
var that = this,
type = exports.event.target.__data__.type,
mode = (keys && exports.event.metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (keys && exports.event.altKey ? MODE_CENTER : MODE_HANDLE),
signX = dim === Y ? null : signsX[type],
signY = dim === X ? null : signsY[type],
state = local$1(that),
extent = state.extent,
selection = state.selection,
W = extent[0][0], w0, w1,
N = extent[0][1], n0, n1,
E = extent[1][0], e0, e1,
S = extent[1][1], s0, s1,
dx = 0,
dy = 0,
moving,
shifting = signX && signY && keys && exports.event.shiftKey,
lockX,
lockY,
pointer = exports.event.touches ? toucher(exports.event.changedTouches[0].identifier) : mouse,
point0 = pointer(that),
point = point0,
emit = emitter(that, arguments, true).beforestart();
if (type === "overlay") {
if (selection) moving = true;
state.selection = selection = [
[w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]],
[e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0]
];
} else {
w0 = selection[0][0];
n0 = selection[0][1];
e0 = selection[1][0];
s0 = selection[1][1];
}
w1 = w0;
n1 = n0;
e1 = e0;
s1 = s0;
var group = select(that)
.attr("pointer-events", "none");
var overlay = group.selectAll(".overlay")
.attr("cursor", cursors[type]);
if (exports.event.touches) {
emit.moved = moved;
emit.ended = ended;
} else {
var view = select(exports.event.view)
.on("mousemove.brush", moved, true)
.on("mouseup.brush", ended, true);
if (keys) view
.on("keydown.brush", keydowned, true)
.on("keyup.brush", keyupped, true);
dragDisable(exports.event.view);
}
nopropagation$1();
interrupt(that);
redraw.call(that);
emit.start();
function moved() {
var point1 = pointer(that);
if (shifting && !lockX && !lockY) {
if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true;
else lockX = true;
}
point = point1;
moving = true;
noevent$1();
move();
}
function move() {
var t;
dx = point[0] - point0[0];
dy = point[1] - point0[1];
switch (mode) {
case MODE_SPACE:
case MODE_DRAG: {
if (signX) dx = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;
if (signY) dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;
break;
}
case MODE_HANDLE: {
if (signX < 0) dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0;
else if (signX > 0) dx = Math.max(W - e0, Math.min(E - e0, dx)), w1 = w0, e1 = e0 + dx;
if (signY < 0) dy = Math.max(N - n0, Math.min(S - n0, dy)), n1 = n0 + dy, s1 = s0;
else if (signY > 0) dy = Math.max(N - s0, Math.min(S - s0, dy)), n1 = n0, s1 = s0 + dy;
break;
}
case MODE_CENTER: {
if (signX) w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX));
if (signY) n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.min(S, s0 + dy * signY));
break;
}
}
if (e1 < w1) {
signX *= -1;
t = w0, w0 = e0, e0 = t;
t = w1, w1 = e1, e1 = t;
if (type in flipX) overlay.attr("cursor", cursors[type = flipX[type]]);
}
if (s1 < n1) {
signY *= -1;
t = n0, n0 = s0, s0 = t;
t = n1, n1 = s1, s1 = t;
if (type in flipY) overlay.attr("cursor", cursors[type = flipY[type]]);
}
if (state.selection) selection = state.selection; // May be set by brush.move!
if (lockX) w1 = selection[0][0], e1 = selection[1][0];
if (lockY) n1 = selection[0][1], s1 = selection[1][1];
if (selection[0][0] !== w1
|| selection[0][1] !== n1
|| selection[1][0] !== e1
|| selection[1][1] !== s1) {
state.selection = [[w1, n1], [e1, s1]];
redraw.call(that);
emit.brush();
}
}
function ended() {
nopropagation$1();
if (exports.event.touches) {
if (exports.event.touches.length) return;
if (touchending) clearTimeout(touchending);
touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
} else {
yesdrag(exports.event.view, moving);
view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null);
}
group.attr("pointer-events", "all");
overlay.attr("cursor", cursors.overlay);
if (state.selection) selection = state.selection; // May be set by brush.move (on start)!
if (empty$1(selection)) state.selection = null, redraw.call(that);
emit.end();
}
function keydowned() {
switch (exports.event.keyCode) {
case 16: { // SHIFT
shifting = signX && signY;
break;
}
case 18: { // ALT
if (mode === MODE_HANDLE) {
if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
mode = MODE_CENTER;
move();
}
break;
}
case 32: { // SPACE; takes priority over ALT
if (mode === MODE_HANDLE || mode === MODE_CENTER) {
if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;
if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;
mode = MODE_SPACE;
overlay.attr("cursor", cursors.selection);
move();
}
break;
}
default: return;
}
noevent$1();
}
function keyupped() {
switch (exports.event.keyCode) {
case 16: { // SHIFT
if (shifting) {
lockX = lockY = shifting = false;
move();
}
break;
}
case 18: { // ALT
if (mode === MODE_CENTER) {
if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
mode = MODE_HANDLE;
move();
}
break;
}
case 32: { // SPACE
if (mode === MODE_SPACE) {
if (exports.event.altKey) {
if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
mode = MODE_CENTER;
} else {
if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
mode = MODE_HANDLE;
}
overlay.attr("cursor", cursors[type]);
move();
}
break;
}
default: return;
}
noevent$1();
}
}
function touchmoved() {
emitter(this, arguments).moved();
}
function touchended() {
emitter(this, arguments).ended();
}
function initialize() {
var state = this.__brush || {selection: null};
state.extent = number2(extent.apply(this, arguments));
state.dim = dim;
return state;
}
brush.extent = function(_) {
return arguments.length ? (extent = typeof _ === "function" ? _ : constant$4(number2(_)), brush) : extent;
};
brush.filter = function(_) {
return arguments.length ? (filter = typeof _ === "function" ? _ : constant$4(!!_), brush) : filter;
};
brush.touchable = function(_) {
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$4(!!_), brush) : touchable;
};
brush.handleSize = function(_) {
return arguments.length ? (handleSize = +_, brush) : handleSize;
};
brush.keyModifiers = function(_) {
return arguments.length ? (keys = !!_, brush) : keys;
};
brush.on = function() {
var value = listeners.on.apply(listeners, arguments);
return value === listeners ? brush : value;
};
return brush;
}
var cos = Math.cos;
var sin = Math.sin;
var pi$1 = Math.PI;
var halfPi$1 = pi$1 / 2;
var tau$1 = pi$1 * 2;
var max$1 = Math.max;
function compareValue(compare) {
return function(a, b) {
return compare(
a.source.value + a.target.value,
b.source.value + b.target.value
);
};
}
function chord() {
var padAngle = 0,
sortGroups = null,
sortSubgroups = null,
sortChords = null;
function chord(matrix) {
var n = matrix.length,
groupSums = [],
groupIndex = sequence(n),
subgroupIndex = [],
chords = [],
groups = chords.groups = new Array(n),
subgroups = new Array(n * n),
k,
x,
x0,
dx,
i,
j;
// Compute the sum.
k = 0, i = -1; while (++i < n) {
x = 0, j = -1; while (++j < n) {
x += matrix[i][j];
}
groupSums.push(x);
subgroupIndex.push(sequence(n));
k += x;
}
// Sort groups…
if (sortGroups) groupIndex.sort(function(a, b) {
return sortGroups(groupSums[a], groupSums[b]);
});
// Sort subgroups…
if (sortSubgroups) subgroupIndex.forEach(function(d, i) {
d.sort(function(a, b) {
return sortSubgroups(matrix[i][a], matrix[i][b]);
});
});
// Convert the sum to scaling factor for [0, 2pi].
// TODO Allow start and end angle to be specified?
// TODO Allow padding to be specified as percentage?
k = max$1(0, tau$1 - padAngle * n) / k;
dx = k ? padAngle : tau$1 / n;
// Compute the start and end angle for each group and subgroup.
// Note: Opera has a bug reordering object literal properties!
x = 0, i = -1; while (++i < n) {
x0 = x, j = -1; while (++j < n) {
var di = groupIndex[i],
dj = subgroupIndex[di][j],
v = matrix[di][dj],
a0 = x,
a1 = x += v * k;
subgroups[dj * n + di] = {
index: di,
subindex: dj,
startAngle: a0,
endAngle: a1,
value: v
};
}
groups[di] = {
index: di,
startAngle: x0,
endAngle: x,
value: groupSums[di]
};
x += dx;
}
// Generate chords for each (non-empty) subgroup-subgroup link.
i = -1; while (++i < n) {
j = i - 1; while (++j < n) {
var source = subgroups[j * n + i],
target = subgroups[i * n + j];
if (source.value || target.value) {
chords.push(source.value < target.value
? {source: target, target: source}
: {source: source, target: target});
}
}
}
return sortChords ? chords.sort(sortChords) : chords;
}
chord.padAngle = function(_) {
return arguments.length ? (padAngle = max$1(0, _), chord) : padAngle;
};
chord.sortGroups = function(_) {
return arguments.length ? (sortGroups = _, chord) : sortGroups;
};
chord.sortSubgroups = function(_) {
return arguments.length ? (sortSubgroups = _, chord) : sortSubgroups;
};
chord.sortChords = function(_) {
return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._;
};
return chord;
}
var slice$2 = Array.prototype.slice;
function constant$5(x) {
return function() {
return x;
};
}
var pi$2 = Math.PI,
tau$2 = 2 * pi$2,
epsilon$1 = 1e-6,
tauEpsilon = tau$2 - epsilon$1;
function Path() {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null; // end of current subpath
this._ = "";
}
function path() {
return new Path;
}
Path.prototype = path.prototype = {
constructor: Path,
moveTo: function(x, y) {
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
},
closePath: function() {
if (this._x1 !== null) {
this._x1 = this._x0, this._y1 = this._y0;
this._ += "Z";
}
},
lineTo: function(x, y) {
this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
},
quadraticCurveTo: function(x1, y1, x, y) {
this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
},
bezierCurveTo: function(x1, y1, x2, y2, x, y) {
this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
},
arcTo: function(x1, y1, x2, y2, r) {
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
var x0 = this._x1,
y0 = this._y1,
x21 = x2 - x1,
y21 = y2 - y1,
x01 = x0 - x1,
y01 = y0 - y1,
l01_2 = x01 * x01 + y01 * y01;
// Is the radius negative? Error.
if (r < 0) throw new Error("negative radius: " + r);
// Is this path empty? Move to (x1,y1).
if (this._x1 === null) {
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
}
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
else if (!(l01_2 > epsilon$1));
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
// Equivalently, is (x1,y1) coincident with (x2,y2)?
// Or, is the radius zero? Line to (x1,y1).
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) {
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
}
// Otherwise, draw an arc!
else {
var x20 = x2 - x0,
y20 = y2 - y0,
l21_2 = x21 * x21 + y21 * y21,
l20_2 = x20 * x20 + y20 * y20,
l21 = Math.sqrt(l21_2),
l01 = Math.sqrt(l01_2),
l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
t01 = l / l01,
t21 = l / l21;
// If the start tangent is not coincident with (x0,y0), line to.
if (Math.abs(t01 - 1) > epsilon$1) {
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
}
this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
}
},
arc: function(x, y, r, a0, a1, ccw) {
x = +x, y = +y, r = +r, ccw = !!ccw;
var dx = r * Math.cos(a0),
dy = r * Math.sin(a0),
x0 = x + dx,
y0 = y + dy,
cw = 1 ^ ccw,
da = ccw ? a0 - a1 : a1 - a0;
// Is the radius negative? Error.
if (r < 0) throw new Error("negative radius: " + r);
// Is this path empty? Move to (x0,y0).
if (this._x1 === null) {
this._ += "M" + x0 + "," + y0;
}
// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) {
this._ += "L" + x0 + "," + y0;
}
// Is this arc empty? We’re done.
if (!r) return;
// Does the angle go the wrong way? Flip the direction.
if (da < 0) da = da % tau$2 + tau$2;
// Is this a complete circle? Draw two arcs to complete the circle.
if (da > tauEpsilon) {
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
}
// Is this arc non-empty? Draw an arc!
else if (da > epsilon$1) {
this._ += "A" + r + "," + r + ",0," + (+(da >= pi$2)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
}
},
rect: function(x, y, w, h) {
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
},
toString: function() {
return this._;
}
};
function defaultSource(d) {
return d.source;
}
function defaultTarget(d) {
return d.target;
}
function defaultRadius(d) {
return d.radius;
}
function defaultStartAngle(d) {
return d.startAngle;
}
function defaultEndAngle(d) {
return d.endAngle;
}
function ribbon() {
var source = defaultSource,
target = defaultTarget,
radius = defaultRadius,
startAngle = defaultStartAngle,
endAngle = defaultEndAngle,
context = null;
function ribbon() {
var buffer,
argv = slice$2.call(arguments),
s = source.apply(this, argv),
t = target.apply(this, argv),
sr = +radius.apply(this, (argv[0] = s, argv)),
sa0 = startAngle.apply(this, argv) - halfPi$1,
sa1 = endAngle.apply(this, argv) - halfPi$1,
sx0 = sr * cos(sa0),
sy0 = sr * sin(sa0),
tr = +radius.apply(this, (argv[0] = t, argv)),
ta0 = startAngle.apply(this, argv) - halfPi$1,
ta1 = endAngle.apply(this, argv) - halfPi$1;
if (!context) context = buffer = path();
context.moveTo(sx0, sy0);
context.arc(0, 0, sr, sa0, sa1);
if (sa0 !== ta0 || sa1 !== ta1) { // TODO sr !== tr?
context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0));
context.arc(0, 0, tr, ta0, ta1);
}
context.quadraticCurveTo(0, 0, sx0, sy0);
context.closePath();
if (buffer) return context = null, buffer + "" || null;
}
ribbon.radius = function(_) {
return arguments.length ? (radius = typeof _ === "function" ? _ : constant$5(+_), ribbon) : radius;
};
ribbon.startAngle = function(_) {
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$5(+_), ribbon) : startAngle;
};
ribbon.endAngle = function(_) {
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$5(+_), ribbon) : endAngle;
};
ribbon.source = function(_) {
return arguments.length ? (source = _, ribbon) : source;
};
ribbon.target = function(_) {
return arguments.length ? (target = _, ribbon) : target;
};
ribbon.context = function(_) {
return arguments.length ? ((context = _ == null ? null : _), ribbon) : context;
};
return ribbon;
}
var prefix = "$";
function Map() {}
Map.prototype = map$1.prototype = {
constructor: Map,
has: function(key) {
return (prefix + key) in this;
},
get: function(key) {
return this[prefix + key];
},
set: function(key, value) {
this[prefix + key] = value;
return this;
},
remove: function(key) {
var property = prefix + key;
return property in this && delete this[property];
},
clear: function() {
for (var property in this) if (property[0] === prefix) delete this[property];
},
keys: function() {
var keys = [];
for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));
return keys;
},
values: function() {
var values = [];
for (var property in this) if (property[0] === prefix) values.push(this[property]);
return values;
},
entries: function() {
var entries = [];
for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});
return entries;
},
size: function() {
var size = 0;
for (var property in this) if (property[0] === prefix) ++size;
return size;
},
empty: function() {
for (var property in this) if (property[0] === prefix) return false;
return true;
},
each: function(f) {
for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);
}
};
function map$1(object, f) {
var map = new Map;
// Copy constructor.
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });
// Index array by numeric index or specified key function.
else if (Array.isArray(object)) {
var i = -1,
n = object.length,
o;
if (f == null) while (++i < n) map.set(i, object[i]);
else while (++i < n) map.set(f(o = object[i], i, object), o);
}
// Convert object to map.
else if (object) for (var key in object) map.set(key, object[key]);
return map;
}
function nest() {
var keys = [],
sortKeys = [],
sortValues,
rollup,
nest;
function apply(array, depth, createResult, setResult) {
if (depth >= keys.length) {
if (sortValues != null) array.sort(sortValues);
return rollup != null ? rollup(array) : array;
}
var i = -1,
n = array.length,
key = keys[
gitextract_aahahm3e/ ├── .gitignore ├── README.md ├── __test__/ │ ├── __snapshots__/ │ │ └── demo.test.js.snap │ └── demo.test.js ├── babel.config.js ├── extension/ │ ├── backend/ │ │ ├── background.js │ │ ├── content_script.js │ │ └── hook.ts │ ├── frontend/ │ │ ├── create-panel.js │ │ ├── devtools-root.html │ │ └── view/ │ │ ├── Components/ │ │ │ ├── left-view/ │ │ │ │ ├── GraphPanel.js │ │ │ │ ├── SelectorTree.js │ │ │ │ └── treeView.js │ │ │ └── right-view/ │ │ │ ├── History.js │ │ │ ├── Navbar.js │ │ │ └── atomView.js │ │ ├── Container.js │ │ ├── style.css │ │ ├── view.html │ │ └── view.js │ ├── libraries/ │ │ └── d3.js │ └── manifest.json ├── mock/ │ └── snapshot.js ├── package.json ├── tsconfig.json └── webpack.config.js
SYMBOL INDEX (1024 symbols across 6 files)
FILE: extension/backend/background.js
function handleMessage (line 37) | function handleMessage(request, sender, sendResponse) {
FILE: extension/backend/content_script.js
function handleMessage (line 13) | function handleMessage(request, sender, sendResponse) {
function sendMessage (line 20) | function sendMessage(tree) {
FILE: extension/backend/hook.ts
type devTools (line 8) | interface devTools {
type Window (line 13) | interface Window {
type Component (line 17) | interface Component {
function patcher (line 27) | function patcher() {
function getComponentData (line 72) | function getComponentData(node: any, arr: any[]) {
function getName (line 83) | function getName(node: any, component: any, arr: Array<any>) {
function getState (line 95) | function getState(node: any, component: any) {
function getAtom (line 122) | function getAtom(component: Component) {
function getChildren (line 157) | function getChildren(node: any, component: Component, arr: any[]) {
function getAtomValues (line 170) | function getAtomValues(obj: object, prop: string) {
function getSelectorAtomLink (line 215) | function getSelectorAtomLink(obj: any, prop: string) {
function cleanState (line 344) | function cleanState(stateNode: any, depth = 0) {
function sendToContentScript (line 387) | function sendToContentScript(obj: any) {
FILE: extension/frontend/view/Components/left-view/SelectorTree.js
function clicked (line 197) | function clicked(p) {
function arcVisible (line 231) | function arcVisible(d) {
function labelVisible (line 235) | function labelVisible(d) {
function labelTransform (line 239) | function labelTransform(d) {
FILE: extension/frontend/view/Components/right-view/atomView.js
function lightup (line 17) | function lightup(e) {
function atomValLightup (line 29) | function atomValLightup(e) {
FILE: extension/libraries/d3.js
function ascending (line 10) | function ascending(a, b) {
function bisector (line 14) | function bisector(compare) {
function ascendingComparator (line 40) | function ascendingComparator(f) {
function pairs (line 50) | function pairs(array, f) {
function pair (line 57) | function pair(a, b) {
function cross (line 61) | function cross(values0, values1, reduce) {
function descending (line 81) | function descending(a, b) {
function number (line 85) | function number(x) {
function variance (line 89) | function variance(values, valueof) {
function deviation (line 121) | function deviation(array, f) {
function extent (line 126) | function extent(values, valueof) {
function constant (line 169) | function constant(x) {
function identity (line 175) | function identity(x) {
function sequence (line 179) | function sequence(start, stop, step) {
function ticks (line 197) | function ticks(start, stop, count) {
function tickIncrement (line 226) | function tickIncrement(start, stop, count) {
function tickStep (line 235) | function tickStep(start, stop, count) {
function thresholdSturges (line 245) | function thresholdSturges(values) {
function histogram (line 249) | function histogram() {
function threshold (line 316) | function threshold(values, p, valueof) {
function freedmanDiaconis (line 329) | function freedmanDiaconis(values, min, max) {
function scott (line 334) | function scott(values, min, max) {
function max (line 338) | function max(values, valueof) {
function mean (line 373) | function mean(values, valueof) {
function median (line 397) | function median(values, valueof) {
function merge (line 422) | function merge(arrays) {
function min (line 444) | function min(values, valueof) {
function permute (line 479) | function permute(array, indexes) {
function scan (line 485) | function scan(values, compare) {
function shuffle (line 504) | function shuffle(array, i0, i1) {
function sum (line 519) | function sum(values, valueof) {
function transpose (line 540) | function transpose(matrix) {
function length (line 550) | function length(d) {
function zip (line 554) | function zip() {
function identity$1 (line 560) | function identity$1(x) {
function translateX (line 570) | function translateX(x) {
function translateY (line 574) | function translateY(y) {
function number$1 (line 578) | function number$1(scale) {
function center (line 584) | function center(scale) {
function entering (line 592) | function entering() {
function axis (line 596) | function axis(orient, scale) {
function axisTop (line 720) | function axisTop(scale) {
function axisRight (line 724) | function axisRight(scale) {
function axisBottom (line 728) | function axisBottom(scale) {
function axisLeft (line 732) | function axisLeft(scale) {
function dispatch (line 738) | function dispatch() {
function Dispatch (line 746) | function Dispatch(_) {
function parseTypenames (line 750) | function parseTypenames(typenames, types) {
function get (line 800) | function get(type, name) {
function set (line 808) | function set(type, name, callback) {
function namespace (line 829) | function namespace(name) {
function creatorInherit (line 835) | function creatorInherit(name) {
function creatorFixed (line 845) | function creatorFixed(fullname) {
function creator (line 851) | function creator(name) {
function none (line 858) | function none() {}
function selector (line 860) | function selector(selector) {
function selection_select (line 866) | function selection_select(select) {
function empty (line 881) | function empty() {
function selectorAll (line 885) | function selectorAll(selector) {
function selection_selectAll (line 891) | function selection_selectAll(select) {
function matcher (line 906) | function matcher(selector) {
function selection_filter (line 912) | function selection_filter(match) {
function sparse (line 926) | function sparse(update) {
function selection_enter (line 930) | function selection_enter() {
function EnterNode (line 934) | function EnterNode(parent, datum) {
function constant$1 (line 950) | function constant$1(x) {
function bindIndex (line 958) | function bindIndex(parent, group, enter, update, exit, data) {
function bindKey (line 984) | function bindKey(parent, group, enter, update, exit, data, key) {
function selection_data (line 1028) | function selection_data(value, key) {
function selection_exit (line 1071) | function selection_exit() {
function selection_join (line 1075) | function selection_join(onenter, onupdate, onexit) {
function selection_merge (line 1083) | function selection_merge(selection) {
function selection_order (line 1100) | function selection_order() {
function selection_sort (line 1114) | function selection_sort(compare) {
function ascending$1 (line 1133) | function ascending$1(a, b) {
function selection_call (line 1137) | function selection_call() {
function selection_nodes (line 1144) | function selection_nodes() {
function selection_node (line 1150) | function selection_node() {
function selection_size (line 1162) | function selection_size() {
function selection_empty (line 1168) | function selection_empty() {
function selection_each (line 1172) | function selection_each(callback) {
function attrRemove (line 1183) | function attrRemove(name) {
function attrRemoveNS (line 1189) | function attrRemoveNS(fullname) {
function attrConstant (line 1195) | function attrConstant(name, value) {
function attrConstantNS (line 1201) | function attrConstantNS(fullname, value) {
function attrFunction (line 1207) | function attrFunction(name, value) {
function attrFunctionNS (line 1215) | function attrFunctionNS(fullname, value) {
function selection_attr (line 1223) | function selection_attr(name, value) {
function defaultView (line 1239) | function defaultView(node) {
function styleRemove (line 1245) | function styleRemove(name) {
function styleConstant (line 1251) | function styleConstant(name, value, priority) {
function styleFunction (line 1257) | function styleFunction(name, value, priority) {
function selection_style (line 1265) | function selection_style(name, value, priority) {
function styleValue (line 1274) | function styleValue(node, name) {
function propertyRemove (line 1279) | function propertyRemove(name) {
function propertyConstant (line 1285) | function propertyConstant(name, value) {
function propertyFunction (line 1291) | function propertyFunction(name, value) {
function selection_property (line 1299) | function selection_property(name, value) {
function classArray (line 1308) | function classArray(string) {
function classList (line 1312) | function classList(node) {
function ClassList (line 1316) | function ClassList(node) {
function classedAdd (line 1341) | function classedAdd(node, names) {
function classedRemove (line 1346) | function classedRemove(node, names) {
function classedTrue (line 1351) | function classedTrue(names) {
function classedFalse (line 1357) | function classedFalse(names) {
function classedFunction (line 1363) | function classedFunction(names, value) {
function selection_classed (line 1369) | function selection_classed(name, value) {
function textRemove (line 1384) | function textRemove() {
function textConstant (line 1388) | function textConstant(value) {
function textFunction (line 1394) | function textFunction(value) {
function selection_text (line 1401) | function selection_text(value) {
function htmlRemove (line 1410) | function htmlRemove() {
function htmlConstant (line 1414) | function htmlConstant(value) {
function htmlFunction (line 1420) | function htmlFunction(value) {
function selection_html (line 1427) | function selection_html(value) {
function raise (line 1436) | function raise() {
function selection_raise (line 1440) | function selection_raise() {
function lower (line 1444) | function lower() {
function selection_lower (line 1448) | function selection_lower() {
function selection_append (line 1452) | function selection_append(name) {
function constantNull (line 1459) | function constantNull() {
function selection_insert (line 1463) | function selection_insert(name, before) {
function remove (line 1471) | function remove() {
function selection_remove (line 1476) | function selection_remove() {
function selection_cloneShallow (line 1480) | function selection_cloneShallow() {
function selection_cloneDeep (line 1485) | function selection_cloneDeep() {
function selection_clone (line 1490) | function selection_clone(deep) {
function selection_datum (line 1494) | function selection_datum(value) {
function filterContextListener (line 1511) | function filterContextListener(listener, index, group) {
function contextListener (line 1521) | function contextListener(listener, index, group) {
function parseTypenames$1 (line 1533) | function parseTypenames$1(typenames) {
function onRemove (line 1541) | function onRemove(typename) {
function onAdd (line 1557) | function onAdd(typename, value, capture) {
function selection_on (line 1576) | function selection_on(typename, value, capture) {
function customEvent (line 1597) | function customEvent(event1, listener, that, args) {
function dispatchEvent (line 1608) | function dispatchEvent(node, type, params) {
function dispatchConstant (line 1623) | function dispatchConstant(type, params) {
function dispatchFunction (line 1629) | function dispatchFunction(type, params) {
function selection_dispatch (line 1635) | function selection_dispatch(type, params) {
function Selection (line 1643) | function Selection(groups, parents) {
function selection (line 1648) | function selection() {
function select (line 1687) | function select(selector) {
function create (line 1693) | function create(name) {
function local (line 1699) | function local() {
function Local (line 1703) | function Local() {
function sourceEvent (line 1725) | function sourceEvent() {
function point (line 1731) | function point(node, event) {
function mouse (line 1745) | function mouse(node) {
function selectAll (line 1751) | function selectAll(selector) {
function touch (line 1757) | function touch(node, touches, identifier) {
function touches (line 1769) | function touches(node, touches) {
function nopropagation (line 1779) | function nopropagation() {
function noevent (line 1783) | function noevent() {
function dragDisable (line 1788) | function dragDisable(view) {
function yesdrag (line 1799) | function yesdrag(view, noclick) {
function constant$2 (line 1814) | function constant$2(x) {
function DragEvent (line 1820) | function DragEvent(target, type, subject, id, active, x, y, dx, dy, disp...
function defaultFilter (line 1839) | function defaultFilter() {
function defaultContainer (line 1843) | function defaultContainer() {
function defaultSubject (line 1847) | function defaultSubject(d) {
function defaultTouchable (line 1851) | function defaultTouchable() {
function drag (line 1855) | function drag() {
function define (line 1999) | function define(constructor, factory, prototype) {
function extend (line 2004) | function extend(parent, definition) {
function Color (line 2010) | function Color() {}
function color_formatHex (line 2191) | function color_formatHex() {
function color_formatHsl (line 2195) | function color_formatHsl() {
function color_formatRgb (line 2199) | function color_formatRgb() {
function color (line 2203) | function color(format) {
function rgbn (line 2222) | function rgbn(n) {
function rgba (line 2226) | function rgba(r, g, b, a) {
function rgbConvert (line 2231) | function rgbConvert(o) {
function rgb (line 2238) | function rgb(r, g, b, opacity) {
function Rgb (line 2242) | function Rgb(r, g, b, opacity) {
function rgb_formatHex (line 2273) | function rgb_formatHex() {
function rgb_formatRgb (line 2277) | function rgb_formatRgb() {
function hex (line 2286) | function hex(value) {
function hsla (line 2291) | function hsla(h, s, l, a) {
function hslConvert (line 2298) | function hslConvert(o) {
function hsl (line 2324) | function hsl(h, s, l, opacity) {
function Hsl (line 2328) | function Hsl(h, s, l, opacity) {
function hsl2rgb (line 2373) | function hsl2rgb(h, m1, m2) {
function labConvert (line 2393) | function labConvert(o) {
function gray (line 2408) | function gray(l, opacity) {
function lab (line 2412) | function lab(l, a, b, opacity) {
function Lab (line 2416) | function Lab(l, a, b, opacity) {
function xyz2lab (line 2446) | function xyz2lab(t) {
function lab2xyz (line 2450) | function lab2xyz(t) {
function lrgb2rgb (line 2454) | function lrgb2rgb(x) {
function rgb2lrgb (line 2458) | function rgb2lrgb(x) {
function hclConvert (line 2462) | function hclConvert(o) {
function lch (line 2470) | function lch(l, c, h, opacity) {
function hcl (line 2474) | function hcl(h, c, l, opacity) {
function Hcl (line 2478) | function Hcl(h, c, l, opacity) {
function hcl2lab (line 2485) | function hcl2lab(o) {
function cubehelixConvert (line 2512) | function cubehelixConvert(o) {
function cubehelix (line 2526) | function cubehelix(h, s, l, opacity) {
function Cubehelix (line 2530) | function Cubehelix(h, s, l, opacity) {
function basis (line 2561) | function basis(t1, v0, v1, v2, v3) {
function basis$1 (line 2569) | function basis$1(values) {
function basisClosed (line 2581) | function basisClosed(values) {
function constant$3 (line 2593) | function constant$3(x) {
function linear (line 2599) | function linear(a, d) {
function exponential (line 2605) | function exponential(a, b, y) {
function hue (line 2611) | function hue(a, b) {
function gamma (line 2616) | function gamma(y) {
function nogamma (line 2622) | function nogamma(a, b) {
function rgb$1 (line 2630) | function rgb$1(start, end) {
function rgbSpline (line 2649) | function rgbSpline(spline) {
function numberArray (line 2678) | function numberArray(a, b) {
function isNumberArray (line 2689) | function isNumberArray(x) {
function array$1 (line 2693) | function array$1(a, b) {
function genericArray (line 2697) | function genericArray(a, b) {
function date (line 2713) | function date(a, b) {
function interpolateNumber (line 2720) | function interpolateNumber(a, b) {
function object (line 2726) | function object(a, b) {
function zero (line 2751) | function zero(b) {
function one (line 2757) | function one(b) {
function interpolateString (line 2763) | function interpolateString(a, b) {
function interpolateValue (line 2811) | function interpolateValue(a, b) {
function discrete (line 2824) | function discrete(range) {
function hue$1 (line 2831) | function hue$1(a, b) {
function interpolateRound (line 2839) | function interpolateRound(a, b) {
function decompose (line 2856) | function decompose(a, b, c, d, e, f) {
function parseCss (line 2877) | function parseCss(value) {
function parseSvg (line 2887) | function parseSvg(value) {
function interpolateTransform (line 2896) | function interpolateTransform(parse, pxComma, pxParen, degParen) {
function cosh (line 2962) | function cosh(x) {
function sinh (line 2966) | function sinh(x) {
function tanh (line 2970) | function tanh(x) {
function interpolateZoom (line 2976) | function interpolateZoom(p0, p1) {
function hsl$1 (line 3022) | function hsl$1(hue) {
function lab$1 (line 3041) | function lab$1(start, end) {
function hcl$1 (line 3055) | function hcl$1(hue) {
function cubehelix$1 (line 3074) | function cubehelix$1(hue) {
function piecewise (line 3101) | function piecewise(interpolate, values) {
function quantize (line 3110) | function quantize(interpolator, n) {
function now (line 3128) | function now() {
function clearNow (line 3132) | function clearNow() {
function Timer (line 3136) | function Timer() {
function timer (line 3165) | function timer(callback, delay, time) {
function timerFlush (line 3171) | function timerFlush() {
function wake (line 3182) | function wake() {
function poke (line 3194) | function poke() {
function nap (line 3199) | function nap() {
function sleep (line 3214) | function sleep(time) {
function timeout$1 (line 3227) | function timeout$1(callback, delay, time) {
function interval$1 (line 3237) | function interval$1(callback, delay, time) {
function schedule (line 3260) | function schedule(node, name, id, index, group, timing) {
function init (line 3279) | function init(node, id) {
function set$1 (line 3285) | function set$1(node, id) {
function get$1 (line 3291) | function get$1(node, id) {
function create$1 (line 3297) | function create$1(node, id, self) {
function interrupt (line 3400) | function interrupt(node, name) {
function selection_interrupt (line 3423) | function selection_interrupt(name) {
function tweenRemove (line 3429) | function tweenRemove(id, name) {
function tweenFunction (line 3453) | function tweenFunction(id, name, value) {
function transition_tween (line 3478) | function transition_tween(name, value) {
function tweenValue (line 3496) | function tweenValue(transition, name, value) {
function interpolate (line 3509) | function interpolate(a, b) {
function attrRemove$1 (line 3517) | function attrRemove$1(name) {
function attrRemoveNS$1 (line 3523) | function attrRemoveNS$1(fullname) {
function attrConstant$1 (line 3529) | function attrConstant$1(name, interpolate, value1) {
function attrConstantNS$1 (line 3541) | function attrConstantNS$1(fullname, interpolate, value1) {
function attrFunction$1 (line 3553) | function attrFunction$1(name, interpolate, value) {
function attrFunctionNS$1 (line 3568) | function attrFunctionNS$1(fullname, interpolate, value) {
function transition_attr (line 3583) | function transition_attr(name, value) {
function attrInterpolate (line 3591) | function attrInterpolate(name, i) {
function attrInterpolateNS (line 3597) | function attrInterpolateNS(fullname, i) {
function attrTweenNS (line 3603) | function attrTweenNS(fullname, value) {
function attrTween (line 3614) | function attrTween(name, value) {
function transition_attrTween (line 3625) | function transition_attrTween(name, value) {
function delayFunction (line 3634) | function delayFunction(id, value) {
function delayConstant (line 3640) | function delayConstant(id, value) {
function transition_delay (line 3646) | function transition_delay(value) {
function durationFunction (line 3656) | function durationFunction(id, value) {
function durationConstant (line 3662) | function durationConstant(id, value) {
function transition_duration (line 3668) | function transition_duration(value) {
function easeConstant (line 3678) | function easeConstant(id, value) {
function transition_ease (line 3685) | function transition_ease(value) {
function transition_filter (line 3693) | function transition_filter(match) {
function transition_merge (line 3707) | function transition_merge(transition) {
function start (line 3725) | function start(name) {
function onFunction (line 3733) | function onFunction(id, name, listener) {
function transition_on (line 3748) | function transition_on(name, listener) {
function removeFunction (line 3756) | function removeFunction(id) {
function transition_remove (line 3764) | function transition_remove() {
function transition_select (line 3768) | function transition_select(select) {
function transition_selectAll (line 3787) | function transition_selectAll(select) {
function transition_selection (line 3812) | function transition_selection() {
function styleNull (line 3816) | function styleNull(name, interpolate) {
function styleRemove$1 (line 3829) | function styleRemove$1(name) {
function styleConstant$1 (line 3835) | function styleConstant$1(name, interpolate, value1) {
function styleFunction$1 (line 3847) | function styleFunction$1(name, interpolate, value) {
function styleMaybeRemove (line 3862) | function styleMaybeRemove(id, name) {
function transition_style (line 3878) | function transition_style(name, value, priority) {
function styleInterpolate (line 3891) | function styleInterpolate(name, i, priority) {
function styleTween (line 3897) | function styleTween(name, value, priority) {
function transition_styleTween (line 3908) | function transition_styleTween(name, value, priority) {
function textConstant$1 (line 3916) | function textConstant$1(value) {
function textFunction$1 (line 3922) | function textFunction$1(value) {
function transition_text (line 3929) | function transition_text(value) {
function textInterpolate (line 3935) | function textInterpolate(i) {
function textTween (line 3941) | function textTween(value) {
function transition_textTween (line 3952) | function transition_textTween(value) {
function transition_transition (line 3960) | function transition_transition() {
function transition_end (line 3982) | function transition_end() {
function Transition (line 4009) | function Transition(groups, parents, name, id) {
function transition (line 4016) | function transition(name) {
function newId (line 4020) | function newId() {
function linear$1 (line 4055) | function linear$1(t) {
function quadIn (line 4059) | function quadIn(t) {
function quadOut (line 4063) | function quadOut(t) {
function quadInOut (line 4067) | function quadInOut(t) {
function cubicIn (line 4071) | function cubicIn(t) {
function cubicOut (line 4075) | function cubicOut(t) {
function cubicInOut (line 4079) | function cubicInOut(t) {
function polyIn (line 4088) | function polyIn(t) {
function polyOut (line 4100) | function polyOut(t) {
function polyInOut (line 4112) | function polyInOut(t) {
function sinIn (line 4124) | function sinIn(t) {
function sinOut (line 4128) | function sinOut(t) {
function sinInOut (line 4132) | function sinInOut(t) {
function expIn (line 4136) | function expIn(t) {
function expOut (line 4140) | function expOut(t) {
function expInOut (line 4144) | function expInOut(t) {
function circleIn (line 4148) | function circleIn(t) {
function circleOut (line 4152) | function circleOut(t) {
function circleInOut (line 4156) | function circleInOut(t) {
function bounceIn (line 4171) | function bounceIn(t) {
function bounceOut (line 4175) | function bounceOut(t) {
function bounceInOut (line 4179) | function bounceInOut(t) {
function backIn (line 4188) | function backIn(t) {
function backOut (line 4200) | function backOut(t) {
function backInOut (line 4212) | function backInOut(t) {
function elasticIn (line 4228) | function elasticIn(t) {
function elasticOut (line 4241) | function elasticOut(t) {
function elasticInOut (line 4254) | function elasticInOut(t) {
function inherit (line 4273) | function inherit(node, id) {
function selection_transition (line 4283) | function selection_transition(name) {
function active (line 4309) | function active(node, name) {
function constant$4 (line 4326) | function constant$4(x) {
function BrushEvent (line 4332) | function BrushEvent(target, type, selection) {
function nopropagation$1 (line 4338) | function nopropagation$1() {
function noevent$1 (line 4342) | function noevent$1() {
function number1 (line 4352) | function number1(e) {
function number2 (line 4356) | function number2(e) {
function toucher (line 4360) | function toucher(identifier) {
function type (line 4444) | function type(t) {
function defaultFilter$1 (line 4449) | function defaultFilter$1() {
function defaultExtent (line 4453) | function defaultExtent() {
function defaultTouchable$1 (line 4462) | function defaultTouchable$1() {
function local$1 (line 4467) | function local$1(node) {
function empty$1 (line 4472) | function empty$1(extent) {
function brushSelection (line 4477) | function brushSelection(node) {
function brushX (line 4482) | function brushX() {
function brushY (line 4486) | function brushY() {
function brush (line 4490) | function brush() {
function brush$1 (line 4494) | function brush$1(dim) {
function compareValue (line 4935) | function compareValue(compare) {
function chord (line 4944) | function chord() {
function constant$5 (line 5056) | function constant$5(x) {
function Path (line 5067) | function Path() {
function path (line 5073) | function path() {
function defaultSource (line 5191) | function defaultSource(d) {
function defaultTarget (line 5195) | function defaultTarget(d) {
function defaultRadius (line 5199) | function defaultRadius(d) {
function defaultStartAngle (line 5203) | function defaultStartAngle(d) {
function defaultEndAngle (line 5207) | function defaultEndAngle(d) {
function ribbon (line 5211) | function ribbon() {
function Map (line 5276) | function Map() {}
function map$1 (line 5326) | function map$1(object, f) {
function nest (line 5348) | function nest() {
function createObject (line 5404) | function createObject() {
function setObject (line 5408) | function setObject(object, key, value) {
function createMap (line 5412) | function createMap() {
function setMap (line 5416) | function setMap(map, key, value) {
function Set (line 5420) | function Set() {}
function set$2 (line 5440) | function set$2(object, f) {
function keys (line 5456) | function keys(map) {
function values (line 5462) | function values(map) {
function entries (line 5468) | function entries(map) {
function ascending$2 (line 5478) | function ascending$2(a, b) {
function area (line 5482) | function area(ring) {
function constant$6 (line 5488) | function constant$6(x) {
function contains (line 5494) | function contains(ring, hole) {
function ringContains (line 5500) | function ringContains(ring, point) {
function segmentContains (line 5510) | function segmentContains(a, b, c) {
function collinear (line 5514) | function collinear(a, b, c) {
function within (line 5518) | function within(p, q, r) {
function noop$1 (line 5522) | function noop$1() {}
function contours (line 5543) | function contours() {
function blurX (line 5723) | function blurX(source, target, r) {
function blurY (line 5745) | function blurY(source, target, r) {
function defaultX (line 5764) | function defaultX(d) {
function defaultY (line 5768) | function defaultY(d) {
function defaultWeight (line 5772) | function defaultWeight() {
function density (line 5776) | function density() {
function objectConverter (line 5898) | function objectConverter(columns) {
function customConverter (line 5904) | function customConverter(columns, f) {
function inferColumns (line 5912) | function inferColumns(rows) {
function pad (line 5927) | function pad(value, width) {
function formatYear (line 5932) | function formatYear(year) {
function formatDate (line 5938) | function formatDate(date) {
function dsvFormat (line 5951) | function dsvFormat(delimiter) {
function autoType (line 6077) | function autoType(object) {
function responseBlob (line 6098) | function responseBlob(response) {
function blob (line 6103) | function blob(input, init) {
function responseArrayBuffer (line 6107) | function responseArrayBuffer(response) {
function buffer (line 6112) | function buffer(input, init) {
function responseText (line 6116) | function responseText(response) {
function text (line 6121) | function text(input, init) {
function dsvParse (line 6125) | function dsvParse(parse) {
function dsv (line 6134) | function dsv(delimiter, input, init, row) {
function image (line 6145) | function image(input, init) {
function responseJson (line 6155) | function responseJson(response) {
function json (line 6160) | function json(input, init) {
function parser (line 6164) | function parser(type) {
function center$1 (line 6178) | function center$1(x, y) {
function constant$7 (line 6215) | function constant$7(x) {
function jiggle (line 6221) | function jiggle() {
function tree_add (line 6225) | function tree_add(d) {
function add (line 6231) | function add(tree, x, y, d) {
function addAll (line 6274) | function addAll(data) {
function tree_cover (line 6310) | function tree_cover(x, y) {
function tree_data (line 6354) | function tree_data() {
function tree_extent (line 6362) | function tree_extent(_) {
function Quad (line 6368) | function Quad(node, x0, y0, x1, y1) {
function tree_find (line 6376) | function tree_find(x, y, radius) {
function tree_remove (line 6445) | function tree_remove(d) {
function removeAll (line 6503) | function removeAll(data) {
function tree_root (line 6508) | function tree_root() {
function tree_size (line 6512) | function tree_size() {
function tree_visit (line 6520) | function tree_visit(callback) {
function tree_visitAfter (line 6535) | function tree_visitAfter(callback) {
function defaultX$1 (line 6555) | function defaultX$1(d) {
function tree_x (line 6559) | function tree_x(_) {
function defaultY$1 (line 6563) | function defaultY$1(d) {
function tree_y (line 6567) | function tree_y(_) {
function quadtree (line 6571) | function quadtree(nodes, x, y) {
function Quadtree (line 6576) | function Quadtree(x, y, x0, y0, x1, y1) {
function leaf_copy (line 6586) | function leaf_copy(leaf) {
function x (line 6632) | function x(d) {
function y (line 6636) | function y(d) {
function collide (line 6640) | function collide(radius) {
function index (line 6727) | function index(d) {
function find (line 6731) | function find(nodeById, nodeId) {
function link (line 6737) | function link(links) {
function x$1 (line 6840) | function x$1(d) {
function y$1 (line 6844) | function y$1(d) {
function simulation (line 6851) | function simulation(nodes) {
function manyBody (line 6988) | function manyBody() {
function radial (line 7098) | function radial(radius, x, y) {
function x$2 (line 7154) | function x$2(x) {
function y$2 (line 7194) | function y$2(y) {
function formatDecimal (line 7237) | function formatDecimal(x, p) {
function exponent$1 (line 7249) | function exponent$1(x) {
function formatGroup (line 7253) | function formatGroup(grouping, thousands) {
function formatNumerals (line 7272) | function formatNumerals(numerals) {
function formatSpecifier (line 7283) | function formatSpecifier(specifier) {
function FormatSpecifier (line 7302) | function FormatSpecifier(specifier) {
function formatTrim (line 7329) | function formatTrim(s) {
function formatPrefixAuto (line 7342) | function formatPrefixAuto(x, p) {
function formatRounded (line 7355) | function formatRounded(x, p) {
function identity$3 (line 7381) | function identity$3(x) {
function formatLocale (line 7388) | function formatLocale(locale) {
function defaultLocale (line 7535) | function defaultLocale(definition) {
function precisionFixed (line 7542) | function precisionFixed(step) {
function precisionPrefix (line 7546) | function precisionPrefix(step, value) {
function precisionRound (line 7550) | function precisionRound(step, max) {
function adder (line 7562) | function adder() {
function Adder (line 7566) | function Adder() {
function add$1 (line 7589) | function add$1(adder, a, b) {
function acos (line 7619) | function acos(x) {
function asin (line 7623) | function asin(x) {
function haversin (line 7627) | function haversin(x) {
function noop$2 (line 7631) | function noop$2() {}
function streamGeometry (line 7633) | function streamGeometry(geometry, stream) {
function streamLine (line 7681) | function streamLine(coordinates, stream, closed) {
function streamPolygon (line 7688) | function streamPolygon(coordinates, stream) {
function geoStream (line 7695) | function geoStream(object, stream) {
function areaRingStart (line 7731) | function areaRingStart() {
function areaRingEnd (line 7735) | function areaRingEnd() {
function areaPointFirst (line 7739) | function areaPointFirst(lambda, phi) {
function areaPoint (line 7746) | function areaPoint(lambda, phi) {
function area$1 (line 7767) | function area$1(object) {
function spherical (line 7773) | function spherical(cartesian) {
function cartesian (line 7777) | function cartesian(spherical) {
function cartesianDot (line 7782) | function cartesianDot(a, b) {
function cartesianCross (line 7786) | function cartesianCross(a, b) {
function cartesianAddInPlace (line 7791) | function cartesianAddInPlace(a, b) {
function cartesianScale (line 7795) | function cartesianScale(vector, k) {
function cartesianNormalizeInPlace (line 7800) | function cartesianNormalizeInPlace(d) {
function boundsPoint (line 7839) | function boundsPoint(lambda, phi) {
function linePoint (line 7845) | function linePoint(lambda, phi) {
function boundsLineStart (line 7894) | function boundsLineStart() {
function boundsLineEnd (line 7898) | function boundsLineEnd() {
function boundsRingPoint (line 7904) | function boundsRingPoint(lambda, phi) {
function boundsRingStart (line 7915) | function boundsRingStart() {
function boundsRingEnd (line 7919) | function boundsRingEnd() {
function angle (line 7930) | function angle(lambda0, lambda1) {
function rangeCompare (line 7934) | function rangeCompare(a, b) {
function rangeContains (line 7938) | function rangeContains(range, x) {
function bounds (line 7942) | function bounds(feature) {
function centroidPoint (line 8002) | function centroidPoint(lambda, phi) {
function centroidPointCartesian (line 8008) | function centroidPointCartesian(x, y, z) {
function centroidLineStart (line 8015) | function centroidLineStart() {
function centroidLinePointFirst (line 8019) | function centroidLinePointFirst(lambda, phi) {
function centroidLinePoint (line 8029) | function centroidLinePoint(lambda, phi) {
function centroidLineEnd (line 8043) | function centroidLineEnd() {
function centroidRingStart (line 8049) | function centroidRingStart() {
function centroidRingEnd (line 8053) | function centroidRingEnd() {
function centroidRingPointFirst (line 8058) | function centroidRingPointFirst(lambda, phi) {
function centroidRingPoint (line 8069) | function centroidRingPoint(lambda, phi) {
function centroid (line 8091) | function centroid(object) {
function constant$8 (line 8116) | function constant$8(x) {
function compose (line 8122) | function compose(a, b) {
function rotationIdentity (line 8135) | function rotationIdentity(lambda, phi) {
function rotateRadians (line 8141) | function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
function forwardRotationLambda (line 8148) | function forwardRotationLambda(deltaLambda) {
function rotationLambda (line 8154) | function rotationLambda(deltaLambda) {
function rotationPhiGamma (line 8160) | function rotationPhiGamma(deltaPhi, deltaGamma) {
function rotation (line 8193) | function rotation(rotate) {
function circleStream (line 8210) | function circleStream(stream, radius, delta, direction, t0, t1) {
function circleRadius (line 8230) | function circleRadius(cosRadius, point) {
function circle (line 8237) | function circle() {
function clipBuffer (line 8277) | function clipBuffer() {
function pointEqual (line 8300) | function pointEqual(a, b) {
function Intersection (line 8304) | function Intersection(point, points, other, entry) {
function clipRejoin (line 8316) | function clipRejoin(segments, compareIntersection, startInside, interpol...
function link$1 (line 8389) | function link$1(array) {
function longitude (line 8406) | function longitude(point) {
function polygonContains (line 8413) | function polygonContains(polygon, point) {
function clip (line 8480) | function clip(pointVisible, clipLine, interpolate, start) {
function validSegment (line 8595) | function validSegment(segment) {
function compareIntersection (line 8601) | function compareIntersection(a, b) {
function clipAntimeridianLine (line 8616) | function clipAntimeridianLine(stream) {
function clipAntimeridianIntersect (line 8661) | function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
function clipAntimeridianInterpolate (line 8672) | function clipAntimeridianInterpolate(from, to, direction, stream) {
function clipCircle (line 8696) | function clipCircle(radius) {
function clipLine (line 8873) | function clipLine(a, b, x0, y0, x1, y1) {
function clipRectangle (line 8938) | function clipRectangle(x0, y0, x1, y1) {
function extent$1 (line 9096) | function extent$1() {
function lengthLineStart (line 9129) | function lengthLineStart() {
function lengthLineEnd (line 9134) | function lengthLineEnd() {
function lengthPointFirst (line 9138) | function lengthPointFirst(lambda, phi) {
function lengthPoint (line 9144) | function lengthPoint(lambda, phi) {
function length$1 (line 9158) | function length$1(object) {
function distance (line 9167) | function distance(a, b) {
function containsGeometry (line 9219) | function containsGeometry(geometry, point) {
function containsPoint (line 9225) | function containsPoint(coordinates, point) {
function containsLine (line 9229) | function containsLine(coordinates, point) {
function containsPolygon (line 9249) | function containsPolygon(coordinates, point) {
function ringRadians (line 9253) | function ringRadians(ring) {
function pointRadians (line 9257) | function pointRadians(point) {
function contains$1 (line 9261) | function contains$1(object, point) {
function graticuleX (line 9267) | function graticuleX(y0, y1, dy) {
function graticuleY (line 9272) | function graticuleY(x0, x1, dx) {
function graticule (line 9277) | function graticule() {
function graticule10 (line 9366) | function graticule10() {
function interpolate$1 (line 9370) | function interpolate$1(a, b) {
function identity$4 (line 9405) | function identity$4(x) {
function areaRingStart$1 (line 9436) | function areaRingStart$1() {
function areaPointFirst$1 (line 9440) | function areaPointFirst$1(x, y) {
function areaPoint$1 (line 9445) | function areaPoint$1(x, y) {
function areaRingEnd$1 (line 9450) | function areaRingEnd$1() {
function boundsPoint$1 (line 9472) | function boundsPoint$1(x, y) {
function centroidPoint$1 (line 9520) | function centroidPoint$1(x, y) {
function centroidLineStart$1 (line 9526) | function centroidLineStart$1() {
function centroidPointFirstLine (line 9530) | function centroidPointFirstLine(x, y) {
function centroidPointLine (line 9535) | function centroidPointLine(x, y) {
function centroidLineEnd$1 (line 9543) | function centroidLineEnd$1() {
function centroidRingStart$1 (line 9547) | function centroidRingStart$1() {
function centroidRingEnd$1 (line 9551) | function centroidRingEnd$1() {
function centroidPointFirstRing (line 9555) | function centroidPointFirstRing(x, y) {
function centroidPointRing (line 9560) | function centroidPointRing(x, y) {
function PathContext (line 9576) | function PathContext(context) {
function lengthPointFirst$1 (line 9648) | function lengthPointFirst$1(x, y) {
function lengthPoint$1 (line 9653) | function lengthPoint$1(x, y) {
function PathString (line 9659) | function PathString() {
function circle$1 (line 9712) | function circle$1(radius) {
function index$1 (line 9719) | function index$1(projection, context) {
function transform (line 9772) | function transform(methods) {
function transformer (line 9778) | function transformer(methods) {
function TransformStream (line 9787) | function TransformStream() {}
function fit (line 9799) | function fit(projection, fitBounds, object) {
function fitExtent (line 9809) | function fitExtent(projection, extent, object) {
function fitSize (line 9820) | function fitSize(projection, size, object) {
function fitWidth (line 9824) | function fitWidth(projection, width, object) {
function fitHeight (line 9834) | function fitHeight(projection, height, object) {
function resample (line 9847) | function resample(project, delta2) {
function resampleNone (line 9851) | function resampleNone(project) {
function resample$1 (line 9860) | function resample$1(project, delta2) {
function transformRotate (line 9949) | function transformRotate(rotate) {
function scaleTranslate (line 9958) | function scaleTranslate(k, dx, dy, sx, sy) {
function scaleTranslateRotate (line 9969) | function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
function projection (line 9988) | function projection(project) {
function projectionMutator (line 9992) | function projectionMutator(projectAt) {
function conicProjection (line 10109) | function conicProjection(projectAt) {
function cylindricalEqualAreaRaw (line 10122) | function cylindricalEqualAreaRaw(phi0) {
function conicEqualAreaRaw (line 10136) | function conicEqualAreaRaw(y0, y1) {
function conicEqualArea (line 10160) | function conicEqualArea() {
function albers (line 10166) | function albers() {
function multiplex (line 10177) | function multiplex(streams) {
function albersUsa (line 10194) | function albersUsa() {
function azimuthalRaw (line 10282) | function azimuthalRaw(scale) {
function azimuthalInvert (line 10294) | function azimuthalInvert(angle) {
function azimuthalEqualArea (line 10315) | function azimuthalEqualArea() {
function azimuthalEquidistant (line 10329) | function azimuthalEquidistant() {
function mercatorRaw (line 10335) | function mercatorRaw(lambda, phi) {
function mercator (line 10343) | function mercator() {
function mercatorProjection (line 10348) | function mercatorProjection(project) {
function tany (line 10384) | function tany(y) {
function conicConformalRaw (line 10388) | function conicConformalRaw(y0, y1) {
function conicConformal (line 10413) | function conicConformal() {
function equirectangularRaw (line 10419) | function equirectangularRaw(lambda, phi) {
function equirectangular (line 10425) | function equirectangular() {
function conicEquidistantRaw (line 10430) | function conicEquidistantRaw(y0, y1) {
function conicEquidistant (line 10453) | function conicEquidistant() {
function equalEarthRaw (line 10466) | function equalEarthRaw(lambda, phi) {
function equalEarth (line 10488) | function equalEarth() {
function gnomonicRaw (line 10493) | function gnomonicRaw(x, y) {
function gnomonic (line 10500) | function gnomonic() {
function identity$5 (line 10506) | function identity$5() {
function naturalEarth1Raw (line 10586) | function naturalEarth1Raw(lambda, phi) {
function naturalEarth1 (line 10607) | function naturalEarth1() {
function orthographicRaw (line 10612) | function orthographicRaw(x, y) {
function orthographic (line 10618) | function orthographic() {
function stereographicRaw (line 10624) | function stereographicRaw(x, y) {
function stereographic (line 10633) | function stereographic() {
function transverseMercatorRaw (line 10639) | function transverseMercatorRaw(lambda, phi) {
function transverseMercator (line 10647) | function transverseMercator() {
function defaultSeparation (line 10664) | function defaultSeparation(a, b) {
function meanX (line 10668) | function meanX(children) {
function meanXReduce (line 10672) | function meanXReduce(x, c) {
function maxY (line 10676) | function maxY(children) {
function maxYReduce (line 10680) | function maxYReduce(y, c) {
function leafLeft (line 10684) | function leafLeft(node) {
function leafRight (line 10690) | function leafRight(node) {
function cluster (line 10696) | function cluster() {
function count (line 10749) | function count(node) {
function node_count (line 10758) | function node_count() {
function node_each (line 10762) | function node_each(callback) {
function node_eachBefore (line 10776) | function node_eachBefore(callback) {
function node_eachAfter (line 10787) | function node_eachAfter(callback) {
function node_sum (line 10801) | function node_sum(value) {
function node_sort (line 10811) | function node_sort(compare) {
function node_path (line 10819) | function node_path(end) {
function leastCommonAncestor (line 10835) | function leastCommonAncestor(a, b) {
function node_ancestors (line 10850) | function node_ancestors() {
function node_descendants (line 10858) | function node_descendants() {
function node_leaves (line 10866) | function node_leaves() {
function node_links (line 10876) | function node_links() {
function hierarchy (line 10886) | function hierarchy(data, children) {
function node_copy (line 10913) | function node_copy() {
function defaultChildren (line 10917) | function defaultChildren(d) {
function copyData (line 10921) | function copyData(node) {
function computeHeight (line 10925) | function computeHeight(node) {
function Node (line 10931) | function Node(data) {
function shuffle$1 (line 10956) | function shuffle$1(array) {
function enclose (line 10971) | function enclose(circles) {
function extendBasis (line 10983) | function extendBasis(B, p) {
function enclosesNot (line 11012) | function enclosesNot(a, b) {
function enclosesWeak (line 11017) | function enclosesWeak(a, b) {
function enclosesWeakAll (line 11022) | function enclosesWeakAll(a, B) {
function encloseBasis (line 11031) | function encloseBasis(B) {
function encloseBasis1 (line 11039) | function encloseBasis1(a) {
function encloseBasis2 (line 11047) | function encloseBasis2(a, b) {
function encloseBasis3 (line 11059) | function encloseBasis3(a, b, c) {
function place (line 11088) | function place(b, a, c) {
function intersects (line 11112) | function intersects(a, b) {
function score (line 11117) | function score(node) {
function Node$1 (line 11126) | function Node$1(circle) {
function packEnclose (line 11132) | function packEnclose(circles) {
function siblings (line 11200) | function siblings(circles) {
function optional (line 11205) | function optional(f) {
function required (line 11209) | function required(f) {
function constantZero (line 11214) | function constantZero() {
function constant$9 (line 11218) | function constant$9(x) {
function defaultRadius$1 (line 11224) | function defaultRadius$1(d) {
function index$2 (line 11228) | function index$2() {
function radiusLeaf (line 11264) | function radiusLeaf(radius) {
function packChildren (line 11272) | function packChildren(padding, k) {
function translateChild (line 11289) | function translateChild(k) {
function roundNode (line 11300) | function roundNode(node) {
function treemapDice (line 11307) | function treemapDice(parent, x0, y0, x1, y1) {
function partition (line 11320) | function partition() {
function defaultId (line 11374) | function defaultId(d) {
function defaultParentId (line 11378) | function defaultParentId(d) {
function stratify (line 11382) | function stratify() {
function defaultSeparation$1 (line 11441) | function defaultSeparation$1(a, b) {
function nextLeft (line 11453) | function nextLeft(v) {
function nextRight (line 11459) | function nextRight(v) {
function moveSubtree (line 11466) | function moveSubtree(wm, wp, shift) {
function executeShifts (line 11478) | function executeShifts(v) {
function nextAncestor (line 11494) | function nextAncestor(vim, v, ancestor) {
function TreeNode (line 11498) | function TreeNode(node, i) {
function treeRoot (line 11514) | function treeRoot(root) {
function tree (line 11538) | function tree() {
function treemapSlice (line 11677) | function treemapSlice(parent, x0, y0, x1, y1) {
function squarifyRatio (line 11692) | function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
function squarify (line 11743) | function squarify(parent, x0, y0, x1, y1) {
function index$3 (line 11754) | function index$3() {
function binary (line 11844) | function binary(parent, x0, y0, x1, y1) {
function sliceDice (line 11891) | function sliceDice(parent, x0, y0, x1, y1) {
function resquarify (line 11897) | function resquarify(parent, x0, y0, x1, y1) {
function area$2 (line 11928) | function area$2(polygon) {
function centroid$1 (line 11944) | function centroid$1(polygon) {
function cross$1 (line 11969) | function cross$1(a, b, c) {
function lexicographicOrder (line 11973) | function lexicographicOrder(a, b) {
function computeUpperHullIndexes (line 11980) | function computeUpperHullIndexes(points) {
function hull (line 11993) | function hull(points) {
function contains$2 (line 12021) | function contains$2(polygon, point) {
function length$2 (line 12038) | function length$2(polygon) {
function defaultSource$1 (line 12062) | function defaultSource$1() {
function randomUniform (line 12067) | function randomUniform(min, max) {
function randomNormal (line 12083) | function randomNormal(mu, sigma) {
function randomLogNormal (line 12110) | function randomLogNormal() {
function randomIrwinHall (line 12123) | function randomIrwinHall(n) {
function randomBates (line 12136) | function randomBates(n) {
function randomExponential (line 12149) | function randomExponential(lambda) {
function initRange (line 12160) | function initRange(domain, range) {
function initInterpolator (line 12169) | function initInterpolator(domain, interpolator) {
function ordinal (line 12185) | function ordinal() {
function band (line 12225) | function band() {
function pointish (line 12304) | function pointish(scale) {
function point$1 (line 12318) | function point$1() {
function constant$a (line 12322) | function constant$a(x) {
function number$2 (line 12328) | function number$2(x) {
function identity$6 (line 12334) | function identity$6(x) {
function normalize (line 12338) | function normalize(a, b) {
function clamper (line 12344) | function clamper(domain) {
function bimap (line 12352) | function bimap(domain, range, interpolate) {
function polymap (line 12359) | function polymap(domain, range, interpolate) {
function copy (line 12382) | function copy(source, target) {
function transformer$1 (line 12391) | function transformer$1() {
function continuous (line 12447) | function continuous(transform, untransform) {
function tickFormat (line 12451) | function tickFormat(start, stop, count, specifier) {
function linearish (line 12478) | function linearish(scale) {
function linear$2 (line 12534) | function linear$2() {
function identity$7 (line 12546) | function identity$7(domain) {
function nice (line 12572) | function nice(domain, interval) {
function transformLog (line 12591) | function transformLog(x) {
function transformExp (line 12595) | function transformExp(x) {
function transformLogn (line 12599) | function transformLogn(x) {
function transformExpn (line 12603) | function transformExpn(x) {
function pow10 (line 12607) | function pow10(x) {
function powp (line 12611) | function powp(base) {
function logp (line 12617) | function logp(base) {
function reflect (line 12624) | function reflect(f) {
function loggish (line 12630) | function loggish(transform) {
function log$1 (line 12719) | function log$1() {
function transformSymlog (line 12731) | function transformSymlog(c) {
function transformSymexp (line 12737) | function transformSymexp(c) {
function symlogish (line 12743) | function symlogish(transform) {
function symlog (line 12753) | function symlog() {
function transformPow (line 12763) | function transformPow(exponent) {
function transformSqrt (line 12769) | function transformSqrt(x) {
function transformSquare (line 12773) | function transformSquare(x) {
function powish (line 12777) | function powish(transform) {
function pow$1 (line 12794) | function pow$1() {
function sqrt$1 (line 12806) | function sqrt$1() {
function quantile (line 12810) | function quantile() {
function quantize$1 (line 12865) | function quantize$1() {
function threshold$1 (line 12918) | function threshold$1() {
function newInterval (line 12958) | function newInterval(floori, offseti, count, field) {
function weekday (line 13099) | function weekday(i) {
function utcWeekday (line 13194) | function utcWeekday(i) {
function localDate (line 13256) | function localDate(d) {
function utcDate (line 13265) | function utcDate(d) {
function newDate (line 13274) | function newDate(y, m, d) {
function formatLocale$1 (line 13278) | function formatLocale$1(locale) {
function pad$1 (line 13629) | function pad$1(value, fill, width) {
function requote (line 13636) | function requote(s) {
function formatRe (line 13640) | function formatRe(names) {
function formatLookup (line 13644) | function formatLookup(names) {
function parseWeekdayNumberSunday (line 13650) | function parseWeekdayNumberSunday(d, string, i) {
function parseWeekdayNumberMonday (line 13655) | function parseWeekdayNumberMonday(d, string, i) {
function parseWeekNumberSunday (line 13660) | function parseWeekNumberSunday(d, string, i) {
function parseWeekNumberISO (line 13665) | function parseWeekNumberISO(d, string, i) {
function parseWeekNumberMonday (line 13670) | function parseWeekNumberMonday(d, string, i) {
function parseFullYear (line 13675) | function parseFullYear(d, string, i) {
function parseYear (line 13680) | function parseYear(d, string, i) {
function parseZone (line 13685) | function parseZone(d, string, i) {
function parseQuarter (line 13690) | function parseQuarter(d, string, i) {
function parseMonthNumber (line 13695) | function parseMonthNumber(d, string, i) {
function parseDayOfMonth (line 13700) | function parseDayOfMonth(d, string, i) {
function parseDayOfYear (line 13705) | function parseDayOfYear(d, string, i) {
function parseHour24 (line 13710) | function parseHour24(d, string, i) {
function parseMinutes (line 13715) | function parseMinutes(d, string, i) {
function parseSeconds (line 13720) | function parseSeconds(d, string, i) {
function parseMilliseconds (line 13725) | function parseMilliseconds(d, string, i) {
function parseMicroseconds (line 13730) | function parseMicroseconds(d, string, i) {
function parseLiteralPercent (line 13735) | function parseLiteralPercent(d, string, i) {
function parseUnixTimestamp (line 13740) | function parseUnixTimestamp(d, string, i) {
function parseUnixTimestampSeconds (line 13745) | function parseUnixTimestampSeconds(d, string, i) {
function formatDayOfMonth (line 13750) | function formatDayOfMonth(d, p) {
function formatHour24 (line 13754) | function formatHour24(d, p) {
function formatHour12 (line 13758) | function formatHour12(d, p) {
function formatDayOfYear (line 13762) | function formatDayOfYear(d, p) {
function formatMilliseconds (line 13766) | function formatMilliseconds(d, p) {
function formatMicroseconds (line 13770) | function formatMicroseconds(d, p) {
function formatMonthNumber (line 13774) | function formatMonthNumber(d, p) {
function formatMinutes (line 13778) | function formatMinutes(d, p) {
function formatSeconds (line 13782) | function formatSeconds(d, p) {
function formatWeekdayNumberMonday (line 13786) | function formatWeekdayNumberMonday(d) {
function formatWeekNumberSunday (line 13791) | function formatWeekNumberSunday(d, p) {
function formatWeekNumberISO (line 13795) | function formatWeekNumberISO(d, p) {
function formatWeekdayNumberSunday (line 13801) | function formatWeekdayNumberSunday(d) {
function formatWeekNumberMonday (line 13805) | function formatWeekNumberMonday(d, p) {
function formatYear$1 (line 13809) | function formatYear$1(d, p) {
function formatFullYear (line 13813) | function formatFullYear(d, p) {
function formatZone (line 13817) | function formatZone(d) {
function formatUTCDayOfMonth (line 13824) | function formatUTCDayOfMonth(d, p) {
function formatUTCHour24 (line 13828) | function formatUTCHour24(d, p) {
function formatUTCHour12 (line 13832) | function formatUTCHour12(d, p) {
function formatUTCDayOfYear (line 13836) | function formatUTCDayOfYear(d, p) {
function formatUTCMilliseconds (line 13840) | function formatUTCMilliseconds(d, p) {
function formatUTCMicroseconds (line 13844) | function formatUTCMicroseconds(d, p) {
function formatUTCMonthNumber (line 13848) | function formatUTCMonthNumber(d, p) {
function formatUTCMinutes (line 13852) | function formatUTCMinutes(d, p) {
function formatUTCSeconds (line 13856) | function formatUTCSeconds(d, p) {
function formatUTCWeekdayNumberMonday (line 13860) | function formatUTCWeekdayNumberMonday(d) {
function formatUTCWeekNumberSunday (line 13865) | function formatUTCWeekNumberSunday(d, p) {
function formatUTCWeekNumberISO (line 13869) | function formatUTCWeekNumberISO(d, p) {
function formatUTCWeekdayNumberSunday (line 13875) | function formatUTCWeekdayNumberSunday(d) {
function formatUTCWeekNumberMonday (line 13879) | function formatUTCWeekNumberMonday(d, p) {
function formatUTCYear (line 13883) | function formatUTCYear(d, p) {
function formatUTCFullYear (line 13887) | function formatUTCFullYear(d, p) {
function formatUTCZone (line 13891) | function formatUTCZone() {
function formatLiteralPercent (line 13895) | function formatLiteralPercent() {
function formatUnixTimestamp (line 13899) | function formatUnixTimestamp(d) {
function formatUnixTimestampSeconds (line 13903) | function formatUnixTimestampSeconds(d) {
function defaultLocale$1 (line 13920) | function defaultLocale$1(definition) {
function formatIsoNative (line 13931) | function formatIsoNative(date) {
function parseIsoNative (line 13939) | function parseIsoNative(string) {
function date$1 (line 13956) | function date$1(t) {
function number$3 (line 13960) | function number$3(t) {
function calendar (line 13964) | function calendar(year, month, week, day, hour, minute, second, millisec...
function time (line 14072) | function time() {
function utcTime (line 14076) | function utcTime() {
function transformer$2 (line 14080) | function transformer$2() {
function copy$1 (line 14117) | function copy$1(source, target) {
function sequential (line 14125) | function sequential() {
function sequentialLog (line 14135) | function sequentialLog() {
function sequentialSymlog (line 14145) | function sequentialSymlog() {
function sequentialPow (line 14155) | function sequentialPow() {
function sequentialSqrt (line 14165) | function sequentialSqrt() {
function sequentialQuantile (line 14169) | function sequentialQuantile() {
function transformer$3 (line 14196) | function transformer$3() {
function diverging (line 14236) | function diverging() {
function divergingLog (line 14246) | function divergingLog() {
function divergingSymlog (line 14256) | function divergingSymlog() {
function divergingPow (line 14266) | function divergingPow() {
function divergingSqrt (line 14276) | function divergingSqrt() {
function colors (line 14280) | function colors(specifier) {
function ramp (line 14306) | function ramp(scheme) {
function cividis (line 14652) | function cividis(t) {
function rainbow (line 14669) | function rainbow(t) {
function sinebow (line 14682) | function sinebow(t) {
function turbo (line 14691) | function turbo(t) {
function ramp$1 (line 14700) | function ramp$1(range) {
function constant$b (line 14715) | function constant$b(x) {
function acos$1 (line 14734) | function acos$1(x) {
function asin$1 (line 14738) | function asin$1(x) {
function arcInnerRadius (line 14742) | function arcInnerRadius(d) {
function arcOuterRadius (line 14746) | function arcOuterRadius(d) {
function arcStartAngle (line 14750) | function arcStartAngle(d) {
function arcEndAngle (line 14754) | function arcEndAngle(d) {
function arcPadAngle (line 14758) | function arcPadAngle(d) {
function intersect (line 14762) | function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
function cornerTangents (line 14773) | function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
function arc (line 14814) | function arc() {
function Linear (line 15000) | function Linear(context) {
function curveLinear (line 15028) | function curveLinear(context) {
function x$3 (line 15032) | function x$3(p) {
function y$3 (line 15036) | function y$3(p) {
function line (line 15040) | function line() {
function area$3 (line 15091) | function area$3() {
function descending$1 (line 15195) | function descending$1(a, b) {
function identity$8 (line 15199) | function identity$8(d) {
function pie (line 15203) | function pie() {
function Radial (line 15280) | function Radial(curve) {
function curveRadial (line 15302) | function curveRadial(curve) {
function lineRadial (line 15313) | function lineRadial(l) {
function lineRadial$1 (line 15326) | function lineRadial$1() {
function areaRadial (line 15330) | function areaRadial() {
function pointRadial (line 15356) | function pointRadial(x, y) {
function linkSource (line 15362) | function linkSource(d) {
function linkTarget (line 15366) | function linkTarget(d) {
function link$2 (line 15370) | function link$2(curve) {
function curveHorizontal (line 15407) | function curveHorizontal(context, x0, y0, x1, y1) {
function curveVertical (line 15412) | function curveVertical(context, x0, y0, x1, y1) {
function curveRadial$1 (line 15417) | function curveRadial$1(context, x0, y0, x1, y1) {
function linkHorizontal (line 15426) | function linkHorizontal() {
function linkVertical (line 15430) | function linkVertical() {
function linkRadial (line 15434) | function linkRadial() {
function symbol (line 15563) | function symbol() {
function noop$3 (line 15590) | function noop$3() {}
function point$2 (line 15592) | function point$2(that, x, y) {
function Basis (line 15603) | function Basis(context) {
function basis$2 (line 15640) | function basis$2(context) {
function BasisClosed (line 15644) | function BasisClosed(context) {
function basisClosed$1 (line 15690) | function basisClosed$1(context) {
function BasisOpen (line 15694) | function BasisOpen(context) {
function basisOpen (line 15728) | function basisOpen(context) {
function Bundle (line 15732) | function Bundle(context, beta) {
function bundle (line 15776) | function bundle(context) {
function point$3 (line 15787) | function point$3(that, x, y) {
function Cardinal (line 15798) | function Cardinal(context, tension) {
function cardinal (line 15838) | function cardinal(context) {
function CardinalClosed (line 15849) | function CardinalClosed(context, tension) {
function cardinal (line 15897) | function cardinal(context) {
function CardinalOpen (line 15908) | function CardinalOpen(context, tension) {
function cardinal (line 15945) | function cardinal(context) {
function point$4 (line 15956) | function point$4(that, x, y) {
function CatmullRom (line 15979) | function CatmullRom(context, alpha) {
function catmullRom (line 16031) | function catmullRom(context) {
function CatmullRomClosed (line 16042) | function CatmullRomClosed(context, alpha) {
function catmullRom (line 16102) | function catmullRom(context) {
function CatmullRomOpen (line 16113) | function CatmullRomOpen(context, alpha) {
function catmullRom (line 16162) | function catmullRom(context) {
function LinearClosed (line 16173) | function LinearClosed(context) {
function linearClosed (line 16193) | function linearClosed(context) {
function sign$1 (line 16197) | function sign$1(x) {
function slope3 (line 16205) | function slope3(that, x2, y2) {
function slope2 (line 16215) | function slope2(that, t) {
function point$5 (line 16223) | function point$5(that, t0, t1) {
function MonotoneX (line 16232) | function MonotoneX(context) {
function MonotoneY (line 16275) | function MonotoneY(context) {
function ReflectContext (line 16283) | function ReflectContext(context) {
function monotoneX (line 16294) | function monotoneX(context) {
function monotoneY (line 16298) | function monotoneY(context) {
function Natural (line 16302) | function Natural(context) {
function controlPoints (line 16346) | function controlPoints(x) {
function natural (line 16364) | function natural(context) {
function Step (line 16368) | function Step(context, t) {
function step (line 16410) | function step(context) {
function stepBefore (line 16414) | function stepBefore(context) {
function stepAfter (line 16418) | function stepAfter(context) {
function none$1 (line 16422) | function none$1(series, order) {
function none$2 (line 16432) | function none$2(series) {
function stackValue (line 16438) | function stackValue(d, key) {
function stack (line 16442) | function stack() {
function expand (line 16491) | function expand(series, order) {
function diverging$1 (line 16500) | function diverging$1(series, order) {
function silhouette (line 16515) | function silhouette(series, order) {
function wiggle (line 16524) | function wiggle(series, order) {
function appearance (line 16547) | function appearance(series) {
function peak (line 16552) | function peak(series) {
function ascending$3 (line 16558) | function ascending$3(series) {
function sum$2 (line 16563) | function sum$2(series) {
function descending$2 (line 16569) | function descending$2(series) {
function insideOut (line 16573) | function insideOut(series) {
function reverse (line 16598) | function reverse(series) {
function constant$c (line 16602) | function constant$c(x) {
function x$4 (line 16608) | function x$4(d) {
function y$4 (line 16612) | function y$4(d) {
function RedBlackTree (line 16616) | function RedBlackTree() {
function RedBlackNode (line 16620) | function RedBlackNode(node) {
function RedBlackRotateLeft (line 16809) | function RedBlackRotateLeft(tree, node) {
function RedBlackRotateRight (line 16828) | function RedBlackRotateRight(tree, node) {
function RedBlackFirst (line 16847) | function RedBlackFirst(node) {
function createEdge (line 16852) | function createEdge(left, right, v0, v1) {
function createBorderEdge (line 16864) | function createBorderEdge(left, v0, v1) {
function setEdgeEnd (line 16870) | function setEdgeEnd(edge, left, right, vertex) {
function clipEdge (line 16883) | function clipEdge(edge, x0, y0, x1, y1) {
function connectEdge (line 16947) | function connectEdge(edge, x0, y0, x1, y1) {
function clipEdges (line 17005) | function clipEdges(x0, y0, x1, y1) {
function createCell (line 17019) | function createCell(site) {
function cellHalfedgeAngle (line 17026) | function cellHalfedgeAngle(cell, edge) {
function cellHalfedgeStart (line 17037) | function cellHalfedgeStart(cell, edge) {
function cellHalfedgeEnd (line 17041) | function cellHalfedgeEnd(cell, edge) {
function sortCellHalfedges (line 17045) | function sortCellHalfedges() {
function clipCells (line 17058) | function clipCells(x0, y0, x1, y1) {
function Circle (line 17147) | function Circle() {
function attachCircle (line 17156) | function attachCircle(arc) {
function detachCircle (line 17208) | function detachCircle(arc) {
function Beach (line 17221) | function Beach() {
function createBeach (line 17228) | function createBeach(site) {
function detachBeach (line 17234) | function detachBeach(beach) {
function removeBeach (line 17241) | function removeBeach(beach) {
function addBeach (line 17294) | function addBeach(site) {
function leftBreakPoint (line 17373) | function leftBreakPoint(arc, directrix) {
function rightBreakPoint (line 17400) | function rightBreakPoint(arc, directrix) {
function triangleArea (line 17414) | function triangleArea(a, b, c) {
function lexicographic (line 17418) | function lexicographic(a, b) {
function Diagram (line 17423) | function Diagram(sites, extent) {
function voronoi (line 17544) | function voronoi() {
function constant$d (line 17589) | function constant$d(x) {
function ZoomEvent (line 17595) | function ZoomEvent(target, type, transform) {
function Transform (line 17601) | function Transform(k, x, y) {
function transform$1 (line 17648) | function transform$1(node) {
function nopropagation$2 (line 17653) | function nopropagation$2() {
function noevent$2 (line 17657) | function noevent$2() {
function defaultFilter$2 (line 17663) | function defaultFilter$2() {
function defaultExtent$1 (line 17667) | function defaultExtent$1() {
function defaultTransform (line 17680) | function defaultTransform() {
function defaultWheelDelta (line 17684) | function defaultWheelDelta() {
function defaultTouchable$2 (line 17688) | function defaultTouchable$2() {
function defaultConstrain (line 17692) | function defaultConstrain(transform, extent, translateExtent) {
function zoom (line 17703) | function zoom() {
Condensed preview — 26 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (605K chars).
[
{
"path": ".gitignore",
"chars": 29,
"preview": "build\nnode_modules\n.DS_Store\n"
},
{
"path": "README.md",
"chars": 5408,
"preview": "\n\n\n\n\n<!-- PROJECT SHIELDS -->\n<!--\n*** I'm using markdown \"reference style\" links for readability.\n*** Reference links a"
},
{
"path": "__test__/__snapshots__/demo.test.js.snap",
"chars": 2913,
"preview": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`renders & matches snapshot - componetAtomTree props 1`] = `\n<Docume"
},
{
"path": "__test__/demo.test.js",
"chars": 632,
"preview": "import React from 'react';\nimport GraphPanel from '../extension/frontend/view/Components/GraphPanel';\nimport { tree } fr"
},
{
"path": "babel.config.js",
"chars": 180,
"preview": "module.exports = {\n presets: [\n '@babel/preset-env',\n '@babel/preset-react',\n '@babel/preset-typescript',\n ],"
},
{
"path": "extension/backend/background.js",
"chars": 1801,
"preview": "const connectedTabs = {};\n\n//opens a long-running port connection between background script and content script\n//adds ta"
},
{
"path": "extension/backend/content_script.js",
"chars": 912,
"preview": "//this will inject the hook file in the application after 500 milliseconds after the application starts to make sure the"
},
{
"path": "extension/backend/hook.ts",
"chars": 14134,
"preview": "const throttle = require('lodash.throttle')\n\n//the export exists to indicate that the file is a module for typescript to"
},
{
"path": "extension/frontend/create-panel.js",
"chars": 224,
"preview": "/* eslint-disable no-use-before-define */\n// This creates the dev tools panel using the panel.html file as the template\n"
},
{
"path": "extension/frontend/devtools-root.html",
"chars": 463,
"preview": "\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, i"
},
{
"path": "extension/frontend/view/Components/left-view/GraphPanel.js",
"chars": 867,
"preview": "import React, { useEffect, useState } from 'react';\nimport {\n BrowserRouter as Router,\n Switch,\n Route,\n Link,\n Red"
},
{
"path": "extension/frontend/view/Components/left-view/SelectorTree.js",
"chars": 9667,
"preview": "import React, { useEffect, useState, useRef } from 'react';\nimport * as d3 from '../../../../libraries/d3';\n\n/*\n instruc"
},
{
"path": "extension/frontend/view/Components/left-view/treeView.js",
"chars": 4161,
"preview": "import React, { useEffect, useState, useRef } from 'react';\nimport * as d3 from '../../../../libraries/d3.js';\nimport { "
},
{
"path": "extension/frontend/view/Components/right-view/History.js",
"chars": 1046,
"preview": "import React, { useEffect, useRef } from 'react';\nimport JSONPretty from 'react-json-pretty';\n\nconst History = ({ histor"
},
{
"path": "extension/frontend/view/Components/right-view/Navbar.js",
"chars": 885,
"preview": "import React from 'react';\nimport {\n BrowserRouter as Router,\n Switch,\n Route,\n Link,\n NavLink\n} from \"react-router"
},
{
"path": "extension/frontend/view/Components/right-view/atomView.js",
"chars": 2124,
"preview": "import React from 'react';\nimport * as d3 from '../../../../libraries/d3.js';\nimport JSONPretty from 'react-json-pretty'"
},
{
"path": "extension/frontend/view/Container.js",
"chars": 1498,
"preview": "import React, { useEffect, useState } from 'react';\nimport Navbar from './Components/right-view/Navbar'\nimport GraphPane"
},
{
"path": "extension/frontend/view/style.css",
"chars": 5014,
"preview": "\n\n* {\n margin: 0px;\n padding: 0px;\n background-color: rgb(53, 59, 70);\n font-size: 18px;\n overflow-y: hidden;\n ove"
},
{
"path": "extension/frontend/view/view.html",
"chars": 400,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, i"
},
{
"path": "extension/frontend/view/view.js",
"chars": 259,
"preview": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Container from './Container'\n\n\nconst App = () => {\n "
},
{
"path": "extension/libraries/d3.js",
"chars": 515587,
"preview": "// https://d3js.org v5.16.0 Copyright 2020 Mike Bostock\n(function (global, factory) {\ntypeof exports === 'object' && typ"
},
{
"path": "extension/manifest.json",
"chars": 411,
"preview": "{\n \"manifest_version\": 2,\n \"name\": \"Recoil Dev Tools\",\n \"version\": \"1.0.0.0\",\n \"description\": \"A React Recoi"
},
{
"path": "mock/snapshot.js",
"chars": 508,
"preview": "export const tree = [\n {\n children: [{\n name: 'test Recoil Root',\n children: [\n {name: 'Body'},\n "
},
{
"path": "package.json",
"chars": 1247,
"preview": "{\n \"name\": \"recoil\",\n \"version\": \"1.0.0\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"test\": \"jest "
},
{
"path": "tsconfig.json",
"chars": 6074,
"preview": "{\n \"compilerOptions\": {\n /* Visit https://aka.ms/tsconfig.json to read more about this file */\n\n /* Basic Options"
},
{
"path": "webpack.config.js",
"chars": 2994,
"preview": "const path = require('path');\nconst CopyPlugin = require('copy-webpack-plugin');\nconst ExtensionReloader = require('webp"
}
]
About this extraction
This page contains the full source code of the oslabs-beta/TotalRecoilJS GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 26 files (565.9 KB), approximately 180.0k tokens, and a symbol index with 1024 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.