diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md old mode 100644 new mode 100755 diff --git a/.github/ISSUE_TEMPLATE/i-have-an-issue.md b/.github/ISSUE_TEMPLATE/i-have-an-issue.md old mode 100644 new mode 100755 diff --git a/.github/workflows/docker_prod.yml b/.github/workflows/docker_prod.yml old mode 100644 new mode 100755 diff --git a/CONTRIBUTING b/CONTRIBUTING old mode 100644 new mode 100755 diff --git a/FUNDING.yml b/FUNDING.yml old mode 100644 new mode 100755 diff --git a/back/pialert.py b/back/pialert.py index c7fa7a5f..db1334b6 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -3054,17 +3054,20 @@ def isNewVersion(): buildTimestamp = int(f.read().strip()) f.close() - url = requests.get("https://api.github.com/repos/jokob-sk/Pi.Alert/releases") - text = url.text - - data = json.loads(text) + try: + url = requests.get("https://api.github.com/repos/jokob-sk/Pi.Alert/releases") + text = url.text + data = json.loads(text) + except requests.exceptions.ConnectionError as e: + file_print(" Couldn't check for new release.") + data = "" # make sure we received a valid response and not an API rate limit exceeded message if len(data) > 0 and "published_at" in data[0]: - - dateTimeStr = data[0]["published_at"] - realeaseTimestamp = int(datetime.datetime.strptime(dateTimeStr, '%Y-%m-%dT%H:%M:%SZ').strftime('%s')) + dateTimeStr = data[0]["published_at"] + + realeaseTimestamp = int(datetime.datetime.strptime(dateTimeStr, '%Y-%m-%dT%H:%M:%SZ').strftime('%s')) if realeaseTimestamp > buildTimestamp + 600: file_print(" New version of the container available!") diff --git a/back/report_sample_1.txt b/back/report_sample_1.txt old mode 100644 new mode 100755 diff --git a/docs/WEBHOOK_N8N.md b/docs/WEBHOOK_N8N.md old mode 100644 new mode 100755 diff --git a/docs/img/size_h_1250_w_1000.txt b/docs/img/size_h_1250_w_1000.txt old mode 100644 new mode 100755 diff --git a/front/css/pialert.css b/front/css/pialert.css index 68d4e34d..a7127ca0 100755 --- a/front/css/pialert.css +++ b/front/css/pialert.css @@ -571,8 +571,8 @@ display: table-cell; text-align: center; padding: 10px; - /* min-width: 180px; */ - width: 25%; + min-width: 180px; + width: 20%; vertical-align: middle; } .db_tools_table_cell_b { @@ -720,42 +720,75 @@ height: 50px; font-size: large; } -#columnsSelectNew li -{ - list-style-type: none; - padding: 1px; -} - .pointer { cursor:pointer; } -.mainDrgLi +.db_info_table_row .select2-container--default .select2-selection--multiple .select2-selection__choice { - padding: 3px; - text-align: start; - width: 100%; + background-color:#258744; } -.drgLiLeft i +.db_info_table_row .select2-container--default .select2-selection--multiple { - width:25px; -} -.drgLiLeft -{ - width:92%; - float: left; -} -.drgLiRight -{ - width:5%; + background-color:#606060; } -.fullwidth +.select2-container .select2-dropdown { - width:100% + background-color:#606060; } -.columnsOrder +#networkTree .box { - display:block; -} \ No newline at end of file + padding:2px; + margin:2px; +} +#networkTree .netNodeText +{ + top: 2px; + margin: 2px; + position: absolute; +} +#networkTree +{ + margin-left: 16px; + /* border: solid; + border-color:#606060; */ + position: relative; + font-size: 0.75em; +} +#networkTree .netIcon +{ + width: 25px;; + float:left; + display:inline; +} +#networkTree .netCollapse +{ + display: block; + position: absolute; + margin-left: 156px; + top: -3px; + font-size: large; + left: -15px; +} +#networkTree .highlightedNode +{ + border: solid; + border-color:cyan; +} +#networkTree .netStatus-Off-line i +{ + color: #dd4b39; +} + +.spanNetworkTree { + display: inline-block; + width: 120px; + white-space: nowrap; + overflow: hidden !important; + text-overflow: ellipsis; +} + + + diff --git a/front/devices.php b/front/devices.php index a880b61d..c3d695e2 100755 --- a/front/devices.php +++ b/front/devices.php @@ -192,8 +192,9 @@ var parTableOrder = 'Front_Devices_Order'; var tableRows = 10; var tableOrder = [[3,'desc'], [0,'asc']]; - var tableColumnVisible = [0,1,2,3,4,5,6,7,8,9,10,12,13] - var tableColumnOrder = [0,1,2,3,4,5,6,7,8,9,10,12,13] + var tableColumnVisible = [0,1,2,3,4,5,6,7,8,9,10,12,13,14]; + var columnsStr = '[0,1,2,3,4,5,6,7,8,9,10,12,13,14]'; + var tableColumnOrder = [0,1,2,3,4,5,6,7,8,9,10,12,13,14] ; // Read parameters & Initialize components main(); @@ -203,12 +204,12 @@ function main () { // get visible columns - $.get('php/server/parameters.php?action=get&expireMinutes=525600&defaultValue=[0,1,2,3,4,5,6,7,8,9,10,11,12,13]¶meter=Front_Devices_Columns_Visible', function(data) { + $.get('php/server/parameters.php?action=get&expireMinutes=525600&defaultValue='+columnsStr+'¶meter=Front_Devices_Columns_Visible', function(data) { tableColumnVisible = numberArrayFromString(data); // get the custom order specified by the user - $.get('php/server/parameters.php?action=get&expireMinutes=525600&defaultValue=[0,1,2,3,4,5,6,7,8,9,10,11,12,13]¶meter=Front_Devices_Columns_Order', function(data) { + $.get('php/server/parameters.php?action=get&expireMinutes=525600&defaultValue='+columnsStr+'¶meter=Front_Devices_Columns_Order', function(data) { tableColumnOrder = numberArrayFromString(data); @@ -226,7 +227,9 @@ function main () { '', '', '', - '']; + '', + '' + ]; html = ''; @@ -423,18 +426,26 @@ function initializeDatatable () { // ----------------------------------------------------------------------------- // Gets a JSON list of rowID and mac from the displayed table in the UI function getDevicesFromTable(table) -{ - // rowIDs = table.column(12, { 'search': 'applied' }).data().toArray() // rowID is in hidden column 12 - rowIDs = table.column(mapIndx(13), { 'search': 'applied' }).data().toArray() // rowID is in hidden column 12 - // rowMACs = table.column(10, { 'search': 'applied' }).data().toArray() // MAC is in hidden column 10 - rowMACs = table.column(mapIndx(11), { 'search': 'applied' }).data().toArray() // MAC is in hidden column 10 +{ + rowIDs = table.column(mapIndx(13), { 'search': 'applied' }).data().toArray() // + rowMACs = table.column(mapIndx(11), { 'search': 'applied' }).data().toArray() // rowNames = table.column(mapIndx(0), { 'search': 'applied' }).data().toArray() // rowTypes = table.column(mapIndx(2), { 'search': 'applied' }).data().toArray() // + rowIcons = table.column(mapIndx(3), { 'search': 'applied' }).data().toArray() // + rowParentMAC = table.column(mapIndx(14), { 'search': 'applied' }).data().toArray() // + rowStatus = table.column(mapIndx(10), { 'search': 'applied' }).data().toArray() // result = [] rowIDs.map(function(rowID, index){ - result.push({"rowid": rowID, "mac":rowMACs[index], "name" : rowNames[index],"type" : rowTypes[index] }) + result.push({ + "rowid": rowID, + "mac":rowMACs[index], + "name" : rowNames[index], + "type" : rowTypes[index], + "icon" : rowIcons[index], + "parentMac" : rowParentMAC[index], + "status" : rowStatus[index] }) }) return JSON.stringify (result) diff --git a/front/js/handle_version.js b/front/js/handle_version.js old mode 100644 new mode 100755 diff --git a/front/js/pialert_common.js b/front/js/pialert_common.js index 536ac789..b7ce84c2 100755 --- a/front/js/pialert_common.js +++ b/front/js/pialert_common.js @@ -260,6 +260,16 @@ function saveData(functionName, id, value) { } +// ----------------------------------------------------------------------------- +// remove an item from an array +function removeItemFromArray(arr, value) { + var index = arr.indexOf(value); + if (index > -1) { + arr.splice(index, 1); + } + return arr; +} + // ----------------------------------------------------------------------------- function sleep(milliseconds) { const date = Date.now(); diff --git a/front/lib/AdminLTE/@eaDir/index.js.map@SynoEAStream b/front/lib/AdminLTE/@eaDir/index.js.map@SynoEAStream new file mode 100755 index 00000000..a1a51552 Binary files /dev/null and b/front/lib/AdminLTE/@eaDir/index.js.map@SynoEAStream differ diff --git a/front/lib/AdminLTE/@eaDir/index.js@SynoEAStream b/front/lib/AdminLTE/@eaDir/index.js@SynoEAStream new file mode 100755 index 00000000..980a77e2 Binary files /dev/null and b/front/lib/AdminLTE/@eaDir/index.js@SynoEAStream differ diff --git a/front/lib/AdminLTE/@eaDir/require.js@SynoEAStream b/front/lib/AdminLTE/@eaDir/require.js@SynoEAStream new file mode 100755 index 00000000..348c4e5e Binary files /dev/null and b/front/lib/AdminLTE/@eaDir/require.js@SynoEAStream differ diff --git a/front/lib/AdminLTE/index.js b/front/lib/AdminLTE/index.js new file mode 100755 index 00000000..e1309c26 --- /dev/null +++ b/front/lib/AdminLTE/index.js @@ -0,0 +1,375 @@ +parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c=0;)t+=r[u].value;else t=1;e.value=t}function t(){return this.eachAfter(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t; +},{}],"ootC":[function(require,module,exports) { +"use strict";function t(t,e){let s=-1;for(const o of this)t.call(e,o,++s,this);return this}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t; +},{}],"v8XQ":[function(require,module,exports) { +"use strict";function e(e,t){for(var r,s,i=this,o=[i],l=-1;i=o.pop();)if(e.call(t,i,++l,this),r=i.children)for(s=r.length-1;s>=0;--s)o.push(r[s]);return this}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"P6uJ":[function(require,module,exports) { +"use strict";function e(e,t){for(var r,o,s,p=this,i=[p],u=[],f=-1;p=i.pop();)if(u.push(p),r=p.children)for(o=0,s=r.length;o=0;)r+=u[a].value;t.value=r})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"j5Cl":[function(require,module,exports) { +"use strict";function e(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"wdBo":[function(require,module,exports) { +"use strict";function r(r){for(var t=this,o=e(t,r),p=[t];t!==o;)t=t.parent,p.push(t);for(var n=p.length;r!==o;)p.splice(n,0,r),r=r.parent;return p}function e(r,e){if(r===e)return r;var t=r.ancestors(),o=e.ancestors(),p=null;for(r=t.pop(),e=o.pop();r===e;)p=r,r=t.pop(),e=o.pop();return p}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r; +},{}],"b4Rq":[function(require,module,exports) { +"use strict";function e(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"mj9L":[function(require,module,exports) { +"use strict";function e(){return Array.from(this)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"dlF0":[function(require,module,exports) { +"use strict";function e(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"iDpf":[function(require,module,exports) { +"use strict";function e(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"kWY8":[function(require,module,exports) { +"use strict";function*e(){var e,r,t,o,i=this,l=[i];do{for(e=l.reverse(),l=[];i=e.pop();)if(yield i,r=i.children)for(t=0,o=r.length;t=0;--i)s.push(a=u[i]=new m(u[i])),a.parent=r,a.depth=r.depth+1;return o.eachBefore(g)}function j(){return p(this).eachBefore(y)}function q(e){return e.children}function v(e){return Array.isArray(e)?e[1]:null}function y(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function g(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function m(e){this.data=e,this.depth=this.height=0,this.parent=null}m.prototype=p.prototype={constructor:m,count:e.default,each:t.default,eachAfter:a.default,eachBefore:r.default,find:u.default,sum:i.default,sort:n.default,path:o.default,ancestors:s.default,descendants:d.default,leaves:f.default,links:l.default,copy:j,[Symbol.iterator]:c.default}; +},{"./count.js":"gwJQ","./each.js":"ootC","./eachBefore.js":"v8XQ","./eachAfter.js":"P6uJ","./find.js":"JqXv","./sum.js":"gWUA","./sort.js":"j5Cl","./path.js":"wdBo","./ancestors.js":"b4Rq","./descendants.js":"mj9L","./leaves.js":"dlF0","./links.js":"iDpf","./iterator.js":"kWY8"}],"g97z":[function(require,module,exports) { +"use strict";function e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function t(e){for(var t,r,o=e.length;o;)r=Math.random()*o--|0,t=e[o],e[o]=e[r],e[r]=t;return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,exports.shuffle=t; +},{}],"Ph5L":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("../array.js");function t(t){for(var e,f,a=0,i=(t=(0,r.shuffle)(Array.from(t))).length,x=[];a0&&n*n>e*e+u*u}function f(r,t){for(var n=0;n(i*=i)?(n=(f+i-u)/(2*f),x=Math.sqrt(Math.max(0,i/f-n*n)),t.x=r.x-n*o-x*s,t.y=r.y-n*s+x*o):(n=(f+u-i)/(2*f),x=Math.sqrt(Math.max(0,u/f-n*n)),t.x=e.x+n*o-x*s,t.y=e.y+n*s+x*o)):(t.x=e.x+t.r,t.y=e.y)}function u(r,e){var t=r.r+e.r-1e-6,n=e.x-r.x,u=e.y-r.y;return t>0&&t*t>n*n+u*u}function x(r){var e=r._,t=r.next._,n=e.r+t.r,u=(e.x*t.r+t.x*e.r)/n,x=(e.y*t.r+t.y*e.r)/n;return u*u+x*x}function i(r){this._=r,this.next=null,this.previous=null}function o(t){if(!(a=(t=(0,r.default)(t)).length))return 0;var o,s,f,a,_,y,l,p,v,c,h;if((o=t[0]).x=0,o.y=0,!(a>1))return o.r;if(s=t[1],o.x=-s.r,s.x=o.r,s.y=0,!(a>2))return o.r+s.r;n(s,o,f=t[2]),o=new i(o),s=new i(s),f=new i(f),o.next=f.previous=s,s.next=o.previous=f,f.next=s.previous=o;r:for(l=3;l0)throw new Error("cycle");return h}return h.id=function(e){return arguments.length?(u=(0,r.required)(e),h):u},h.parentId=function(e){return arguments.length?(a=(0,r.required)(e),h):a},h} +},{"./accessors.js":"ConL","./hierarchy/index.js":"awbY"}],"spqv":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=l;var n=require("./hierarchy/index.js");function e(n,e){return n.parent===e.parent?1:2}function t(n){var e=n.children;return e?e[0]:n.t}function r(n){var e=n.children;return e?e[e.length-1]:n.t}function i(n,e,t){var r=t/(e.i-n.i);e.c-=r,e.s+=t,n.c+=r,e.z+=t,e.m+=t}function u(n){for(var e,t=0,r=0,i=n.children,u=i.length;--u>=0;)(e=i[u]).z+=t,e.m+=t,t+=e.s+(r+=e.c)}function c(n,e,t){return n.a.parent===e.parent?n.a:t}function a(n,e){this._=n,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function h(n){for(var e,t,r,i,u,c=new a(n,0),h=[c];e=h.pop();)if(r=e._.children)for(e.children=new Array(u=r.length),i=u-1;i>=0;--i)h.push(t=e.children[i]=new a(r[i],i)),t.parent=e;return(c.parent=new a(null,0)).children=[c],c}function l(){var n=e,a=1,l=1,o=null;function f(e){var t=h(e);if(t.eachAfter(p),t.parent.m=-t.z,t.eachBefore(s),o)e.eachBefore(d);else{var r=e,i=e,u=e;e.eachBefore(function(n){n.xi.x&&(i=n),n.depth>u.depth&&(u=n)});var c=r===i?1:n(r,i)/2,f=c-r.x,m=a/(i.x+c+f),z=l/(u.depth||1);e.eachBefore(function(n){n.x=(n.x+f)*m,n.y=n.depth*z})}return e}function p(e){var a=e.children,h=e.parent.children,l=e.i?h[e.i-1]:null;if(a){u(e);var o=(a[0].z+a[a.length-1].z)/2;l?(e.z=l.z+n(e._,l._),e.m=e.z-o):e.z=o}else l&&(e.z=l.z+n(e._,l._));e.parent.A=function(e,u,a){if(u){for(var h,l=e,o=e,f=u,p=l.parent.children[0],s=l.m,d=o.m,m=f.m,z=p.m;f=r(f),l=t(l),f&&l;)p=t(p),(o=r(o)).a=e,(h=f.z+m-l.z-s+n(f._,l._))>0&&(i(c(f,e,a),e,h),s+=h,d+=h),m+=f.m,s+=l.m,z+=p.m,d+=o.m;f&&!r(o)&&(o.t=f,o.m+=m-d),l&&!t(p)&&(p.t=l,p.m+=s-z,a=e)}return a}(e,l,e.parent.A||h[0])}function s(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function d(n){n.x*=a,n.y=n.depth*l}return f.separation=function(e){return arguments.length?(n=e,f):n},f.size=function(n){return arguments.length?(o=!1,a=+n[0],l=+n[1],f):o?null:[a,l]},f.nodeSize=function(n){return arguments.length?(o=!0,a=+n[0],l=+n[1],f):o?[a,l]:null},f}a.prototype=Object.create(n.Node.prototype); +},{"./hierarchy/index.js":"awbY"}],"HMFn":[function(require,module,exports) { +"use strict";function e(e,t,l,r,u){for(var a,o=e.children,n=-1,s=o.length,v=e.value&&(u-l)/e.value;++np&&(p=s),q=c*c*M,(v=Math.max(p/q,q/h))>x){c-=s;break}x=v}_.push(n={value:c,dice:d1?r:1)},t}(u);exports.default=i; +},{"./dice.js":"lDeM","./slice.js":"HMFn"}],"zTYD":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=f;var n=i(require("./round.js")),t=i(require("./squarify.js")),e=require("../accessors.js"),r=o(require("../constant.js"));function u(){if("function"!=typeof WeakMap)return null;var n=new WeakMap;return u=function(){return n},n}function o(n){if(n&&n.__esModule)return n;if(null===n||"object"!=typeof n&&"function"!=typeof n)return{default:n};var t=u();if(t&&t.has(n))return t.get(n);var e={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)){var i=r?Object.getOwnPropertyDescriptor(n,o):null;i&&(i.get||i.set)?Object.defineProperty(e,o,i):e[o]=n[o]}return e.default=n,t&&t.set(n,e),e}function i(n){return n&&n.__esModule?n:{default:n}}function f(){var u=t.default,o=!1,i=1,f=1,d=[0],a=r.constantZero,c=r.constantZero,p=r.constantZero,l=r.constantZero,g=r.constantZero;function s(t){return t.x0=t.y0=0,t.x1=i,t.y1=f,t.eachBefore(y),d=[0],o&&t.eachBefore(n.default),t}function y(n){var t=d[n.depth],e=n.x0+t,r=n.y0+t,o=n.x1-t,i=n.y1-t;o=a-1){var l=u[r];return l.x0=v,l.y0=n,l.x1=o,void(l.y1=f)}var s=i[r],c=t/2+s,d=r+1,x=a-1;for(;d>>1;i[y]f-n){var _=t?(v*h+o*p)/t:o;e(r,d,p,v,n,_,f),e(d,a,h,_,n,o,f)}else{var b=t?(n*h+f*p)/t:f;e(r,d,p,v,n,o,b),e(d,a,h,v,b,o,f)}}(0,f,e.value,r,a,t,v)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"aii9":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var e=u(require("./dice.js")),t=u(require("./slice.js"));function u(e){return e&&e.__esModule?e:{default:e}}function r(u,r,d,s,i){(1&u.depth?t.default:e.default)(u,r,d,s,i)} +},{"./dice.js":"lDeM","./slice.js":"HMFn"}],"F98V":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("./dice.js")),r=t(require("./slice.js")),u=require("./squarify.js");function t(e){return e&&e.__esModule?e:{default:e}}var a=function t(a){function i(t,i,l,f,o){if((s=t._squarify)&&s.ratio===a)for(var s,n,d,v,c,q=-1,_=s.length,p=t.value;++q<_;){for(d=(n=s[q]).children,v=n.value=0,c=d.length;v1?e:1)},i}(u.phi);exports.default=a; +},{"./dice.js":"lDeM","./slice.js":"HMFn","./squarify.js":"jOK3"}],"vZwX":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"cluster",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(exports,"hierarchy",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"pack",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"packSiblings",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(exports,"packEnclose",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(exports,"partition",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(exports,"stratify",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(exports,"tree",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(exports,"treemap",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(exports,"treemapBinary",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(exports,"treemapDice",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(exports,"treemapSlice",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(exports,"treemapSliceDice",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(exports,"treemapSquarify",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(exports,"treemapResquarify",{enumerable:!0,get:function(){return b.default}});var e=j(require("./cluster.js")),r=j(require("./hierarchy/index.js")),t=j(require("./pack/index.js")),n=j(require("./pack/siblings.js")),u=j(require("./pack/enclose.js")),i=j(require("./partition.js")),a=j(require("./stratify.js")),f=j(require("./tree.js")),o=j(require("./treemap/index.js")),p=j(require("./treemap/binary.js")),c=j(require("./treemap/dice.js")),s=j(require("./treemap/slice.js")),l=j(require("./treemap/sliceDice.js")),d=j(require("./treemap/squarify.js")),b=j(require("./treemap/resquarify.js"));function j(e){return e&&e.__esModule?e:{default:e}} +},{"./cluster.js":"npog","./hierarchy/index.js":"awbY","./pack/index.js":"iLjI","./pack/siblings.js":"tCEz","./pack/enclose.js":"Ph5L","./partition.js":"aOXa","./stratify.js":"l7QX","./tree.js":"spqv","./treemap/index.js":"zTYD","./treemap/binary.js":"B9FY","./treemap/dice.js":"lDeM","./treemap/slice.js":"HMFn","./treemap/sliceDice.js":"aii9","./treemap/squarify.js":"jOK3","./treemap/resquarify.js":"F98V"}],"TZ6S":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.xhtml=void 0;var t="http://www.w3.org/1999/xhtml";exports.xhtml=t;var w={svg:"http://www.w3.org/2000/svg",xhtml:t,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};exports.default=w; +},{}],"Sva1":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var e=r(require("./namespaces.js"));function r(e){return e&&e.__esModule?e:{default:e}}function t(r){var t=r+="",s=t.indexOf(":");return s>=0&&"xmlns"!==(t=r.slice(0,s))&&(r=r.slice(s+1)),e.default.hasOwnProperty(t)?{space:e.default[t],local:r}:r} +},{"./namespaces.js":"TZ6S"}],"vTHN":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=a;var e=n(require("./namespace.js")),t=require("./namespaces.js");function n(e){return e&&e.__esModule?e:{default:e}}function r(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===t.xhtml&&n.documentElement.namespaceURI===t.xhtml?n.createElement(e):n.createElementNS(r,e)}}function u(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function a(t){var n=(0,e.default)(t);return(n.local?u:r)(n)} +},{"./namespace.js":"Sva1","./namespaces.js":"TZ6S"}],"hX8m":[function(require,module,exports) { +"use strict";function e(){}function t(t){return null==t?e:function(){return this.querySelector(t)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t; +},{}],"um0S":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=_;var e=require("./index.js"),t=r(require("../selector.js"));function r(e){return e&&e.__esModule?e:{default:e}}function _(r){"function"!=typeof r&&(r=(0,t.default)(r));for(var _=this._groups,a=_.length,n=new Array(a),u=0;u=N&&(N=E+1);!(M=x[N])&&++N=0;)(o=n[s])&&(i&&4^o.compareDocumentPosition(i)&&i.parentNode.insertBefore(o,i),i=o);return this}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"Eo98":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var r=require("./index.js");function e(e){function n(r,t){return r&&t?e(r.__data__,t.__data__):!r-!t}e||(e=t);for(var a=this._groups,o=a.length,u=new Array(o),_=0;_e?1:r>=e?0:NaN} +},{"./index.js":"Pd8D"}],"del0":[function(require,module,exports) { +"use strict";function e(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"P06B":[function(require,module,exports) { +"use strict";function e(){for(var e=this._groups,r=0,t=e.length;r1?this.each((null==t?r:"function"==typeof t?u:n)(e,t,null==o?"":o)):l(this.node(),e)}function l(t,r){return t.style.getPropertyValue(r)||(0,e.default)(t).getComputedStyle(t,null).getPropertyValue(r)} +},{"../window.js":"a7iO"}],"Qc7K":[function(require,module,exports) { +"use strict";function t(t){return function(){delete this[t]}}function e(t,e){return function(){this[t]=e}}function n(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function u(u,i){return arguments.length>1?this.each((null==i?t:"function"==typeof i?n:e)(u,i)):this.node()[u]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=u; +},{}],"u8Lo":[function(require,module,exports) { +"use strict";function t(t){return t.trim().split(/^|\s+/)}function n(t){return t.classList||new e(t)}function e(n){this._node=n,this._names=t(n.getAttribute("class")||"")}function i(t,e){for(var i=n(t),s=-1,r=e.length;++s=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}}; +},{}],"sv0a":[function(require,module,exports) { +"use strict";function t(){this.textContent=""}function n(t){return function(){this.textContent=t}}function e(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function o(o){return arguments.length?this.each(null==o?t:("function"==typeof o?e:n)(o)):this.node().textContent}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=o; +},{}],"IOHV":[function(require,module,exports) { +"use strict";function n(){this.innerHTML=""}function t(n){return function(){this.innerHTML=n}}function e(n){return function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}}function i(i){return arguments.length?this.each(null==i?n:("function"==typeof i?e:t)(i)):this.node().innerHTML}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=i; +},{}],"Bs6a":[function(require,module,exports) { +"use strict";function e(){this.nextSibling&&this.parentNode.appendChild(this)}function t(){return this.each(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t; +},{}],"s7fh":[function(require,module,exports) { +"use strict";function e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function t(){return this.each(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t; +},{}],"XBOq":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var e=t(require("../creator.js"));function t(e){return e&&e.__esModule?e:{default:e}}function r(t){var r="function"==typeof t?t:(0,e.default)(t);return this.select(function(){return this.appendChild(r.apply(this,arguments))})} +},{"../creator.js":"vTHN"}],"DmTR":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=n;var e=r(require("../creator.js")),t=r(require("../selector.js"));function r(e){return e&&e.__esModule?e:{default:e}}function u(){return null}function n(r,n){var l="function"==typeof r?r:(0,e.default)(r),o=null==n?u:"function"==typeof n?n:(0,t.default)(n);return this.select(function(){return this.insertBefore(l.apply(this,arguments),o.apply(this,arguments)||null)})} +},{"../creator.js":"vTHN","../selector.js":"hX8m"}],"lzg5":[function(require,module,exports) { +"use strict";function e(){var e=this.parentNode;e&&e.removeChild(this)}function t(){return this.each(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t; +},{}],"lcuA":[function(require,module,exports) { +"use strict";function e(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function t(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function n(n){return this.select(n?t:e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=n; +},{}],"rHST":[function(require,module,exports) { +"use strict";function e(e){return arguments.length?this.property("__data__",e):this.node().__data__}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"tgqN":[function(require,module,exports) { +"use strict";function e(e){return function(t){e.call(this,t,this.__data__)}}function t(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function n(e){return function(){var t=this.__on;if(t){for(var n,i=0,r=-1,o=t.length;i(0,e.default)(r,u))} +},{"./pointer.js":"LxI0","./sourceEvent.js":"fcLX"}],"n60l":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=n;var e=r(require("./array.js")),t=require("./selection/index.js");function r(e){return e&&e.__esModule?e:{default:e}}function n(r){return"string"==typeof r?new t.Selection([document.querySelectorAll(r)],[document.documentElement]):new t.Selection([null==r?[]:(0,e.default)(r)],t.root)} +},{"./array.js":"LMDO","./selection/index.js":"Pd8D"}],"Gs4P":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"create",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(exports,"creator",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(exports,"local",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"matcher",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(exports,"namespace",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(exports,"namespaces",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(exports,"pointer",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(exports,"pointers",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(exports,"select",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(exports,"selectAll",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(exports,"selection",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(exports,"selector",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(exports,"selectorAll",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(exports,"style",{enumerable:!0,get:function(){return d.styleValue}}),Object.defineProperty(exports,"window",{enumerable:!0,get:function(){return b.default}});var e=j(require("./create.js")),r=j(require("./creator.js")),t=j(require("./local.js")),n=j(require("./matcher.js")),u=j(require("./namespace.js")),o=j(require("./namespaces.js")),l=j(require("./pointer.js")),i=j(require("./pointers.js")),s=j(require("./select.js")),c=j(require("./selectAll.js")),a=j(require("./selection/index.js")),f=j(require("./selector.js")),p=j(require("./selectorAll.js")),d=require("./selection/style.js"),b=j(require("./window.js"));function j(e){return e&&e.__esModule?e:{default:e}} +},{"./create.js":"o4tJ","./creator.js":"vTHN","./local.js":"F0np","./matcher.js":"LbZ4","./namespace.js":"Sva1","./namespaces.js":"TZ6S","./pointer.js":"LxI0","./pointers.js":"y35B","./select.js":"SawF","./selectAll.js":"n60l","./selection/index.js":"Pd8D","./selector.js":"hX8m","./selectorAll.js":"sReu","./selection/style.js":"PNUm","./window.js":"a7iO"}],"SYAW":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var n={value:()=>{}};function r(){for(var n,r=0,t=arguments.length,o={};r=0&&(e=n.slice(t+1),n=n.slice(0,t)),n&&!r.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:e}})}function o(n,r){for(var e,t=0,o=n.length;t0)for(var e,t,o=new Array(e),i=0;i()=>e;exports.default=e; +},{}],"QusW":[function(require,module,exports) { +"use strict";function e(e,{sourceEvent:u,subject:a,target:r,identifier:l,active:n,x:t,y:i,dx:b,dy:o,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:u,enumerable:!0,configurable:!0},subject:{value:a,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:l,enumerable:!0,configurable:!0},active:{value:n,enumerable:!0,configurable:!0},x:{value:t,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:b,enumerable:!0,configurable:!0},dy:{value:o,enumerable:!0,configurable:!0},_:{value:c}})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,e.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e}; +},{}],"U7NX":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=h;var t=require("d3-dispatch"),e=require("d3-selection"),n=c(require("./nodrag.js")),r=c(require("./noevent.js")),o=u(require("./constant.js")),i=u(require("./event.js"));function u(t){return t&&t.__esModule?t:{default:t}}function a(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return a=function(){return t},t}function c(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var e=a();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}return n.default=t,e&&e.set(t,n),n}function f(t){return!t.ctrlKey&&!t.button}function l(){return this.parentNode}function s(t,e){return null==e?{x:t.x,y:t.y}:e}function d(){return navigator.maxTouchPoints||"ontouchstart"in this}function h(){var u,a,c,h,p=f,g=l,v=s,y=d,b={},m=(0,t.dispatch)("start","drag","end"),j=0,w=0;function x(t){t.on("mousedown.drag",O).filter(y).on("touchstart.drag",M).on("touchmove.drag",T).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function O(t,o){if(!h&&p.call(this,t,o)){var i=k(this,g.call(this,t,o),t,o,"mouse");i&&((0,e.select)(t.view).on("mousemove.drag",q,!0).on("mouseup.drag",P,!0),(0,n.default)(t.view),(0,r.nopropagation)(t),c=!1,u=t.clientX,a=t.clientY,i("start",t))}}function q(t){if((0,r.default)(t),!c){var e=t.clientX-u,n=t.clientY-a;c=e*e+n*n>w}b.mouse("drag",t)}function P(t){(0,e.select)(t.view).on("mousemove.drag mouseup.drag",null),(0,n.yesdrag)(t.view,c),(0,r.default)(t),b.mouse("end",t)}function M(t,e){if(p.call(this,t,e)){var n,o,i=t.changedTouches,u=g.call(this,t,e),a=i.length;for(n=0;n>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?v(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?v(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=u.exec(e))?new O(t[1],t[2],t[3],1):(t=g.exec(e))?new O(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=c.exec(e))?v(t[1],t[2],t[3],t[4]):(t=d.exec(e))?v(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=p.exec(e))?E(t[1],t[2]/100,t[3]/100,1):(t=f.exec(e))?E(t[1],t[2]/100,t[3]/100,t[4]):b.hasOwnProperty(e)?x(b[e]):"transparent"===e?new O(NaN,NaN,NaN,0):null}function x(e){return new O(e>>16&255,e>>8&255,255&e,1)}function v(e,t,r,n){return n<=0&&(e=t=r=NaN),new O(e,t,r,n)}function M(e){return e instanceof n||(e=k(e)),e?new O((e=e.rgb()).r,e.g,e.b,e.opacity):new O}function N(e,t,r,n){return 1===arguments.length?M(e):new O(e,t,r,null==n?1:n)}function O(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function j(){return"#"+R(this.r)+R(this.g)+R(this.b)}function q(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"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))+(1===e?")":", "+e+")")}function R(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function E(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new H(e,t,r,n)}function P(e){if(e instanceof H)return new H(e.h,e.s,e.l,e.opacity);if(e instanceof n||(e=k(e)),!e)return new H;if(e instanceof H)return e;var t=(e=e.rgb()).r/255,r=e.g/255,i=e.b/255,a=Math.min(t,r,i),o=Math.max(t,r,i),s=NaN,l=o-a,h=(o+a)/2;return l?(s=t===o?(r-i)/l+6*(r0&&h<1?0:s,new H(s,l,h,e.opacity)}function $(e,t,r,n){return 1===arguments.length?P(e):new H(e,t,r,null==n?1:n)}function H(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function C(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}(0,e.default)(n,k,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:y,formatHex:y,formatHsl:m,formatRgb:w,toString:w}),(0,e.default)(O,N,(0,e.extend)(n,{brighter:function(e){return e=null==e?a:Math.pow(a,e),new O(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?i:Math.pow(i,e),new O(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:j,formatHex:j,formatRgb:q,toString:q})),(0,e.default)(H,$,(0,e.extend)(n,{brighter:function(e){return e=null==e?a:Math.pow(a,e),new H(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?i:Math.pow(i,e),new H(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new O(C(e>=240?e-240:e+120,i,n),C(e,i,n),C(e<120?e+240:e-120,i,n),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 e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}})); +},{"./define.js":"I82Z"}],"Ip0L":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.degrees=exports.radians=void 0;const e=Math.PI/180;exports.radians=e;const s=180/Math.PI;exports.degrees=s; +},{}],"u9JU":[function(require,module,exports) { + +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.gray=b,exports.default=y,exports.Lab=w,exports.lch=N,exports.hcl=x,exports.Hcl=O;var t=i(require("./define.js")),n=require("./color.js"),e=require("./math.js");function r(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return r=function(){return t},t}function i(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=r();if(n&&n.has(t))return n.get(t);var e={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var u=i?Object.getOwnPropertyDescriptor(t,o):null;u&&(u.get||u.set)?Object.defineProperty(e,o,u):e[o]=t[o]}return e.default=t,n&&n.set(t,e),e}const o=18,u=.96422,a=1,c=.82521,s=4/29,l=6/29,h=3*l*l,f=l*l*l;function p(t){if(t instanceof w)return new w(t.l,t.a,t.b,t.opacity);if(t instanceof O)return P(t);t instanceof n.Rgb||(t=(0,n.rgbConvert)(t));var e,r,i=M(t.r),o=M(t.g),s=M(t.b),l=g((.2225045*i+.7168786*o+.0606169*s)/a);return i===o&&o===s?e=r=l:(e=g((.4360747*i+.3850649*o+.1430804*s)/u),r=g((.0139322*i+.0971045*o+.7141733*s)/c)),new w(116*l-16,500*(e-l),200*(l-r),t.opacity)}function b(t,n){return new w(t,0,0,null==n?1:n)}function y(t,n,e,r){return 1===arguments.length?p(t):new w(t,n,e,null==r?1:r)}function w(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function g(t){return t>f?Math.pow(t,1/3):t/h+s}function d(t){return t>l?t*t*t:h*(t-s)}function v(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function M(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function j(t){if(t instanceof O)return new O(t.h,t.c,t.l,t.opacity);if(t instanceof w||(t=p(t)),0===t.a&&0===t.b)return new O(NaN,0=1?(n=1,t-1):Math.floor(n*t),u=r[o],s=r[o+1],a=o>0?r[o-1]:2*u-s,f=o180||u<-180?u-360*Math.round(u/360):u):(0,t.default)(isNaN(e)?r:e)}function o(e){return 1==(e=+e)?a:function(n,u){return u-n?r(n,u,e):(0,t.default)(isNaN(n)?u:n)}}function a(e,r){var u=r-e;return u?n(e,u):(0,t.default)(isNaN(e)?r:e)} +},{"./constant.js":"l0wH"}],"uEB8":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.rgbBasisClosed=exports.rgbBasis=exports.default=void 0;var r=require("d3-color"),e=a(require("./basis.js")),t=a(require("./basisClosed.js")),n=u(require("./color.js"));function o(){if("function"!=typeof WeakMap)return null;var r=new WeakMap;return o=function(){return r},r}function u(r){if(r&&r.__esModule)return r;if(null===r||"object"!=typeof r&&"function"!=typeof r)return{default:r};var e=o();if(e&&e.has(r))return e.get(r);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in r)if(Object.prototype.hasOwnProperty.call(r,u)){var a=n?Object.getOwnPropertyDescriptor(r,u):null;a&&(a.get||a.set)?Object.defineProperty(t,u,a):t[u]=r[u]}return t.default=r,e&&e.set(r,t),t}function a(r){return r&&r.__esModule?r:{default:r}}var i=function e(t){var o=(0,n.gamma)(t);function u(e,t){var u=o((e=(0,r.rgb)(e)).r,(t=(0,r.rgb)(t)).r),a=o(e.g,t.g),i=o(e.b,t.b),s=(0,n.default)(e.opacity,t.opacity);return function(r){return e.r=u(r),e.g=a(r),e.b=i(r),e.opacity=s(r),e+""}}return u.gamma=e,u}(1);function s(e){return function(t){var n,o,u=t.length,a=new Array(u),i=new Array(u),s=new Array(u);for(n=0;ns&&(d=l.slice(s,d),x[f]?x[f]+=d:x[++f]=d),(o=o[0])===(c=c[0])?x[f]?x[f]+=c:x[++f]=c:(x[++f]=null,a.push({i:f,x:(0,e.default)(o,c)})),s=t.lastIndex;return s180?r+=360:r-t>180&&(t+=360),u.push({i:s.push(a(s)+"rotate(",null,n)-2,x:(0,e.default)(t,r)})):r&&s.push(a(s)+"rotate("+r+n)}(u.rotate,l.rotate,o,p),function(t,r,s,u){t!==r?u.push({i:s.push(a(s)+"skewX(",null,n)-2,x:(0,e.default)(t,r)}):r&&s.push(a(s)+"skewX("+r+n)}(u.skewX,l.skewX,o,p),function(t,r,s,n,u,l){if(t!==s||r!==n){var o=u.push(a(u)+"scale(",null,",",null,")");l.push({i:o-4,x:(0,e.default)(t,s)},{i:o-2,x:(0,e.default)(r,n)})}else 1===s&&1===n||u.push(a(u)+"scale("+s+","+n+")")}(u.scaleX,u.scaleY,l.scaleX,l.scaleY,o,p),u=l=null,function(e){for(var t,r=-1,s=p.length;++r=0&&o._call.call(null,n),o=o._next;--e}function h(){c=(l=u.now())+s,e=o=0;try{w()}finally{e=0,y(),c=0}}function x(){var t=u.now(),n=t-l;n>r&&(s-=n,l=t)}function y(){for(var e,o,i=t,r=1/0;i;)i._call?(r>i._time&&(r=i._time),e=i,i=i._next):(o=i._next,i._next=null,i=e?e._next=o:t=o);n=e,v(r)}function v(t){e||(o&&(o=clearTimeout(o)),t-c>24?(t<1/0&&(o=setTimeout(h,t-u.now()-s)),i&&(i=clearInterval(i))):(i||(l=u.now(),i=setInterval(x,r)),e=1,a(h)))}m.prototype=p.prototype={constructor:m,restart:function(e,o,i){if("function"!=typeof e)throw new TypeError("callback is not a function");i=(null==i?f():+i)+(null==o?0:+o),this._next||n===this||(n?n._next=this:t=this,n=this),this._call=e,this._time=i,v()},stop:function(){this._call&&(this._call=null,this._time=1/0,v())}}; +},{}],"ELFE":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var e=require("./timer.js");function r(r,t,s){var u=new e.Timer;return t=null==t?0:+t,u.restart(e=>{u.stop(),r(e+t)},t,s),u} +},{"./timer.js":"VMoR"}],"ngd6":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("./timer.js");function t(t,e,s){var n=new r.Timer,a=e;return null==e?(n.restart(t,e,s),n):(n._restart=n.restart,n.restart=function(t,e,s){e=+e,s=null==s?(0,r.now)():+s,n._restart(function r(u){u+=a,n._restart(r,a+=e,s),t(u)},e,s)},n.restart(t,e,s),n)} +},{"./timer.js":"VMoR"}],"yaK5":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"now",{enumerable:!0,get:function(){return e.now}}),Object.defineProperty(exports,"timer",{enumerable:!0,get:function(){return e.timer}}),Object.defineProperty(exports,"timerFlush",{enumerable:!0,get:function(){return e.timerFlush}}),Object.defineProperty(exports,"timeout",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"interval",{enumerable:!0,get:function(){return r.default}});var e=require("./timer.js"),t=n(require("./timeout.js")),r=n(require("./interval.js"));function n(e){return e&&e.__esModule?e:{default:e}} +},{"./timer.js":"VMoR","./timeout.js":"ELFE","./interval.js":"ngd6"}],"qU2W":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=p,exports.init=_,exports.set=c,exports.get=f,exports.ENDED=exports.ENDING=exports.RUNNING=exports.STARTED=exports.STARTING=exports.SCHEDULED=exports.CREATED=void 0;var t=require("d3-dispatch"),e=require("d3-timer"),r=(0,t.dispatch)("start","end","cancel","interrupt"),a=[],n=0;exports.CREATED=n;var o=1;exports.SCHEDULED=o;var i=2;exports.STARTING=i;var s=3;exports.STARTED=s;var l=4;exports.RUNNING=l;var u=5;exports.ENDING=u;var d=6;function p(t,e,o,i,s,l){var u=t.__transition;if(u){if(o in u)return}else t.__transition={};x(t,o,{name:e,index:i,group:s,on:r,tween:a,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:n})}function _(t,e){var r=f(t,e);if(r.state>n)throw new Error("too late; already scheduled");return r}function c(t,e){var r=f(t,e);if(r.state>s)throw new Error("too late; already running");return r}function f(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function x(t,r,a){var n,p=t.__transition;function _(u){var x,m,E,v;if(a.state!==o)return f();for(x in p)if((v=p[x]).name===a.name){if(v.state===s)return(0,e.timeout)(_);v.state===l?(v.state=d,v.timer.stop(),v.on.call("interrupt",t,t.__data__,v.index,v.group),delete p[x]):+xe.STARTING&&r.state=0&&(e=e.slice(0,t)),!e||"start"===e})}function n(n,r,i){var o,s,u=t(r)?e.init:e.set;return function(){var e=u(this,n),t=e.on;t!==o&&(s=(o=t).copy()).on(r,i),e.on=s}}function r(t,r){var i=this._id;return arguments.length<2?(0,e.get)(this.node(),i).on.on(t):this.each(n(i,t,r))} +},{"./schedule.js":"qU2W"}],"eP7r":[function(require,module,exports) { +"use strict";function e(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function t(){return this.on("end.remove",e(this._id))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t; +},{}],"QqhT":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=o;var e=require("d3-selection"),t=require("./index.js"),r=a(require("./schedule.js"));function n(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return n=function(){return e},e}function a(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=n();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,t&&t.set(e,r),r}function o(n){var a=this._name,o=this._id;"function"!=typeof n&&(n=(0,e.selector)(n));for(var i=this._groups,u=i.length,f=new Array(u),s=0;s+e;exports.linear=e; +},{}],"NlV3":[function(require,module,exports) { +"use strict";function t(t){return t*t}function e(t){return t*(2-t)}function u(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}Object.defineProperty(exports,"__esModule",{value:!0}),exports.quadIn=t,exports.quadOut=e,exports.quadInOut=u; +},{}],"ATE0":[function(require,module,exports) { +"use strict";function t(t){return t*t*t}function e(t){return--t*t*t+1}function u(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}Object.defineProperty(exports,"__esModule",{value:!0}),exports.cubicIn=t,exports.cubicOut=e,exports.cubicInOut=u; +},{}],"xJOL":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.polyInOut=exports.polyOut=exports.polyIn=void 0;var t=3,n=function t(n){function o(t){return Math.pow(t,n)}return n=+n,o.exponent=t,o}(t);exports.polyIn=n;var o=function t(n){function o(t){return 1-Math.pow(1-t,n)}return n=+n,o.exponent=t,o}(t);exports.polyOut=o;var e=function t(n){function o(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,o.exponent=t,o}(t);exports.polyInOut=e; +},{}],"aKKp":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sinIn=e,exports.sinOut=r,exports.sinInOut=s;var t=Math.PI,n=t/2;function e(t){return 1==+t?1:1-Math.cos(t*n)}function r(t){return Math.sin(t*n)}function s(n){return(1-Math.cos(t*n))/2} +},{}],"n70i":[function(require,module,exports) { +"use strict";function e(e){return 1.0009775171065494*(Math.pow(2,-10*e)-.0009765625)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.tpmt=e; +},{}],"GEdw":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.expIn=e,exports.expOut=r,exports.expInOut=n;var t=require("./math.js");function e(e){return(0,t.tpmt)(1-+e)}function r(e){return 1-(0,t.tpmt)(e)}function n(e){return((e*=2)<=1?(0,t.tpmt)(1-e):2-(0,t.tpmt)(e-1))/2} +},{"./math.js":"n70i"}],"erIK":[function(require,module,exports) { +"use strict";function t(t){return 1-Math.sqrt(1-t*t)}function r(t){return Math.sqrt(1- --t*t)}function e(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}Object.defineProperty(exports,"__esModule",{value:!0}),exports.circleIn=t,exports.circleOut=r,exports.circleInOut=e; +},{}],"WtpZ":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.bounceIn=b,exports.bounceOut=f,exports.bounceInOut=x;var e=4/11,t=6/11,n=8/11,r=.75,u=9/11,o=10/11,c=.9375,s=21/22,i=63/64,p=1/e/e;function b(e){return 1-f(1-e)}function f(b){return(b=+b)n.SCHEDULED&&u.name===i)return new e.Transition([[t]],r,i,+s);return null} +},{"./transition/index.js":"SG3l","./transition/schedule.js":"qU2W"}],"ErME":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"transition",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(exports,"active",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"interrupt",{enumerable:!0,get:function(){return r.default}}),require("./selection/index.js");var e=n(require("./transition/index.js")),t=n(require("./active.js")),r=n(require("./interrupt.js"));function n(e){return e&&e.__esModule?e:{default:e}} +},{"./selection/index.js":"qltf","./transition/index.js":"SG3l","./active.js":"xpP9","./interrupt.js":"shc0"}],"JNHq":[function(require,module,exports) { +"use strict";function e(e,{sourceEvent:r,target:t,transform:a,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:a,enumerable:!0,configurable:!0},_:{value:u}})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e; +},{}],"IEEo":[function(require,module,exports) { +"use strict";function t(t,i,n){this.k=t,this.x=i,this.y=n}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Transform=t,exports.default=n,exports.identity=void 0,t.prototype={constructor:t,scale:function(i){return 1===i?this:new t(this.k*i,this.x,this.y)},translate:function(i,n){return 0===i&0===n?this:new t(this.k,this.x+this.k*i,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var i=new t(1,0,0);function n(t){for(;!t.__zoom;)if(!(t=t.parentNode))return i;return t.__zoom}exports.identity=i,n.prototype=t.prototype; +},{}],"LONi":[function(require,module,exports) { +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=_;var t=require("d3-dispatch"),e=require("d3-drag"),n=require("d3-interpolate"),o=require("d3-selection"),i=require("d3-transition"),r=l(require("./constant.js")),u=l(require("./event.js")),h=require("./transform.js"),a=c(require("./noevent.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function c(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=o?Object.getOwnPropertyDescriptor(t,i):null;r&&(r.get||r.set)?Object.defineProperty(n,i,r):n[i]=t[i]}return n.default=t,e&&e.set(t,n),n}function l(t){return t&&t.__esModule?t:{default:t}}function f(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function p(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function m(){return this.__zoom||h.identity}function v(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function d(){return navigator.maxTouchPoints||"ontouchstart"in this}function y(t,e,n){var o=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],r=t.invertY(e[0][1])-n[0][1],u=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),u>r?(r+u)/2:Math.min(0,r)||Math.max(0,u))}function _(){var s,c,l,_=f,z=p,g=y,w=v,x=d,M=[0,1/0],b=[[-1/0,-1/0],[1/0,1/0]],T=250,k=n.interpolateZoom,j=(0,t.dispatch)("start","zoom","end"),q=500,E=150,O=0,P=10;function D(t){t.property("__zoom",m).on("wheel.zoom",G).on("mousedown.zoom",S).on("dblclick.zoom",A).filter(x).on("touchstart.zoom",H).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function V(t,e){return(e=Math.max(M[0],Math.min(M[1],e)))===t.k?t:new h.Transform(e,t.x,t.y)}function Y(t,e,n){var o=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return o===t.x&&i===t.y?t:new h.Transform(t.k,o,i)}function B(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function X(t,e,n,o){t.on("start.zoom",function(){K(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){K(this,arguments).event(o).end()}).tween("zoom",function(){var t=arguments,i=K(this,t).event(o),r=z.apply(this,t),u=null==n?B(r):"function"==typeof n?n.apply(this,t):n,a=Math.max(r[1][0]-r[0][0],r[1][1]-r[0][1]),s=this.__zoom,c="function"==typeof e?e.apply(this,t):e,l=k(s.invert(u).concat(a/s.k),c.invert(u).concat(a/c.k));return function(t){if(1===t)t=c;else{var e=l(t),n=a/e[2];t=new h.Transform(n,u[0]-e[0]*n,u[1]-e[1]*n)}i.zoom(null,t)}})}function K(t,e,n){return!n&&t.__zooming||new W(t,e)}function W(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=z.apply(t,e),this.taps=0}function G(t,...e){if(_.apply(this,arguments)){var n=K(this,e).event(t),r=this.__zoom,u=Math.max(M[0],Math.min(M[1],r.k*Math.pow(2,w.apply(this,arguments)))),h=(0,o.pointer)(t);if(n.wheel)n.mouse[0][0]===h[0]&&n.mouse[0][1]===h[1]||(n.mouse[1]=r.invert(n.mouse[0]=h)),clearTimeout(n.wheel);else{if(r.k===u)return;n.mouse=[h,r.invert(h)],(0,i.interrupt)(this),n.start()}(0,a.default)(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},E),n.zoom("mouse",g(Y(V(r,u),n.mouse[0],n.mouse[1]),n.extent,b))}}function S(t,...n){if(!l&&_.apply(this,arguments)){var r=K(this,n,!0).event(t),u=(0,o.select)(t.view).on("mousemove.zoom",function(t){if((0,a.default)(t),!r.moved){var e=t.clientX-c,n=t.clientY-f;r.moved=e*e+n*n>O}r.event(t).zoom("mouse",g(Y(r.that.__zoom,r.mouse[0]=(0,o.pointer)(t,s),r.mouse[1]),r.extent,b))},!0).on("mouseup.zoom",function(t){u.on("mousemove.zoom mouseup.zoom",null),(0,e.dragEnable)(t.view,r.moved),(0,a.default)(t),r.event(t).end()},!0),h=(0,o.pointer)(t,s),s=t.currentTarget,c=t.clientX,f=t.clientY;(0,e.dragDisable)(t.view),(0,a.nopropagation)(t),r.mouse=[h,this.__zoom.invert(h)],(0,i.interrupt)(this),r.start()}}function A(t,...e){if(_.apply(this,arguments)){var n=this.__zoom,i=(0,o.pointer)(t.changedTouches?t.changedTouches[0]:t,this),r=n.invert(i),u=n.k*(t.shiftKey?.5:2),h=g(Y(V(n,u),i,r),z.apply(this,e),b);(0,a.default)(t),T>0?(0,o.select)(this).transition().duration(T).call(X,h,i,t):(0,o.select)(this).call(D.transform,h,i,t)}}function H(t,...e){if(_.apply(this,arguments)){var n,r,u,h,l=t.touches,f=l.length,p=K(this,e,t.changedTouches.length===f).event(t);for((0,a.nopropagation)(t),r=0;rn?x:y= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n\nexport function shuffle(array) {\n var m = array.length,\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m];\n array[m] = array[i];\n array[i] = t;\n }\n\n return array;\n}\n","import {shuffle} from \"../array.js\";\n\nexport default function(circles) {\n var i = 0, n = (circles = shuffle(Array.from(circles))).length, B = [], p, e;\n\n while (i < n) {\n p = circles[i];\n if (e && enclosesWeak(e, p)) ++i;\n else e = encloseBasis(B = extendBasis(B, p)), i = 0;\n }\n\n return e;\n}\n\nfunction extendBasis(B, p) {\n var i, j;\n\n if (enclosesWeakAll(p, B)) return [p];\n\n // If we get here then B must have at least one element.\n for (i = 0; i < B.length; ++i) {\n if (enclosesNot(p, B[i])\n && enclosesWeakAll(encloseBasis2(B[i], p), B)) {\n return [B[i], p];\n }\n }\n\n // If we get here then B must have at least two elements.\n for (i = 0; i < B.length - 1; ++i) {\n for (j = i + 1; j < B.length; ++j) {\n if (enclosesNot(encloseBasis2(B[i], B[j]), p)\n && enclosesNot(encloseBasis2(B[i], p), B[j])\n && enclosesNot(encloseBasis2(B[j], p), B[i])\n && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) {\n return [B[i], B[j], p];\n }\n }\n }\n\n // If we get here then something is very wrong.\n throw new Error;\n}\n\nfunction enclosesNot(a, b) {\n var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;\n return dr < 0 || dr * dr < dx * dx + dy * dy;\n}\n\nfunction enclosesWeak(a, b) {\n var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction enclosesWeakAll(a, B) {\n for (var i = 0; i < B.length; ++i) {\n if (!enclosesWeak(a, B[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction encloseBasis(B) {\n switch (B.length) {\n case 1: return encloseBasis1(B[0]);\n case 2: return encloseBasis2(B[0], B[1]);\n case 3: return encloseBasis3(B[0], B[1], B[2]);\n }\n}\n\nfunction encloseBasis1(a) {\n return {\n x: a.x,\n y: a.y,\n r: a.r\n };\n}\n\nfunction encloseBasis2(a, b) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,\n l = Math.sqrt(x21 * x21 + y21 * y21);\n return {\n x: (x1 + x2 + x21 / l * r21) / 2,\n y: (y1 + y2 + y21 / l * r21) / 2,\n r: (l + r1 + r2) / 2\n };\n}\n\nfunction encloseBasis3(a, b, c) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x3 = c.x, y3 = c.y, r3 = c.r,\n a2 = x1 - x2,\n a3 = x1 - x3,\n b2 = y1 - y2,\n b3 = y1 - y3,\n c2 = r2 - r1,\n c3 = r3 - r1,\n d1 = x1 * x1 + y1 * y1 - r1 * r1,\n d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2,\n d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3,\n ab = a3 * b2 - a2 * b3,\n xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1,\n xb = (b3 * c2 - b2 * c3) / ab,\n ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1,\n yb = (a2 * c3 - a3 * c2) / ab,\n A = xb * xb + yb * yb - 1,\n B = 2 * (r1 + xa * xb + ya * yb),\n C = xa * xa + ya * ya - r1 * r1,\n r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);\n return {\n x: x1 + xa + xb * r,\n y: y1 + ya + yb * r,\n r: r\n };\n}\n","import array from \"../array.js\";\nimport enclose from \"./enclose.js\";\n\nfunction place(b, a, c) {\n var dx = b.x - a.x, x, a2,\n dy = b.y - a.y, y, b2,\n d2 = dx * dx + dy * dy;\n if (d2) {\n a2 = a.r + c.r, a2 *= a2;\n b2 = b.r + c.r, b2 *= b2;\n if (a2 > b2) {\n x = (d2 + b2 - a2) / (2 * d2);\n y = Math.sqrt(Math.max(0, b2 / d2 - x * x));\n c.x = b.x - x * dx - y * dy;\n c.y = b.y - x * dy + y * dx;\n } else {\n x = (d2 + a2 - b2) / (2 * d2);\n y = Math.sqrt(Math.max(0, a2 / d2 - x * x));\n c.x = a.x + x * dx - y * dy;\n c.y = a.y + x * dy + y * dx;\n }\n } else {\n c.x = a.x + c.r;\n c.y = a.y;\n }\n}\n\nfunction intersects(a, b) {\n var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction score(node) {\n var a = node._,\n b = node.next._,\n ab = a.r + b.r,\n dx = (a.x * b.r + b.x * a.r) / ab,\n dy = (a.y * b.r + b.y * a.r) / ab;\n return dx * dx + dy * dy;\n}\n\nfunction Node(circle) {\n this._ = circle;\n this.next = null;\n this.previous = null;\n}\n\nexport function packEnclose(circles) {\n if (!(n = (circles = array(circles)).length)) return 0;\n\n var a, b, c, n, aa, ca, i, j, k, sj, sk;\n\n // Place the first circle.\n a = circles[0], a.x = 0, a.y = 0;\n if (!(n > 1)) return a.r;\n\n // Place the second circle.\n b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;\n if (!(n > 2)) return a.r + b.r;\n\n // Place the third circle.\n place(b, a, c = circles[2]);\n\n // Initialize the front-chain using the first three circles a, b and c.\n a = new Node(a), b = new Node(b), c = new Node(c);\n a.next = c.previous = b;\n b.next = a.previous = c;\n c.next = b.previous = a;\n\n // Attempt to place each remaining circle…\n pack: for (i = 3; i < n; ++i) {\n place(a._, b._, c = circles[i]), c = new Node(c);\n\n // Find the closest intersecting circle on the front-chain, if any.\n // “Closeness” is determined by linear distance along the front-chain.\n // “Ahead” or “behind” is likewise determined by linear distance.\n j = b.next, k = a.previous, sj = b._.r, sk = a._.r;\n do {\n if (sj <= sk) {\n if (intersects(j._, c._)) {\n b = j, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sj += j._.r, j = j.next;\n } else {\n if (intersects(k._, c._)) {\n a = k, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sk += k._.r, k = k.previous;\n }\n } while (j !== k.next);\n\n // Success! Insert the new circle c between a and b.\n c.previous = a, c.next = b, a.next = b.previous = b = c;\n\n // Compute the new closest circle pair to the centroid.\n aa = score(a);\n while ((c = c.next) !== b) {\n if ((ca = score(c)) < aa) {\n a = c, aa = ca;\n }\n }\n b = a.next;\n }\n\n // Compute the enclosing circle of the front chain.\n a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a);\n\n // Translate the circles to put the enclosing circle around the origin.\n for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;\n\n return c.r;\n}\n\nexport default function(circles) {\n packEnclose(circles);\n return circles;\n}\n","export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","import {packEnclose} from \"./siblings.js\";\nimport {optional} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nfunction defaultRadius(d) {\n return Math.sqrt(d.value);\n}\n\nexport default function() {\n var radius = null,\n dx = 1,\n dy = 1,\n padding = constantZero;\n\n function pack(root) {\n root.x = dx / 2, root.y = dy / 2;\n if (radius) {\n root.eachBefore(radiusLeaf(radius))\n .eachAfter(packChildren(padding, 0.5))\n .eachBefore(translateChild(1));\n } else {\n root.eachBefore(radiusLeaf(defaultRadius))\n .eachAfter(packChildren(constantZero, 1))\n .eachAfter(packChildren(padding, root.r / Math.min(dx, dy)))\n .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));\n }\n return root;\n }\n\n pack.radius = function(x) {\n return arguments.length ? (radius = optional(x), pack) : radius;\n };\n\n pack.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];\n };\n\n pack.padding = function(x) {\n return arguments.length ? (padding = typeof x === \"function\" ? x : constant(+x), pack) : padding;\n };\n\n return pack;\n}\n\nfunction radiusLeaf(radius) {\n return function(node) {\n if (!node.children) {\n node.r = Math.max(0, +radius(node) || 0);\n }\n };\n}\n\nfunction packChildren(padding, k) {\n return function(node) {\n if (children = node.children) {\n var children,\n i,\n n = children.length,\n r = padding(node) * k || 0,\n e;\n\n if (r) for (i = 0; i < n; ++i) children[i].r += r;\n e = packEnclose(children);\n if (r) for (i = 0; i < n; ++i) children[i].r -= r;\n node.r = e + r;\n }\n };\n}\n\nfunction translateChild(k) {\n return function(node) {\n var parent = node.parent;\n node.r *= k;\n if (parent) {\n node.x = parent.x + k * node.x;\n node.y = parent.y + k * node.y;\n }\n };\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import roundNode from \"./treemap/round.js\";\nimport treemapDice from \"./treemap/dice.js\";\n\nexport default function() {\n var dx = 1,\n dy = 1,\n padding = 0,\n round = false;\n\n function partition(root) {\n var n = root.height + 1;\n root.x0 =\n root.y0 = padding;\n root.x1 = dx;\n root.y1 = dy / n;\n root.eachBefore(positionNode(dy, n));\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(dy, n) {\n return function(node) {\n if (node.children) {\n treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);\n }\n var x0 = node.x0,\n y0 = node.y0,\n x1 = node.x1 - padding,\n y1 = node.y1 - padding;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n };\n }\n\n partition.round = function(x) {\n return arguments.length ? (round = !!x, partition) : round;\n };\n\n partition.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];\n };\n\n partition.padding = function(x) {\n return arguments.length ? (padding = +x, partition) : padding;\n };\n\n return partition;\n}\n","import {required} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId;\n\n function stratify(data) {\n var nodes = Array.from(data),\n n = nodes.length,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n for (i = 0; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = id(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = parentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = required(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = required(x), stratify) : parentId;\n };\n\n return stratify;\n}\n","import {Node} from \"./hierarchy/index.js\";\n\nfunction defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\n// function radialSeparation(a, b) {\n// return (a.parent === b.parent ? 1 : 2) / a.depth;\n// }\n\n// This function is used to traverse the left contour of a subtree (or\n// subforest). It returns the successor of v on this contour. This successor is\n// either given by the leftmost child of v or by the thread of v. The function\n// returns null if and only if v is on the highest level of its subtree.\nfunction nextLeft(v) {\n var children = v.children;\n return children ? children[0] : v.t;\n}\n\n// This function works analogously to nextLeft.\nfunction nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}\n\n// Shifts the current subtree rooted at w+. This is done by increasing\n// prelim(w+) and mod(w+) by shift.\nfunction moveSubtree(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n}\n\n// All other shifts, applied to the smaller subtrees between w- and w+, are\n// performed by this function. To prepare the shifts, we have to adjust\n// change(w+), shift(w+), and change(w-).\nfunction executeShifts(v) {\n var shift = 0,\n change = 0,\n children = v.children,\n i = children.length,\n w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n}\n\n// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,\n// returns the specified (default) ancestor.\nfunction nextAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n}\n\nfunction TreeNode(node, i) {\n this._ = node;\n this.parent = null;\n this.children = null;\n this.A = null; // default ancestor\n this.a = this; // ancestor\n this.z = 0; // prelim\n this.m = 0; // mod\n this.c = 0; // change\n this.s = 0; // shift\n this.t = null; // thread\n this.i = i; // number\n}\n\nTreeNode.prototype = Object.create(Node.prototype);\n\nfunction treeRoot(root) {\n var tree = new TreeNode(root, 0),\n node,\n nodes = [tree],\n child,\n children,\n i,\n n;\n\n while (node = nodes.pop()) {\n if (children = node._.children) {\n node.children = new Array(n = children.length);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new TreeNode(children[i], i));\n child.parent = node;\n }\n }\n }\n\n (tree.parent = new TreeNode(null, 0)).children = [tree];\n return tree;\n}\n\n// Node-link tree diagram using the Reingold-Tilford \"tidy\" algorithm\nexport default function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n i, n = nodes.length,\n sum, sums = new Array(n + 1);\n\n for (sums[0] = sum = i = 0; i < n; ++i) {\n sums[i + 1] = sum += nodes[i].value;\n }\n\n partition(0, n, parent.value, x0, y0, x1, y1);\n\n function partition(i, j, value, x0, y0, x1, y1) {\n if (i >= j - 1) {\n var node = nodes[i];\n node.x0 = x0, node.y0 = y0;\n node.x1 = x1, node.y1 = y1;\n return;\n }\n\n var valueOffset = sums[i],\n valueTarget = (value / 2) + valueOffset,\n k = i + 1,\n hi = j - 1;\n\n while (k < hi) {\n var mid = k + hi >>> 1;\n if (sums[mid] < valueTarget) k = mid + 1;\n else hi = mid;\n }\n\n if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k;\n\n var valueLeft = sums[k] - valueOffset,\n valueRight = value - valueLeft;\n\n if ((x1 - x0) > (y1 - y0)) {\n var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1;\n partition(i, k, valueLeft, x0, y0, xk, y1);\n partition(k, j, valueRight, xk, y0, x1, y1);\n } else {\n var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1;\n partition(i, k, valueLeft, x0, y0, x1, yk);\n partition(k, j, valueRight, x0, yk, x1, y1);\n }\n }\n}\n","import dice from \"./dice.js\";\nimport slice from \"./slice.js\";\n\nexport default function(parent, x0, y0, x1, y1) {\n (parent.depth & 1 ? slice : dice)(parent, x0, y0, x1, y1);\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\nimport {phi, squarifyRatio} from \"./squarify.js\";\n\nexport default (function custom(ratio) {\n\n function resquarify(parent, x0, y0, x1, y1) {\n if ((rows = parent._squarify) && (rows.ratio === ratio)) {\n var rows,\n row,\n nodes,\n i,\n j = -1,\n n,\n m = rows.length,\n value = parent.value;\n\n while (++j < m) {\n row = rows[j], nodes = row.children;\n for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);\n value -= row.value;\n }\n } else {\n parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);\n rows.ratio = ratio;\n }\n }\n\n resquarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return resquarify;\n})(phi);\n","export {default as cluster} from \"./cluster.js\";\nexport {default as hierarchy} from \"./hierarchy/index.js\";\nexport {default as pack} from \"./pack/index.js\";\nexport {default as packSiblings} from \"./pack/siblings.js\";\nexport {default as packEnclose} from \"./pack/enclose.js\";\nexport {default as partition} from \"./partition.js\";\nexport {default as stratify} from \"./stratify.js\";\nexport {default as tree} from \"./tree.js\";\nexport {default as treemap} from \"./treemap/index.js\";\nexport {default as treemapBinary} from \"./treemap/binary.js\";\nexport {default as treemapDice} from \"./treemap/dice.js\";\nexport {default as treemapSlice} from \"./treemap/slice.js\";\nexport {default as treemapSliceDice} from \"./treemap/sliceDice.js\";\nexport {default as treemapSquarify} from \"./treemap/squarify.js\";\nexport {default as treemapResquarify} from \"./treemap/resquarify.js\";\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n var group = select.apply(this, arguments);\n return group == null ? [] : array(group);\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return this.children;\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport array from \"../array.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = array(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n enter = typeof onenter === \"function\" ? onenter(enter) : enter.append(onenter + \"\");\n if (onupdate != null) update = onupdate(update);\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(selection) {\n if (!(selection instanceof Selection)) throw new Error(\"invalid merge\");\n\n 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) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import creator from \"./creator.js\";\nimport select from \"./select.js\";\n\nexport default function(name) {\n return select(creator(name).call(document.documentElement));\n}\n","var nextId = 0;\n\nexport default function local() {\n return new Local;\n}\n\nfunction Local() {\n this._ = \"@\" + (++nextId).toString(36);\n}\n\nLocal.prototype = local.prototype = {\n constructor: Local,\n get: function(node) {\n var id = this._;\n while (!(id in node)) if (!(node = node.parentNode)) return;\n return node[id];\n },\n set: function(node, value) {\n return node[this._] = value;\n },\n remove: function(node) {\n return this._ in node && delete node[this._];\n },\n toString: function() {\n return this._;\n }\n};\n","export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n","import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n","import pointer from \"./pointer.js\";\nimport sourceEvent from \"./sourceEvent.js\";\n\nexport default function(events, node) {\n if (events.target) { // i.e., instanceof Event, not TouchList or iterable\n events = sourceEvent(events);\n if (node === undefined) node = events.currentTarget;\n events = events.touches || [events];\n }\n return Array.from(events, event => pointer(event, node));\n}\n","import array from \"./array.js\";\nimport {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([document.querySelectorAll(selector)], [document.documentElement])\n : new Selection([selector == null ? [] : array(selector)], root);\n}\n","export {default as create} from \"./create.js\";\nexport {default as creator} from \"./creator.js\";\nexport {default as local} from \"./local.js\";\nexport {default as matcher} from \"./matcher.js\";\nexport {default as namespace} from \"./namespace.js\";\nexport {default as namespaces} from \"./namespaces.js\";\nexport {default as pointer} from \"./pointer.js\";\nexport {default as pointers} from \"./pointers.js\";\nexport {default as select} from \"./select.js\";\nexport {default as selectAll} from \"./selectAll.js\";\nexport {default as selection} from \"./selection/index.js\";\nexport {default as selector} from \"./selector.js\";\nexport {default as selectorAll} from \"./selectorAll.js\";\nexport {styleValue as style} from \"./selection/style.js\";\nexport {default as window} from \"./window.js\";\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","export {default as dispatch} from \"./dispatch.js\";\n","export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {select} from \"d3-selection\";\nimport noevent from \"./noevent.js\";\n\nexport default function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, true);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, true);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n}\n\nexport function yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, true);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n","export default x => () => x;\n","export default function DragEvent(type, {\n sourceEvent,\n subject,\n target,\n identifier,\n active,\n x, y, dx, dy,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n subject: {value: subject, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n identifier: {value: identifier, enumerable: true, configurable: true},\n active: {value: active, enumerable: true, configurable: true},\n x: {value: x, enumerable: true, configurable: true},\n y: {value: y, enumerable: true, configurable: true},\n dx: {value: dx, enumerable: true, configurable: true},\n dy: {value: dy, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n\nDragEvent.prototype.on = function() {\n var value = this._.on.apply(this._, arguments);\n return value === this._ ? this : value;\n};\n","import {dispatch} from \"d3-dispatch\";\nimport {select, pointer} from \"d3-selection\";\nimport nodrag, {yesdrag} from \"./nodrag.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\nimport constant from \"./constant.js\";\nimport DragEvent from \"./event.js\";\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultContainer() {\n return this.parentNode;\n}\n\nfunction defaultSubject(event, d) {\n return d == null ? {x: event.x, y: event.y} : d;\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nexport default function() {\n var filter = defaultFilter,\n container = defaultContainer,\n subject = defaultSubject,\n touchable = defaultTouchable,\n gestures = {},\n listeners = dispatch(\"start\", \"drag\", \"end\"),\n active = 0,\n mousedownx,\n mousedowny,\n mousemoving,\n touchending,\n clickDistance2 = 0;\n\n function drag(selection) {\n selection\n .on(\"mousedown.drag\", mousedowned)\n .filter(touchable)\n .on(\"touchstart.drag\", touchstarted)\n .on(\"touchmove.drag\", touchmoved)\n .on(\"touchend.drag touchcancel.drag\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n function mousedowned(event, d) {\n if (touchending || !filter.call(this, event, d)) return;\n var gesture = beforestart(this, container.call(this, event, d), event, d, \"mouse\");\n if (!gesture) return;\n select(event.view).on(\"mousemove.drag\", mousemoved, true).on(\"mouseup.drag\", mouseupped, true);\n nodrag(event.view);\n nopropagation(event);\n mousemoving = false;\n mousedownx = event.clientX;\n mousedowny = event.clientY;\n gesture(\"start\", event);\n }\n\n function mousemoved(event) {\n noevent(event);\n if (!mousemoving) {\n var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;\n mousemoving = dx * dx + dy * dy > clickDistance2;\n }\n gestures.mouse(\"drag\", event);\n }\n\n function mouseupped(event) {\n select(event.view).on(\"mousemove.drag mouseup.drag\", null);\n yesdrag(event.view, mousemoving);\n noevent(event);\n gestures.mouse(\"end\", event);\n }\n\n function touchstarted(event, d) {\n if (!filter.call(this, event, d)) return;\n var touches = event.changedTouches,\n c = container.call(this, event, d),\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = beforestart(this, c, event, d, touches[i].identifier, touches[i])) {\n nopropagation(event);\n gesture(\"start\", event, touches[i]);\n }\n }\n }\n\n function touchmoved(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n noevent(event);\n gesture(\"drag\", event, touches[i]);\n }\n }\n }\n\n function touchended(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n nopropagation(event);\n gesture(\"end\", event, touches[i]);\n }\n }\n }\n\n function beforestart(that, container, event, d, identifier, touch) {\n var dispatch = listeners.copy(),\n p = pointer(touch || event, container), dx, dy,\n s;\n\n if ((s = subject.call(that, new DragEvent(\"beforestart\", {\n sourceEvent: event,\n target: drag,\n identifier,\n active,\n x: p[0],\n y: p[1],\n dx: 0,\n dy: 0,\n dispatch\n }), d)) == null) return;\n\n dx = s.x - p[0] || 0;\n dy = s.y - p[1] || 0;\n\n return function gesture(type, event, touch) {\n var p0 = p, n;\n switch (type) {\n case \"start\": gestures[identifier] = gesture, n = active++; break;\n case \"end\": delete gestures[identifier], --active; // nobreak\n case \"drag\": p = pointer(touch || event, container), n = active; break;\n }\n dispatch.call(\n type,\n that,\n new DragEvent(type, {\n sourceEvent: event,\n subject: s,\n target: drag,\n identifier,\n active: n,\n x: p[0] + dx,\n y: p[1] + dy,\n dx: p[0] - p0[0],\n dy: p[1] - p0[1],\n dispatch\n }),\n d\n );\n };\n }\n\n drag.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), drag) : filter;\n };\n\n drag.container = function(_) {\n return arguments.length ? (container = typeof _ === \"function\" ? _ : constant(_), drag) : container;\n };\n\n drag.subject = function(_) {\n return arguments.length ? (subject = typeof _ === \"function\" ? _ : constant(_), drag) : subject;\n };\n\n drag.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), drag) : touchable;\n };\n\n drag.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? drag : value;\n };\n\n drag.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);\n };\n\n return drag;\n}\n","export {default as drag} from \"./drag.js\";\nexport {default as dragDisable, yesdrag as dragEnable} from \"./nodrag.js\";\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(\"^rgb\\\\(\" + [reI, reI, reI] + \"\\\\)$\"),\n reRgbPercent = new RegExp(\"^rgb\\\\(\" + [reP, reP, reP] + \"\\\\)$\"),\n reRgbaInteger = new RegExp(\"^rgba\\\\(\" + [reI, reI, reI, reN] + \"\\\\)$\"),\n reRgbaPercent = new RegExp(\"^rgba\\\\(\" + [reP, reP, reP, reN] + \"\\\\)$\"),\n reHslPercent = new RegExp(\"^hsl\\\\(\" + [reN, reP, reP] + \"\\\\)$\"),\n reHslaPercent = new RegExp(\"^hsla\\\\(\" + [reN, reP, reP, reN] + \"\\\\)$\");\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy: function(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable: function() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : 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\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb: function() {\n return this;\n },\n displayable: function() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return \"#\" + hex(this.r) + hex(this.g) + hex(this.b);\n}\n\nfunction rgb_formatRgb() {\n var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));\n return (a === 1 ? \"rgb(\" : \"rgba(\")\n + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.b) || 0))\n + (a === 1 ? \")\" : \", \" + a + \")\");\n}\n\nfunction hex(value) {\n value = Math.max(0, Math.min(255, Math.round(value) || 0));\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n displayable: function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl: function() {\n var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));\n return (a === 1 ? \"hsl(\" : \"hsla(\")\n + (this.h || 0) + \", \"\n + (this.s || 0) * 100 + \"%, \"\n + (this.l || 0) * 100 + \"%\"\n + (a === 1 ? \")\" : \", \" + a + \")\");\n }\n}));\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export const radians = Math.PI / 180;\nexport const degrees = 180 / Math.PI;\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\n// https://observablehq.com/@mbostock/lab-and-rgb\nconst K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter: function(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker: function(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb: function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\nfunction hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter: function(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker: function(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb: function() {\n return hcl2lab(this).rgb();\n }\n}));\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n","export {default as color, rgb, hsl} from \"./color.js\";\nexport {default as lab, hcl, lch, gray} from \"./lab.js\";\nexport {default as cubehelix} from \"./cubehelix.js\";\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n","import {hue} from \"./color.js\";\n\nexport default function(a, b) {\n var i = hue(+a, +b);\n return function(t) {\n var x = i(t);\n return x - 360 * Math.floor(x / 360);\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","var epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\nexport default (function zoomRho(rho, rho2, rho4) {\n\n // p0 = [ux0, uy0, w0]\n // p1 = [ux1, uy1, w1]\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000 * rho / Math.SQRT2;\n\n return i;\n }\n\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n\n return zoom;\n})(Math.SQRT2, 2, 4);\n","import {hsl as colorHsl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hsl(hue) {\n return function(start, end) {\n var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hsl(hue);\nexport var hslLong = hsl(color);\n","import {lab as colorLab} from \"d3-color\";\nimport color from \"./color.js\";\n\nexport default function lab(start, end) {\n var l = color((start = colorLab(start)).l, (end = colorLab(end)).l),\n a = color(start.a, end.a),\n b = color(start.b, end.b),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n","import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n","import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n","import {default as value} from \"./value.js\";\n\nexport default function piecewise(interpolate, values) {\n if (values === undefined) values = interpolate, interpolate = value;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i](t - i);\n };\n}\n","export default function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n}\n","export {default as interpolate} from \"./value.js\";\nexport {default as interpolateArray} from \"./array.js\";\nexport {default as interpolateBasis} from \"./basis.js\";\nexport {default as interpolateBasisClosed} from \"./basisClosed.js\";\nexport {default as interpolateDate} from \"./date.js\";\nexport {default as interpolateDiscrete} from \"./discrete.js\";\nexport {default as interpolateHue} from \"./hue.js\";\nexport {default as interpolateNumber} from \"./number.js\";\nexport {default as interpolateNumberArray} from \"./numberArray.js\";\nexport {default as interpolateObject} from \"./object.js\";\nexport {default as interpolateRound} from \"./round.js\";\nexport {default as interpolateString} from \"./string.js\";\nexport {interpolateTransformCss, interpolateTransformSvg} from \"./transform/index.js\";\nexport {default as interpolateZoom} from \"./zoom.js\";\nexport {default as interpolateRgb, rgbBasis as interpolateRgbBasis, rgbBasisClosed as interpolateRgbBasisClosed} from \"./rgb.js\";\nexport {default as interpolateHsl, hslLong as interpolateHslLong} from \"./hsl.js\";\nexport {default as interpolateLab} from \"./lab.js\";\nexport {default as interpolateHcl, hclLong as interpolateHclLong} from \"./hcl.js\";\nexport {default as interpolateCubehelix, cubehelixLong as interpolateCubehelixLong} from \"./cubehelix.js\";\nexport {default as piecewise} from \"./piecewise.js\";\nexport {default as quantize} from \"./quantize.js\";\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(null, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","import {Timer, now} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer, total = delay;\n if (delay == null) return t.restart(callback, delay, time), t;\n t._restart = t.restart;\n t.restart = function(callback, delay, time) {\n delay = +delay, time = time == null ? now() : +time;\n t._restart(function tick(elapsed) {\n elapsed += total;\n t._restart(tick, total += delay, time);\n callback(elapsed);\n }, delay, time);\n }\n t.restart(callback, delay, time);\n return t;\n}\n","export {\n now,\n timer,\n timerFlush\n} from \"./timer.js\";\n\nexport {\n default as timeout\n} from \"./timeout.js\";\n\nexport {\n default as interval\n} from \"./interval.js\";\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n 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) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","export const linear = t => +t;\n","export function quadIn(t) {\n return t * t;\n}\n\nexport function quadOut(t) {\n return t * (2 - t);\n}\n\nexport function quadInOut(t) {\n return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;\n}\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","var exponent = 3;\n\nexport var polyIn = (function custom(e) {\n e = +e;\n\n function polyIn(t) {\n return Math.pow(t, e);\n }\n\n polyIn.exponent = custom;\n\n return polyIn;\n})(exponent);\n\nexport var polyOut = (function custom(e) {\n e = +e;\n\n function polyOut(t) {\n return 1 - Math.pow(1 - t, e);\n }\n\n polyOut.exponent = custom;\n\n return polyOut;\n})(exponent);\n\nexport var polyInOut = (function custom(e) {\n e = +e;\n\n function polyInOut(t) {\n return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;\n }\n\n polyInOut.exponent = custom;\n\n return polyInOut;\n})(exponent);\n","var pi = Math.PI,\n halfPi = pi / 2;\n\nexport function sinIn(t) {\n return (+t === 1) ? 1 : 1 - Math.cos(t * halfPi);\n}\n\nexport function sinOut(t) {\n return Math.sin(t * halfPi);\n}\n\nexport function sinInOut(t) {\n return (1 - Math.cos(pi * t)) / 2;\n}\n","// tpmt is two power minus ten times t scaled to [0,1]\nexport function tpmt(x) {\n return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494;\n}\n","import {tpmt} from \"./math.js\";\n\nexport function expIn(t) {\n return tpmt(1 - +t);\n}\n\nexport function expOut(t) {\n return 1 - tpmt(t);\n}\n\nexport function expInOut(t) {\n return ((t *= 2) <= 1 ? tpmt(1 - t) : 2 - tpmt(t - 1)) / 2;\n}\n","export function circleIn(t) {\n return 1 - Math.sqrt(1 - t * t);\n}\n\nexport function circleOut(t) {\n return Math.sqrt(1 - --t * t);\n}\n\nexport function circleInOut(t) {\n return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;\n}\n","var b1 = 4 / 11,\n b2 = 6 / 11,\n b3 = 8 / 11,\n b4 = 3 / 4,\n b5 = 9 / 11,\n b6 = 10 / 11,\n b7 = 15 / 16,\n b8 = 21 / 22,\n b9 = 63 / 64,\n b0 = 1 / b1 / b1;\n\nexport function bounceIn(t) {\n return 1 - bounceOut(1 - t);\n}\n\nexport function bounceOut(t) {\n 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;\n}\n\nexport function bounceInOut(t) {\n return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;\n}\n","var overshoot = 1.70158;\n\nexport var backIn = (function custom(s) {\n s = +s;\n\n function backIn(t) {\n return (t = +t) * t * (s * (t - 1) + t);\n }\n\n backIn.overshoot = custom;\n\n return backIn;\n})(overshoot);\n\nexport var backOut = (function custom(s) {\n s = +s;\n\n function backOut(t) {\n return --t * t * ((t + 1) * s + t) + 1;\n }\n\n backOut.overshoot = custom;\n\n return backOut;\n})(overshoot);\n\nexport var backInOut = (function custom(s) {\n s = +s;\n\n function backInOut(t) {\n return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;\n }\n\n backInOut.overshoot = custom;\n\n return backInOut;\n})(overshoot);\n","import {tpmt} from \"./math.js\";\n\nvar tau = 2 * Math.PI,\n amplitude = 1,\n period = 0.3;\n\nexport var elasticIn = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticIn(t) {\n return a * tpmt(-(--t)) * Math.sin((s - t) / p);\n }\n\n elasticIn.amplitude = function(a) { return custom(a, p * tau); };\n elasticIn.period = function(p) { return custom(a, p); };\n\n return elasticIn;\n})(amplitude, period);\n\nexport var elasticOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticOut(t) {\n return 1 - a * tpmt(t = +t) * Math.sin((t + s) / p);\n }\n\n elasticOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticOut.period = function(p) { return custom(a, p); };\n\n return elasticOut;\n})(amplitude, period);\n\nexport var elasticInOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticInOut(t) {\n return ((t = t * 2 - 1) < 0\n ? a * tpmt(-t) * Math.sin((s - t) / p)\n : 2 - a * tpmt(t) * Math.sin((s + t) / p)) / 2;\n }\n\n elasticInOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticInOut.period = function(p) { return custom(a, p); };\n\n return elasticInOut;\n})(amplitude, period);\n","export {\n linear as easeLinear\n} from \"./linear.js\";\n\nexport {\n quadInOut as easeQuad,\n quadIn as easeQuadIn,\n quadOut as easeQuadOut,\n quadInOut as easeQuadInOut\n} from \"./quad.js\";\n\nexport {\n cubicInOut as easeCubic,\n cubicIn as easeCubicIn,\n cubicOut as easeCubicOut,\n cubicInOut as easeCubicInOut\n} from \"./cubic.js\";\n\nexport {\n polyInOut as easePoly,\n polyIn as easePolyIn,\n polyOut as easePolyOut,\n polyInOut as easePolyInOut\n} from \"./poly.js\";\n\nexport {\n sinInOut as easeSin,\n sinIn as easeSinIn,\n sinOut as easeSinOut,\n sinInOut as easeSinInOut\n} from \"./sin.js\";\n\nexport {\n expInOut as easeExp,\n expIn as easeExpIn,\n expOut as easeExpOut,\n expInOut as easeExpInOut\n} from \"./exp.js\";\n\nexport {\n circleInOut as easeCircle,\n circleIn as easeCircleIn,\n circleOut as easeCircleOut,\n circleInOut as easeCircleInOut\n} from \"./circle.js\";\n\nexport {\n bounceOut as easeBounce,\n bounceIn as easeBounceIn,\n bounceOut as easeBounceOut,\n bounceInOut as easeBounceInOut\n} from \"./bounce.js\";\n\nexport {\n backInOut as easeBack,\n backIn as easeBackIn,\n backOut as easeBackOut,\n backInOut as easeBackInOut\n} from \"./back.js\";\n\nexport {\n elasticOut as easeElastic,\n elasticIn as easeElasticIn,\n elasticOut as easeElasticOut,\n elasticInOut as easeElasticInOut\n} from \"./elastic.js\";\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import {Transition} from \"./transition/index.js\";\nimport {SCHEDULED} from \"./transition/schedule.js\";\n\nvar root = [null];\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n i;\n\n if (schedules) {\n name = name == null ? null : name + \"\";\n for (i in schedules) {\n if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {\n return new Transition([[node]], root, name, +i);\n }\n }\n }\n\n return null;\n}\n","import \"./selection/index.js\";\nexport {default as transition} from \"./transition/index.js\";\nexport {default as active} from \"./active.js\";\nexport {default as interrupt} from \"./interrupt.js\";\n","export default x => () => x;\n","export default function ZoomEvent(type, {\n sourceEvent,\n target,\n transform,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n transform: {value: transform, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n","export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n","export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolateZoom} from \"d3-interpolate\";\nimport {select, pointer} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport ZoomEvent from \"./event.js\";\nimport {Transform, identity} from \"./transform.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\n// Ignore right-click, since that should open the context menu.\n// except for pinch-to-zoom, which is sent as a wheel+ctrlKey event\nfunction defaultFilter(event) {\n return (!event.ctrlKey || event.type === 'wheel') && !event.button;\n}\n\nfunction defaultExtent() {\n var e = this;\n if (e instanceof SVGElement) {\n e = e.ownerSVGElement || e;\n if (e.hasAttribute(\"viewBox\")) {\n e = e.viewBox.baseVal;\n return [[e.x, e.y], [e.x + e.width, e.y + e.height]];\n }\n return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];\n }\n return [[0, 0], [e.clientWidth, e.clientHeight]];\n}\n\nfunction defaultTransform() {\n return this.__zoom || identity;\n}\n\nfunction defaultWheelDelta(event) {\n return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * (event.ctrlKey ? 10 : 1);\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nfunction defaultConstrain(transform, extent, translateExtent) {\n var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],\n dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],\n dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],\n dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];\n return transform.translate(\n dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),\n dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)\n );\n}\n\nexport default function() {\n var filter = defaultFilter,\n extent = defaultExtent,\n constrain = defaultConstrain,\n wheelDelta = defaultWheelDelta,\n touchable = defaultTouchable,\n scaleExtent = [0, Infinity],\n translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],\n duration = 250,\n interpolate = interpolateZoom,\n listeners = dispatch(\"start\", \"zoom\", \"end\"),\n touchstarting,\n touchfirst,\n touchending,\n touchDelay = 500,\n wheelDelay = 150,\n clickDistance2 = 0,\n tapDistance = 10;\n\n function zoom(selection) {\n selection\n .property(\"__zoom\", defaultTransform)\n .on(\"wheel.zoom\", wheeled)\n .on(\"mousedown.zoom\", mousedowned)\n .on(\"dblclick.zoom\", dblclicked)\n .filter(touchable)\n .on(\"touchstart.zoom\", touchstarted)\n .on(\"touchmove.zoom\", touchmoved)\n .on(\"touchend.zoom touchcancel.zoom\", touchended)\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n zoom.transform = function(collection, transform, point, event) {\n var selection = collection.selection ? collection.selection() : collection;\n selection.property(\"__zoom\", defaultTransform);\n if (collection !== selection) {\n schedule(collection, transform, point, event);\n } else {\n selection.interrupt().each(function() {\n gesture(this, arguments)\n .event(event)\n .start()\n .zoom(null, typeof transform === \"function\" ? transform.apply(this, arguments) : transform)\n .end();\n });\n }\n };\n\n zoom.scaleBy = function(selection, k, p, event) {\n zoom.scaleTo(selection, function() {\n var k0 = this.__zoom.k,\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return k0 * k1;\n }, p, event);\n };\n\n zoom.scaleTo = function(selection, k, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t0 = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p,\n p1 = t0.invert(p0),\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);\n }, p, event);\n };\n\n zoom.translateBy = function(selection, x, y, event) {\n zoom.transform(selection, function() {\n return constrain(this.__zoom.translate(\n typeof x === \"function\" ? x.apply(this, arguments) : x,\n typeof y === \"function\" ? y.apply(this, arguments) : y\n ), extent.apply(this, arguments), translateExtent);\n }, null, event);\n };\n\n zoom.translateTo = function(selection, x, y, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p;\n return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(\n typeof x === \"function\" ? -x.apply(this, arguments) : -x,\n typeof y === \"function\" ? -y.apply(this, arguments) : -y\n ), e, translateExtent);\n }, p, event);\n };\n\n function scale(transform, k) {\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));\n return k === transform.k ? transform : new Transform(k, transform.x, transform.y);\n }\n\n function translate(transform, p0, p1) {\n var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;\n return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);\n }\n\n function centroid(extent) {\n return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];\n }\n\n function schedule(transition, transform, point, event) {\n transition\n .on(\"start.zoom\", function() { gesture(this, arguments).event(event).start(); })\n .on(\"interrupt.zoom end.zoom\", function() { gesture(this, arguments).event(event).end(); })\n .tween(\"zoom\", function() {\n var that = this,\n args = arguments,\n g = gesture(that, args).event(event),\n e = extent.apply(that, args),\n p = point == null ? centroid(e) : typeof point === \"function\" ? point.apply(that, args) : point,\n w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),\n a = that.__zoom,\n b = typeof transform === \"function\" ? transform.apply(that, args) : transform,\n i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));\n return function(t) {\n if (t === 1) t = b; // Avoid rounding error on end.\n else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }\n g.zoom(null, t);\n };\n });\n }\n\n function gesture(that, args, clean) {\n return (!clean && that.__zooming) || new Gesture(that, args);\n }\n\n function Gesture(that, args) {\n this.that = that;\n this.args = args;\n this.active = 0;\n this.sourceEvent = null;\n this.extent = extent.apply(that, args);\n this.taps = 0;\n }\n\n Gesture.prototype = {\n event: function(event) {\n if (event) this.sourceEvent = event;\n return this;\n },\n start: function() {\n if (++this.active === 1) {\n this.that.__zooming = this;\n this.emit(\"start\");\n }\n return this;\n },\n zoom: function(key, transform) {\n if (this.mouse && key !== \"mouse\") this.mouse[1] = transform.invert(this.mouse[0]);\n if (this.touch0 && key !== \"touch\") this.touch0[1] = transform.invert(this.touch0[0]);\n if (this.touch1 && key !== \"touch\") this.touch1[1] = transform.invert(this.touch1[0]);\n this.that.__zoom = transform;\n this.emit(\"zoom\");\n return this;\n },\n end: function() {\n if (--this.active === 0) {\n delete this.that.__zooming;\n this.emit(\"end\");\n }\n return this;\n },\n emit: function(type) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new ZoomEvent(type, {\n sourceEvent: this.sourceEvent,\n target: zoom,\n type,\n transform: this.that.__zoom,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function wheeled(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, args).event(event),\n t = this.__zoom,\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),\n p = pointer(event);\n\n // If the mouse is in the same location as before, reuse it.\n // If there were recent wheel events, reset the wheel idle timeout.\n if (g.wheel) {\n if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {\n g.mouse[1] = t.invert(g.mouse[0] = p);\n }\n clearTimeout(g.wheel);\n }\n\n // If this wheel event won’t trigger a transform change, ignore it.\n else if (t.k === k) return;\n\n // Otherwise, capture the mouse point and location at the start.\n else {\n g.mouse = [p, t.invert(p)];\n interrupt(this);\n g.start();\n }\n\n noevent(event);\n g.wheel = setTimeout(wheelidled, wheelDelay);\n g.zoom(\"mouse\", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));\n\n function wheelidled() {\n g.wheel = null;\n g.end();\n }\n }\n\n function mousedowned(event, ...args) {\n if (touchending || !filter.apply(this, arguments)) return;\n var g = gesture(this, args, true).event(event),\n v = select(event.view).on(\"mousemove.zoom\", mousemoved, true).on(\"mouseup.zoom\", mouseupped, true),\n p = pointer(event, currentTarget),\n currentTarget = event.currentTarget,\n x0 = event.clientX,\n y0 = event.clientY;\n\n dragDisable(event.view);\n nopropagation(event);\n g.mouse = [p, this.__zoom.invert(p)];\n interrupt(this);\n g.start();\n\n function mousemoved(event) {\n noevent(event);\n if (!g.moved) {\n var dx = event.clientX - x0, dy = event.clientY - y0;\n g.moved = dx * dx + dy * dy > clickDistance2;\n }\n g.event(event)\n .zoom(\"mouse\", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event, currentTarget), g.mouse[1]), g.extent, translateExtent));\n }\n\n function mouseupped(event) {\n v.on(\"mousemove.zoom mouseup.zoom\", null);\n dragEnable(event.view, g.moved);\n noevent(event);\n g.event(event).end();\n }\n }\n\n function dblclicked(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var t0 = this.__zoom,\n p0 = pointer(event.changedTouches ? event.changedTouches[0] : event, this),\n p1 = t0.invert(p0),\n k1 = t0.k * (event.shiftKey ? 0.5 : 2),\n t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent);\n\n noevent(event);\n if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0, event);\n else select(this).call(zoom.transform, t1, p0, event);\n }\n\n function touchstarted(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var touches = event.touches,\n n = touches.length,\n g = gesture(this, args, event.changedTouches.length === n).event(event),\n started, i, t, p;\n\n nopropagation(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n p = [p, this.__zoom.invert(p), t.identifier];\n if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;\n else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;\n }\n\n if (touchstarting) touchstarting = clearTimeout(touchstarting);\n\n if (started) {\n if (g.taps < 2) touchfirst = p[0], touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);\n interrupt(this);\n g.start();\n }\n }\n\n function touchmoved(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t, p, l;\n\n noevent(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;\n else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;\n }\n t = g.that.__zoom;\n if (g.touch1) {\n var p0 = g.touch0[0], l0 = g.touch0[1],\n p1 = g.touch1[0], l1 = g.touch1[1],\n dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,\n dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;\n t = scale(t, Math.sqrt(dp / dl));\n p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];\n l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];\n }\n else if (g.touch0) p = g.touch0[0], l = g.touch0[1];\n else return;\n\n g.zoom(\"touch\", constrain(translate(t, p, l), g.extent, translateExtent));\n }\n\n function touchended(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t;\n\n nopropagation(event);\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, touchDelay);\n for (i = 0; i < n; ++i) {\n t = touches[i];\n if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;\n else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;\n }\n if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;\n if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);\n else {\n g.end();\n // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.\n if (g.taps === 2) {\n t = pointer(t, this);\n if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {\n var p = select(this).on(\"dblclick.zoom\");\n if (p) p.apply(this, arguments);\n }\n }\n }\n }\n\n zoom.wheelDelta = function(_) {\n return arguments.length ? (wheelDelta = typeof _ === \"function\" ? _ : constant(+_), zoom) : wheelDelta;\n };\n\n zoom.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), zoom) : filter;\n };\n\n zoom.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), zoom) : touchable;\n };\n\n zoom.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;\n };\n\n zoom.scaleExtent = function(_) {\n return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];\n };\n\n zoom.translateExtent = function(_) {\n return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];\n };\n\n zoom.constrain = function(_) {\n return arguments.length ? (constrain = _, zoom) : constrain;\n };\n\n zoom.duration = function(_) {\n return arguments.length ? (duration = +_, zoom) : duration;\n };\n\n zoom.interpolate = function(_) {\n return arguments.length ? (interpolate = _, zoom) : interpolate;\n };\n\n zoom.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? zoom : value;\n };\n\n zoom.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);\n };\n\n zoom.tapDistance = function(_) {\n return arguments.length ? (tapDistance = +_, zoom) : tapDistance;\n };\n\n return zoom;\n}\n","export {default as zoom} from \"./zoom.js\";\nexport {default as zoomTransform, identity as zoomIdentity} from \"./transform.js\";\n","import { hierarchy, stratify, tree, treemap } from \"d3-hierarchy\";\nimport { select, selectAll } from \"d3-selection\";\nimport { zoom } from \"d3-zoom\";\n\nexport default {\n hierarchy,\n stratify,\n tree,\n treemap,\n select,\n selectAll,\n zoom,\n};\n","import { ExtendedHierarchyPointNode, ITreeConfig } from \"./typings\";\n\nexport const getAreaSize = (htmlId: string) => {\n const SVGContainer = document.querySelector(`#${htmlId}`);\n if (SVGContainer === null) {\n throw new Error(`Cannot find dom element with id:${htmlId}`);\n }\n const areaWidth = SVGContainer.clientWidth;\n const areaHeight = SVGContainer.clientHeight;\n if (areaHeight === 0 || areaWidth === 0) {\n throw new Error(\n \"The tree can't be display because the svg height or width of the container is null\"\n );\n }\n return { areaWidth, areaHeight };\n};\n\ntype Result = ExtendedHierarchyPointNode & { x0: number; y0: number };\n\nexport const getFirstDisplayedAncestor = (\n ghostNodes: ExtendedHierarchyPointNode[],\n viewableNodes: ExtendedHierarchyPointNode[],\n id: string\n): Result => {\n try {\n // @ts-ignore\n const parentNode: Result = ghostNodes.find((node) => node.id === id);\n\n // @ts-ignore\n const parentNodeId: string = parentNode.ancestors()[1].id;\n const isPresentInOldNodes = viewableNodes.some(\n (oldNode) => oldNode.id === parentNodeId\n );\n\n if (isPresentInOldNodes) {\n return parentNode.ancestors()[1];\n } else {\n return getFirstDisplayedAncestor(ghostNodes, viewableNodes, parentNodeId);\n }\n } catch (e) {\n // @ts-ignore\n return ghostNodes.find((node) => node.id === id);\n }\n};\n\nexport const setNodeLocation = (\n xPosition: number,\n yPosition: number,\n settings: ITreeConfig\n) => {\n if (settings.isHorizontal) {\n return \"translate(\" + yPosition + \",\" + xPosition + \")\";\n } else {\n return \"translate(\" + xPosition + \",\" + yPosition + \")\";\n }\n};\n\n// RefreshQueue ensures that don't run a refresh while another refresh\n// is in transition.\nexport class RefreshQueue {\n // The queue is an array that contains objects. Each object represents an\n // refresh action and only they have 2 properties:\n // {\n // callback: triggers when it's the first of queue and then it\n // becomes null to prevent that callback executes more\n // than once.\n // delayNextCallback: when callback is executed, queue will subtracts\n // milliseconds from it. When it becomes 0, the entire\n // object is destroyed (shifted) from the array and then\n // the next item (if exists) will be executed similary\n // to this.\n // }\n private static queue: Array<{\n delayNextCallback: number;\n callback: any;\n }> = [];\n\n // Contains setInterval ID\n private static runner: number;\n\n // Milliseconds of each iteration\n private static runnerSpeed: number = 100;\n\n // Developer internal magic number. Time added at end of refresh transition to\n // let DOM and d3 rest before another refresh.\n // 0 creates console and visual errors because getFirstDisplayedAncestor never\n // found the needed id and setNodeLocation receives undefined parameters.\n // Between 50 and 100 milliseconds seems enough for 10 nodes (demo example)\n private static readonly extraDelayBetweenCallbacks: number = 100;\n\n // Developer internal for debugging RefreshQueue class. Set true to see\n // console \"real time\" queue of tasks.\n // If there is a cleaner method, remove it!\n private static showQueueLog: boolean = false;\n\n // Adds one refresh action to the queue. When safe callback will be\n // triggered\n public static add(duration: number, callback: () => any) {\n this.queue.push({\n delayNextCallback: duration + this.extraDelayBetweenCallbacks,\n callback: callback,\n });\n this.log(\n this.queue.map((_) => _.delayNextCallback),\n \"<-- New task !!!\"\n );\n if (!this.runner) {\n this.runnerFunction();\n //@ts-ignore\n this.runner = setInterval(() => this.runnerFunction(), this.runnerSpeed);\n }\n }\n\n // Each this.runnerSpeed milliseconds it's executed. It stops when finish.\n private static runnerFunction() {\n if (this.queue[0]) {\n // ************************ Callback section ************************\n if (this.queue[0].callback) {\n this.log(\"Executing task, delaying next task...\");\n try {\n this.queue[0].callback();\n } catch (e) {\n console.error(e);\n } finally {\n // To prevent trigger callback more than once\n this.queue[0].callback = null;\n }\n }\n // ******************** Delay until next callback ********************\n this.queue[0].delayNextCallback -= this.runnerSpeed;\n this.log(this.queue.map((_) => _.delayNextCallback));\n if (this.queue[0].delayNextCallback <= 0) {\n this.queue.shift();\n }\n } else {\n this.log(\"No task found\");\n clearInterval(this.runner);\n this.runner = 0;\n }\n }\n\n // Print to console debug data if this.showQueueLog = true\n private static log(...msg: any) {\n if (this.showQueueLog) console.log(...msg);\n }\n}\n","// Got to import d3 two times because of an issue with Webpack/Babel with d3.event\nimport { transform } from \"typescript\";\nimport d3 from \"./d3\";\nimport { ITreeConfig } from \"./typings\";\nimport { getAreaSize } from \"./utils\";\n\nexport const initiliazeSVG = (treeConfig: ITreeConfig) => {\n const {\n htmlId,\n isHorizontal,\n hasPanAndZoom,\n hasPan,\n hasZoom,\n mainAxisNodeSpacing,\n nodeHeight,\n nodeWidth,\n marginBottom,\n marginLeft,\n marginRight,\n marginTop,\n } = treeConfig;\n const margin = {\n top: marginTop,\n right: marginRight,\n bottom: marginBottom,\n left: marginLeft,\n };\n const { areaHeight, areaWidth } = getAreaSize(treeConfig.htmlId);\n const width = areaWidth - margin.left - margin.right;\n const height = areaHeight - margin.top - margin.bottom;\n\n const svg = d3\n .select(\"#\" + htmlId)\n .append(\"svg\")\n .attr(\"width\", areaWidth)\n .attr(\"height\", areaHeight);\n\n const [allowHasPan, allowHasZoom] = getHasPanAndZoom(\n hasPanAndZoom,\n hasPan,\n hasZoom\n );\n\n if (!allowHasPan) {\n svg\n .on(\"mousedown.zoom\", null)\n .on(\"touchstart.zoom\", null)\n .on(\"touchmove.zoom\", null)\n .on(\"touchend.zoom\", null);\n }\n\n if (!allowHasZoom) {\n svg\n .on(\"wheel.zoom\", null)\n .on(\"mousewheel.zoom\", null)\n .on(\"mousemove.zoom\", null)\n .on(\"DOMMouseScroll.zoom\", null)\n .on(\"dblclick.zoom\", null);\n }\n\n // Create a G container and move it according to the Zoom Behavior attached to the main element\n const ZoomContainer = svg.append(\"g\");\n const zoom = d3.zoom().on(\"zoom\", (e) => {\n ZoomContainer.attr(\"transform\", () => e.transform);\n });\n // @ts-ignore\n svg.call(zoom);\n\n const MainG = ZoomContainer.append(\"g\").attr(\n \"transform\",\n mainAxisNodeSpacing === \"auto\"\n ? \"translate(0,0)\"\n : isHorizontal\n ? \"translate(\" +\n margin.left +\n \",\" +\n (margin.top + height / 2 - nodeHeight / 2) +\n \")\"\n : \"translate(\" +\n (margin.left + width / 2 - nodeWidth / 2) +\n \",\" +\n margin.top +\n \")\"\n );\n return MainG;\n};\n\nconst getHasPanAndZoom = (\n hasPanAndZoom?: boolean,\n hasPan?: boolean,\n hasZoom?: boolean\n): [boolean, boolean] => {\n let hasPanAndZoomResult: [boolean, boolean] = [false, false];\n if (hasPanAndZoom === true || hasPanAndZoom === false) {\n hasPanAndZoomResult = [hasPanAndZoom, hasPanAndZoom];\n }\n if (hasPan === true || hasPan === false) hasPanAndZoomResult[0] = hasPan;\n if (hasZoom === true || hasZoom === false) hasPanAndZoomResult[1] = hasZoom;\n return hasPanAndZoomResult;\n};\n","import { ITreeConfig } from \"../typings\";\n\ninterface ICoordinates {\n x: number;\n y: number;\n}\n\nexport const generateLinkLayout = (\n s: ICoordinates, // source\n d: ICoordinates, // destination\n treeConfig: ITreeConfig\n): string => {\n const { isHorizontal, nodeHeight, nodeWidth, linkShape } = treeConfig;\n if (linkShape === \"orthogonal\") {\n if (isHorizontal) {\n return `M ${s.y} ${s.x + nodeHeight / 2}\n L ${(s.y + d.y + nodeWidth) / 2} ${s.x + nodeHeight / 2}\n L ${(s.y + d.y + nodeWidth) / 2} ${d.x + nodeHeight / 2}\n ${d.y + nodeWidth} ${d.x + nodeHeight / 2}`;\n } else {\n return `M ${s.x + nodeWidth / 2} ${s.y}\n L ${s.x + nodeWidth / 2} ${(s.y + d.y + nodeHeight) / 2}\n L ${d.x + nodeWidth / 2} ${(s.y + d.y + nodeHeight) / 2}\n ${d.x + nodeWidth / 2} ${d.y + nodeHeight} `;\n }\n } else if (linkShape === \"curve\") {\n if (isHorizontal) {\n return `M ${s.y} ${s.x + nodeHeight / 2}\n L ${s.y - (s.y - d.y - nodeWidth) / 2 + 15} ${s.x + nodeHeight / 2}\n Q${s.y - (s.y - d.y - nodeWidth) / 2} ${s.x + nodeHeight / 2}\n ${s.y - (s.y - d.y - nodeWidth) / 2} ${s.x +\n nodeHeight / 2 -\n offsetPosOrNeg(s.x, d.x, 15)}\n L ${s.y - (s.y - d.y - nodeWidth) / 2} ${d.x + nodeHeight / 2}\n L ${d.y + nodeWidth} ${d.x + nodeHeight / 2}`;\n } else {\n return `M ${s.x + nodeWidth / 2} ${s.y}\n L ${s.x + nodeWidth / 2} ${s.y - (s.y - d.y - nodeHeight) / 2 + 15}\n Q${s.x + nodeWidth / 2} ${s.y - (s.y - d.y - nodeHeight) / 2}\n ${s.x + nodeWidth / 2 - offsetPosOrNeg(s.x, d.x, 15)} ${s.y -\n (s.y - d.y - nodeHeight) / 2}\n L ${d.x + nodeWidth / 2} ${s.y - (s.y - d.y - nodeHeight) / 2} \n L ${d.x + nodeWidth / 2} ${d.y + nodeHeight} `;\n }\n } else {\n if (isHorizontal) {\n return `M ${s.y} ${s.x + nodeHeight / 2}\n C ${(s.y + d.y + nodeWidth) / 2} ${s.x + nodeHeight / 2}\n ${(s.y + d.y + nodeWidth) / 2} ${d.x + nodeHeight / 2}\n ${d.y + nodeWidth} ${d.x + nodeHeight / 2}`;\n } else {\n return `M ${s.x + nodeWidth / 2} ${s.y}\n C ${s.x + nodeWidth / 2} ${(s.y + d.y + nodeHeight) / 2}\n ${d.x + nodeWidth / 2} ${(s.y + d.y + nodeHeight) / 2}\n ${d.x + nodeWidth / 2} ${d.y + nodeHeight} `;\n }\n }\n};\n\nconst offsetPosOrNeg = (val1: number, val2: number, offset: number) =>\n val1 > val2 ? offset : val1 < val2 ? -offset : 0;\n","import { HierarchyPointNode } from \"d3-hierarchy\";\nimport { BaseType, Selection } from \"d3-selection\";\nimport { ExtendedHierarchyPointNode, ITreeConfig } from \"../typings\";\nimport { getFirstDisplayedAncestor } from \"../utils\";\nimport { generateLinkLayout } from \"./draw-links\";\n\nexport const drawLinkEnter = (\n link: Selection, SVGGElement, {}>,\n settings: ITreeConfig,\n nodes: ExtendedHierarchyPointNode[],\n oldNodes: ExtendedHierarchyPointNode[]\n) =>\n link\n .enter()\n .insert(\"path\", \"g\")\n .attr(\"class\", \"link\")\n .attr(\"d\", (d: any) => {\n const firstDisplayedParentNode = getFirstDisplayedAncestor(\n nodes,\n oldNodes,\n d.id\n );\n const o = {\n x: firstDisplayedParentNode.x0,\n y: firstDisplayedParentNode.y0,\n };\n return generateLinkLayout(o, o, settings);\n })\n .attr(\"fill\", \"none\")\n .attr(\"stroke-width\", ({ data }: { data: any }) => settings.linkWidth(data))\n .attr(\"stroke\", ({ data }: { data: any }) => settings.linkColor(data));\n","import { HierarchyPointNode } from \"d3-hierarchy\";\nimport { BaseType, Selection } from \"d3-selection\";\nimport { ExtendedHierarchyPointNode, ITreeConfig } from \"../typings\";\nimport { getFirstDisplayedAncestor } from \"../utils\";\nimport { generateLinkLayout } from \"./draw-links\";\n\nexport const drawLinkExit = (\n link: Selection, SVGGElement, {}>,\n settings: ITreeConfig,\n nodes: ExtendedHierarchyPointNode[],\n oldNodes: ExtendedHierarchyPointNode[]\n) => {\n link\n .exit()\n // @ts-ignore\n .transition()\n .duration(settings.duration)\n .style(\"opacity\", 0)\n .attr(\"d\", (d: any) => {\n const firstDisplayedParentNode = getFirstDisplayedAncestor(\n oldNodes,\n nodes,\n d.id\n );\n const o = {\n x: firstDisplayedParentNode.x0,\n y: firstDisplayedParentNode.y0,\n };\n return generateLinkLayout(o, o, settings);\n })\n .remove();\n};\n","import { HierarchyPointNode } from \"d3-hierarchy\";\nimport { BaseType, Selection } from \"d3-selection\";\nimport { ITreeConfig } from \"../typings\";\nimport { generateLinkLayout } from \"./draw-links\";\n\nexport const drawLinkUpdate = (\n linkEnter: Selection, SVGGElement, {}>,\n link: Selection, SVGGElement, {}>,\n settings: ITreeConfig\n) => {\n // @ts-ignore\n const linkUpdate = linkEnter.merge(link);\n\n linkUpdate\n // @ts-ignore\n .transition()\n .duration(settings.duration)\n .attr(\"d\", (d: any) => {\n return generateLinkLayout(d, d.parent, settings);\n })\n .attr(\"fill\", \"none\")\n .attr(\"stroke-width\", ({ data }: { data: any }) => settings.linkWidth(data))\n .attr(\"stroke\", ({ data }: { data: any }) => settings.linkColor(data));\n};\n","import { BaseType, Selection } from \"d3-selection\";\nimport { ExtendedHierarchyPointNode, ITreeConfig } from \"../typings\";\nimport { getFirstDisplayedAncestor, setNodeLocation } from \"../utils\";\n\nexport const drawNodeEnter = (\n node: Selection,\n settings: ITreeConfig,\n nodes: ExtendedHierarchyPointNode[],\n oldNodes: ExtendedHierarchyPointNode[]\n) => {\n const nodeEnter = node\n .enter()\n .append(\"g\")\n .attr(\"class\", \"node\")\n .attr(\"transform\", (d: any) => {\n const firstDisplayedParentNode = getFirstDisplayedAncestor(\n nodes,\n oldNodes,\n d.id\n );\n return setNodeLocation(\n firstDisplayedParentNode.x0,\n firstDisplayedParentNode.y0,\n settings\n );\n });\n\n nodeEnter\n .append(\"foreignObject\")\n .attr(\"width\", settings.nodeWidth)\n .attr(\"height\", settings.nodeHeight);\n\n return nodeEnter;\n};\n","import { BaseType, Selection } from \"d3-selection\";\nimport { ExtendedHierarchyPointNode, ITreeConfig } from \"../typings\";\nimport { getFirstDisplayedAncestor, setNodeLocation } from \"../utils\";\n\nexport const drawNodeExit = (\n node: Selection,\n settings: ITreeConfig,\n nodes: ExtendedHierarchyPointNode[],\n oldNodes: ExtendedHierarchyPointNode[]\n) => {\n const nodeExit = node\n .exit()\n // @ts-ignore\n .transition()\n .duration(settings.duration)\n .style(\"opacity\", 0)\n .attr(\"transform\", (d: any) => {\n const firstDisplayedParentNode = getFirstDisplayedAncestor(\n oldNodes,\n nodes,\n d.id\n );\n return setNodeLocation(\n firstDisplayedParentNode.x0,\n firstDisplayedParentNode.y0,\n settings\n );\n })\n .remove();\n\n nodeExit.select(\"rect\").style(\"fill-opacity\", 1e-6);\n nodeExit.select(\"circle\").attr(\"r\", 1e-6);\n nodeExit.select(\"text\").style(\"fill-opacity\", 1e-6);\n};\n","import { BaseType, Selection } from \"d3-selection\";\nimport { ExtendedHierarchyPointNode, ITreeConfig } from \"../typings\";\n\nexport const drawNodeUpdate = (\n nodeEnter: Selection<\n SVGGElement,\n ExtendedHierarchyPointNode,\n SVGGElement,\n {}\n >,\n node: Selection,\n settings: ITreeConfig\n) => {\n // @ts-ignore\n const nodeUpdate = nodeEnter.merge(node);\n nodeUpdate\n // @ts-ignore\n .transition()\n .duration(settings.duration)\n .attr(\"transform\", (d: any) => {\n return settings.isHorizontal\n ? \"translate(\" + d.y + \",\" + d.x + \")\"\n : \"translate(\" + d.x + \",\" + d.y + \")\";\n });\n\n nodeUpdate\n .select(\"foreignObject\")\n .attr(\"width\", settings.nodeWidth)\n .attr(\"height\", settings.nodeHeight)\n .style(\"overflow\", \"visible\")\n .on(\"click\", settings.onNodeClick)\n .on(\"mouseenter\", settings.onNodeMouseEnter)\n .on(\"mouseleave\", settings.onNodeMouseLeave)\n .html((d) => settings.renderNode({ ...d, settings }));\n};\n","import { HierarchyNode } from \"d3-hierarchy\";\nimport d3 from \"./d3\";\nimport { ITreeConfig } from \"./typings\";\nimport { getAreaSize } from \"./utils\";\n\nexport const generateNestedData = (\n data: any,\n treeConfig: ITreeConfig\n): HierarchyNode => {\n const { idKey, relationnalField, hasFlatData } = treeConfig;\n return hasFlatData\n ? d3\n .stratify()\n .id((d: any) => d[idKey])\n .parentId((d: any) => d[relationnalField])(data)\n : d3.hierarchy(data, d => d[relationnalField]);\n};\n\nexport const generateBasicTreemap = (treeConfig: ITreeConfig) => {\n const { areaHeight, areaWidth } = getAreaSize(treeConfig.htmlId);\n return treeConfig.mainAxisNodeSpacing === \"auto\" && treeConfig.isHorizontal\n ? d3\n .tree()\n .size([\n areaHeight - treeConfig.nodeHeight,\n areaWidth - treeConfig.nodeWidth,\n ])\n : treeConfig.mainAxisNodeSpacing === \"auto\" && !treeConfig.isHorizontal\n ? d3\n .tree()\n .size([\n areaWidth - treeConfig.nodeWidth,\n areaHeight - treeConfig.nodeHeight,\n ])\n : treeConfig.isHorizontal === true\n ? d3\n .tree()\n .nodeSize([\n treeConfig.nodeHeight * treeConfig.secondaryAxisNodeSpacing,\n treeConfig.nodeWidth,\n ])\n : d3\n .tree()\n .nodeSize([\n treeConfig.nodeWidth * treeConfig.secondaryAxisNodeSpacing,\n treeConfig.nodeHeight,\n ]);\n};\n","import { HierarchyPointNode } from \"d3-hierarchy\";\nimport { Selection } from \"d3-selection\";\nimport { initiliazeSVG } from \"./initializeSVG\";\nimport { drawLinkEnter } from \"./links/link-enter\";\nimport { drawLinkExit } from \"./links/link-exit\";\nimport { drawLinkUpdate } from \"./links/link-update\";\nimport { drawNodeEnter } from \"./nodes/node-enter\";\nimport { drawNodeExit } from \"./nodes/node-exit\";\nimport { drawNodeUpdate } from \"./nodes/node-update\";\nimport { generateBasicTreemap, generateNestedData } from \"./prepare-data\";\nimport { ExtendedHierarchyPointNode, ITreeConfig } from \"./typings\";\nimport { RefreshQueue } from \"./utils\";\n\nexport function create(userSettings: Partial) {\n const defaultSettings: ITreeConfig = {\n htmlId: \"\",\n idKey: \"id\",\n relationnalField: \"father\",\n hasFlatData: true,\n nodeWidth: 160,\n nodeHeight: 100,\n mainAxisNodeSpacing: 300,\n renderNode: () => \"Node\",\n linkColor: () => \"#ffcc80\",\n linkWidth: () => 10,\n linkShape: \"quadraticBeziers\",\n isHorizontal: true,\n hasPanAndZoom: false,\n duration: 600,\n onNodeClick: () => undefined,\n onNodeMouseEnter: () => undefined,\n onNodeMouseLeave: () => undefined,\n marginBottom: 0,\n marginLeft: 0,\n marginRight: 0,\n marginTop: 0,\n secondaryAxisNodeSpacing: 1.25,\n };\n let settings: ITreeConfig = {\n ...defaultSettings,\n ...userSettings,\n };\n if (typeof userSettings.hasPanAndZoom !== \"undefined\") {\n console.warn(\n \"[DEPRECATED] hasPanAndZoom is deprecated and will be removed in treeviz version 3. Use hasPan and hasZoom instead\"\n );\n }\n let oldNodes: ExtendedHierarchyPointNode[] = [];\n\n function draw(\n svg: Selection,\n computedTree: HierarchyPointNode<{}>\n ) {\n const nodes = computedTree.descendants() as ExtendedHierarchyPointNode[];\n\n const links = computedTree.descendants().slice(1);\n\n const { mainAxisNodeSpacing: mainAxisNodeSpacing } = settings;\n if (mainAxisNodeSpacing !== \"auto\") {\n // Normalize for fixed-depth.\n nodes.forEach((d: any) => {\n d.y = d.depth * settings.nodeWidth * mainAxisNodeSpacing;\n });\n }\n\n nodes.forEach((currentNode: ExtendedHierarchyPointNode) => {\n const currentNodeOldPosition = oldNodes.find(\n (node) => node.id === currentNode.id\n );\n currentNode.x0 = currentNodeOldPosition\n ? currentNodeOldPosition.x0\n : currentNode.x;\n currentNode.y0 = currentNodeOldPosition\n ? currentNodeOldPosition.y0\n : currentNode.y;\n });\n\n // ****************** Nodes section ***************************\n const node = svg.selectAll(\"g.node\").data(nodes, (d: any) => {\n return d[settings.idKey];\n });\n\n const nodeEnter = drawNodeEnter(node, settings, nodes, oldNodes);\n drawNodeUpdate(nodeEnter, node, settings);\n drawNodeExit(node, settings, nodes, oldNodes);\n\n // ****************** links section ***************************\n\n const link = svg.selectAll(\"path.link\").data(links, (d: any) => {\n return d.id;\n });\n\n const linkEnter = drawLinkEnter(link, settings, nodes, oldNodes);\n drawLinkUpdate(linkEnter, link, settings);\n drawLinkExit(link, settings, nodes, oldNodes);\n\n oldNodes = [...nodes];\n }\n\n function refresh(data: any, newSettings?: Partial) {\n RefreshQueue.add(settings.duration, () => {\n if (newSettings) {\n settings = { ...settings, ...newSettings };\n }\n const nestedData = generateNestedData(data, settings);\n const treemap = generateBasicTreemap(settings);\n const computedTree = treemap(nestedData); // mutation\n\n // @ts-ignore\n draw(svg, computedTree);\n });\n }\n\n function clean(keepConfig: boolean) {\n const myNode = keepConfig\n ? document.querySelector(`#${settings.htmlId} svg g`)\n : document.querySelector(`#${settings.htmlId}`);\n if (myNode) {\n while (myNode.firstChild) {\n myNode.removeChild(myNode.firstChild);\n }\n }\n oldNodes = [];\n }\n\n const treeObject = { refresh, clean };\n\n const svg = initiliazeSVG(settings);\n return treeObject;\n}\n"]} \ No newline at end of file diff --git a/front/lib/AdminLTE/require.js b/front/lib/AdminLTE/require.js new file mode 100755 index 00000000..a4203f0d --- /dev/null +++ b/front/lib/AdminLTE/require.js @@ -0,0 +1,5 @@ +/** vim: et:ts=4:sw=4:sts=4 + * @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors. + * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE + */ +var requirejs,require,define;!function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.6",commentRegExp=/\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(e,t){return t||""}function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){var i;if(e)for(i=0;i
-
- @@ -219,8 +219,8 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
-
- @@ -235,7 +235,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
-
+
@@ -246,7 +246,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- +
@@ -269,6 +269,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) { +
@@ -278,24 +279,6 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
- - -
-
-
-
- - -
-
- -
-
-
- - -
@@ -778,28 +761,13 @@ function scrollDown() // Manage displayed columns // -------------------------------------------------------- -var columnLabels = [ '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '']; - function saveSelectedColumns () { $.get('php/server/parameters.php?action=set&expireMinutes=525600&value=['+ $('#columnsSelect').val().toString() +']¶meter=Front_Devices_Columns_Visible', function(data) { // save full order of all columns to simplify mapping later on colDisplayed = $('#columnsSelect').val(); - colDefaultOrder = ['0','1','2','3','4','5','6','7','8','9','10','12','13']; + colDefaultOrder = ['0','1','2','3','4','5','6','7','8','9','10','12','13','14']; colNewOrder = colDisplayed; @@ -823,12 +791,10 @@ function saveSelectedColumns () { // -------------------------------------------------------- function initializeSelectedColumns () { - $.get('php/server/parameters.php?action=get&expireMinutes=525600&defaultValue=[0,1,2,3,4,5,6,7,8,9,10,12,13]¶meter=Front_Devices_Columns_Visible', function(data) { + $.get('php/server/parameters.php?action=get&expireMinutes=525600&defaultValue=[0,1,2,3,4,5,6,7,8,9,10,12,13,14]¶meter=Front_Devices_Columns_Visible', function(data) { tableColumnShow = numberArrayFromString(data); - listItems = '' - for(i=0; i < tableColumnShow.length; i++) { // create the option and append to Select2 @@ -836,22 +802,9 @@ function initializeSelectedColumns () { $("#columnsSelect").append(option).trigger('change'); - - listItems += '
  • \ -
    \ -
    \ - \ - '+columnLabels[tableColumnShow[i]]+'\ -
    \ -
    \ - \ -
    \ -
    \ -
  • '; - } - - $("#columnsSelectNew").html(listItems); - + $(option).attr('eee','eee') + } + }); } @@ -861,26 +814,20 @@ function initializeSelectedColumns () { $(function () { selectEl = $('.select2').select2(); - console.log('------------') selectEl.next().children().children().children().sortable({ containment: 'parent', stop: function (event, ui) { ui.item.parent().children('[title]').each(function () { var title = $(this).attr('title'); - console.log(title) var original = $( 'option:contains(' + title + ')', selectEl ).first(); original.detach(); selectEl.append(original) }); - // selectEl.change(); + selectEl.change(); } }); }); -$( function() { - $( "#columnsSelectNew" ).sortable(); - } ); - // -------------------------------------------------------- // General initialization diff --git a/front/network.php b/front/network.php index 39426887..e055e1d0 100755 --- a/front/network.php +++ b/front/network.php @@ -24,10 +24,13 @@ + + +
    +
    - ' // _id is added so it doesn't conflict with AdminLTE tab behavior + ' // _id is added so it doesn't conflict with AdminLTE tab behavior .$icon.$node_name.' ' .$str_port.$node_badge. ' '; @@ -312,7 +315,7 @@ echo ' + + + + + + - \ No newline at end of file + // init selected (first) tab + initTab(); + + // create tree + initTree(getHierarchy()); + + // attach on-click events + attachTreeEvents(); + + + + + + diff --git a/front/php/server/devices.php b/front/php/server/devices.php index 1f13c5ac..ee263b28 100755 --- a/front/php/server/devices.php +++ b/front/php/server/devices.php @@ -584,7 +584,8 @@ function getDevicesList() { array("dev_Status", 10, -1), array("dev_MAC_full", 11, -1), array("dev_LastIP_orderable", 12, -1), - array("rowid", 13, -1) + array("rowid", 13, -1), + array("dev_Network_Node_MAC_ADDR", 14, -1) ); // get device columns order @@ -632,7 +633,8 @@ function getDevicesList() { $row['dev_Status'], $row['dev_MAC'], // MAC (hidden) formatIPlong ($row['dev_LastIP']), // IP orderable - $row['rowid'] // Rowid (hidden) + $row['rowid'], // Rowid (hidden) + $row['dev_Network_Node_MAC_ADDR'] // ); $newOrder = array(); diff --git a/front/php/templates/language/en_us.php b/front/php/templates/language/en_us.php index 8b54df2e..24a4c3e6 100755 --- a/front/php/templates/language/en_us.php +++ b/front/php/templates/language/en_us.php @@ -68,6 +68,7 @@ $lang['en_us'] = array( 'Device_TableHead_Type' => 'Type', 'Device_TableHead_Icon' => 'Icon', 'Device_TableHead_RowID' => 'Row ID', +'Device_TableHead_Parent_MAC' => 'Parent node MAC', 'Device_TableHead_Favorite' => 'Favorite', 'Device_TableHead_Group' => 'Group', 'Device_TableHead_FirstSession' => 'First Session', @@ -76,7 +77,6 @@ $lang['en_us'] = array( 'Device_TableHead_MAC' => 'MAC', 'Device_TableHead_MAC_full' => 'Full MAC', 'Device_TableHead_LastIPOrder' => 'Last IP Order', -'Device_TableHead_Rowid' => 'Rowid', 'Device_TableHead_Status' => 'Status', 'Device_Searchbox' => 'Search', 'Device_Tablelenght' => 'Show _MENU_ entries', @@ -255,8 +255,8 @@ $lang['en_us'] = array( 'Maintenance_Tools_Tab_Tools' => 'Tools', 'Maintenance_Tools_Tab_BackupRestore' => 'Backup / Restore', 'Maintenance_Tools_Tab_Logging' => 'Logs', -'Maintenance_Tool_displayed_columns_text' => 'Which columns should be displayed in the Devices page.', -'Maintenance_Tool_order_columns_text' => 'Change the order of the columns in the Devices page.', +'Maintenance_Tool_displayed_columns_text' => 'Change the order of the columns in the Devices page. (The drag-and-drop is a bit clunky, but for now workable, not a common task).', +'Maintenance_Tool_order_columns_text' => '', 'Maintenance_Tool_darkmode' => 'Toggle Modes (Dark/Light)', 'Maintenance_Tool_drag_me' => 'Drag me to reorder columns.', 'Maintenance_Tool_check_visible' => 'Uncheck to hide column.', diff --git a/front/php/templates/language/lang.php b/front/php/templates/language/lang.php old mode 100644 new mode 100755 diff --git a/front/php/templates/security.php b/front/php/templates/security.php old mode 100644 new mode 100755 diff --git a/front/php/templates/skinUI.php b/front/php/templates/skinUI.php old mode 100644 new mode 100755 diff --git a/front/php/templates/timezone.php b/front/php/templates/timezone.php old mode 100644 new mode 100755 diff --git a/front/settings.php b/front/settings.php old mode 100644 new mode 100755 diff --git a/pholus/AAtlasis - An Attack-in-Depth Analysis of multicast DNS and DNS Service Discovery_wp.pdf b/pholus/AAtlasis - An Attack-in-Depth Analysis of multicast DNS and DNS Service Discovery_wp.pdf old mode 100644 new mode 100755 diff --git a/pholus/README.md b/pholus/README.md old mode 100644 new mode 100755 diff --git a/pholus/licence.txt b/pholus/licence.txt old mode 100644 new mode 100755 diff --git a/pholus/pholus.py b/pholus/pholus.py old mode 100644 new mode 100755 diff --git a/pholus/pholus3.py b/pholus/pholus3.py old mode 100644 new mode 100755