Total Complexity | 869 |
Complexity/F | 1.98 |
Lines of Code | 3165 |
Function Count | 440 |
Duplicated Lines | 3165 |
Ratio | 100 % |
Changes | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like demo/hill-chart.cjs.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | View Code Duplication | 'use strict'; |
|
|
|||
2 | function t(t, n) { |
||
3 | for (var e = 0; e < n.length; e++) { |
||
4 | var r = n[e]; |
||
5 | (r.enumerable = r.enumerable || !1), |
||
6 | (r.configurable = !0), |
||
7 | 'value' in r && (r.writable = !0), |
||
8 | Object.defineProperty(t, r.key, r); |
||
9 | } |
||
10 | } |
||
11 | function n(t, n, e) { |
||
12 | return ( |
||
13 | n in t |
||
14 | ? Object.defineProperty(t, n, { |
||
15 | value: e, |
||
16 | enumerable: !0, |
||
17 | configurable: !0, |
||
18 | writable: !0, |
||
19 | }) |
||
20 | : (t[n] = e), |
||
21 | t |
||
22 | ); |
||
23 | } |
||
24 | function e(t, n) { |
||
25 | var e = Object.keys(t); |
||
26 | if (Object.getOwnPropertySymbols) { |
||
27 | var r = Object.getOwnPropertySymbols(t); |
||
28 | n && |
||
29 | (r = r.filter(function (n) { |
||
30 | return Object.getOwnPropertyDescriptor(t, n).enumerable; |
||
31 | })), |
||
32 | e.push.apply(e, r); |
||
33 | } |
||
34 | return e; |
||
35 | } |
||
36 | function r(t) { |
||
37 | for (var r = 1; r < arguments.length; r++) { |
||
38 | var i = null != arguments[r] ? arguments[r] : {}; |
||
39 | r % 2 |
||
40 | ? e(Object(i), !0).forEach(function (e) { |
||
41 | n(t, e, i[e]); |
||
42 | }) |
||
43 | : Object.getOwnPropertyDescriptors |
||
44 | ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) |
||
45 | : e(Object(i)).forEach(function (n) { |
||
46 | Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(i, n)); |
||
47 | }); |
||
48 | } |
||
49 | return t; |
||
50 | } |
||
51 | function i(t) { |
||
52 | return (i = Object.setPrototypeOf |
||
53 | ? Object.getPrototypeOf |
||
54 | : function (t) { |
||
55 | return t.__proto__ || Object.getPrototypeOf(t); |
||
56 | })(t); |
||
57 | } |
||
58 | function o(t, n) { |
||
59 | return (o = |
||
60 | Object.setPrototypeOf || |
||
61 | function (t, n) { |
||
62 | return (t.__proto__ = n), t; |
||
63 | })(t, n); |
||
64 | } |
||
65 | function a(t) { |
||
66 | if (void 0 === t) |
||
67 | throw new ReferenceError( |
||
68 | "this hasn't been initialised - super() hasn't been called" |
||
69 | ); |
||
70 | return t; |
||
71 | } |
||
72 | function u(t, n) { |
||
73 | return !n || ('object' != typeof n && 'function' != typeof n) ? a(t) : n; |
||
74 | } |
||
75 | function s(t) { |
||
76 | var n = (function () { |
||
77 | if ('undefined' == typeof Reflect || !Reflect.construct) return !1; |
||
78 | if (Reflect.construct.sham) return !1; |
||
79 | if ('function' == typeof Proxy) return !0; |
||
80 | try { |
||
81 | return ( |
||
82 | Date.prototype.toString.call( |
||
83 | Reflect.construct(Date, [], function () {}) |
||
84 | ), |
||
85 | !0 |
||
86 | ); |
||
87 | } catch (t) { |
||
88 | return !1; |
||
89 | } |
||
90 | })(); |
||
91 | return function () { |
||
92 | var e, |
||
93 | r = i(t); |
||
94 | if (n) { |
||
95 | var o = i(this).constructor; |
||
96 | e = Reflect.construct(r, arguments, o); |
||
97 | } else e = r.apply(this, arguments); |
||
98 | return u(this, e); |
||
99 | }; |
||
100 | } |
||
101 | var c = (function () { |
||
102 | function t(t, n) { |
||
103 | for (var e = 0; e < n.length; e++) { |
||
104 | var r = n[e]; |
||
105 | (r.enumerable = r.enumerable || !1), |
||
106 | (r.configurable = !0), |
||
107 | 'value' in r && (r.writable = !0), |
||
108 | Object.defineProperty(t, r.key, r); |
||
109 | } |
||
110 | } |
||
111 | return function (n, e, r) { |
||
112 | return e && t(n.prototype, e), r && t(n, r), n; |
||
113 | }; |
||
114 | })(); |
||
115 | function l(t, n) { |
||
116 | if (!(t instanceof n)) |
||
117 | throw new TypeError('Cannot call a class as a function'); |
||
118 | } |
||
119 | var h = { emitDelay: 10, strictMode: !1 }, |
||
120 | f = (function () { |
||
121 | function t() { |
||
122 | var n = |
||
123 | arguments.length <= 0 || void 0 === arguments[0] ? h : arguments[0]; |
||
124 | l(this, t); |
||
125 | var e = void 0, |
||
126 | r = void 0; |
||
127 | (e = n.hasOwnProperty('emitDelay') ? n.emitDelay : h.emitDelay), |
||
128 | (this._emitDelay = e), |
||
129 | (r = n.hasOwnProperty('strictMode') ? n.strictMode : h.strictMode), |
||
130 | (this._strictMode = r), |
||
131 | (this._listeners = {}), |
||
132 | (this.events = []); |
||
133 | } |
||
134 | return ( |
||
135 | c(t, [ |
||
136 | { |
||
137 | key: '_addListenner', |
||
138 | value: function (t, n, e) { |
||
139 | if ('function' != typeof n) |
||
140 | throw TypeError('listener must be a function'); |
||
141 | -1 === this.events.indexOf(t) |
||
142 | ? ((this._listeners[t] = [{ once: e, fn: n }]), |
||
143 | this.events.push(t)) |
||
144 | : this._listeners[t].push({ once: e, fn: n }); |
||
145 | }, |
||
146 | }, |
||
147 | { |
||
148 | key: 'on', |
||
149 | value: function (t, n) { |
||
150 | this._addListenner(t, n, !1); |
||
151 | }, |
||
152 | }, |
||
153 | { |
||
154 | key: 'once', |
||
155 | value: function (t, n) { |
||
156 | this._addListenner(t, n, !0); |
||
157 | }, |
||
158 | }, |
||
159 | { |
||
160 | key: 'off', |
||
161 | value: function (t, n) { |
||
162 | var e, |
||
163 | r, |
||
164 | i = this, |
||
165 | o = this.events.indexOf(t); |
||
166 | t && |
||
167 | -1 !== o && |
||
168 | (n |
||
169 | ? ((e = []), |
||
170 | (r = i._listeners[t]).forEach(function (t, r) { |
||
171 | t.fn === n && e.unshift(r); |
||
172 | }), |
||
173 | e.forEach(function (t) { |
||
174 | r.splice(t, 1); |
||
175 | }), |
||
176 | r.length || (i.events.splice(o, 1), delete i._listeners[t])) |
||
177 | : (delete this._listeners[t], this.events.splice(o, 1))); |
||
178 | }, |
||
179 | }, |
||
180 | { |
||
181 | key: '_applyEvents', |
||
182 | value: function (t, n) { |
||
183 | var e = this._listeners[t]; |
||
184 | if (e && e.length) { |
||
185 | var r = []; |
||
186 | e.forEach(function (t, e) { |
||
187 | t.fn.apply(null, n), t.once && r.unshift(e); |
||
188 | }), |
||
189 | r.forEach(function (t) { |
||
190 | e.splice(t, 1); |
||
191 | }); |
||
192 | } else if (this._strictMode) |
||
193 | throw 'No listeners specified for event: ' + t; |
||
194 | }, |
||
195 | }, |
||
196 | { |
||
197 | key: 'emit', |
||
198 | value: function (t) { |
||
199 | for ( |
||
200 | var n = this, |
||
201 | e = arguments.length, |
||
202 | r = Array(e > 1 ? e - 1 : 0), |
||
203 | i = 1; |
||
204 | i < e; |
||
205 | i++ |
||
206 | ) |
||
207 | r[i - 1] = arguments[i]; |
||
208 | this._emitDelay |
||
209 | ? setTimeout(function () { |
||
210 | n._applyEvents.call(n, t, r); |
||
211 | }, this._emitDelay) |
||
212 | : this._applyEvents(t, r); |
||
213 | }, |
||
214 | }, |
||
215 | { |
||
216 | key: 'emitSync', |
||
217 | value: function (t) { |
||
218 | for ( |
||
219 | var n = arguments.length, e = Array(n > 1 ? n - 1 : 0), r = 1; |
||
220 | r < n; |
||
221 | r++ |
||
222 | ) |
||
223 | e[r - 1] = arguments[r]; |
||
224 | this._applyEvents(t, e); |
||
225 | }, |
||
226 | }, |
||
227 | { |
||
228 | key: 'destroy', |
||
229 | value: function () { |
||
230 | (this._listeners = {}), (this.events = []); |
||
231 | }, |
||
232 | }, |
||
233 | ]), |
||
234 | t |
||
235 | ); |
||
236 | })(), |
||
237 | p = 'http://www.w3.org/1999/xhtml', |
||
238 | d = { |
||
239 | svg: 'http://www.w3.org/2000/svg', |
||
240 | xhtml: p, |
||
241 | xlink: 'http://www.w3.org/1999/xlink', |
||
242 | xml: 'http://www.w3.org/XML/1998/namespace', |
||
243 | xmlns: 'http://www.w3.org/2000/xmlns/', |
||
244 | }; |
||
245 | function g(t) { |
||
246 | var n = (t += ''), |
||
247 | e = n.indexOf(':'); |
||
248 | return ( |
||
249 | e >= 0 && 'xmlns' !== (n = t.slice(0, e)) && (t = t.slice(e + 1)), |
||
250 | d.hasOwnProperty(n) ? { space: d[n], local: t } : t |
||
251 | ); |
||
252 | } |
||
253 | function y(t) { |
||
254 | return function () { |
||
255 | var n = this.ownerDocument, |
||
256 | e = this.namespaceURI; |
||
257 | return e === p && n.documentElement.namespaceURI === p |
||
258 | ? n.createElement(t) |
||
259 | : n.createElementNS(e, t); |
||
260 | }; |
||
261 | } |
||
262 | function v(t) { |
||
263 | return function () { |
||
264 | return this.ownerDocument.createElementNS(t.space, t.local); |
||
265 | }; |
||
266 | } |
||
267 | function m(t) { |
||
268 | var n = g(t); |
||
269 | return (n.local ? v : y)(n); |
||
270 | } |
||
271 | function _() {} |
||
272 | function w(t) { |
||
273 | return null == t |
||
274 | ? _ |
||
275 | : function () { |
||
276 | return this.querySelector(t); |
||
277 | }; |
||
278 | } |
||
279 | function x() { |
||
280 | return []; |
||
281 | } |
||
282 | function b(t) { |
||
283 | return new Array(t.length); |
||
284 | } |
||
285 | function M(t, n) { |
||
286 | (this.ownerDocument = t.ownerDocument), |
||
287 | (this.namespaceURI = t.namespaceURI), |
||
288 | (this._next = null), |
||
289 | (this._parent = t), |
||
290 | (this.__data__ = n); |
||
291 | } |
||
292 | M.prototype = { |
||
293 | constructor: M, |
||
294 | appendChild: function (t) { |
||
295 | return this._parent.insertBefore(t, this._next); |
||
296 | }, |
||
297 | insertBefore: function (t, n) { |
||
298 | return this._parent.insertBefore(t, n); |
||
299 | }, |
||
300 | querySelector: function (t) { |
||
301 | return this._parent.querySelector(t); |
||
302 | }, |
||
303 | querySelectorAll: function (t) { |
||
304 | return this._parent.querySelectorAll(t); |
||
305 | }, |
||
306 | }; |
||
307 | function k(t, n, e, r, i, o) { |
||
308 | for (var a, u = 0, s = n.length, c = o.length; u < c; ++u) |
||
309 | (a = n[u]) ? ((a.__data__ = o[u]), (r[u] = a)) : (e[u] = new M(t, o[u])); |
||
310 | for (; u < s; ++u) (a = n[u]) && (i[u] = a); |
||
311 | } |
||
312 | function N(t, n, e, r, i, o, a) { |
||
313 | var u, |
||
314 | s, |
||
315 | c, |
||
316 | l = {}, |
||
317 | h = n.length, |
||
318 | f = o.length, |
||
319 | p = new Array(h); |
||
320 | for (u = 0; u < h; ++u) |
||
321 | (s = n[u]) && |
||
322 | ((p[u] = c = '$' + a.call(s, s.__data__, u, n)), |
||
323 | c in l ? (i[u] = s) : (l[c] = s)); |
||
324 | for (u = 0; u < f; ++u) |
||
325 | (s = l[(c = '$' + a.call(t, o[u], u, o))]) |
||
326 | ? ((r[u] = s), (s.__data__ = o[u]), (l[c] = null)) |
||
327 | : (e[u] = new M(t, o[u])); |
||
328 | for (u = 0; u < h; ++u) (s = n[u]) && l[p[u]] === s && (i[u] = s); |
||
329 | } |
||
330 | function S(t, n) { |
||
331 | return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN; |
||
332 | } |
||
333 | function A(t) { |
||
334 | return function () { |
||
335 | this.removeAttribute(t); |
||
336 | }; |
||
337 | } |
||
338 | function E(t) { |
||
339 | return function () { |
||
340 | this.removeAttributeNS(t.space, t.local); |
||
341 | }; |
||
342 | } |
||
343 | function P(t, n) { |
||
344 | return function () { |
||
345 | this.setAttribute(t, n); |
||
346 | }; |
||
347 | } |
||
348 | function O(t, n) { |
||
349 | return function () { |
||
350 | this.setAttributeNS(t.space, t.local, n); |
||
351 | }; |
||
352 | } |
||
353 | function j(t, n) { |
||
354 | return function () { |
||
355 | var e = n.apply(this, arguments); |
||
356 | null == e ? this.removeAttribute(t) : this.setAttribute(t, e); |
||
357 | }; |
||
358 | } |
||
359 | function T(t, n) { |
||
360 | return function () { |
||
361 | var e = n.apply(this, arguments); |
||
362 | null == e |
||
363 | ? this.removeAttributeNS(t.space, t.local) |
||
364 | : this.setAttributeNS(t.space, t.local, e); |
||
365 | }; |
||
366 | } |
||
367 | function C(t) { |
||
368 | return ( |
||
369 | (t.ownerDocument && t.ownerDocument.defaultView) || |
||
370 | (t.document && t) || |
||
371 | t.defaultView |
||
372 | ); |
||
373 | } |
||
374 | function L(t) { |
||
375 | return function () { |
||
376 | this.style.removeProperty(t); |
||
377 | }; |
||
378 | } |
||
379 | function z(t, n, e) { |
||
380 | return function () { |
||
381 | this.style.setProperty(t, n, e); |
||
382 | }; |
||
383 | } |
||
384 | function D(t, n, e) { |
||
385 | return function () { |
||
386 | var r = n.apply(this, arguments); |
||
387 | null == r ? this.style.removeProperty(t) : this.style.setProperty(t, r, e); |
||
388 | }; |
||
389 | } |
||
390 | function q(t, n) { |
||
391 | return ( |
||
392 | t.style.getPropertyValue(n) || |
||
393 | C(t).getComputedStyle(t, null).getPropertyValue(n) |
||
394 | ); |
||
395 | } |
||
396 | function R(t) { |
||
397 | return function () { |
||
398 | delete this[t]; |
||
399 | }; |
||
400 | } |
||
401 | function H(t, n) { |
||
402 | return function () { |
||
403 | this[t] = n; |
||
404 | }; |
||
405 | } |
||
406 | function I(t, n) { |
||
407 | return function () { |
||
408 | var e = n.apply(this, arguments); |
||
409 | null == e ? delete this[t] : (this[t] = e); |
||
410 | }; |
||
411 | } |
||
412 | function V(t) { |
||
413 | return t.trim().split(/^|\s+/); |
||
414 | } |
||
415 | function $(t) { |
||
416 | return t.classList || new B(t); |
||
417 | } |
||
418 | function B(t) { |
||
419 | (this._node = t), (this._names = V(t.getAttribute('class') || '')); |
||
420 | } |
||
421 | function F(t, n) { |
||
422 | for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.add(n[r]); |
||
423 | } |
||
424 | function U(t, n) { |
||
425 | for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.remove(n[r]); |
||
426 | } |
||
427 | function X(t) { |
||
428 | return function () { |
||
429 | F(this, t); |
||
430 | }; |
||
431 | } |
||
432 | function W(t) { |
||
433 | return function () { |
||
434 | U(this, t); |
||
435 | }; |
||
436 | } |
||
437 | function Y(t, n) { |
||
438 | return function () { |
||
439 | (n.apply(this, arguments) ? F : U)(this, t); |
||
440 | }; |
||
441 | } |
||
442 | function G() { |
||
443 | this.textContent = ''; |
||
444 | } |
||
445 | function Z(t) { |
||
446 | return function () { |
||
447 | this.textContent = t; |
||
448 | }; |
||
449 | } |
||
450 | function K(t) { |
||
451 | return function () { |
||
452 | var n = t.apply(this, arguments); |
||
453 | this.textContent = null == n ? '' : n; |
||
454 | }; |
||
455 | } |
||
456 | function Q() { |
||
457 | this.innerHTML = ''; |
||
458 | } |
||
459 | function J(t) { |
||
460 | return function () { |
||
461 | this.innerHTML = t; |
||
462 | }; |
||
463 | } |
||
464 | function tt(t) { |
||
465 | return function () { |
||
466 | var n = t.apply(this, arguments); |
||
467 | this.innerHTML = null == n ? '' : n; |
||
468 | }; |
||
469 | } |
||
470 | function nt() { |
||
471 | this.nextSibling && this.parentNode.appendChild(this); |
||
472 | } |
||
473 | function et() { |
||
474 | this.previousSibling && |
||
475 | this.parentNode.insertBefore(this, this.parentNode.firstChild); |
||
476 | } |
||
477 | function rt() { |
||
478 | return null; |
||
479 | } |
||
480 | function it() { |
||
481 | var t = this.parentNode; |
||
482 | t && t.removeChild(this); |
||
483 | } |
||
484 | function ot() { |
||
485 | var t = this.cloneNode(!1), |
||
486 | n = this.parentNode; |
||
487 | return n ? n.insertBefore(t, this.nextSibling) : t; |
||
488 | } |
||
489 | function at() { |
||
490 | var t = this.cloneNode(!0), |
||
491 | n = this.parentNode; |
||
492 | return n ? n.insertBefore(t, this.nextSibling) : t; |
||
493 | } |
||
494 | B.prototype = { |
||
495 | add: function (t) { |
||
496 | this._names.indexOf(t) < 0 && |
||
497 | (this._names.push(t), |
||
498 | this._node.setAttribute('class', this._names.join(' '))); |
||
499 | }, |
||
500 | remove: function (t) { |
||
501 | var n = this._names.indexOf(t); |
||
502 | n >= 0 && |
||
503 | (this._names.splice(n, 1), |
||
504 | this._node.setAttribute('class', this._names.join(' '))); |
||
505 | }, |
||
506 | contains: function (t) { |
||
507 | return this._names.indexOf(t) >= 0; |
||
508 | }, |
||
509 | }; |
||
510 | var ut = {}, |
||
511 | st = null; |
||
512 | 'undefined' != typeof document && |
||
513 | ('onmouseenter' in document.documentElement || |
||
514 | (ut = { mouseenter: 'mouseover', mouseleave: 'mouseout' })); |
||
515 | function ct(t, n, e) { |
||
516 | return ( |
||
517 | (t = lt(t, n, e)), |
||
518 | function (n) { |
||
519 | var e = n.relatedTarget; |
||
520 | (e && (e === this || 8 & e.compareDocumentPosition(this))) || |
||
521 | t.call(this, n); |
||
522 | } |
||
523 | ); |
||
524 | } |
||
525 | function lt(t, n, e) { |
||
526 | return function (r) { |
||
527 | var i = st; |
||
528 | st = r; |
||
529 | try { |
||
530 | t.call(this, this.__data__, n, e); |
||
531 | } finally { |
||
532 | st = i; |
||
533 | } |
||
534 | }; |
||
535 | } |
||
536 | function ht(t) { |
||
537 | return t |
||
538 | .trim() |
||
539 | .split(/^|\s+/) |
||
540 | .map(function (t) { |
||
541 | var n = '', |
||
542 | e = t.indexOf('.'); |
||
543 | return ( |
||
544 | e >= 0 && ((n = t.slice(e + 1)), (t = t.slice(0, e))), |
||
545 | { type: t, name: n } |
||
546 | ); |
||
547 | }); |
||
548 | } |
||
549 | function ft(t) { |
||
550 | return function () { |
||
551 | var n = this.__on; |
||
552 | if (n) { |
||
553 | for (var e, r = 0, i = -1, o = n.length; r < o; ++r) |
||
554 | (e = n[r]), |
||
555 | (t.type && e.type !== t.type) || e.name !== t.name |
||
556 | ? (n[++i] = e) |
||
557 | : this.removeEventListener(e.type, e.listener, e.capture); |
||
558 | ++i ? (n.length = i) : delete this.__on; |
||
559 | } |
||
560 | }; |
||
561 | } |
||
562 | function pt(t, n, e) { |
||
563 | var r = ut.hasOwnProperty(t.type) ? ct : lt; |
||
564 | return function (i, o, a) { |
||
565 | var u, |
||
566 | s = this.__on, |
||
567 | c = r(n, o, a); |
||
568 | if (s) |
||
569 | for (var l = 0, h = s.length; l < h; ++l) |
||
570 | if ((u = s[l]).type === t.type && u.name === t.name) |
||
571 | return ( |
||
572 | this.removeEventListener(u.type, u.listener, u.capture), |
||
573 | this.addEventListener(u.type, (u.listener = c), (u.capture = e)), |
||
574 | void (u.value = n) |
||
575 | ); |
||
576 | this.addEventListener(t.type, c, e), |
||
577 | (u = { type: t.type, name: t.name, value: n, listener: c, capture: e }), |
||
578 | s ? s.push(u) : (this.__on = [u]); |
||
579 | }; |
||
580 | } |
||
581 | function dt(t, n, e, r) { |
||
582 | var i = st; |
||
583 | (t.sourceEvent = st), (st = t); |
||
584 | try { |
||
585 | return n.apply(e, r); |
||
586 | } finally { |
||
587 | st = i; |
||
588 | } |
||
589 | } |
||
590 | function gt(t, n, e) { |
||
591 | var r = C(t), |
||
592 | i = r.CustomEvent; |
||
593 | 'function' == typeof i |
||
594 | ? (i = new i(n, e)) |
||
595 | : ((i = r.document.createEvent('Event')), |
||
596 | e |
||
597 | ? (i.initEvent(n, e.bubbles, e.cancelable), (i.detail = e.detail)) |
||
598 | : i.initEvent(n, !1, !1)), |
||
599 | t.dispatchEvent(i); |
||
600 | } |
||
601 | function yt(t, n) { |
||
602 | return function () { |
||
603 | return gt(this, t, n); |
||
604 | }; |
||
605 | } |
||
606 | function vt(t, n) { |
||
607 | return function () { |
||
608 | return gt(this, t, n.apply(this, arguments)); |
||
609 | }; |
||
610 | } |
||
611 | var mt = [null]; |
||
612 | function _t(t, n) { |
||
613 | (this._groups = t), (this._parents = n); |
||
614 | } |
||
615 | function wt(t) { |
||
616 | return 'string' == typeof t |
||
617 | ? new _t([[document.querySelector(t)]], [document.documentElement]) |
||
618 | : new _t([[t]], mt); |
||
619 | } |
||
620 | function xt() { |
||
621 | for (var t, n = st; (t = n.sourceEvent); ) n = t; |
||
622 | return n; |
||
623 | } |
||
624 | function bt(t, n) { |
||
625 | var e = t.ownerSVGElement || t; |
||
626 | if (e.createSVGPoint) { |
||
627 | var r = e.createSVGPoint(); |
||
628 | return ( |
||
629 | (r.x = n.clientX), |
||
630 | (r.y = n.clientY), |
||
631 | [(r = r.matrixTransform(t.getScreenCTM().inverse())).x, r.y] |
||
632 | ); |
||
633 | } |
||
634 | var i = t.getBoundingClientRect(); |
||
635 | return [n.clientX - i.left - t.clientLeft, n.clientY - i.top - t.clientTop]; |
||
636 | } |
||
637 | function Mt(t) { |
||
638 | var n = xt(); |
||
639 | return n.changedTouches && (n = n.changedTouches[0]), bt(t, n); |
||
640 | } |
||
641 | function kt(t, n, e) { |
||
642 | arguments.length < 3 && ((e = n), (n = xt().changedTouches)); |
||
643 | for (var r, i = 0, o = n ? n.length : 0; i < o; ++i) |
||
644 | if ((r = n[i]).identifier === e) return bt(t, r); |
||
645 | return null; |
||
646 | } |
||
647 | function Nt(t, n) { |
||
648 | return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN; |
||
649 | } |
||
650 | _t.prototype = function () { |
||
651 | return new _t([[document.documentElement]], mt); |
||
652 | }.prototype = { |
||
653 | constructor: _t, |
||
654 | select: function (t) { |
||
655 | 'function' != typeof t && (t = w(t)); |
||
656 | for ( |
||
657 | var n = this._groups, e = n.length, r = new Array(e), i = 0; |
||
658 | i < e; |
||
659 | ++i |
||
660 | ) |
||
661 | for ( |
||
662 | var o, a, u = n[i], s = u.length, c = (r[i] = new Array(s)), l = 0; |
||
663 | l < s; |
||
664 | ++l |
||
665 | ) |
||
666 | (o = u[l]) && |
||
667 | (a = t.call(o, o.__data__, l, u)) && |
||
668 | ('__data__' in o && (a.__data__ = o.__data__), (c[l] = a)); |
||
669 | return new _t(r, this._parents); |
||
670 | }, |
||
671 | selectAll: function (t) { |
||
672 | 'function' != typeof t && |
||
673 | (t = (function (t) { |
||
674 | return null == t |
||
675 | ? x |
||
676 | : function () { |
||
677 | return this.querySelectorAll(t); |
||
678 | }; |
||
679 | })(t)); |
||
680 | for (var n = this._groups, e = n.length, r = [], i = [], o = 0; o < e; ++o) |
||
681 | for (var a, u = n[o], s = u.length, c = 0; c < s; ++c) |
||
682 | (a = u[c]) && (r.push(t.call(a, a.__data__, c, u)), i.push(a)); |
||
683 | return new _t(r, i); |
||
684 | }, |
||
685 | filter: function (t) { |
||
686 | 'function' != typeof t && |
||
687 | (t = (function (t) { |
||
688 | return function () { |
||
689 | return this.matches(t); |
||
690 | }; |
||
691 | })(t)); |
||
692 | for ( |
||
693 | var n = this._groups, e = n.length, r = new Array(e), i = 0; |
||
694 | i < e; |
||
695 | ++i |
||
696 | ) |
||
697 | for (var o, a = n[i], u = a.length, s = (r[i] = []), c = 0; c < u; ++c) |
||
698 | (o = a[c]) && t.call(o, o.__data__, c, a) && s.push(o); |
||
699 | return new _t(r, this._parents); |
||
700 | }, |
||
701 | data: function (t, n) { |
||
702 | if (!t) |
||
703 | return ( |
||
704 | (p = new Array(this.size())), |
||
705 | (c = -1), |
||
706 | this.each(function (t) { |
||
707 | p[++c] = t; |
||
708 | }), |
||
709 | p |
||
710 | ); |
||
711 | var e = n ? N : k, |
||
712 | r = this._parents, |
||
713 | i = this._groups; |
||
714 | 'function' != typeof t && |
||
715 | (t = (function (t) { |
||
716 | return function () { |
||
717 | return t; |
||
718 | }; |
||
719 | })(t)); |
||
720 | for ( |
||
721 | var o = i.length, |
||
722 | a = new Array(o), |
||
723 | u = new Array(o), |
||
724 | s = new Array(o), |
||
725 | c = 0; |
||
726 | c < o; |
||
727 | ++c |
||
728 | ) { |
||
729 | var l = r[c], |
||
730 | h = i[c], |
||
731 | f = h.length, |
||
732 | p = t.call(l, l && l.__data__, c, r), |
||
733 | d = p.length, |
||
734 | g = (u[c] = new Array(d)), |
||
735 | y = (a[c] = new Array(d)); |
||
736 | e(l, h, g, y, (s[c] = new Array(f)), p, n); |
||
737 | for (var v, m, _ = 0, w = 0; _ < d; ++_) |
||
738 | if ((v = g[_])) { |
||
739 | for (_ >= w && (w = _ + 1); !(m = y[w]) && ++w < d; ); |
||
740 | v._next = m || null; |
||
741 | } |
||
742 | } |
||
743 | return ((a = new _t(a, r))._enter = u), (a._exit = s), a; |
||
744 | }, |
||
745 | enter: function () { |
||
746 | return new _t(this._enter || this._groups.map(b), this._parents); |
||
747 | }, |
||
748 | exit: function () { |
||
749 | return new _t(this._exit || this._groups.map(b), this._parents); |
||
750 | }, |
||
751 | join: function (t, n, e) { |
||
752 | var r = this.enter(), |
||
753 | i = this, |
||
754 | o = this.exit(); |
||
755 | return ( |
||
756 | (r = 'function' == typeof t ? t(r) : r.append(t + '')), |
||
757 | null != n && (i = n(i)), |
||
758 | null == e ? o.remove() : e(o), |
||
759 | r && i ? r.merge(i).order() : i |
||
760 | ); |
||
761 | }, |
||
762 | merge: function (t) { |
||
763 | for ( |
||
764 | var n = this._groups, |
||
765 | e = t._groups, |
||
766 | r = n.length, |
||
767 | i = e.length, |
||
768 | o = Math.min(r, i), |
||
769 | a = new Array(r), |
||
770 | u = 0; |
||
771 | u < o; |
||
772 | ++u |
||
773 | ) |
||
774 | for ( |
||
775 | var s, |
||
776 | c = n[u], |
||
777 | l = e[u], |
||
778 | h = c.length, |
||
779 | f = (a[u] = new Array(h)), |
||
780 | p = 0; |
||
781 | p < h; |
||
782 | ++p |
||
783 | ) |
||
784 | (s = c[p] || l[p]) && (f[p] = s); |
||
785 | for (; u < r; ++u) a[u] = n[u]; |
||
786 | return new _t(a, this._parents); |
||
787 | }, |
||
788 | order: function () { |
||
789 | for (var t = this._groups, n = -1, e = t.length; ++n < e; ) |
||
790 | for (var r, i = t[n], o = i.length - 1, a = i[o]; --o >= 0; ) |
||
791 | (r = i[o]) && |
||
792 | (a && |
||
793 | 4 ^ r.compareDocumentPosition(a) && |
||
794 | a.parentNode.insertBefore(r, a), |
||
795 | (a = r)); |
||
796 | return this; |
||
797 | }, |
||
798 | sort: function (t) { |
||
799 | function n(n, e) { |
||
800 | return n && e ? t(n.__data__, e.__data__) : !n - !e; |
||
801 | } |
||
802 | t || (t = S); |
||
803 | for ( |
||
804 | var e = this._groups, r = e.length, i = new Array(r), o = 0; |
||
805 | o < r; |
||
806 | ++o |
||
807 | ) { |
||
808 | for ( |
||
809 | var a, u = e[o], s = u.length, c = (i[o] = new Array(s)), l = 0; |
||
810 | l < s; |
||
811 | ++l |
||
812 | ) |
||
813 | (a = u[l]) && (c[l] = a); |
||
814 | c.sort(n); |
||
815 | } |
||
816 | return new _t(i, this._parents).order(); |
||
817 | }, |
||
818 | call: function () { |
||
819 | var t = arguments[0]; |
||
820 | return (arguments[0] = this), t.apply(null, arguments), this; |
||
821 | }, |
||
822 | nodes: function () { |
||
823 | var t = new Array(this.size()), |
||
824 | n = -1; |
||
825 | return ( |
||
826 | this.each(function () { |
||
827 | t[++n] = this; |
||
828 | }), |
||
829 | t |
||
830 | ); |
||
831 | }, |
||
832 | node: function () { |
||
833 | for (var t = this._groups, n = 0, e = t.length; n < e; ++n) |
||
834 | for (var r = t[n], i = 0, o = r.length; i < o; ++i) { |
||
835 | var a = r[i]; |
||
836 | if (a) return a; |
||
837 | } |
||
838 | return null; |
||
839 | }, |
||
840 | size: function () { |
||
841 | var t = 0; |
||
842 | return ( |
||
843 | this.each(function () { |
||
844 | ++t; |
||
845 | }), |
||
846 | t |
||
847 | ); |
||
848 | }, |
||
849 | empty: function () { |
||
850 | return !this.node(); |
||
851 | }, |
||
852 | each: function (t) { |
||
853 | for (var n = this._groups, e = 0, r = n.length; e < r; ++e) |
||
854 | for (var i, o = n[e], a = 0, u = o.length; a < u; ++a) |
||
855 | (i = o[a]) && t.call(i, i.__data__, a, o); |
||
856 | return this; |
||
857 | }, |
||
858 | attr: function (t, n) { |
||
859 | var e = g(t); |
||
860 | if (arguments.length < 2) { |
||
861 | var r = this.node(); |
||
862 | return e.local ? r.getAttributeNS(e.space, e.local) : r.getAttribute(e); |
||
863 | } |
||
864 | return this.each( |
||
865 | (null == n |
||
866 | ? e.local |
||
867 | ? E |
||
868 | : A |
||
869 | : 'function' == typeof n |
||
870 | ? e.local |
||
871 | ? T |
||
872 | : j |
||
873 | : e.local |
||
874 | ? O |
||
875 | : P)(e, n) |
||
876 | ); |
||
877 | }, |
||
878 | style: function (t, n, e) { |
||
879 | return arguments.length > 1 |
||
880 | ? this.each( |
||
881 | (null == n ? L : 'function' == typeof n ? D : z)( |
||
882 | t, |
||
883 | n, |
||
884 | null == e ? '' : e |
||
885 | ) |
||
886 | ) |
||
887 | : q(this.node(), t); |
||
888 | }, |
||
889 | property: function (t, n) { |
||
890 | return arguments.length > 1 |
||
891 | ? this.each((null == n ? R : 'function' == typeof n ? I : H)(t, n)) |
||
892 | : this.node()[t]; |
||
893 | }, |
||
894 | classed: function (t, n) { |
||
895 | var e = V(t + ''); |
||
896 | if (arguments.length < 2) { |
||
897 | for (var r = $(this.node()), i = -1, o = e.length; ++i < o; ) |
||
898 | if (!r.contains(e[i])) return !1; |
||
899 | return !0; |
||
900 | } |
||
901 | return this.each(('function' == typeof n ? Y : n ? X : W)(e, n)); |
||
902 | }, |
||
903 | text: function (t) { |
||
904 | return arguments.length |
||
905 | ? this.each(null == t ? G : ('function' == typeof t ? K : Z)(t)) |
||
906 | : this.node().textContent; |
||
907 | }, |
||
908 | html: function (t) { |
||
909 | return arguments.length |
||
910 | ? this.each(null == t ? Q : ('function' == typeof t ? tt : J)(t)) |
||
911 | : this.node().innerHTML; |
||
912 | }, |
||
913 | raise: function () { |
||
914 | return this.each(nt); |
||
915 | }, |
||
916 | lower: function () { |
||
917 | return this.each(et); |
||
918 | }, |
||
919 | append: function (t) { |
||
920 | var n = 'function' == typeof t ? t : m(t); |
||
921 | return this.select(function () { |
||
922 | return this.appendChild(n.apply(this, arguments)); |
||
923 | }); |
||
924 | }, |
||
925 | insert: function (t, n) { |
||
926 | var e = 'function' == typeof t ? t : m(t), |
||
927 | r = null == n ? rt : 'function' == typeof n ? n : w(n); |
||
928 | return this.select(function () { |
||
929 | return this.insertBefore( |
||
930 | e.apply(this, arguments), |
||
931 | r.apply(this, arguments) || null |
||
932 | ); |
||
933 | }); |
||
934 | }, |
||
935 | remove: function () { |
||
936 | return this.each(it); |
||
937 | }, |
||
938 | clone: function (t) { |
||
939 | return this.select(t ? at : ot); |
||
940 | }, |
||
941 | datum: function (t) { |
||
942 | return arguments.length |
||
943 | ? this.property('__data__', t) |
||
944 | : this.node().__data__; |
||
945 | }, |
||
946 | on: function (t, n, e) { |
||
947 | var r, |
||
948 | i, |
||
949 | o = ht(t + ''), |
||
950 | a = o.length; |
||
951 | if (!(arguments.length < 2)) { |
||
952 | for (u = n ? pt : ft, null == e && (e = !1), r = 0; r < a; ++r) |
||
953 | this.each(u(o[r], n, e)); |
||
954 | return this; |
||
955 | } |
||
956 | var u = this.node().__on; |
||
957 | if (u) |
||
958 | for (var s, c = 0, l = u.length; c < l; ++c) |
||
959 | for (r = 0, s = u[c]; r < a; ++r) |
||
960 | if ((i = o[r]).type === s.type && i.name === s.name) return s.value; |
||
961 | }, |
||
962 | dispatch: function (t, n) { |
||
963 | return this.each(('function' == typeof n ? vt : yt)(t, n)); |
||
964 | }, |
||
965 | }; |
||
966 | var St, |
||
967 | At, |
||
968 | Et = (1 === (St = Nt).length && |
||
969 | ((At = St), |
||
970 | (St = function (t, n) { |
||
971 | return Nt(At(t), n); |
||
972 | })), |
||
973 | { |
||
974 | left: function (t, n, e, r) { |
||
975 | for (null == e && (e = 0), null == r && (r = t.length); e < r; ) { |
||
976 | var i = (e + r) >>> 1; |
||
977 | St(t[i], n) < 0 ? (e = i + 1) : (r = i); |
||
978 | } |
||
979 | return e; |
||
980 | }, |
||
981 | right: function (t, n, e, r) { |
||
982 | for (null == e && (e = 0), null == r && (r = t.length); e < r; ) { |
||
983 | var i = (e + r) >>> 1; |
||
984 | St(t[i], n) > 0 ? (r = i) : (e = i + 1); |
||
985 | } |
||
986 | return e; |
||
987 | }, |
||
988 | }).right; |
||
989 | var Pt = Math.sqrt(50), |
||
990 | Ot = Math.sqrt(10), |
||
991 | jt = Math.sqrt(2); |
||
992 | function Tt(t, n, e) { |
||
993 | var r = (n - t) / Math.max(0, e), |
||
994 | i = Math.floor(Math.log(r) / Math.LN10), |
||
995 | o = r / Math.pow(10, i); |
||
996 | return i >= 0 |
||
997 | ? (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1) * Math.pow(10, i) |
||
998 | : -Math.pow(10, -i) / (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1); |
||
999 | } |
||
1000 | function Ct(t, n) { |
||
1001 | switch (arguments.length) { |
||
1002 | case 0: |
||
1003 | break; |
||
1004 | case 1: |
||
1005 | this.range(t); |
||
1006 | break; |
||
1007 | default: |
||
1008 | this.range(n).domain(t); |
||
1009 | } |
||
1010 | return this; |
||
1011 | } |
||
1012 | function Lt(t, n, e) { |
||
1013 | (t.prototype = n.prototype = e), (e.constructor = t); |
||
1014 | } |
||
1015 | function zt(t, n) { |
||
1016 | var e = Object.create(t.prototype); |
||
1017 | for (var r in n) e[r] = n[r]; |
||
1018 | return e; |
||
1019 | } |
||
1020 | function Dt() {} |
||
1021 | var qt = '\\s*([+-]?\\d+)\\s*', |
||
1022 | Rt = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*', |
||
1023 | Ht = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*', |
||
1024 | It = /^#([0-9a-f]{3,8})$/, |
||
1025 | Vt = new RegExp('^rgb\\(' + [qt, qt, qt] + '\\)$'), |
||
1026 | $t = new RegExp('^rgb\\(' + [Ht, Ht, Ht] + '\\)$'), |
||
1027 | Bt = new RegExp('^rgba\\(' + [qt, qt, qt, Rt] + '\\)$'), |
||
1028 | Ft = new RegExp('^rgba\\(' + [Ht, Ht, Ht, Rt] + '\\)$'), |
||
1029 | Ut = new RegExp('^hsl\\(' + [Rt, Ht, Ht] + '\\)$'), |
||
1030 | Xt = new RegExp('^hsla\\(' + [Rt, Ht, Ht, Rt] + '\\)$'), |
||
1031 | Wt = { |
||
1032 | aliceblue: 15792383, |
||
1033 | antiquewhite: 16444375, |
||
1034 | aqua: 65535, |
||
1035 | aquamarine: 8388564, |
||
1036 | azure: 15794175, |
||
1037 | beige: 16119260, |
||
1038 | bisque: 16770244, |
||
1039 | black: 0, |
||
1040 | blanchedalmond: 16772045, |
||
1041 | blue: 255, |
||
1042 | blueviolet: 9055202, |
||
1043 | brown: 10824234, |
||
1044 | burlywood: 14596231, |
||
1045 | cadetblue: 6266528, |
||
1046 | chartreuse: 8388352, |
||
1047 | chocolate: 13789470, |
||
1048 | coral: 16744272, |
||
1049 | cornflowerblue: 6591981, |
||
1050 | cornsilk: 16775388, |
||
1051 | crimson: 14423100, |
||
1052 | cyan: 65535, |
||
1053 | darkblue: 139, |
||
1054 | darkcyan: 35723, |
||
1055 | darkgoldenrod: 12092939, |
||
1056 | darkgray: 11119017, |
||
1057 | darkgreen: 25600, |
||
1058 | darkgrey: 11119017, |
||
1059 | darkkhaki: 12433259, |
||
1060 | darkmagenta: 9109643, |
||
1061 | darkolivegreen: 5597999, |
||
1062 | darkorange: 16747520, |
||
1063 | darkorchid: 10040012, |
||
1064 | darkred: 9109504, |
||
1065 | darksalmon: 15308410, |
||
1066 | darkseagreen: 9419919, |
||
1067 | darkslateblue: 4734347, |
||
1068 | darkslategray: 3100495, |
||
1069 | darkslategrey: 3100495, |
||
1070 | darkturquoise: 52945, |
||
1071 | darkviolet: 9699539, |
||
1072 | deeppink: 16716947, |
||
1073 | deepskyblue: 49151, |
||
1074 | dimgray: 6908265, |
||
1075 | dimgrey: 6908265, |
||
1076 | dodgerblue: 2003199, |
||
1077 | firebrick: 11674146, |
||
1078 | floralwhite: 16775920, |
||
1079 | forestgreen: 2263842, |
||
1080 | fuchsia: 16711935, |
||
1081 | gainsboro: 14474460, |
||
1082 | ghostwhite: 16316671, |
||
1083 | gold: 16766720, |
||
1084 | goldenrod: 14329120, |
||
1085 | gray: 8421504, |
||
1086 | green: 32768, |
||
1087 | greenyellow: 11403055, |
||
1088 | grey: 8421504, |
||
1089 | honeydew: 15794160, |
||
1090 | hotpink: 16738740, |
||
1091 | indianred: 13458524, |
||
1092 | indigo: 4915330, |
||
1093 | ivory: 16777200, |
||
1094 | khaki: 15787660, |
||
1095 | lavender: 15132410, |
||
1096 | lavenderblush: 16773365, |
||
1097 | lawngreen: 8190976, |
||
1098 | lemonchiffon: 16775885, |
||
1099 | lightblue: 11393254, |
||
1100 | lightcoral: 15761536, |
||
1101 | lightcyan: 14745599, |
||
1102 | lightgoldenrodyellow: 16448210, |
||
1103 | lightgray: 13882323, |
||
1104 | lightgreen: 9498256, |
||
1105 | lightgrey: 13882323, |
||
1106 | lightpink: 16758465, |
||
1107 | lightsalmon: 16752762, |
||
1108 | lightseagreen: 2142890, |
||
1109 | lightskyblue: 8900346, |
||
1110 | lightslategray: 7833753, |
||
1111 | lightslategrey: 7833753, |
||
1112 | lightsteelblue: 11584734, |
||
1113 | lightyellow: 16777184, |
||
1114 | lime: 65280, |
||
1115 | limegreen: 3329330, |
||
1116 | linen: 16445670, |
||
1117 | magenta: 16711935, |
||
1118 | maroon: 8388608, |
||
1119 | mediumaquamarine: 6737322, |
||
1120 | mediumblue: 205, |
||
1121 | mediumorchid: 12211667, |
||
1122 | mediumpurple: 9662683, |
||
1123 | mediumseagreen: 3978097, |
||
1124 | mediumslateblue: 8087790, |
||
1125 | mediumspringgreen: 64154, |
||
1126 | mediumturquoise: 4772300, |
||
1127 | mediumvioletred: 13047173, |
||
1128 | midnightblue: 1644912, |
||
1129 | mintcream: 16121850, |
||
1130 | mistyrose: 16770273, |
||
1131 | moccasin: 16770229, |
||
1132 | navajowhite: 16768685, |
||
1133 | navy: 128, |
||
1134 | oldlace: 16643558, |
||
1135 | olive: 8421376, |
||
1136 | olivedrab: 7048739, |
||
1137 | orange: 16753920, |
||
1138 | orangered: 16729344, |
||
1139 | orchid: 14315734, |
||
1140 | palegoldenrod: 15657130, |
||
1141 | palegreen: 10025880, |
||
1142 | paleturquoise: 11529966, |
||
1143 | palevioletred: 14381203, |
||
1144 | papayawhip: 16773077, |
||
1145 | peachpuff: 16767673, |
||
1146 | peru: 13468991, |
||
1147 | pink: 16761035, |
||
1148 | plum: 14524637, |
||
1149 | powderblue: 11591910, |
||
1150 | purple: 8388736, |
||
1151 | rebeccapurple: 6697881, |
||
1152 | red: 16711680, |
||
1153 | rosybrown: 12357519, |
||
1154 | royalblue: 4286945, |
||
1155 | saddlebrown: 9127187, |
||
1156 | salmon: 16416882, |
||
1157 | sandybrown: 16032864, |
||
1158 | seagreen: 3050327, |
||
1159 | seashell: 16774638, |
||
1160 | sienna: 10506797, |
||
1161 | silver: 12632256, |
||
1162 | skyblue: 8900331, |
||
1163 | slateblue: 6970061, |
||
1164 | slategray: 7372944, |
||
1165 | slategrey: 7372944, |
||
1166 | snow: 16775930, |
||
1167 | springgreen: 65407, |
||
1168 | steelblue: 4620980, |
||
1169 | tan: 13808780, |
||
1170 | teal: 32896, |
||
1171 | thistle: 14204888, |
||
1172 | tomato: 16737095, |
||
1173 | turquoise: 4251856, |
||
1174 | violet: 15631086, |
||
1175 | wheat: 16113331, |
||
1176 | white: 16777215, |
||
1177 | whitesmoke: 16119285, |
||
1178 | yellow: 16776960, |
||
1179 | yellowgreen: 10145074, |
||
1180 | }; |
||
1181 | function Yt() { |
||
1182 | return this.rgb().formatHex(); |
||
1183 | } |
||
1184 | function Gt() { |
||
1185 | return this.rgb().formatRgb(); |
||
1186 | } |
||
1187 | function Zt(t) { |
||
1188 | var n, e; |
||
1189 | return ( |
||
1190 | (t = (t + '').trim().toLowerCase()), |
||
1191 | (n = It.exec(t)) |
||
1192 | ? ((e = n[1].length), |
||
1193 | (n = parseInt(n[1], 16)), |
||
1194 | 6 === e |
||
1195 | ? Kt(n) |
||
1196 | : 3 === e |
||
1197 | ? new nn( |
||
1198 | ((n >> 8) & 15) | ((n >> 4) & 240), |
||
1199 | ((n >> 4) & 15) | (240 & n), |
||
1200 | ((15 & n) << 4) | (15 & n), |
||
1201 | 1 |
||
1202 | ) |
||
1203 | : 8 === e |
||
1204 | ? Qt( |
||
1205 | (n >> 24) & 255, |
||
1206 | (n >> 16) & 255, |
||
1207 | (n >> 8) & 255, |
||
1208 | (255 & n) / 255 |
||
1209 | ) |
||
1210 | : 4 === e |
||
1211 | ? Qt( |
||
1212 | ((n >> 12) & 15) | ((n >> 8) & 240), |
||
1213 | ((n >> 8) & 15) | ((n >> 4) & 240), |
||
1214 | ((n >> 4) & 15) | (240 & n), |
||
1215 | (((15 & n) << 4) | (15 & n)) / 255 |
||
1216 | ) |
||
1217 | : null) |
||
1218 | : (n = Vt.exec(t)) |
||
1219 | ? new nn(n[1], n[2], n[3], 1) |
||
1220 | : (n = $t.exec(t)) |
||
1221 | ? new nn((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, 1) |
||
1222 | : (n = Bt.exec(t)) |
||
1223 | ? Qt(n[1], n[2], n[3], n[4]) |
||
1224 | : (n = Ft.exec(t)) |
||
1225 | ? Qt((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, n[4]) |
||
1226 | : (n = Ut.exec(t)) |
||
1227 | ? an(n[1], n[2] / 100, n[3] / 100, 1) |
||
1228 | : (n = Xt.exec(t)) |
||
1229 | ? an(n[1], n[2] / 100, n[3] / 100, n[4]) |
||
1230 | : Wt.hasOwnProperty(t) |
||
1231 | ? Kt(Wt[t]) |
||
1232 | : 'transparent' === t |
||
1233 | ? new nn(NaN, NaN, NaN, 0) |
||
1234 | : null |
||
1235 | ); |
||
1236 | } |
||
1237 | function Kt(t) { |
||
1238 | return new nn((t >> 16) & 255, (t >> 8) & 255, 255 & t, 1); |
||
1239 | } |
||
1240 | function Qt(t, n, e, r) { |
||
1241 | return r <= 0 && (t = n = e = NaN), new nn(t, n, e, r); |
||
1242 | } |
||
1243 | function Jt(t) { |
||
1244 | return ( |
||
1245 | t instanceof Dt || (t = Zt(t)), |
||
1246 | t ? new nn((t = t.rgb()).r, t.g, t.b, t.opacity) : new nn() |
||
1247 | ); |
||
1248 | } |
||
1249 | function tn(t, n, e, r) { |
||
1250 | return 1 === arguments.length ? Jt(t) : new nn(t, n, e, null == r ? 1 : r); |
||
1251 | } |
||
1252 | function nn(t, n, e, r) { |
||
1253 | (this.r = +t), (this.g = +n), (this.b = +e), (this.opacity = +r); |
||
1254 | } |
||
1255 | function en() { |
||
1256 | return '#' + on(this.r) + on(this.g) + on(this.b); |
||
1257 | } |
||
1258 | function rn() { |
||
1259 | var t = this.opacity; |
||
1260 | return ( |
||
1261 | (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t))) |
||
1262 | ? 'rgb(' |
||
1263 | : 'rgba(') + |
||
1264 | Math.max(0, Math.min(255, Math.round(this.r) || 0)) + |
||
1265 | ', ' + |
||
1266 | Math.max(0, Math.min(255, Math.round(this.g) || 0)) + |
||
1267 | ', ' + |
||
1268 | Math.max(0, Math.min(255, Math.round(this.b) || 0)) + |
||
1269 | (1 === t ? ')' : ', ' + t + ')') |
||
1270 | ); |
||
1271 | } |
||
1272 | function on(t) { |
||
1273 | return ( |
||
1274 | ((t = Math.max(0, Math.min(255, Math.round(t) || 0))) < 16 ? '0' : '') + |
||
1275 | t.toString(16) |
||
1276 | ); |
||
1277 | } |
||
1278 | function an(t, n, e, r) { |
||
1279 | return ( |
||
1280 | r <= 0 |
||
1281 | ? (t = n = e = NaN) |
||
1282 | : e <= 0 || e >= 1 |
||
1283 | ? (t = n = NaN) |
||
1284 | : n <= 0 && (t = NaN), |
||
1285 | new sn(t, n, e, r) |
||
1286 | ); |
||
1287 | } |
||
1288 | function un(t) { |
||
1289 | if (t instanceof sn) return new sn(t.h, t.s, t.l, t.opacity); |
||
1290 | if ((t instanceof Dt || (t = Zt(t)), !t)) return new sn(); |
||
1291 | if (t instanceof sn) return t; |
||
1292 | var n = (t = t.rgb()).r / 255, |
||
1293 | e = t.g / 255, |
||
1294 | r = t.b / 255, |
||
1295 | i = Math.min(n, e, r), |
||
1296 | o = Math.max(n, e, r), |
||
1297 | a = NaN, |
||
1298 | u = o - i, |
||
1299 | s = (o + i) / 2; |
||
1300 | return ( |
||
1301 | u |
||
1302 | ? ((a = |
||
1303 | n === o |
||
1304 | ? (e - r) / u + 6 * (e < r) |
||
1305 | : e === o |
||
1306 | ? (r - n) / u + 2 |
||
1307 | : (n - e) / u + 4), |
||
1308 | (u /= s < 0.5 ? o + i : 2 - o - i), |
||
1309 | (a *= 60)) |
||
1310 | : (u = s > 0 && s < 1 ? 0 : a), |
||
1311 | new sn(a, u, s, t.opacity) |
||
1312 | ); |
||
1313 | } |
||
1314 | function sn(t, n, e, r) { |
||
1315 | (this.h = +t), (this.s = +n), (this.l = +e), (this.opacity = +r); |
||
1316 | } |
||
1317 | function cn(t, n, e) { |
||
1318 | return ( |
||
1319 | 255 * |
||
1320 | (t < 60 |
||
1321 | ? n + ((e - n) * t) / 60 |
||
1322 | : t < 180 |
||
1323 | ? e |
||
1324 | : t < 240 |
||
1325 | ? n + ((e - n) * (240 - t)) / 60 |
||
1326 | : n) |
||
1327 | ); |
||
1328 | } |
||
1329 | function ln(t) { |
||
1330 | return function () { |
||
1331 | return t; |
||
1332 | }; |
||
1333 | } |
||
1334 | function hn(t) { |
||
1335 | return 1 == (t = +t) |
||
1336 | ? fn |
||
1337 | : function (n, e) { |
||
1338 | return e - n |
||
1339 | ? (function (t, n, e) { |
||
1340 | return ( |
||
1341 | (t = Math.pow(t, e)), |
||
1342 | (n = Math.pow(n, e) - t), |
||
1343 | (e = 1 / e), |
||
1344 | function (r) { |
||
1345 | return Math.pow(t + r * n, e); |
||
1346 | } |
||
1347 | ); |
||
1348 | })(n, e, t) |
||
1349 | : ln(isNaN(n) ? e : n); |
||
1350 | }; |
||
1351 | } |
||
1352 | function fn(t, n) { |
||
1353 | var e = n - t; |
||
1354 | return e |
||
1355 | ? (function (t, n) { |
||
1356 | return function (e) { |
||
1357 | return t + e * n; |
||
1358 | }; |
||
1359 | })(t, e) |
||
1360 | : ln(isNaN(t) ? n : t); |
||
1361 | } |
||
1362 | Lt(Dt, Zt, { |
||
1363 | copy: function (t) { |
||
1364 | return Object.assign(new this.constructor(), this, t); |
||
1365 | }, |
||
1366 | displayable: function () { |
||
1367 | return this.rgb().displayable(); |
||
1368 | }, |
||
1369 | hex: Yt, |
||
1370 | formatHex: Yt, |
||
1371 | formatHsl: function () { |
||
1372 | return un(this).formatHsl(); |
||
1373 | }, |
||
1374 | formatRgb: Gt, |
||
1375 | toString: Gt, |
||
1376 | }), |
||
1377 | Lt( |
||
1378 | nn, |
||
1379 | tn, |
||
1380 | zt(Dt, { |
||
1381 | brighter: function (t) { |
||
1382 | return ( |
||
1383 | (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)), |
||
1384 | new nn(this.r * t, this.g * t, this.b * t, this.opacity) |
||
1385 | ); |
||
1386 | }, |
||
1387 | darker: function (t) { |
||
1388 | return ( |
||
1389 | (t = null == t ? 0.7 : Math.pow(0.7, t)), |
||
1390 | new nn(this.r * t, this.g * t, this.b * t, this.opacity) |
||
1391 | ); |
||
1392 | }, |
||
1393 | rgb: function () { |
||
1394 | return this; |
||
1395 | }, |
||
1396 | displayable: function () { |
||
1397 | return ( |
||
1398 | -0.5 <= this.r && |
||
1399 | this.r < 255.5 && |
||
1400 | -0.5 <= this.g && |
||
1401 | this.g < 255.5 && |
||
1402 | -0.5 <= this.b && |
||
1403 | this.b < 255.5 && |
||
1404 | 0 <= this.opacity && |
||
1405 | this.opacity <= 1 |
||
1406 | ); |
||
1407 | }, |
||
1408 | hex: en, |
||
1409 | formatHex: en, |
||
1410 | formatRgb: rn, |
||
1411 | toString: rn, |
||
1412 | }) |
||
1413 | ), |
||
1414 | Lt( |
||
1415 | sn, |
||
1416 | function (t, n, e, r) { |
||
1417 | return 1 === arguments.length |
||
1418 | ? un(t) |
||
1419 | : new sn(t, n, e, null == r ? 1 : r); |
||
1420 | }, |
||
1421 | zt(Dt, { |
||
1422 | brighter: function (t) { |
||
1423 | return ( |
||
1424 | (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)), |
||
1425 | new sn(this.h, this.s, this.l * t, this.opacity) |
||
1426 | ); |
||
1427 | }, |
||
1428 | darker: function (t) { |
||
1429 | return ( |
||
1430 | (t = null == t ? 0.7 : Math.pow(0.7, t)), |
||
1431 | new sn(this.h, this.s, this.l * t, this.opacity) |
||
1432 | ); |
||
1433 | }, |
||
1434 | rgb: function () { |
||
1435 | var t = (this.h % 360) + 360 * (this.h < 0), |
||
1436 | n = isNaN(t) || isNaN(this.s) ? 0 : this.s, |
||
1437 | e = this.l, |
||
1438 | r = e + (e < 0.5 ? e : 1 - e) * n, |
||
1439 | i = 2 * e - r; |
||
1440 | return new nn( |
||
1441 | cn(t >= 240 ? t - 240 : t + 120, i, r), |
||
1442 | cn(t, i, r), |
||
1443 | cn(t < 120 ? t + 240 : t - 120, i, r), |
||
1444 | this.opacity |
||
1445 | ); |
||
1446 | }, |
||
1447 | displayable: function () { |
||
1448 | return ( |
||
1449 | ((0 <= this.s && this.s <= 1) || isNaN(this.s)) && |
||
1450 | 0 <= this.l && |
||
1451 | this.l <= 1 && |
||
1452 | 0 <= this.opacity && |
||
1453 | this.opacity <= 1 |
||
1454 | ); |
||
1455 | }, |
||
1456 | formatHsl: function () { |
||
1457 | var t = this.opacity; |
||
1458 | return ( |
||
1459 | (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t))) |
||
1460 | ? 'hsl(' |
||
1461 | : 'hsla(') + |
||
1462 | (this.h || 0) + |
||
1463 | ', ' + |
||
1464 | 100 * (this.s || 0) + |
||
1465 | '%, ' + |
||
1466 | 100 * (this.l || 0) + |
||
1467 | '%' + |
||
1468 | (1 === t ? ')' : ', ' + t + ')') |
||
1469 | ); |
||
1470 | }, |
||
1471 | }) |
||
1472 | ); |
||
1473 | var pn = (function t(n) { |
||
1474 | var e = hn(n); |
||
1475 | function r(t, n) { |
||
1476 | var r = e((t = tn(t)).r, (n = tn(n)).r), |
||
1477 | i = e(t.g, n.g), |
||
1478 | o = e(t.b, n.b), |
||
1479 | a = fn(t.opacity, n.opacity); |
||
1480 | return function (n) { |
||
1481 | return ( |
||
1482 | (t.r = r(n)), (t.g = i(n)), (t.b = o(n)), (t.opacity = a(n)), t + '' |
||
1483 | ); |
||
1484 | }; |
||
1485 | } |
||
1486 | return (r.gamma = t), r; |
||
1487 | })(1); |
||
1488 | function dn(t, n) { |
||
1489 | n || (n = []); |
||
1490 | var e, |
||
1491 | r = t ? Math.min(n.length, t.length) : 0, |
||
1492 | i = n.slice(); |
||
1493 | return function (o) { |
||
1494 | for (e = 0; e < r; ++e) i[e] = t[e] * (1 - o) + n[e] * o; |
||
1495 | return i; |
||
1496 | }; |
||
1497 | } |
||
1498 | function gn(t, n) { |
||
1499 | var e, |
||
1500 | r = n ? n.length : 0, |
||
1501 | i = t ? Math.min(r, t.length) : 0, |
||
1502 | o = new Array(i), |
||
1503 | a = new Array(r); |
||
1504 | for (e = 0; e < i; ++e) o[e] = bn(t[e], n[e]); |
||
1505 | for (; e < r; ++e) a[e] = n[e]; |
||
1506 | return function (t) { |
||
1507 | for (e = 0; e < i; ++e) a[e] = o[e](t); |
||
1508 | return a; |
||
1509 | }; |
||
1510 | } |
||
1511 | function yn(t, n) { |
||
1512 | var e = new Date(); |
||
1513 | return ( |
||
1514 | (t = +t), |
||
1515 | (n = +n), |
||
1516 | function (r) { |
||
1517 | return e.setTime(t * (1 - r) + n * r), e; |
||
1518 | } |
||
1519 | ); |
||
1520 | } |
||
1521 | function vn(t, n) { |
||
1522 | return ( |
||
1523 | (t = +t), |
||
1524 | (n = +n), |
||
1525 | function (e) { |
||
1526 | return t * (1 - e) + n * e; |
||
1527 | } |
||
1528 | ); |
||
1529 | } |
||
1530 | function mn(t, n) { |
||
1531 | var e, |
||
1532 | r = {}, |
||
1533 | i = {}; |
||
1534 | for (e in ((null !== t && 'object' == typeof t) || (t = {}), |
||
1535 | (null !== n && 'object' == typeof n) || (n = {}), |
||
1536 | n)) |
||
1537 | e in t ? (r[e] = bn(t[e], n[e])) : (i[e] = n[e]); |
||
1538 | return function (t) { |
||
1539 | for (e in r) i[e] = r[e](t); |
||
1540 | return i; |
||
1541 | }; |
||
1542 | } |
||
1543 | var _n = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, |
||
1544 | wn = new RegExp(_n.source, 'g'); |
||
1545 | function xn(t, n) { |
||
1546 | var e, |
||
1547 | r, |
||
1548 | i, |
||
1549 | o = (_n.lastIndex = wn.lastIndex = 0), |
||
1550 | a = -1, |
||
1551 | u = [], |
||
1552 | s = []; |
||
1553 | for (t += '', n += ''; (e = _n.exec(t)) && (r = wn.exec(n)); ) |
||
1554 | (i = r.index) > o && |
||
1555 | ((i = n.slice(o, i)), u[a] ? (u[a] += i) : (u[++a] = i)), |
||
1556 | (e = e[0]) === (r = r[0]) |
||
1557 | ? u[a] |
||
1558 | ? (u[a] += r) |
||
1559 | : (u[++a] = r) |
||
1560 | : ((u[++a] = null), s.push({ i: a, x: vn(e, r) })), |
||
1561 | (o = wn.lastIndex); |
||
1562 | return ( |
||
1563 | o < n.length && ((i = n.slice(o)), u[a] ? (u[a] += i) : (u[++a] = i)), |
||
1564 | u.length < 2 |
||
1565 | ? s[0] |
||
1566 | ? (function (t) { |
||
1567 | return function (n) { |
||
1568 | return t(n) + ''; |
||
1569 | }; |
||
1570 | })(s[0].x) |
||
1571 | : (function (t) { |
||
1572 | return function () { |
||
1573 | return t; |
||
1574 | }; |
||
1575 | })(n) |
||
1576 | : ((n = s.length), |
||
1577 | function (t) { |
||
1578 | for (var e, r = 0; r < n; ++r) u[(e = s[r]).i] = e.x(t); |
||
1579 | return u.join(''); |
||
1580 | }) |
||
1581 | ); |
||
1582 | } |
||
1583 | function bn(t, n) { |
||
1584 | var e, |
||
1585 | r = typeof n; |
||
1586 | return null == n || 'boolean' === r |
||
1587 | ? ln(n) |
||
1588 | : ('number' === r |
||
1589 | ? vn |
||
1590 | : 'string' === r |
||
1591 | ? (e = Zt(n)) |
||
1592 | ? ((n = e), pn) |
||
1593 | : xn |
||
1594 | : n instanceof Zt |
||
1595 | ? pn |
||
1596 | : n instanceof Date |
||
1597 | ? yn |
||
1598 | : (function (t) { |
||
1599 | return ArrayBuffer.isView(t) && !(t instanceof DataView); |
||
1600 | })(n) |
||
1601 | ? dn |
||
1602 | : Array.isArray(n) |
||
1603 | ? gn |
||
1604 | : ('function' != typeof n.valueOf && 'function' != typeof n.toString) || |
||
1605 | isNaN(n) |
||
1606 | ? mn |
||
1607 | : vn)(t, n); |
||
1608 | } |
||
1609 | function Mn(t, n) { |
||
1610 | return ( |
||
1611 | (t = +t), |
||
1612 | (n = +n), |
||
1613 | function (e) { |
||
1614 | return Math.round(t * (1 - e) + n * e); |
||
1615 | } |
||
1616 | ); |
||
1617 | } |
||
1618 | function kn(t) { |
||
1619 | return +t; |
||
1620 | } |
||
1621 | var Nn = [0, 1]; |
||
1622 | function Sn(t) { |
||
1623 | return t; |
||
1624 | } |
||
1625 | function An(t, n) { |
||
1626 | return (n -= t = +t) |
||
1627 | ? function (e) { |
||
1628 | return (e - t) / n; |
||
1629 | } |
||
1630 | : (function (t) { |
||
1631 | return function () { |
||
1632 | return t; |
||
1633 | }; |
||
1634 | })(isNaN(n) ? NaN : 0.5); |
||
1635 | } |
||
1636 | function En(t, n, e) { |
||
1637 | var r = t[0], |
||
1638 | i = t[1], |
||
1639 | o = n[0], |
||
1640 | a = n[1]; |
||
1641 | return ( |
||
1642 | i < r ? ((r = An(i, r)), (o = e(a, o))) : ((r = An(r, i)), (o = e(o, a))), |
||
1643 | function (t) { |
||
1644 | return o(r(t)); |
||
1645 | } |
||
1646 | ); |
||
1647 | } |
||
1648 | function Pn(t, n, e) { |
||
1649 | var r = Math.min(t.length, n.length) - 1, |
||
1650 | i = new Array(r), |
||
1651 | o = new Array(r), |
||
1652 | a = -1; |
||
1653 | for ( |
||
1654 | t[r] < t[0] && ((t = t.slice().reverse()), (n = n.slice().reverse())); |
||
1655 | ++a < r; |
||
1656 | |||
1657 | ) |
||
1658 | (i[a] = An(t[a], t[a + 1])), (o[a] = e(n[a], n[a + 1])); |
||
1659 | return function (n) { |
||
1660 | var e = Et(t, n, 1, r) - 1; |
||
1661 | return o[e](i[e](n)); |
||
1662 | }; |
||
1663 | } |
||
1664 | function On(t, n) { |
||
1665 | return n |
||
1666 | .domain(t.domain()) |
||
1667 | .range(t.range()) |
||
1668 | .interpolate(t.interpolate()) |
||
1669 | .clamp(t.clamp()) |
||
1670 | .unknown(t.unknown()); |
||
1671 | } |
||
1672 | function jn() { |
||
1673 | var t, |
||
1674 | n, |
||
1675 | e, |
||
1676 | r, |
||
1677 | i, |
||
1678 | o, |
||
1679 | a = Nn, |
||
1680 | u = Nn, |
||
1681 | s = bn, |
||
1682 | c = Sn; |
||
1683 | function l() { |
||
1684 | var t, |
||
1685 | n, |
||
1686 | e, |
||
1687 | s = Math.min(a.length, u.length); |
||
1688 | return ( |
||
1689 | c !== Sn && |
||
1690 | ((t = a[0]), |
||
1691 | (n = a[s - 1]), |
||
1692 | t > n && ((e = t), (t = n), (n = e)), |
||
1693 | (c = function (e) { |
||
1694 | return Math.max(t, Math.min(n, e)); |
||
1695 | })), |
||
1696 | (r = s > 2 ? Pn : En), |
||
1697 | (i = o = null), |
||
1698 | h |
||
1699 | ); |
||
1700 | } |
||
1701 | function h(n) { |
||
1702 | return isNaN((n = +n)) ? e : (i || (i = r(a.map(t), u, s)))(t(c(n))); |
||
1703 | } |
||
1704 | return ( |
||
1705 | (h.invert = function (e) { |
||
1706 | return c(n((o || (o = r(u, a.map(t), vn)))(e))); |
||
1707 | }), |
||
1708 | (h.domain = function (t) { |
||
1709 | return arguments.length ? ((a = Array.from(t, kn)), l()) : a.slice(); |
||
1710 | }), |
||
1711 | (h.range = function (t) { |
||
1712 | return arguments.length ? ((u = Array.from(t)), l()) : u.slice(); |
||
1713 | }), |
||
1714 | (h.rangeRound = function (t) { |
||
1715 | return (u = Array.from(t)), (s = Mn), l(); |
||
1716 | }), |
||
1717 | (h.clamp = function (t) { |
||
1718 | return arguments.length ? ((c = !!t || Sn), l()) : c !== Sn; |
||
1719 | }), |
||
1720 | (h.interpolate = function (t) { |
||
1721 | return arguments.length ? ((s = t), l()) : s; |
||
1722 | }), |
||
1723 | (h.unknown = function (t) { |
||
1724 | return arguments.length ? ((e = t), h) : e; |
||
1725 | }), |
||
1726 | function (e, r) { |
||
1727 | return (t = e), (n = r), l(); |
||
1728 | } |
||
1729 | ); |
||
1730 | } |
||
1731 | function Tn() { |
||
1732 | return jn()(Sn, Sn); |
||
1733 | } |
||
1734 | function Cn(t, n) { |
||
1735 | if ( |
||
1736 | (e = (t = n ? t.toExponential(n - 1) : t.toExponential()).indexOf('e')) < 0 |
||
1737 | ) |
||
1738 | return null; |
||
1739 | var e, |
||
1740 | r = t.slice(0, e); |
||
1741 | return [r.length > 1 ? r[0] + r.slice(2) : r, +t.slice(e + 1)]; |
||
1742 | } |
||
1743 | function Ln(t) { |
||
1744 | return (t = Cn(Math.abs(t))) ? t[1] : NaN; |
||
1745 | } |
||
1746 | var zn, |
||
1747 | Dn = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; |
||
1748 | function qn(t) { |
||
1749 | if (!(n = Dn.exec(t))) throw new Error('invalid format: ' + t); |
||
1750 | var n; |
||
1751 | return new Rn({ |
||
1752 | fill: n[1], |
||
1753 | align: n[2], |
||
1754 | sign: n[3], |
||
1755 | symbol: n[4], |
||
1756 | zero: n[5], |
||
1757 | width: n[6], |
||
1758 | comma: n[7], |
||
1759 | precision: n[8] && n[8].slice(1), |
||
1760 | trim: n[9], |
||
1761 | type: n[10], |
||
1762 | }); |
||
1763 | } |
||
1764 | function Rn(t) { |
||
1765 | (this.fill = void 0 === t.fill ? ' ' : t.fill + ''), |
||
1766 | (this.align = void 0 === t.align ? '>' : t.align + ''), |
||
1767 | (this.sign = void 0 === t.sign ? '-' : t.sign + ''), |
||
1768 | (this.symbol = void 0 === t.symbol ? '' : t.symbol + ''), |
||
1769 | (this.zero = !!t.zero), |
||
1770 | (this.width = void 0 === t.width ? void 0 : +t.width), |
||
1771 | (this.comma = !!t.comma), |
||
1772 | (this.precision = void 0 === t.precision ? void 0 : +t.precision), |
||
1773 | (this.trim = !!t.trim), |
||
1774 | (this.type = void 0 === t.type ? '' : t.type + ''); |
||
1775 | } |
||
1776 | function Hn(t, n) { |
||
1777 | var e = Cn(t, n); |
||
1778 | if (!e) return t + ''; |
||
1779 | var r = e[0], |
||
1780 | i = e[1]; |
||
1781 | return i < 0 |
||
1782 | ? '0.' + new Array(-i).join('0') + r |
||
1783 | : r.length > i + 1 |
||
1784 | ? r.slice(0, i + 1) + '.' + r.slice(i + 1) |
||
1785 | : r + new Array(i - r.length + 2).join('0'); |
||
1786 | } |
||
1787 | (qn.prototype = Rn.prototype), |
||
1788 | (Rn.prototype.toString = function () { |
||
1789 | return ( |
||
1790 | this.fill + |
||
1791 | this.align + |
||
1792 | this.sign + |
||
1793 | this.symbol + |
||
1794 | (this.zero ? '0' : '') + |
||
1795 | (void 0 === this.width ? '' : Math.max(1, 0 | this.width)) + |
||
1796 | (this.comma ? ',' : '') + |
||
1797 | (void 0 === this.precision ? '' : '.' + Math.max(0, 0 | this.precision)) + |
||
1798 | (this.trim ? '~' : '') + |
||
1799 | this.type |
||
1800 | ); |
||
1801 | }); |
||
1802 | var In = { |
||
1803 | '%': function (t, n) { |
||
1804 | return (100 * t).toFixed(n); |
||
1805 | }, |
||
1806 | b: function (t) { |
||
1807 | return Math.round(t).toString(2); |
||
1808 | }, |
||
1809 | c: function (t) { |
||
1810 | return t + ''; |
||
1811 | }, |
||
1812 | d: function (t) { |
||
1813 | return Math.round(t).toString(10); |
||
1814 | }, |
||
1815 | e: function (t, n) { |
||
1816 | return t.toExponential(n); |
||
1817 | }, |
||
1818 | f: function (t, n) { |
||
1819 | return t.toFixed(n); |
||
1820 | }, |
||
1821 | g: function (t, n) { |
||
1822 | return t.toPrecision(n); |
||
1823 | }, |
||
1824 | o: function (t) { |
||
1825 | return Math.round(t).toString(8); |
||
1826 | }, |
||
1827 | p: function (t, n) { |
||
1828 | return Hn(100 * t, n); |
||
1829 | }, |
||
1830 | r: Hn, |
||
1831 | s: function (t, n) { |
||
1832 | var e = Cn(t, n); |
||
1833 | if (!e) return t + ''; |
||
1834 | var r = e[0], |
||
1835 | i = e[1], |
||
1836 | o = i - (zn = 3 * Math.max(-8, Math.min(8, Math.floor(i / 3)))) + 1, |
||
1837 | a = r.length; |
||
1838 | return o === a |
||
1839 | ? r |
||
1840 | : o > a |
||
1841 | ? r + new Array(o - a + 1).join('0') |
||
1842 | : o > 0 |
||
1843 | ? r.slice(0, o) + '.' + r.slice(o) |
||
1844 | : '0.' + new Array(1 - o).join('0') + Cn(t, Math.max(0, n + o - 1))[0]; |
||
1845 | }, |
||
1846 | X: function (t) { |
||
1847 | return Math.round(t).toString(16).toUpperCase(); |
||
1848 | }, |
||
1849 | x: function (t) { |
||
1850 | return Math.round(t).toString(16); |
||
1851 | }, |
||
1852 | }; |
||
1853 | function Vn(t) { |
||
1854 | return t; |
||
1855 | } |
||
1856 | var $n, |
||
1857 | Bn, |
||
1858 | Fn, |
||
1859 | Un = Array.prototype.map, |
||
1860 | Xn = [ |
||
1861 | 'y', |
||
1862 | 'z', |
||
1863 | 'a', |
||
1864 | 'f', |
||
1865 | 'p', |
||
1866 | 'n', |
||
1867 | 'µ', |
||
1868 | 'm', |
||
1869 | '', |
||
1870 | 'k', |
||
1871 | 'M', |
||
1872 | 'G', |
||
1873 | 'T', |
||
1874 | 'P', |
||
1875 | 'E', |
||
1876 | 'Z', |
||
1877 | 'Y', |
||
1878 | ]; |
||
1879 | function Wn(t) { |
||
1880 | var n, |
||
1881 | e, |
||
1882 | r = |
||
1883 | void 0 === t.grouping || void 0 === t.thousands |
||
1884 | ? Vn |
||
1885 | : ((n = Un.call(t.grouping, Number)), |
||
1886 | (e = t.thousands + ''), |
||
1887 | function (t, r) { |
||
1888 | for ( |
||
1889 | var i = t.length, o = [], a = 0, u = n[0], s = 0; |
||
1890 | i > 0 && |
||
1891 | u > 0 && |
||
1892 | (s + u + 1 > r && (u = Math.max(1, r - s)), |
||
1893 | o.push(t.substring((i -= u), i + u)), |
||
1894 | !((s += u + 1) > r)); |
||
1895 | |||
1896 | ) |
||
1897 | u = n[(a = (a + 1) % n.length)]; |
||
1898 | return o.reverse().join(e); |
||
1899 | }), |
||
1900 | i = void 0 === t.currency ? '' : t.currency[0] + '', |
||
1901 | o = void 0 === t.currency ? '' : t.currency[1] + '', |
||
1902 | a = void 0 === t.decimal ? '.' : t.decimal + '', |
||
1903 | u = |
||
1904 | void 0 === t.numerals |
||
1905 | ? Vn |
||
1906 | : (function (t) { |
||
1907 | return function (n) { |
||
1908 | return n.replace(/[0-9]/g, function (n) { |
||
1909 | return t[+n]; |
||
1910 | }); |
||
1911 | }; |
||
1912 | })(Un.call(t.numerals, String)), |
||
1913 | s = void 0 === t.percent ? '%' : t.percent + '', |
||
1914 | c = void 0 === t.minus ? '-' : t.minus + '', |
||
1915 | l = void 0 === t.nan ? 'NaN' : t.nan + ''; |
||
1916 | function h(t) { |
||
1917 | var n = (t = qn(t)).fill, |
||
1918 | e = t.align, |
||
1919 | h = t.sign, |
||
1920 | f = t.symbol, |
||
1921 | p = t.zero, |
||
1922 | d = t.width, |
||
1923 | g = t.comma, |
||
1924 | y = t.precision, |
||
1925 | v = t.trim, |
||
1926 | m = t.type; |
||
1927 | 'n' === m |
||
1928 | ? ((g = !0), (m = 'g')) |
||
1929 | : In[m] || (void 0 === y && (y = 12), (v = !0), (m = 'g')), |
||
1930 | (p || ('0' === n && '=' === e)) && ((p = !0), (n = '0'), (e = '=')); |
||
1931 | var _ = |
||
1932 | '$' === f |
||
1933 | ? i |
||
1934 | : '#' === f && /[boxX]/.test(m) |
||
1935 | ? '0' + m.toLowerCase() |
||
1936 | : '', |
||
1937 | w = '$' === f ? o : /[%p]/.test(m) ? s : '', |
||
1938 | x = In[m], |
||
1939 | b = /[defgprs%]/.test(m); |
||
1940 | function M(t) { |
||
1941 | var i, |
||
1942 | o, |
||
1943 | s, |
||
1944 | f = _, |
||
1945 | M = w; |
||
1946 | if ('c' === m) (M = x(t) + M), (t = ''); |
||
1947 | else { |
||
1948 | var k = (t = +t) < 0 || 1 / t < 0; |
||
1949 | if ( |
||
1950 | ((t = isNaN(t) ? l : x(Math.abs(t), y)), |
||
1951 | v && |
||
1952 | (t = (function (t) { |
||
1953 | t: for (var n, e = t.length, r = 1, i = -1; r < e; ++r) |
||
1954 | switch (t[r]) { |
||
1955 | case '.': |
||
1956 | i = n = r; |
||
1957 | break; |
||
1958 | case '0': |
||
1959 | 0 === i && (i = r), (n = r); |
||
1960 | break; |
||
1961 | default: |
||
1962 | if (!+t[r]) break t; |
||
1963 | i > 0 && (i = 0); |
||
1964 | } |
||
1965 | return i > 0 ? t.slice(0, i) + t.slice(n + 1) : t; |
||
1966 | })(t)), |
||
1967 | k && 0 == +t && '+' !== h && (k = !1), |
||
1968 | (f = (k ? ('(' === h ? h : c) : '-' === h || '(' === h ? '' : h) + f), |
||
1969 | (M = |
||
1970 | ('s' === m ? Xn[8 + zn / 3] : '') + |
||
1971 | M + |
||
1972 | (k && '(' === h ? ')' : '')), |
||
1973 | b) |
||
1974 | ) |
||
1975 | for (i = -1, o = t.length; ++i < o; ) |
||
1976 | if (48 > (s = t.charCodeAt(i)) || s > 57) { |
||
1977 | (M = (46 === s ? a + t.slice(i + 1) : t.slice(i)) + M), |
||
1978 | (t = t.slice(0, i)); |
||
1979 | break; |
||
1980 | } |
||
1981 | } |
||
1982 | g && !p && (t = r(t, 1 / 0)); |
||
1983 | var N = f.length + t.length + M.length, |
||
1984 | S = N < d ? new Array(d - N + 1).join(n) : ''; |
||
1985 | switch ( |
||
1986 | (g && p && ((t = r(S + t, S.length ? d - M.length : 1 / 0)), (S = '')), |
||
1987 | e) |
||
1988 | ) { |
||
1989 | case '<': |
||
1990 | t = f + t + M + S; |
||
1991 | break; |
||
1992 | case '=': |
||
1993 | t = f + S + t + M; |
||
1994 | break; |
||
1995 | case '^': |
||
1996 | t = S.slice(0, (N = S.length >> 1)) + f + t + M + S.slice(N); |
||
1997 | break; |
||
1998 | default: |
||
1999 | t = S + f + t + M; |
||
2000 | } |
||
2001 | return u(t); |
||
2002 | } |
||
2003 | return ( |
||
2004 | (y = |
||
2005 | void 0 === y |
||
2006 | ? 6 |
||
2007 | : /[gprs]/.test(m) |
||
2008 | ? Math.max(1, Math.min(21, y)) |
||
2009 | : Math.max(0, Math.min(20, y))), |
||
2010 | (M.toString = function () { |
||
2011 | return t + ''; |
||
2012 | }), |
||
2013 | M |
||
2014 | ); |
||
2015 | } |
||
2016 | return { |
||
2017 | format: h, |
||
2018 | formatPrefix: function (t, n) { |
||
2019 | var e = h((((t = qn(t)).type = 'f'), t)), |
||
2020 | r = 3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))), |
||
2021 | i = Math.pow(10, -r), |
||
2022 | o = Xn[8 + r / 3]; |
||
2023 | return function (t) { |
||
2024 | return e(i * t) + o; |
||
2025 | }; |
||
2026 | }, |
||
2027 | }; |
||
2028 | } |
||
2029 | function Yn(t, n, e, r) { |
||
2030 | var i, |
||
2031 | o = (function (t, n, e) { |
||
2032 | var r = Math.abs(n - t) / Math.max(0, e), |
||
2033 | i = Math.pow(10, Math.floor(Math.log(r) / Math.LN10)), |
||
2034 | o = r / i; |
||
2035 | return ( |
||
2036 | o >= Pt ? (i *= 10) : o >= Ot ? (i *= 5) : o >= jt && (i *= 2), |
||
2037 | n < t ? -i : i |
||
2038 | ); |
||
2039 | })(t, n, e); |
||
2040 | switch ((r = qn(null == r ? ',f' : r)).type) { |
||
2041 | case 's': |
||
2042 | var a = Math.max(Math.abs(t), Math.abs(n)); |
||
2043 | return ( |
||
2044 | null != r.precision || |
||
2045 | isNaN( |
||
2046 | (i = (function (t, n) { |
||
2047 | return Math.max( |
||
2048 | 0, |
||
2049 | 3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))) - |
||
2050 | Ln(Math.abs(t)) |
||
2051 | ); |
||
2052 | })(o, a)) |
||
2053 | ) || |
||
2054 | (r.precision = i), |
||
2055 | Fn(r, a) |
||
2056 | ); |
||
2057 | case '': |
||
2058 | case 'e': |
||
2059 | case 'g': |
||
2060 | case 'p': |
||
2061 | case 'r': |
||
2062 | null != r.precision || |
||
2063 | isNaN( |
||
2064 | (i = (function (t, n) { |
||
2065 | return ( |
||
2066 | (t = Math.abs(t)), |
||
2067 | (n = Math.abs(n) - t), |
||
2068 | Math.max(0, Ln(n) - Ln(t)) + 1 |
||
2069 | ); |
||
2070 | })(o, Math.max(Math.abs(t), Math.abs(n)))) |
||
2071 | ) || |
||
2072 | (r.precision = i - ('e' === r.type)); |
||
2073 | break; |
||
2074 | case 'f': |
||
2075 | case '%': |
||
2076 | null != r.precision || |
||
2077 | isNaN( |
||
2078 | (i = (function (t) { |
||
2079 | return Math.max(0, -Ln(Math.abs(t))); |
||
2080 | })(o)) |
||
2081 | ) || |
||
2082 | (r.precision = i - 2 * ('%' === r.type)); |
||
2083 | } |
||
2084 | return Bn(r); |
||
2085 | } |
||
2086 | function Gn(t) { |
||
2087 | var n = t.domain; |
||
2088 | return ( |
||
2089 | (t.ticks = function (t) { |
||
2090 | var e = n(); |
||
2091 | return (function (t, n, e) { |
||
2092 | var r, |
||
2093 | i, |
||
2094 | o, |
||
2095 | a, |
||
2096 | u = -1; |
||
2097 | if (((e = +e), (t = +t) === (n = +n) && e > 0)) return [t]; |
||
2098 | if ( |
||
2099 | ((r = n < t) && ((i = t), (t = n), (n = i)), |
||
2100 | 0 === (a = Tt(t, n, e)) || !isFinite(a)) |
||
2101 | ) |
||
2102 | return []; |
||
2103 | if (a > 0) |
||
2104 | for ( |
||
2105 | t = Math.ceil(t / a), |
||
2106 | n = Math.floor(n / a), |
||
2107 | o = new Array((i = Math.ceil(n - t + 1))); |
||
2108 | ++u < i; |
||
2109 | |||
2110 | ) |
||
2111 | o[u] = (t + u) * a; |
||
2112 | else |
||
2113 | for ( |
||
2114 | t = Math.floor(t * a), |
||
2115 | n = Math.ceil(n * a), |
||
2116 | o = new Array((i = Math.ceil(t - n + 1))); |
||
2117 | ++u < i; |
||
2118 | |||
2119 | ) |
||
2120 | o[u] = (t - u) / a; |
||
2121 | return r && o.reverse(), o; |
||
2122 | })(e[0], e[e.length - 1], null == t ? 10 : t); |
||
2123 | }), |
||
2124 | (t.tickFormat = function (t, e) { |
||
2125 | var r = n(); |
||
2126 | return Yn(r[0], r[r.length - 1], null == t ? 10 : t, e); |
||
2127 | }), |
||
2128 | (t.nice = function (e) { |
||
2129 | null == e && (e = 10); |
||
2130 | var r, |
||
2131 | i = n(), |
||
2132 | o = 0, |
||
2133 | a = i.length - 1, |
||
2134 | u = i[o], |
||
2135 | s = i[a]; |
||
2136 | return ( |
||
2137 | s < u && ((r = u), (u = s), (s = r), (r = o), (o = a), (a = r)), |
||
2138 | (r = Tt(u, s, e)) > 0 |
||
2139 | ? (r = Tt((u = Math.floor(u / r) * r), (s = Math.ceil(s / r) * r), e)) |
||
2140 | : r < 0 && |
||
2141 | (r = Tt( |
||
2142 | (u = Math.ceil(u * r) / r), |
||
2143 | (s = Math.floor(s * r) / r), |
||
2144 | e |
||
2145 | )), |
||
2146 | r > 0 |
||
2147 | ? ((i[o] = Math.floor(u / r) * r), |
||
2148 | (i[a] = Math.ceil(s / r) * r), |
||
2149 | n(i)) |
||
2150 | : r < 0 && |
||
2151 | ((i[o] = Math.ceil(u * r) / r), |
||
2152 | (i[a] = Math.floor(s * r) / r), |
||
2153 | n(i)), |
||
2154 | t |
||
2155 | ); |
||
2156 | }), |
||
2157 | t |
||
2158 | ); |
||
2159 | } |
||
2160 | function Zn() { |
||
2161 | var t = Tn(); |
||
2162 | return ( |
||
2163 | (t.copy = function () { |
||
2164 | return On(t, Zn()); |
||
2165 | }), |
||
2166 | Ct.apply(t, arguments), |
||
2167 | Gn(t) |
||
2168 | ); |
||
2169 | } |
||
2170 | ($n = Wn({ |
||
2171 | decimal: '.', |
||
2172 | thousands: ',', |
||
2173 | grouping: [3], |
||
2174 | currency: ['$', ''], |
||
2175 | minus: '-', |
||
2176 | })), |
||
2177 | (Bn = $n.format), |
||
2178 | (Fn = $n.formatPrefix); |
||
2179 | var Kn = Array.prototype.slice; |
||
2180 | function Qn(t) { |
||
2181 | return t; |
||
2182 | } |
||
2183 | function Jn(t) { |
||
2184 | return 'translate(' + (t + 0.5) + ',0)'; |
||
2185 | } |
||
2186 | function te(t) { |
||
2187 | return 'translate(0,' + (t + 0.5) + ')'; |
||
2188 | } |
||
2189 | function ne(t) { |
||
2190 | return function (n) { |
||
2191 | return +t(n); |
||
2192 | }; |
||
2193 | } |
||
2194 | function ee(t) { |
||
2195 | var n = Math.max(0, t.bandwidth() - 1) / 2; |
||
2196 | return ( |
||
2197 | t.round() && (n = Math.round(n)), |
||
2198 | function (e) { |
||
2199 | return +t(e) + n; |
||
2200 | } |
||
2201 | ); |
||
2202 | } |
||
2203 | function re() { |
||
2204 | return !this.__axis; |
||
2205 | } |
||
2206 | function ie(t, n) { |
||
2207 | var e = [], |
||
2208 | r = null, |
||
2209 | i = null, |
||
2210 | o = 6, |
||
2211 | a = 6, |
||
2212 | u = 3, |
||
2213 | s = 1 === t || 4 === t ? -1 : 1, |
||
2214 | c = 4 === t || 2 === t ? 'x' : 'y', |
||
2215 | l = 1 === t || 3 === t ? Jn : te; |
||
2216 | function h(h) { |
||
2217 | var f = null == r ? (n.ticks ? n.ticks.apply(n, e) : n.domain()) : r, |
||
2218 | p = null == i ? (n.tickFormat ? n.tickFormat.apply(n, e) : Qn) : i, |
||
2219 | d = Math.max(o, 0) + u, |
||
2220 | g = n.range(), |
||
2221 | y = +g[0] + 0.5, |
||
2222 | v = +g[g.length - 1] + 0.5, |
||
2223 | m = (n.bandwidth ? ee : ne)(n.copy()), |
||
2224 | _ = h.selection ? h.selection() : h, |
||
2225 | w = _.selectAll('.domain').data([null]), |
||
2226 | x = _.selectAll('.tick').data(f, n).order(), |
||
2227 | b = x.exit(), |
||
2228 | M = x.enter().append('g').attr('class', 'tick'), |
||
2229 | k = x.select('line'), |
||
2230 | N = x.select('text'); |
||
2231 | (w = w.merge( |
||
2232 | w |
||
2233 | .enter() |
||
2234 | .insert('path', '.tick') |
||
2235 | .attr('class', 'domain') |
||
2236 | .attr('stroke', 'currentColor') |
||
2237 | )), |
||
2238 | (x = x.merge(M)), |
||
2239 | (k = k.merge( |
||
2240 | M.append('line') |
||
2241 | .attr('stroke', 'currentColor') |
||
2242 | .attr(c + '2', s * o) |
||
2243 | )), |
||
2244 | (N = N.merge( |
||
2245 | M.append('text') |
||
2246 | .attr('fill', 'currentColor') |
||
2247 | .attr(c, s * d) |
||
2248 | .attr('dy', 1 === t ? '0em' : 3 === t ? '0.71em' : '0.32em') |
||
2249 | )), |
||
2250 | h !== _ && |
||
2251 | ((w = w.transition(h)), |
||
2252 | (x = x.transition(h)), |
||
2253 | (k = k.transition(h)), |
||
2254 | (N = N.transition(h)), |
||
2255 | (b = b |
||
2256 | .transition(h) |
||
2257 | .attr('opacity', 1e-6) |
||
2258 | .attr('transform', function (t) { |
||
2259 | return isFinite((t = m(t))) ? l(t) : this.getAttribute('transform'); |
||
2260 | })), |
||
2261 | M.attr('opacity', 1e-6).attr('transform', function (t) { |
||
2262 | var n = this.parentNode.__axis; |
||
2263 | return l(n && isFinite((n = n(t))) ? n : m(t)); |
||
2264 | })), |
||
2265 | b.remove(), |
||
2266 | w.attr( |
||
2267 | 'd', |
||
2268 | 4 === t || 2 == t |
||
2269 | ? a |
||
2270 | ? 'M' + s * a + ',' + y + 'H0.5V' + v + 'H' + s * a |
||
2271 | : 'M0.5,' + y + 'V' + v |
||
2272 | : a |
||
2273 | ? 'M' + y + ',' + s * a + 'V0.5H' + v + 'V' + s * a |
||
2274 | : 'M' + y + ',0.5H' + v |
||
2275 | ), |
||
2276 | x.attr('opacity', 1).attr('transform', function (t) { |
||
2277 | return l(m(t)); |
||
2278 | }), |
||
2279 | k.attr(c + '2', s * o), |
||
2280 | N.attr(c, s * d).text(p), |
||
2281 | _.filter(re) |
||
2282 | .attr('fill', 'none') |
||
2283 | .attr('font-size', 10) |
||
2284 | .attr('font-family', 'sans-serif') |
||
2285 | .attr('text-anchor', 2 === t ? 'start' : 4 === t ? 'end' : 'middle'), |
||
2286 | _.each(function () { |
||
2287 | this.__axis = m; |
||
2288 | }); |
||
2289 | } |
||
2290 | return ( |
||
2291 | (h.scale = function (t) { |
||
2292 | return arguments.length ? ((n = t), h) : n; |
||
2293 | }), |
||
2294 | (h.ticks = function () { |
||
2295 | return (e = Kn.call(arguments)), h; |
||
2296 | }), |
||
2297 | (h.tickArguments = function (t) { |
||
2298 | return arguments.length |
||
2299 | ? ((e = null == t ? [] : Kn.call(t)), h) |
||
2300 | : e.slice(); |
||
2301 | }), |
||
2302 | (h.tickValues = function (t) { |
||
2303 | return arguments.length |
||
2304 | ? ((r = null == t ? null : Kn.call(t)), h) |
||
2305 | : r && r.slice(); |
||
2306 | }), |
||
2307 | (h.tickFormat = function (t) { |
||
2308 | return arguments.length ? ((i = t), h) : i; |
||
2309 | }), |
||
2310 | (h.tickSize = function (t) { |
||
2311 | return arguments.length ? ((o = a = +t), h) : o; |
||
2312 | }), |
||
2313 | (h.tickSizeInner = function (t) { |
||
2314 | return arguments.length ? ((o = +t), h) : o; |
||
2315 | }), |
||
2316 | (h.tickSizeOuter = function (t) { |
||
2317 | return arguments.length ? ((a = +t), h) : a; |
||
2318 | }), |
||
2319 | (h.tickPadding = function (t) { |
||
2320 | return arguments.length ? ((u = +t), h) : u; |
||
2321 | }), |
||
2322 | h |
||
2323 | ); |
||
2324 | } |
||
2325 | function oe(t) { |
||
2326 | return ie(3, t); |
||
2327 | } |
||
2328 | var ae = Math.PI, |
||
2329 | ue = 2 * ae, |
||
2330 | se = ue - 1e-6; |
||
2331 | function ce() { |
||
2332 | (this._x0 = this._y0 = this._x1 = this._y1 = null), (this._ = ''); |
||
2333 | } |
||
2334 | function le() { |
||
2335 | return new ce(); |
||
2336 | } |
||
2337 | function he(t) { |
||
2338 | return function () { |
||
2339 | return t; |
||
2340 | }; |
||
2341 | } |
||
2342 | function fe(t) { |
||
2343 | this._context = t; |
||
2344 | } |
||
2345 | function pe(t) { |
||
2346 | return new fe(t); |
||
2347 | } |
||
2348 | function de(t) { |
||
2349 | return t[0]; |
||
2350 | } |
||
2351 | function ge(t) { |
||
2352 | return t[1]; |
||
2353 | } |
||
2354 | (ce.prototype = le.prototype = { |
||
2355 | constructor: ce, |
||
2356 | moveTo: function (t, n) { |
||
2357 | this._ += |
||
2358 | 'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +n); |
||
2359 | }, |
||
2360 | closePath: function () { |
||
2361 | null !== this._x1 && |
||
2362 | ((this._x1 = this._x0), (this._y1 = this._y0), (this._ += 'Z')); |
||
2363 | }, |
||
2364 | lineTo: function (t, n) { |
||
2365 | this._ += 'L' + (this._x1 = +t) + ',' + (this._y1 = +n); |
||
2366 | }, |
||
2367 | quadraticCurveTo: function (t, n, e, r) { |
||
2368 | this._ += |
||
2369 | 'Q' + +t + ',' + +n + ',' + (this._x1 = +e) + ',' + (this._y1 = +r); |
||
2370 | }, |
||
2371 | bezierCurveTo: function (t, n, e, r, i, o) { |
||
2372 | this._ += |
||
2373 | 'C' + |
||
2374 | +t + |
||
2375 | ',' + |
||
2376 | +n + |
||
2377 | ',' + |
||
2378 | +e + |
||
2379 | ',' + |
||
2380 | +r + |
||
2381 | ',' + |
||
2382 | (this._x1 = +i) + |
||
2383 | ',' + |
||
2384 | (this._y1 = +o); |
||
2385 | }, |
||
2386 | arcTo: function (t, n, e, r, i) { |
||
2387 | (t = +t), (n = +n), (e = +e), (r = +r), (i = +i); |
||
2388 | var o = this._x1, |
||
2389 | a = this._y1, |
||
2390 | u = e - t, |
||
2391 | s = r - n, |
||
2392 | c = o - t, |
||
2393 | l = a - n, |
||
2394 | h = c * c + l * l; |
||
2395 | if (i < 0) throw new Error('negative radius: ' + i); |
||
2396 | if (null === this._x1) |
||
2397 | this._ += 'M' + (this._x1 = t) + ',' + (this._y1 = n); |
||
2398 | else if (h > 1e-6) |
||
2399 | if (Math.abs(l * u - s * c) > 1e-6 && i) { |
||
2400 | var f = e - o, |
||
2401 | p = r - a, |
||
2402 | d = u * u + s * s, |
||
2403 | g = f * f + p * p, |
||
2404 | y = Math.sqrt(d), |
||
2405 | v = Math.sqrt(h), |
||
2406 | m = i * Math.tan((ae - Math.acos((d + h - g) / (2 * y * v))) / 2), |
||
2407 | _ = m / v, |
||
2408 | w = m / y; |
||
2409 | Math.abs(_ - 1) > 1e-6 && |
||
2410 | (this._ += 'L' + (t + _ * c) + ',' + (n + _ * l)), |
||
2411 | (this._ += |
||
2412 | 'A' + |
||
2413 | i + |
||
2414 | ',' + |
||
2415 | i + |
||
2416 | ',0,0,' + |
||
2417 | +(l * f > c * p) + |
||
2418 | ',' + |
||
2419 | (this._x1 = t + w * u) + |
||
2420 | ',' + |
||
2421 | (this._y1 = n + w * s)); |
||
2422 | } else this._ += 'L' + (this._x1 = t) + ',' + (this._y1 = n); |
||
2423 | else; |
||
2424 | }, |
||
2425 | arc: function (t, n, e, r, i, o) { |
||
2426 | (t = +t), (n = +n), (o = !!o); |
||
2427 | var a = (e = +e) * Math.cos(r), |
||
2428 | u = e * Math.sin(r), |
||
2429 | s = t + a, |
||
2430 | c = n + u, |
||
2431 | l = 1 ^ o, |
||
2432 | h = o ? r - i : i - r; |
||
2433 | if (e < 0) throw new Error('negative radius: ' + e); |
||
2434 | null === this._x1 |
||
2435 | ? (this._ += 'M' + s + ',' + c) |
||
2436 | : (Math.abs(this._x1 - s) > 1e-6 || Math.abs(this._y1 - c) > 1e-6) && |
||
2437 | (this._ += 'L' + s + ',' + c), |
||
2438 | e && |
||
2439 | (h < 0 && (h = (h % ue) + ue), |
||
2440 | h > se |
||
2441 | ? (this._ += |
||
2442 | 'A' + |
||
2443 | e + |
||
2444 | ',' + |
||
2445 | e + |
||
2446 | ',0,1,' + |
||
2447 | l + |
||
2448 | ',' + |
||
2449 | (t - a) + |
||
2450 | ',' + |
||
2451 | (n - u) + |
||
2452 | 'A' + |
||
2453 | e + |
||
2454 | ',' + |
||
2455 | e + |
||
2456 | ',0,1,' + |
||
2457 | l + |
||
2458 | ',' + |
||
2459 | (this._x1 = s) + |
||
2460 | ',' + |
||
2461 | (this._y1 = c)) |
||
2462 | : h > 1e-6 && |
||
2463 | (this._ += |
||
2464 | 'A' + |
||
2465 | e + |
||
2466 | ',' + |
||
2467 | e + |
||
2468 | ',0,' + |
||
2469 | +(h >= ae) + |
||
2470 | ',' + |
||
2471 | l + |
||
2472 | ',' + |
||
2473 | (this._x1 = t + e * Math.cos(i)) + |
||
2474 | ',' + |
||
2475 | (this._y1 = n + e * Math.sin(i)))); |
||
2476 | }, |
||
2477 | rect: function (t, n, e, r) { |
||
2478 | this._ += |
||
2479 | 'M' + |
||
2480 | (this._x0 = this._x1 = +t) + |
||
2481 | ',' + |
||
2482 | (this._y0 = this._y1 = +n) + |
||
2483 | 'h' + |
||
2484 | +e + |
||
2485 | 'v' + |
||
2486 | +r + |
||
2487 | 'h' + |
||
2488 | -e + |
||
2489 | 'Z'; |
||
2490 | }, |
||
2491 | toString: function () { |
||
2492 | return this._; |
||
2493 | }, |
||
2494 | }), |
||
2495 | (fe.prototype = { |
||
2496 | areaStart: function () { |
||
2497 | this._line = 0; |
||
2498 | }, |
||
2499 | areaEnd: function () { |
||
2500 | this._line = NaN; |
||
2501 | }, |
||
2502 | lineStart: function () { |
||
2503 | this._point = 0; |
||
2504 | }, |
||
2505 | lineEnd: function () { |
||
2506 | (this._line || (0 !== this._line && 1 === this._point)) && |
||
2507 | this._context.closePath(), |
||
2508 | (this._line = 1 - this._line); |
||
2509 | }, |
||
2510 | point: function (t, n) { |
||
2511 | switch (((t = +t), (n = +n), this._point)) { |
||
2512 | case 0: |
||
2513 | (this._point = 1), |
||
2514 | this._line |
||
2515 | ? this._context.lineTo(t, n) |
||
2516 | : this._context.moveTo(t, n); |
||
2517 | break; |
||
2518 | case 1: |
||
2519 | this._point = 2; |
||
2520 | default: |
||
2521 | this._context.lineTo(t, n); |
||
2522 | } |
||
2523 | }, |
||
2524 | }); |
||
2525 | var ye = { value: function () {} }; |
||
2526 | function ve() { |
||
2527 | for (var t, n = 0, e = arguments.length, r = {}; n < e; ++n) { |
||
2528 | if (!(t = arguments[n] + '') || t in r || /[\s.]/.test(t)) |
||
2529 | throw new Error('illegal type: ' + t); |
||
2530 | r[t] = []; |
||
2531 | } |
||
2532 | return new me(r); |
||
2533 | } |
||
2534 | function me(t) { |
||
2535 | this._ = t; |
||
2536 | } |
||
2537 | function _e(t, n) { |
||
2538 | return t |
||
2539 | .trim() |
||
2540 | .split(/^|\s+/) |
||
2541 | .map(function (t) { |
||
2542 | var e = '', |
||
2543 | r = t.indexOf('.'); |
||
2544 | if ( |
||
2545 | (r >= 0 && ((e = t.slice(r + 1)), (t = t.slice(0, r))), |
||
2546 | t && !n.hasOwnProperty(t)) |
||
2547 | ) |
||
2548 | throw new Error('unknown type: ' + t); |
||
2549 | return { type: t, name: e }; |
||
2550 | }); |
||
2551 | } |
||
2552 | function we(t, n) { |
||
2553 | for (var e, r = 0, i = t.length; r < i; ++r) |
||
2554 | if ((e = t[r]).name === n) return e.value; |
||
2555 | } |
||
2556 | function xe(t, n, e) { |
||
2557 | for (var r = 0, i = t.length; r < i; ++r) |
||
2558 | if (t[r].name === n) { |
||
2559 | (t[r] = ye), (t = t.slice(0, r).concat(t.slice(r + 1))); |
||
2560 | break; |
||
2561 | } |
||
2562 | return null != e && t.push({ name: n, value: e }), t; |
||
2563 | } |
||
2564 | function be() { |
||
2565 | st.stopImmediatePropagation(); |
||
2566 | } |
||
2567 | function Me() { |
||
2568 | st.preventDefault(), st.stopImmediatePropagation(); |
||
2569 | } |
||
2570 | function ke(t) { |
||
2571 | var n = t.document.documentElement, |
||
2572 | e = wt(t).on('dragstart.drag', Me, !0); |
||
2573 | 'onselectstart' in n |
||
2574 | ? e.on('selectstart.drag', Me, !0) |
||
2575 | : ((n.__noselect = n.style.MozUserSelect), |
||
2576 | (n.style.MozUserSelect = 'none')); |
||
2577 | } |
||
2578 | function Ne(t) { |
||
2579 | return function () { |
||
2580 | return t; |
||
2581 | }; |
||
2582 | } |
||
2583 | function Se(t, n, e, r, i, o, a, u, s, c) { |
||
2584 | (this.target = t), |
||
2585 | (this.type = n), |
||
2586 | (this.subject = e), |
||
2587 | (this.identifier = r), |
||
2588 | (this.active = i), |
||
2589 | (this.x = o), |
||
2590 | (this.y = a), |
||
2591 | (this.dx = u), |
||
2592 | (this.dy = s), |
||
2593 | (this._ = c); |
||
2594 | } |
||
2595 | function Ae() { |
||
2596 | return !st.ctrlKey && !st.button; |
||
2597 | } |
||
2598 | function Ee() { |
||
2599 | return this.parentNode; |
||
2600 | } |
||
2601 | function Pe(t) { |
||
2602 | return null == t ? { x: st.x, y: st.y } : t; |
||
2603 | } |
||
2604 | function Oe() { |
||
2605 | return navigator.maxTouchPoints || 'ontouchstart' in this; |
||
2606 | } |
||
2607 | function je() { |
||
2608 | var t, |
||
2609 | n, |
||
2610 | e, |
||
2611 | r, |
||
2612 | i = Ae, |
||
2613 | o = Ee, |
||
2614 | a = Pe, |
||
2615 | u = Oe, |
||
2616 | s = {}, |
||
2617 | c = ve('start', 'drag', 'end'), |
||
2618 | l = 0, |
||
2619 | h = 0; |
||
2620 | function f(t) { |
||
2621 | t.on('mousedown.drag', p) |
||
2622 | .filter(u) |
||
2623 | .on('touchstart.drag', y) |
||
2624 | .on('touchmove.drag', v) |
||
2625 | .on('touchend.drag touchcancel.drag', m) |
||
2626 | .style('touch-action', 'none') |
||
2627 | .style('-webkit-tap-highlight-color', 'rgba(0,0,0,0)'); |
||
2628 | } |
||
2629 | function p() { |
||
2630 | if (!r && i.apply(this, arguments)) { |
||
2631 | var a = _('mouse', o.apply(this, arguments), Mt, this, arguments); |
||
2632 | a && |
||
2633 | (wt(st.view).on('mousemove.drag', d, !0).on('mouseup.drag', g, !0), |
||
2634 | ke(st.view), |
||
2635 | be(), |
||
2636 | (e = !1), |
||
2637 | (t = st.clientX), |
||
2638 | (n = st.clientY), |
||
2639 | a('start')); |
||
2640 | } |
||
2641 | } |
||
2642 | function d() { |
||
2643 | if ((Me(), !e)) { |
||
2644 | var r = st.clientX - t, |
||
2645 | i = st.clientY - n; |
||
2646 | e = r * r + i * i > h; |
||
2647 | } |
||
2648 | s.mouse('drag'); |
||
2649 | } |
||
2650 | function g() { |
||
2651 | wt(st.view).on('mousemove.drag mouseup.drag', null), |
||
2652 | (function (t, n) { |
||
2653 | var e = t.document.documentElement, |
||
2654 | r = wt(t).on('dragstart.drag', null); |
||
2655 | n && |
||
2656 | (r.on('click.drag', Me, !0), |
||
2657 | setTimeout(function () { |
||
2658 | r.on('click.drag', null); |
||
2659 | }, 0)), |
||
2660 | 'onselectstart' in e |
||
2661 | ? r.on('selectstart.drag', null) |
||
2662 | : ((e.style.MozUserSelect = e.__noselect), delete e.__noselect); |
||
2663 | })(st.view, e), |
||
2664 | Me(), |
||
2665 | s.mouse('end'); |
||
2666 | } |
||
2667 | function y() { |
||
2668 | if (i.apply(this, arguments)) { |
||
2669 | var t, |
||
2670 | n, |
||
2671 | e = st.changedTouches, |
||
2672 | r = o.apply(this, arguments), |
||
2673 | a = e.length; |
||
2674 | for (t = 0; t < a; ++t) |
||
2675 | (n = _(e[t].identifier, r, kt, this, arguments)) && (be(), n('start')); |
||
2676 | } |
||
2677 | } |
||
2678 | function v() { |
||
2679 | var t, |
||
2680 | n, |
||
2681 | e = st.changedTouches, |
||
2682 | r = e.length; |
||
2683 | for (t = 0; t < r; ++t) (n = s[e[t].identifier]) && (Me(), n('drag')); |
||
2684 | } |
||
2685 | function m() { |
||
2686 | var t, |
||
2687 | n, |
||
2688 | e = st.changedTouches, |
||
2689 | i = e.length; |
||
2690 | for ( |
||
2691 | r && clearTimeout(r), |
||
2692 | r = setTimeout(function () { |
||
2693 | r = null; |
||
2694 | }, 500), |
||
2695 | t = 0; |
||
2696 | t < i; |
||
2697 | ++t |
||
2698 | ) |
||
2699 | (n = s[e[t].identifier]) && (be(), n('end')); |
||
2700 | } |
||
2701 | function _(t, n, e, r, i) { |
||
2702 | var o, |
||
2703 | u, |
||
2704 | h, |
||
2705 | p = e(n, t), |
||
2706 | d = c.copy(); |
||
2707 | if ( |
||
2708 | dt(new Se(f, 'beforestart', o, t, l, p[0], p[1], 0, 0, d), function () { |
||
2709 | return ( |
||
2710 | null != (st.subject = o = a.apply(r, i)) && |
||
2711 | ((u = o.x - p[0] || 0), (h = o.y - p[1] || 0), !0) |
||
2712 | ); |
||
2713 | }) |
||
2714 | ) |
||
2715 | return function a(c) { |
||
2716 | var g, |
||
2717 | y = p; |
||
2718 | switch (c) { |
||
2719 | case 'start': |
||
2720 | (s[t] = a), (g = l++); |
||
2721 | break; |
||
2722 | case 'end': |
||
2723 | delete s[t], --l; |
||
2724 | case 'drag': |
||
2725 | (p = e(n, t)), (g = l); |
||
2726 | } |
||
2727 | dt( |
||
2728 | new Se( |
||
2729 | f, |
||
2730 | c, |
||
2731 | o, |
||
2732 | t, |
||
2733 | g, |
||
2734 | p[0] + u, |
||
2735 | p[1] + h, |
||
2736 | p[0] - y[0], |
||
2737 | p[1] - y[1], |
||
2738 | d |
||
2739 | ), |
||
2740 | d.apply, |
||
2741 | d, |
||
2742 | [c, r, i] |
||
2743 | ); |
||
2744 | }; |
||
2745 | } |
||
2746 | return ( |
||
2747 | (f.filter = function (t) { |
||
2748 | return arguments.length |
||
2749 | ? ((i = 'function' == typeof t ? t : Ne(!!t)), f) |
||
2750 | : i; |
||
2751 | }), |
||
2752 | (f.container = function (t) { |
||
2753 | return arguments.length |
||
2754 | ? ((o = 'function' == typeof t ? t : Ne(t)), f) |
||
2755 | : o; |
||
2756 | }), |
||
2757 | (f.subject = function (t) { |
||
2758 | return arguments.length |
||
2759 | ? ((a = 'function' == typeof t ? t : Ne(t)), f) |
||
2760 | : a; |
||
2761 | }), |
||
2762 | (f.touchable = function (t) { |
||
2763 | return arguments.length |
||
2764 | ? ((u = 'function' == typeof t ? t : Ne(!!t)), f) |
||
2765 | : u; |
||
2766 | }), |
||
2767 | (f.on = function () { |
||
2768 | var t = c.on.apply(c, arguments); |
||
2769 | return t === c ? f : t; |
||
2770 | }), |
||
2771 | (f.clickDistance = function (t) { |
||
2772 | return arguments.length ? ((h = (t = +t) * t), f) : Math.sqrt(h); |
||
2773 | }), |
||
2774 | f |
||
2775 | ); |
||
2776 | } |
||
2777 | (me.prototype = ve.prototype = { |
||
2778 | constructor: me, |
||
2779 | on: function (t, n) { |
||
2780 | var e, |
||
2781 | r = this._, |
||
2782 | i = _e(t + '', r), |
||
2783 | o = -1, |
||
2784 | a = i.length; |
||
2785 | if (!(arguments.length < 2)) { |
||
2786 | if (null != n && 'function' != typeof n) |
||
2787 | throw new Error('invalid callback: ' + n); |
||
2788 | for (; ++o < a; ) |
||
2789 | if ((e = (t = i[o]).type)) r[e] = xe(r[e], t.name, n); |
||
2790 | else if (null == n) for (e in r) r[e] = xe(r[e], t.name, null); |
||
2791 | return this; |
||
2792 | } |
||
2793 | for (; ++o < a; ) |
||
2794 | if ((e = (t = i[o]).type) && (e = we(r[e], t.name))) return e; |
||
2795 | }, |
||
2796 | copy: function () { |
||
2797 | var t = {}, |
||
2798 | n = this._; |
||
2799 | for (var e in n) t[e] = n[e].slice(); |
||
2800 | return new me(t); |
||
2801 | }, |
||
2802 | call: function (t, n) { |
||
2803 | if ((e = arguments.length - 2) > 0) |
||
2804 | for (var e, r, i = new Array(e), o = 0; o < e; ++o) |
||
2805 | i[o] = arguments[o + 2]; |
||
2806 | if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); |
||
2807 | for (o = 0, e = (r = this._[t]).length; o < e; ++o) r[o].value.apply(n, i); |
||
2808 | }, |
||
2809 | apply: function (t, n, e) { |
||
2810 | if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); |
||
2811 | for (var r = this._[t], i = 0, o = r.length; i < o; ++i) |
||
2812 | r[i].value.apply(n, e); |
||
2813 | }, |
||
2814 | }), |
||
2815 | (Se.prototype.on = function () { |
||
2816 | var t = this._.on.apply(this._, arguments); |
||
2817 | return t === this._ ? this : t; |
||
2818 | }); |
||
2819 | var Te = function (t) { |
||
2820 | return 50 * Math.sin((Math.PI / 50) * t - 0.5 * Math.PI) + 50; |
||
2821 | }, |
||
2822 | Ce = function (t) { |
||
2823 | return (25 * (2 * Math.asin((t - 50) / 50) + Math.PI)) / Math.PI; |
||
2824 | }, |
||
2825 | Le = function (t) { |
||
2826 | return t >= 80 && t <= 100; |
||
2827 | }, |
||
2828 | ze = function (t, n) { |
||
2829 | var e = t + 5; |
||
2830 | return Le(n) ? -1 * e : e; |
||
2831 | }, |
||
2832 | De = { |
||
2833 | target: 'svg', |
||
2834 | width: 900, |
||
2835 | height: 300, |
||
2836 | preview: !1, |
||
2837 | margin: { top: 20, right: 20, bottom: 40, left: 20 }, |
||
2838 | }, |
||
2839 | qe = (function (n) { |
||
2840 | !(function (t, n) { |
||
2841 | if ('function' != typeof n && null !== n) |
||
2842 | throw new TypeError( |
||
2843 | 'Super expression must either be null or a function' |
||
2844 | ); |
||
2845 | (t.prototype = Object.create(n && n.prototype, { |
||
2846 | constructor: { value: t, writable: !0, configurable: !0 }, |
||
2847 | })), |
||
2848 | n && o(t, n); |
||
2849 | })(l, f); |
||
2850 | var e, |
||
2851 | i, |
||
2852 | u, |
||
2853 | c = s(l); |
||
2854 | function l(t, n) { |
||
2855 | var e; |
||
2856 | return ( |
||
2857 | (function (t, n) { |
||
2858 | if (!(t instanceof n)) |
||
2859 | throw new TypeError('Cannot call a class as a function'); |
||
2860 | })(this, l), |
||
2861 | (e = c.call(this)), |
||
2862 | Object.assign(a(e), De, { data: t }, n), |
||
2863 | e.init(), |
||
2864 | e |
||
2865 | ); |
||
2866 | } |
||
2867 | return ( |
||
2868 | (e = l), |
||
2869 | (i = [ |
||
2870 | { |
||
2871 | key: 'init', |
||
2872 | value: function () { |
||
2873 | var t = this.width, |
||
2874 | n = this.height, |
||
2875 | e = this.margin, |
||
2876 | r = this.target; |
||
2877 | (this.chartWidth = t - e.left - e.right), |
||
2878 | (this.chartHeight = n - e.top - e.bottom), |
||
2879 | (this.svg = wt(r) |
||
2880 | .attr('width', t) |
||
2881 | .attr('height', n) |
||
2882 | .append('g') |
||
2883 | .attr( |
||
2884 | 'transform', |
||
2885 | 'translate('.concat(e.left, ', ').concat(e.top, ')') |
||
2886 | )), |
||
2887 | (this.xScale = Zn().domain([0, 100]).range([0, this.chartWidth])), |
||
2888 | (this.yScale = Zn() |
||
2889 | .domain([0, 100]) |
||
2890 | .range([this.chartHeight, 0])), |
||
2891 | this.normalizeData(); |
||
2892 | }, |
||
2893 | }, |
||
2894 | { |
||
2895 | key: 'normalizeData', |
||
2896 | value: function () { |
||
2897 | this.data = this.data.map(function (t) { |
||
2898 | return { |
||
2899 | color: t.color, |
||
2900 | description: t.description, |
||
2901 | link: t.link, |
||
2902 | x: t.x ? t.x : 0, |
||
2903 | y: Te(t.y ? t.y : 0), |
||
2904 | size: t.size ? t.size : 10, |
||
2905 | }; |
||
2906 | }); |
||
2907 | }, |
||
2908 | }, |
||
2909 | { |
||
2910 | key: 'render', |
||
2911 | value: function () { |
||
2912 | var t = this; |
||
2913 | this.renderBottomLine(5), |
||
2914 | this.renderMainCurve(), |
||
2915 | this.renderMiddleLine(), |
||
2916 | this.renderFooterText(); |
||
2917 | var n, |
||
2918 | e = this, |
||
2919 | i = je().on('drag', function (t) { |
||
2920 | var n = st.x; |
||
2921 | n < 0 |
||
2922 | ? ((n = 0), |
||
2923 | e.emit( |
||
2924 | 'home', |
||
2925 | r(r({}, t), {}, { y: Ce(e.yScale.invert(t.y)) }) |
||
2926 | )) |
||
2927 | : n > e.chartWidth && |
||
2928 | ((n = e.chartWidth), |
||
2929 | e.emit( |
||
2930 | 'end', |
||
2931 | r( |
||
2932 | r({}, t), |
||
2933 | {}, |
||
2934 | { |
||
2935 | x: e.xScale.invert(e.chartWidth), |
||
2936 | y: Ce(e.yScale.invert(t.y)), |
||
2937 | } |
||
2938 | ) |
||
2939 | )); |
||
2940 | var i = e.xScale.invert(n); |
||
2941 | (t.x = n), (t.y = e.yScale(Te(i))); |
||
2942 | var o = Ce(e.yScale.invert(t.y)), |
||
2943 | a = { x: i, y: o }; |
||
2944 | wt(this).on('click', function () { |
||
2945 | e.emit('pointClick', r(r({}, t), a)); |
||
2946 | }), |
||
2947 | e.preview || |
||
2948 | (wt(this) |
||
2949 | .attr( |
||
2950 | 'transform', |
||
2951 | 'translate('.concat(t.x, ', ').concat(t.y, ')') |
||
2952 | ) |
||
2953 | .select('text') |
||
2954 | .style('text-anchor', function () { |
||
2955 | return Le(i) ? 'end' : 'start'; |
||
2956 | }) |
||
2957 | .attr('x', function (t) { |
||
2958 | return ze(t.size, i); |
||
2959 | }), |
||
2960 | e.emit('move', i, o), |
||
2961 | e.emit('moved', r(r({}, t), a))); |
||
2962 | }); |
||
2963 | (n = this.preview |
||
2964 | ? this.undraggablePoint() |
||
2965 | : this.svg |
||
2966 | .selectAll('.hill-chart-group') |
||
2967 | .data(this.data) |
||
2968 | .enter() |
||
2969 | .append('g') |
||
2970 | .attr('class', 'hill-chart-group') |
||
2971 | .attr('transform', function (n) { |
||
2972 | return ( |
||
2973 | (n.x = t.xScale(n.x)), |
||
2974 | (n.y = t.yScale(n.y)), |
||
2975 | 'translate('.concat(n.x, ', ').concat(n.y, ')') |
||
2976 | ); |
||
2977 | }) |
||
2978 | .call(i)) |
||
2979 | .append('circle') |
||
2980 | .attr('class', 'hill-chart-circle') |
||
2981 | .attr('fill', function (t) { |
||
2982 | return t.color; |
||
2983 | }) |
||
2984 | .attr('cx', 0) |
||
2985 | .attr('cy', 0) |
||
2986 | .attr('r', function (t) { |
||
2987 | return t.size; |
||
2988 | }), |
||
2989 | n |
||
2990 | .append('text') |
||
2991 | .text(function (t) { |
||
2992 | return t.description; |
||
2993 | }) |
||
2994 | .attr('x', function (n) { |
||
2995 | return ze(n.size, t.xScale.invert(n.x)); |
||
2996 | }) |
||
2997 | .style('text-anchor', function (n) { |
||
2998 | return Le(t.xScale.invert(n.x)) ? 'end' : 'start'; |
||
2999 | }) |
||
3000 | .attr('y', 5); |
||
3001 | }, |
||
3002 | }, |
||
3003 | { |
||
3004 | key: 'undraggablePoint', |
||
3005 | value: function () { |
||
3006 | var t = this; |
||
3007 | return this.svg |
||
3008 | .selectAll('.hill-chart-group') |
||
3009 | .data(this.data) |
||
3010 | .enter() |
||
3011 | .append('a') |
||
3012 | .attr('href', function (t) { |
||
3013 | return t.link ? t.link : '#'; |
||
3014 | }) |
||
3015 | .append('g') |
||
3016 | .attr('class', 'hill-chart-group') |
||
3017 | .style('cursor', 'pointer') |
||
3018 | .attr('transform', function (n) { |
||
3019 | return ( |
||
3020 | (n.x = t.xScale(n.x)), |
||
3021 | (n.y = t.yScale(n.y)), |
||
3022 | 'translate('.concat(n.x, ', ').concat(n.y, ')') |
||
3023 | ); |
||
3024 | }); |
||
3025 | }, |
||
3026 | }, |
||
3027 | { |
||
3028 | key: 'renderMainCurve', |
||
3029 | value: function () { |
||
3030 | var t = this; |
||
3031 | (this.mainLineCurvePoints = (function (t, n, e) { |
||
3032 | (t = +t), |
||
3033 | (n = +n), |
||
3034 | (e = |
||
3035 | (i = arguments.length) < 2 |
||
3036 | ? ((n = t), (t = 0), 1) |
||
3037 | : i < 3 |
||
3038 | ? 1 |
||
3039 | : +e); |
||
3040 | for ( |
||
3041 | var r = -1, |
||
3042 | i = 0 | Math.max(0, Math.ceil((n - t) / e)), |
||
3043 | o = new Array(i); |
||
3044 | ++r < i; |
||
3045 | |||
3046 | ) |
||
3047 | o[r] = t + r * e; |
||
3048 | return o; |
||
3049 | })(0, 100, 0.1).map(function (t) { |
||
3050 | return { x: t, y: Te(t) }; |
||
3051 | })), |
||
3052 | (this.line = (function () { |
||
3053 | var t = de, |
||
3054 | n = ge, |
||
3055 | e = he(!0), |
||
3056 | r = null, |
||
3057 | i = pe, |
||
3058 | o = null; |
||
3059 | function a(a) { |
||
3060 | var u, |
||
3061 | s, |
||
3062 | c, |
||
3063 | l = a.length, |
||
3064 | h = !1; |
||
3065 | for (null == r && (o = i((c = le()))), u = 0; u <= l; ++u) |
||
3066 | !(u < l && e((s = a[u]), u, a)) === h && |
||
3067 | ((h = !h) ? o.lineStart() : o.lineEnd()), |
||
3068 | h && o.point(+t(s, u, a), +n(s, u, a)); |
||
3069 | if (c) return (o = null), c + '' || null; |
||
3070 | } |
||
3071 | return ( |
||
3072 | (a.x = function (n) { |
||
3073 | return arguments.length |
||
3074 | ? ((t = 'function' == typeof n ? n : he(+n)), a) |
||
3075 | : t; |
||
3076 | }), |
||
3077 | (a.y = function (t) { |
||
3078 | return arguments.length |
||
3079 | ? ((n = 'function' == typeof t ? t : he(+t)), a) |
||
3080 | : n; |
||
3081 | }), |
||
3082 | (a.defined = function (t) { |
||
3083 | return arguments.length |
||
3084 | ? ((e = 'function' == typeof t ? t : he(!!t)), a) |
||
3085 | : e; |
||
3086 | }), |
||
3087 | (a.curve = function (t) { |
||
3088 | return arguments.length |
||
3089 | ? ((i = t), null != r && (o = i(r)), a) |
||
3090 | : i; |
||
3091 | }), |
||
3092 | (a.context = function (t) { |
||
3093 | return arguments.length |
||
3094 | ? (null == t ? (r = o = null) : (o = i((r = t))), a) |
||
3095 | : r; |
||
3096 | }), |
||
3097 | a |
||
3098 | ); |
||
3099 | })() |
||
3100 | .x(function (n) { |
||
3101 | return t.xScale(n.x); |
||
3102 | }) |
||
3103 | .y(function (n) { |
||
3104 | return t.yScale(n.y); |
||
3105 | })), |
||
3106 | this.svg |
||
3107 | .append('path') |
||
3108 | .attr('class', 'chart-hill-main-curve') |
||
3109 | .datum(this.mainLineCurvePoints) |
||
3110 | .attr('d', this.line); |
||
3111 | }, |
||
3112 | }, |
||
3113 | { |
||
3114 | key: 'renderBottomLine', |
||
3115 | value: function () { |
||
3116 | var t = |
||
3117 | arguments.length > 0 && void 0 !== arguments[0] |
||
3118 | ? arguments[0] |
||
3119 | : 5; |
||
3120 | (this.bottomLine = oe(this.xScale).ticks(0).tickSize(0)), |
||
3121 | this.svg |
||
3122 | .append('g') |
||
3123 | .attr('class', 'hill-chart-bottom-line') |
||
3124 | .attr( |
||
3125 | 'transform', |
||
3126 | 'translate(0, '.concat(this.chartHeight + t, ')') |
||
3127 | ) |
||
3128 | .call(this.bottomLine); |
||
3129 | }, |
||
3130 | }, |
||
3131 | { |
||
3132 | key: 'renderMiddleLine', |
||
3133 | value: function () { |
||
3134 | this.svg |
||
3135 | .append('line') |
||
3136 | .attr('class', 'hill-chart-middle-line') |
||
3137 | .attr('y1', this.yScale(0)) |
||
3138 | .attr('y2', this.yScale(100)) |
||
3139 | .attr('x2', this.xScale(50)) |
||
3140 | .attr('x1', this.xScale(50)); |
||
3141 | }, |
||
3142 | }, |
||
3143 | { |
||
3144 | key: 'renderFooterText', |
||
3145 | value: function () { |
||
3146 | this.svg |
||
3147 | .append('text') |
||
3148 | .attr('class', 'hill-chart-text') |
||
3149 | .text('Figuring things out') |
||
3150 | .attr('x', this.xScale(25)) |
||
3151 | .attr('y', this.chartHeight + 25), |
||
3152 | this.svg |
||
3153 | .append('text') |
||
3154 | .attr('class', 'hill-chart-text') |
||
3155 | .text('Making it happen') |
||
3156 | .attr('x', this.xScale(75)) |
||
3157 | .attr('y', this.chartHeight + 25); |
||
3158 | }, |
||
3159 | }, |
||
3160 | ]) && t(e.prototype, i), |
||
3161 | u && t(e, u), |
||
3162 | l |
||
3163 | ); |
||
3164 | })(); |
||
3165 | module.exports = qe; |
||
3166 |