1 line
54 KiB
JavaScript
1 line
54 KiB
JavaScript
|
|
var e={value:()=>{}};function t(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+``)||i in r||/[\s.]/.test(i))throw Error(`illegal type: `+i);r[i]=[]}return new n(r)}function n(e){this._=e}function r(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}n.prototype=t.prototype={constructor:n,on:function(e,t){var n=this._,o=r(e+``,n),s,c=-1,l=o.length;if(arguments.length<2){for(;++c<l;)if((s=(e=o[c]).type)&&(s=i(n[s],e.name)))return s;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++c<l;)if(s=(e=o[c]).type)n[s]=a(n[s],e.name,t);else if(t==null)for(s in n)n[s]=a(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new n(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function i(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function a(t,n,r){for(var i=0,a=t.length;i<a;++i)if(t[i].name===n){t[i]=e,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:n,value:r}),t}var o={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function s(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),o.hasOwnProperty(t)?{space:o[t],local:e}:e}function c(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function l(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function u(e){var t=s(e);return(t.local?l:c)(t)}function d(){}function f(e){return e==null?d:function(){return this.querySelector(e)}}function p(e){typeof e!=`function`&&(e=f(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new C(r,this._parents)}function m(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function h(){return[]}function g(e){return e==null?h:function(){return this.querySelectorAll(e)}}function _(e){return function(){return m(e.apply(this,arguments))}}function v(e){e=typeof e==`function`?_(e):g(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new C(r,i)}function y(e){return function(){return this.matches(e)}}function b(e){return function(t){return t.matches(e)}}var ee=Array.prototype.find;function te(e){return function(){return ee.call(this.children,e)}}function ne(){return this.firstElementChild}function re(e){return this.select(e==null?ne:te(typeof e==`function`?e:b(e)))}var ie=Array.prototype.filter;function ae(){return Array.from(this.children)}function oe(e){return function(){return ie.call(this.children,e)}}function se(e){return this.selectAll(e==null?ae:oe(typeof e==`function`?e:b(e)))}function ce(e){typeof e!=`function`&&(e=y(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new C(r,this._parents)}function le(e){return Array(e.length)}function ue(){return new C(this._enter||this._groups.map(le),this._parents)}function x(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}x.prototype={constructor:x,appendChild:function(e){ret
|