0&&(i=(n=e[t[0]]).length)>0){for(var n,i,o,a=0,u=1;u=n-1){var s=u[t];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=c)}var f=l[t],d=r/2+f,h=t+1,p=n-1;for(;h >>1;l[b]c-o){var g=(i*y+a*v)/r;e(t,h,v,i,o,g,c),e(h,n,y,g,o,a,c)}else{var m=(o*y+c*v)/r;e(t,h,v,i,o,a,m),e(h,n,y,i,m,a,c)}}(0,c,e.value,t,n,r,i)}},function(e,t,n){"use strict";var r=n(59),i=n(60);t.a=function(e,t,n,o,a){(1&e.depth?i.a:r.a)(e,t,n,o,a)}},function(e,t,n){"use strict";var r=n(59),i=n(60),o=n(136);t.a=function e(t){function n(e,n,a,u,c){if((l=e._squarify)&&l.ratio===t)for(var l,s,f,d,h,p=-1,b=l.length,v=e.value;++p1?t:1)},n}(o.b)},function(e,t,n){"use strict";t.a=function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-14825.05*e)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+707.56*e)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-6838.66*e)))))))+")"}},function(e,t,n){"use strict";t.a=function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-2710.57*e)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-67.37*e)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-2475.67*e)))))))+")"}},function(e,t,n){"use strict";n.d(t,"a",(function(){return y})),n.d(t,"b",(function(){return g})),n.d(t,"c",(function(){return m})),n.d(t,"d",(function(){return O}));var r=n(401),i=n(13),o=n(16),a=Object(i.a)((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/o.a}),(function(e){return e.getUTCDate()-1})),u=a,c=(a.range,n(402)),l=Object(i.a)((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*o.c)/o.a}),(function(e){return e.getDate()-1})),s=l,f=(l.range,n(403)),d=n(404);function h(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function p(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function b(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var v,y,g,m,O,x={"-":"",_:" ",0:"0"},j=/^\s*\d+/,w=/^%/,_=/[\\^$*+?|[\]().{}]/g;function k(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o68?1900:2e3),n+r[0].length):-1}function N(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function D(e,t,n){var r=j.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function z(e,t,n){var r=j.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function W(e,t,n){var r=j.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function F(e,t,n){var r=j.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function U(e,t,n){var r=j.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function q(e,t,n){var r=j.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function V(e,t,n){var r=j.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function B(e,t,n){var r=j.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function H(e,t,n){var r=j.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Y(e,t,n){var r=w.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function G(e,t,n){var r=j.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function $(e,t,n){var r=j.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function X(e,t){return k(e.getDate(),t,2)}function Q(e,t){return k(e.getHours(),t,2)}function K(e,t){return k(e.getHours()%12||12,t,2)}function Z(e,t){return k(1+s.count(Object(f.a)(e),e),t,3)}function J(e,t){return k(e.getMilliseconds(),t,3)}function ee(e,t){return J(e,t)+"000"}function te(e,t){return k(e.getMonth()+1,t,2)}function ne(e,t){return k(e.getMinutes(),t,2)}function re(e,t){return k(e.getSeconds(),t,2)}function ie(e){var t=e.getDay();return 0===t?7:t}function oe(e,t){return k(c.d.count(Object(f.a)(e)-1,e),t,2)}function ae(e){var t=e.getDay();return t>=4||0===t?Object(c.e)(e):c.e.ceil(e)}function ue(e,t){return e=ae(e),k(c.e.count(Object(f.a)(e),e)+(4===Object(f.a)(e).getDay()),t,2)}function ce(e){return e.getDay()}function le(e,t){return k(c.b.count(Object(f.a)(e)-1,e),t,2)}function se(e,t){return k(e.getFullYear()%100,t,2)}function fe(e,t){return k((e=ae(e)).getFullYear()%100,t,2)}function de(e,t){return k(e.getFullYear()%1e4,t,4)}function he(e,t){var n=e.getDay();return k((e=n>=4||0===n?Object(c.e)(e):c.e.ceil(e)).getFullYear()%1e4,t,4)}function pe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+k(t/60|0,"0",2)+k(t%60,"0",2)}function be(e,t){return k(e.getUTCDate(),t,2)}function ve(e,t){return k(e.getUTCHours(),t,2)}function ye(e,t){return k(e.getUTCHours()%12||12,t,2)}function ge(e,t){return k(1+u.count(Object(d.a)(e),e),t,3)}function me(e,t){return k(e.getUTCMilliseconds(),t,3)}function Oe(e,t){return me(e,t)+"000"}function xe(e,t){return k(e.getUTCMonth()+1,t,2)}function je(e,t){return k(e.getUTCMinutes(),t,2)}function we(e,t){return k(e.getUTCSeconds(),t,2)}function _e(e){var t=e.getUTCDay();return 0===t?7:t}function ke(e,t){return k(r.d.count(Object(d.a)(e)-1,e),t,2)}function Se(e){var t=e.getUTCDay();return t>=4||0===t?Object(r.e)(e):r.e.ceil(e)}function Me(e,t){return e=Se(e),k(r.e.count(Object(d.a)(e),e)+(4===Object(d.a)(e).getUTCDay()),t,2)}function Ce(e){return e.getUTCDay()}function Ee(e,t){return k(r.b.count(Object(d.a)(e)-1,e),t,2)}function Te(e,t){return k(e.getUTCFullYear()%100,t,2)}function Pe(e,t){return k((e=Se(e)).getUTCFullYear()%100,t,2)}function Ae(e,t){return k(e.getUTCFullYear()%1e4,t,4)}function Re(e,t){var n=e.getUTCDay();return k((e=n>=4||0===n?Object(r.e)(e):r.e.ceil(e)).getUTCFullYear()%1e4,t,4)}function Le(){return"+0000"}function Ie(){return"%"}function Ne(e){return+e}function De(e){return Math.floor(+e/1e3)}v=function(e){var t=e.dateTime,n=e.date,i=e.time,o=e.periods,a=e.days,l=e.shortDays,f=e.months,d=e.shortMonths,v=M(o),y=C(o),g=M(a),m=C(a),O=M(l),j=C(l),w=M(f),_=C(f),k=M(d),S=C(d),ae={a:function(e){return l[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return d[e.getMonth()]},B:function(e){return f[e.getMonth()]},c:null,d:X,e:X,f:ee,g:fe,G:he,H:Q,I:K,j:Z,L:J,m:te,M:ne,p:function(e){return o[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Ne,s:De,S:re,u:ie,U:oe,V:ue,w:ce,W:le,x:null,X:null,y:se,Y:de,Z:pe,"%":Ie},Se={a:function(e){return l[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return d[e.getUTCMonth()]},B:function(e){return f[e.getUTCMonth()]},c:null,d:be,e:be,f:Oe,g:Pe,G:Re,H:ve,I:ye,j:ge,L:me,m:xe,M:je,p:function(e){return o[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Ne,s:De,S:we,u:_e,U:ke,V:Me,w:Ce,W:Ee,x:null,X:null,y:Te,Y:Ae,Z:Le,"%":Ie},ze={a:function(e,t,n){var r=O.exec(t.slice(n));return r?(e.w=j.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=k.exec(t.slice(n));return r?(e.m=S.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=w.exec(t.slice(n));return r?(e.m=_.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return Ue(e,t,n,r)},d:W,e:W,f:H,g:I,G:L,H:U,I:U,j:F,L:B,m:z,M:q,p:function(e,t,n){var r=v.exec(t.slice(n));return r?(e.p=y.get(r[0].toLowerCase()),n+r[0].length):-1},q:D,Q:G,s:$,S:V,u:T,U:P,V:A,w:E,W:R,x:function(e,t,r){return Ue(e,n,t,r)},X:function(e,t,n){return Ue(e,i,t,n)},y:I,Y:L,Z:N,"%":Y};function We(e,t){return function(n){var r,i,o,a=[],u=-1,c=0,l=e.length;for(n instanceof Date||(n=new Date(+n));++u53)return null;"w"in a||(a.w=1),"Z"in a?(o=(i=p(b(a.y,0,1))).getUTCDay(),i=o>4||0===o?r.b.ceil(i):Object(r.b)(i),i=u.offset(i,7*(a.V-1)),a.y=i.getUTCFullYear(),a.m=i.getUTCMonth(),a.d=i.getUTCDate()+(a.w+6)%7):(o=(i=h(b(a.y,0,1))).getDay(),i=o>4||0===o?c.b.ceil(i):Object(c.b)(i),i=s.offset(i,7*(a.V-1)),a.y=i.getFullYear(),a.m=i.getMonth(),a.d=i.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),o="Z"in a?p(b(a.y,0,1)).getUTCDay():h(b(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(o+5)%7:a.w+7*a.U-(o+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,p(a)):h(a)}}function Ue(e,t,n,r){for(var i,o,a=0,u=t.length,c=n.length;a=c)return-1;if(37===(i=t.charCodeAt(a++))){if(i=t.charAt(a++),!(o=ze[i in x?t.charAt(a++):i])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return ae.x=We(n,ae),ae.X=We(i,ae),ae.c=We(t,ae),Se.x=We(n,Se),Se.X=We(i,Se),Se.c=We(t,Se),{format:function(e){var t=We(e+="",ae);return t.toString=function(){return e},t},parse:function(e){var t=Fe(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=We(e+="",Se);return t.toString=function(){return e},t},utcParse:function(e){var t=Fe(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),y=v.format,g=v.parse,m=v.utcFormat,O=v.utcParse},function(e,t,n){"use strict";var r=n(41);function i(e){for(var t,n=-1,r=0,i=e.length,o=-1/0;++no&&(o=t,r=n);return r}var o=n(84);t.a=function(e){var t,n,a=e.length,u=e.map(o.b),c=function(e){var t=e.map(i);return Object(r.a)(e).sort((function(e,n){return t[e]-t[n]}))}(e),l=0,s=0,f=[],d=[];for(t=0;t0?Object(r.a)((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null},t.a=i;i.range},function(e,t,n){"use strict";var r=n(13),i=Object(r.a)((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));i.every=function(e){return isFinite(e=Math.floor(e))&&e>0?Object(r.a)((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null},t.a=i;i.range},function(e,t,n){"use strict";var r=n(35),i=n(138),o=function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(o){for(n=0;n schedule(fn, updateQueue);\nlet writeQueue = makeQueue();\n\nraf.write = fn => schedule(fn, writeQueue);\n\nlet onStartQueue = makeQueue();\n\nraf.onStart = fn => schedule(fn, onStartQueue);\n\nlet onFrameQueue = makeQueue();\n\nraf.onFrame = fn => schedule(fn, onFrameQueue);\n\nlet onFinishQueue = makeQueue();\n\nraf.onFinish = fn => schedule(fn, onFinishQueue);\n\nlet timeouts = [];\n\nraf.setTimeout = (handler, ms) => {\n let time = raf.now() + ms;\n\n let cancel = () => {\n let i = timeouts.findIndex(t => t.cancel == cancel);\n if (~i) timeouts.splice(i, 1);\n __raf.count -= ~i ? 1 : 0;\n };\n\n let timeout = {\n time,\n handler,\n cancel\n };\n timeouts.splice(findTimeout(time), 0, timeout);\n __raf.count += 1;\n start();\n return timeout;\n};\n\nlet findTimeout = time => ~(~timeouts.findIndex(t => t.time > time) || ~timeouts.length);\n\nraf.cancel = fn => {\n updateQueue.delete(fn);\n writeQueue.delete(fn);\n};\n\nraf.sync = fn => {\n sync = true;\n raf.batchedUpdates(fn);\n sync = false;\n};\n\nraf.throttle = fn => {\n let lastArgs;\n\n function queuedFn() {\n try {\n fn(...lastArgs);\n } finally {\n lastArgs = null;\n }\n }\n\n function throttled(...args) {\n lastArgs = args;\n raf.onStart(queuedFn);\n }\n\n throttled.handler = fn;\n\n throttled.cancel = () => {\n onStartQueue.delete(queuedFn);\n lastArgs = null;\n };\n\n return throttled;\n};\n\nlet nativeRaf = typeof window != 'undefined' ? window.requestAnimationFrame : () => {};\n\nraf.use = impl => nativeRaf = impl;\n\nraf.now = typeof performance != 'undefined' ? () => performance.now() : Date.now;\n\nraf.batchedUpdates = fn => fn();\n\nraf.catch = console.error;\nraf.frameLoop = 'always';\n\nraf.advance = () => {\n if (raf.frameLoop !== 'demand') {\n console.warn('Cannot call the manual advancement of rafz whilst frameLoop is not set as demand');\n } else {\n update();\n }\n};\n\nlet ts = -1;\nlet sync = false;\n\nfunction schedule(fn, queue) {\n if (sync) {\n queue.delete(fn);\n fn(0);\n } else {\n queue.add(fn);\n start();\n }\n}\n\nfunction start() {\n if (ts < 0) {\n ts = 0;\n\n if (raf.frameLoop !== 'demand') {\n nativeRaf(loop);\n }\n }\n}\n\nfunction loop() {\n if (~ts) {\n nativeRaf(loop);\n raf.batchedUpdates(update);\n }\n}\n\nfunction update() {\n let prevTs = ts;\n ts = raf.now();\n let count = findTimeout(ts);\n\n if (count) {\n eachSafely(timeouts.splice(0, count), t => t.handler());\n __raf.count -= count;\n }\n\n onStartQueue.flush();\n updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);\n onFrameQueue.flush();\n writeQueue.flush();\n onFinishQueue.flush();\n}\n\nfunction makeQueue() {\n let next = new Set();\n let current = next;\n return {\n add(fn) {\n __raf.count += current == next && !next.has(fn) ? 1 : 0;\n next.add(fn);\n },\n\n delete(fn) {\n __raf.count -= current == next && next.has(fn) ? 1 : 0;\n return next.delete(fn);\n },\n\n flush(arg) {\n if (current.size) {\n next = new Set();\n __raf.count -= current.size;\n eachSafely(current, fn => fn(arg) && next.add(fn));\n __raf.count += next.size;\n current = next;\n }\n }\n\n };\n}\n\nfunction eachSafely(values, each) {\n values.forEach(value => {\n try {\n each(value);\n } catch (e) {\n raf.catch(e);\n }\n });\n}\n\nconst __raf = {\n count: 0,\n\n clear() {\n ts = -1;\n timeouts = [];\n onStartQueue = makeQueue();\n updateQueue = makeQueue();\n onFrameQueue = makeQueue();\n writeQueue = makeQueue();\n onFinishQueue = makeQueue();\n __raf.count = 0;\n }\n\n};\n\nexport { __raf, raf };\n","import { raf } from '@react-spring/rafz';\nexport { raf } from '@react-spring/rafz';\nimport * as React from 'react';\nimport { useEffect, useState, useRef } from 'react';\n\nfunction noop() {}\nconst defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {\n value,\n writable: true,\n configurable: true\n});\nconst is = {\n arr: Array.isArray,\n obj: a => !!a && a.constructor.name === 'Object',\n fun: a => typeof a === 'function',\n str: a => typeof a === 'string',\n num: a => typeof a === 'number',\n und: a => a === undefined\n};\nfunction isEqual(a, b) {\n if (is.arr(a)) {\n if (!is.arr(b) || a.length !== b.length) return false;\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n\n return true;\n }\n\n return a === b;\n}\nconst each = (obj, fn) => obj.forEach(fn);\nfunction eachProp(obj, fn, ctx) {\n if (is.arr(obj)) {\n for (let i = 0; i < obj.length; i++) {\n fn.call(ctx, obj[i], `${i}`);\n }\n\n return;\n }\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n fn.call(ctx, obj[key], key);\n }\n }\n}\nconst toArray = a => is.und(a) ? [] : is.arr(a) ? a : [a];\nfunction flush(queue, iterator) {\n if (queue.size) {\n const items = Array.from(queue);\n queue.clear();\n each(items, iterator);\n }\n}\nconst flushCalls = (queue, ...args) => flush(queue, fn => fn(...args));\n\nlet createStringInterpolator$1;\nlet to;\nlet colors$1 = null;\nlet skipAnimation = false;\nlet willAdvance = noop;\nconst assign = globals => {\n if (globals.to) to = globals.to;\n if (globals.now) raf.now = globals.now;\n if (globals.colors !== undefined) colors$1 = globals.colors;\n if (globals.skipAnimation != null) skipAnimation = globals.skipAnimation;\n if (globals.createStringInterpolator) createStringInterpolator$1 = globals.createStringInterpolator;\n if (globals.requestAnimationFrame) raf.use(globals.requestAnimationFrame);\n if (globals.batchedUpdates) raf.batchedUpdates = globals.batchedUpdates;\n if (globals.willAdvance) willAdvance = globals.willAdvance;\n if (globals.frameLoop) raf.frameLoop = globals.frameLoop;\n};\n\nvar globals = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get createStringInterpolator () { return createStringInterpolator$1; },\n get to () { return to; },\n get colors () { return colors$1; },\n get skipAnimation () { return skipAnimation; },\n get willAdvance () { return willAdvance; },\n assign: assign\n});\n\nconst startQueue = new Set();\nlet currentFrame = [];\nlet prevFrame = [];\nlet priority = 0;\nconst frameLoop = {\n get idle() {\n return !startQueue.size && !currentFrame.length;\n },\n\n start(animation) {\n if (priority > animation.priority) {\n startQueue.add(animation);\n raf.onStart(flushStartQueue);\n } else {\n startSafely(animation);\n raf(advance);\n }\n },\n\n advance,\n\n sort(animation) {\n if (priority) {\n raf.onFrame(() => frameLoop.sort(animation));\n } else {\n const prevIndex = currentFrame.indexOf(animation);\n\n if (~prevIndex) {\n currentFrame.splice(prevIndex, 1);\n startUnsafely(animation);\n }\n }\n },\n\n clear() {\n currentFrame = [];\n startQueue.clear();\n }\n\n};\n\nfunction flushStartQueue() {\n startQueue.forEach(startSafely);\n startQueue.clear();\n raf(advance);\n}\n\nfunction startSafely(animation) {\n if (!currentFrame.includes(animation)) startUnsafely(animation);\n}\n\nfunction startUnsafely(animation) {\n currentFrame.splice(findIndex(currentFrame, other => other.priority > animation.priority), 0, animation);\n}\n\nfunction advance(dt) {\n const nextFrame = prevFrame;\n\n for (let i = 0; i < currentFrame.length; i++) {\n const animation = currentFrame[i];\n priority = animation.priority;\n\n if (!animation.idle) {\n willAdvance(animation);\n animation.advance(dt);\n\n if (!animation.idle) {\n nextFrame.push(animation);\n }\n }\n }\n\n priority = 0;\n prevFrame = currentFrame;\n prevFrame.length = 0;\n currentFrame = nextFrame;\n return currentFrame.length > 0;\n}\n\nfunction findIndex(arr, test) {\n const index = arr.findIndex(test);\n return index < 0 ? arr.length : index;\n}\n\nconst colors = {\n transparent: 0x00000000,\n aliceblue: 0xf0f8ffff,\n antiquewhite: 0xfaebd7ff,\n aqua: 0x00ffffff,\n aquamarine: 0x7fffd4ff,\n azure: 0xf0ffffff,\n beige: 0xf5f5dcff,\n bisque: 0xffe4c4ff,\n black: 0x000000ff,\n blanchedalmond: 0xffebcdff,\n blue: 0x0000ffff,\n blueviolet: 0x8a2be2ff,\n brown: 0xa52a2aff,\n burlywood: 0xdeb887ff,\n burntsienna: 0xea7e5dff,\n cadetblue: 0x5f9ea0ff,\n chartreuse: 0x7fff00ff,\n chocolate: 0xd2691eff,\n coral: 0xff7f50ff,\n cornflowerblue: 0x6495edff,\n cornsilk: 0xfff8dcff,\n crimson: 0xdc143cff,\n cyan: 0x00ffffff,\n darkblue: 0x00008bff,\n darkcyan: 0x008b8bff,\n darkgoldenrod: 0xb8860bff,\n darkgray: 0xa9a9a9ff,\n darkgreen: 0x006400ff,\n darkgrey: 0xa9a9a9ff,\n darkkhaki: 0xbdb76bff,\n darkmagenta: 0x8b008bff,\n darkolivegreen: 0x556b2fff,\n darkorange: 0xff8c00ff,\n darkorchid: 0x9932ccff,\n darkred: 0x8b0000ff,\n darksalmon: 0xe9967aff,\n darkseagreen: 0x8fbc8fff,\n darkslateblue: 0x483d8bff,\n darkslategray: 0x2f4f4fff,\n darkslategrey: 0x2f4f4fff,\n darkturquoise: 0x00ced1ff,\n darkviolet: 0x9400d3ff,\n deeppink: 0xff1493ff,\n deepskyblue: 0x00bfffff,\n dimgray: 0x696969ff,\n dimgrey: 0x696969ff,\n dodgerblue: 0x1e90ffff,\n firebrick: 0xb22222ff,\n floralwhite: 0xfffaf0ff,\n forestgreen: 0x228b22ff,\n fuchsia: 0xff00ffff,\n gainsboro: 0xdcdcdcff,\n ghostwhite: 0xf8f8ffff,\n gold: 0xffd700ff,\n goldenrod: 0xdaa520ff,\n gray: 0x808080ff,\n green: 0x008000ff,\n greenyellow: 0xadff2fff,\n grey: 0x808080ff,\n honeydew: 0xf0fff0ff,\n hotpink: 0xff69b4ff,\n indianred: 0xcd5c5cff,\n indigo: 0x4b0082ff,\n ivory: 0xfffff0ff,\n khaki: 0xf0e68cff,\n lavender: 0xe6e6faff,\n lavenderblush: 0xfff0f5ff,\n lawngreen: 0x7cfc00ff,\n lemonchiffon: 0xfffacdff,\n lightblue: 0xadd8e6ff,\n lightcoral: 0xf08080ff,\n lightcyan: 0xe0ffffff,\n lightgoldenrodyellow: 0xfafad2ff,\n lightgray: 0xd3d3d3ff,\n lightgreen: 0x90ee90ff,\n lightgrey: 0xd3d3d3ff,\n lightpink: 0xffb6c1ff,\n lightsalmon: 0xffa07aff,\n lightseagreen: 0x20b2aaff,\n lightskyblue: 0x87cefaff,\n lightslategray: 0x778899ff,\n lightslategrey: 0x778899ff,\n lightsteelblue: 0xb0c4deff,\n lightyellow: 0xffffe0ff,\n lime: 0x00ff00ff,\n limegreen: 0x32cd32ff,\n linen: 0xfaf0e6ff,\n magenta: 0xff00ffff,\n maroon: 0x800000ff,\n mediumaquamarine: 0x66cdaaff,\n mediumblue: 0x0000cdff,\n mediumorchid: 0xba55d3ff,\n mediumpurple: 0x9370dbff,\n mediumseagreen: 0x3cb371ff,\n mediumslateblue: 0x7b68eeff,\n mediumspringgreen: 0x00fa9aff,\n mediumturquoise: 0x48d1ccff,\n mediumvioletred: 0xc71585ff,\n midnightblue: 0x191970ff,\n mintcream: 0xf5fffaff,\n mistyrose: 0xffe4e1ff,\n moccasin: 0xffe4b5ff,\n navajowhite: 0xffdeadff,\n navy: 0x000080ff,\n oldlace: 0xfdf5e6ff,\n olive: 0x808000ff,\n olivedrab: 0x6b8e23ff,\n orange: 0xffa500ff,\n orangered: 0xff4500ff,\n orchid: 0xda70d6ff,\n palegoldenrod: 0xeee8aaff,\n palegreen: 0x98fb98ff,\n paleturquoise: 0xafeeeeff,\n palevioletred: 0xdb7093ff,\n papayawhip: 0xffefd5ff,\n peachpuff: 0xffdab9ff,\n peru: 0xcd853fff,\n pink: 0xffc0cbff,\n plum: 0xdda0ddff,\n powderblue: 0xb0e0e6ff,\n purple: 0x800080ff,\n rebeccapurple: 0x663399ff,\n red: 0xff0000ff,\n rosybrown: 0xbc8f8fff,\n royalblue: 0x4169e1ff,\n saddlebrown: 0x8b4513ff,\n salmon: 0xfa8072ff,\n sandybrown: 0xf4a460ff,\n seagreen: 0x2e8b57ff,\n seashell: 0xfff5eeff,\n sienna: 0xa0522dff,\n silver: 0xc0c0c0ff,\n skyblue: 0x87ceebff,\n slateblue: 0x6a5acdff,\n slategray: 0x708090ff,\n slategrey: 0x708090ff,\n snow: 0xfffafaff,\n springgreen: 0x00ff7fff,\n steelblue: 0x4682b4ff,\n tan: 0xd2b48cff,\n teal: 0x008080ff,\n thistle: 0xd8bfd8ff,\n tomato: 0xff6347ff,\n turquoise: 0x40e0d0ff,\n violet: 0xee82eeff,\n wheat: 0xf5deb3ff,\n white: 0xffffffff,\n whitesmoke: 0xf5f5f5ff,\n yellow: 0xffff00ff,\n yellowgreen: 0x9acd32ff\n};\n\nconst NUMBER = '[-+]?\\\\d*\\\\.?\\\\d+';\nconst PERCENTAGE = NUMBER + '%';\n\nfunction call(...parts) {\n return '\\\\(\\\\s*(' + parts.join(')\\\\s*,\\\\s*(') + ')\\\\s*\\\\)';\n}\n\nconst rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));\nconst rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));\nconst hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));\nconst hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));\nconst hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;\nconst hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;\nconst hex6 = /^#([0-9a-fA-F]{6})$/;\nconst hex8 = /^#([0-9a-fA-F]{8})$/;\n\nfunction normalizeColor(color) {\n let match;\n\n if (typeof color === 'number') {\n return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null;\n }\n\n if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0;\n\n if (colors$1 && colors$1[color] !== undefined) {\n return colors$1[color];\n }\n\n if (match = rgb.exec(color)) {\n return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 0x000000ff) >>> 0;\n }\n\n if (match = rgba.exec(color)) {\n return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;\n }\n\n if (match = hex3.exec(color)) {\n return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + 'ff', 16) >>> 0;\n }\n\n if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0;\n\n if (match = hex4.exec(color)) {\n return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;\n }\n\n if (match = hsl.exec(color)) {\n return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 0x000000ff) >>> 0;\n }\n\n if (match = hsla.exec(color)) {\n return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;\n }\n\n return null;\n}\n\nfunction hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\n\nfunction hslToRgb(h, s, l) {\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n const r = hue2rgb(p, q, h + 1 / 3);\n const g = hue2rgb(p, q, h);\n const b = hue2rgb(p, q, h - 1 / 3);\n return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;\n}\n\nfunction parse255(str) {\n const int = parseInt(str, 10);\n if (int < 0) return 0;\n if (int > 255) return 255;\n return int;\n}\n\nfunction parse360(str) {\n const int = parseFloat(str);\n return (int % 360 + 360) % 360 / 360;\n}\n\nfunction parse1(str) {\n const num = parseFloat(str);\n if (num < 0) return 0;\n if (num > 1) return 255;\n return Math.round(num * 255);\n}\n\nfunction parsePercentage(str) {\n const int = parseFloat(str);\n if (int < 0) return 0;\n if (int > 100) return 1;\n return int / 100;\n}\n\nfunction colorToRgba(input) {\n let int32Color = normalizeColor(input);\n if (int32Color === null) return input;\n int32Color = int32Color || 0;\n let r = (int32Color & 0xff000000) >>> 24;\n let g = (int32Color & 0x00ff0000) >>> 16;\n let b = (int32Color & 0x0000ff00) >>> 8;\n let a = (int32Color & 0x000000ff) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n}\n\nconst createInterpolator = (range, output, extrapolate) => {\n if (is.fun(range)) {\n return range;\n }\n\n if (is.arr(range)) {\n return createInterpolator({\n range,\n output: output,\n extrapolate\n });\n }\n\n if (is.str(range.output[0])) {\n return createStringInterpolator$1(range);\n }\n\n const config = range;\n const outputRange = config.output;\n const inputRange = config.range || [0, 1];\n const extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend';\n const extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend';\n\n const easing = config.easing || (t => t);\n\n return input => {\n const range = findRange(input, inputRange);\n return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map);\n };\n};\n\nfunction interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {\n let result = map ? map(input) : input;\n\n if (result < inputMin) {\n if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin;\n }\n\n if (result > inputMax) {\n if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax;\n }\n\n if (outputMin === outputMax) return outputMin;\n if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax;\n if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin);\n result = easing(result);\n if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin;\n return result;\n}\n\nfunction findRange(input, inputRange) {\n for (var i = 1; i < inputRange.length - 1; ++i) if (inputRange[i] >= input) break;\n\n return i - 1;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nconst $get = Symbol.for('FluidValue.get');\nconst $observers = Symbol.for('FluidValue.observers');\n\nconst hasFluidValue = arg => Boolean(arg && arg[$get]);\n\nconst getFluidValue = arg => arg && arg[$get] ? arg[$get]() : arg;\n\nconst getFluidObservers = target => target[$observers] || null;\n\nfunction callFluidObserver(observer, event) {\n if (observer.eventObserved) {\n observer.eventObserved(event);\n } else {\n observer(event);\n }\n}\n\nfunction callFluidObservers(target, event) {\n let observers = target[$observers];\n\n if (observers) {\n observers.forEach(observer => {\n callFluidObserver(observer, event);\n });\n }\n}\n\nclass FluidValue {\n constructor(get) {\n this[$get] = void 0;\n this[$observers] = void 0;\n\n if (!get && !(get = this.get)) {\n throw Error('Unknown getter');\n }\n\n setFluidGetter(this, get);\n }\n\n}\n\nconst setFluidGetter = (target, get) => setHidden(target, $get, get);\n\nfunction addFluidObserver(target, observer) {\n if (target[$get]) {\n let observers = target[$observers];\n\n if (!observers) {\n setHidden(target, $observers, observers = new Set());\n }\n\n if (!observers.has(observer)) {\n observers.add(observer);\n\n if (target.observerAdded) {\n target.observerAdded(observers.size, observer);\n }\n }\n }\n\n return observer;\n}\n\nfunction removeFluidObserver(target, observer) {\n let observers = target[$observers];\n\n if (observers && observers.has(observer)) {\n const count = observers.size - 1;\n\n if (count) {\n observers.delete(observer);\n } else {\n target[$observers] = null;\n }\n\n if (target.observerRemoved) {\n target.observerRemoved(count, observer);\n }\n }\n}\n\nconst setHidden = (target, key, value) => Object.defineProperty(target, key, {\n value,\n writable: true,\n configurable: true\n});\n\nconst numberRegex = /[+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g;\nconst colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?\\d+%?[,\\s]+){2,3}\\s*[\\d\\.]+%?\\))/gi;\nlet namedColorRegex;\nconst rgbaRegex = /rgba\\(([0-9\\.-]+), ([0-9\\.-]+), ([0-9\\.-]+), ([0-9\\.-]+)\\)/gi;\n\nconst rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`;\n\nconst createStringInterpolator = config => {\n if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`(${Object.keys(colors$1).join('|')})(?!\\\\w)`, 'g') : /^\\b$/;\n const output = config.output.map(value => getFluidValue(value).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba));\n const keyframes = output.map(value => value.match(numberRegex).map(Number));\n const outputRanges = keyframes[0].map((_, i) => keyframes.map(values => {\n if (!(i in values)) {\n throw Error('The arity of each \"output\" value must be equal');\n }\n\n return values[i];\n }));\n const interpolators = outputRanges.map(output => createInterpolator(_extends({}, config, {\n output\n })));\n return input => {\n let i = 0;\n return output[0].replace(numberRegex, () => String(interpolators[i++](input))).replace(rgbaRegex, rgbaRound);\n };\n};\n\nconst prefix = 'react-spring: ';\n\nconst once = fn => {\n const func = fn;\n let called = false;\n\n if (typeof func != 'function') {\n throw new TypeError(`${prefix}once requires a function parameter`);\n }\n\n return (...args) => {\n if (!called) {\n func(...args);\n called = true;\n }\n };\n};\n\nconst warnInterpolate = once(console.warn);\nfunction deprecateInterpolate() {\n warnInterpolate(`${prefix}The \"interpolate\" function is deprecated in v9 (use \"to\" instead)`);\n}\nconst warnDirectCall = once(console.warn);\nfunction deprecateDirectCall() {\n warnDirectCall(`${prefix}Directly calling start instead of using the api object is deprecated in v9 (use \".start\" instead), this will be removed in later 0.X.0 versions`);\n}\n\nfunction isAnimatedString(value) {\n return is.str(value) && (value[0] == '#' || /\\d/.test(value) || value in (colors$1 || {}));\n}\n\nconst useOnce = effect => useEffect(effect, emptyDeps);\nconst emptyDeps = [];\n\nfunction useForceUpdate() {\n const update = useState()[1];\n const mounted = useState(makeMountedRef)[0];\n useOnce(mounted.unmount);\n return () => {\n if (mounted.current) {\n update({});\n }\n };\n}\n\nfunction makeMountedRef() {\n const mounted = {\n current: true,\n unmount: () => () => {\n mounted.current = false;\n }\n };\n return mounted;\n}\n\nfunction useMemoOne(getResult, inputs) {\n const [initial] = useState(() => ({\n inputs,\n result: getResult()\n }));\n const committed = useRef();\n const prevCache = committed.current;\n let cache = prevCache;\n\n if (cache) {\n const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs));\n\n if (!useCache) {\n cache = {\n inputs,\n result: getResult()\n };\n }\n } else {\n cache = initial;\n }\n\n useEffect(() => {\n committed.current = cache;\n\n if (prevCache == initial) {\n initial.inputs = initial.result = undefined;\n }\n }, [cache]);\n return cache.result;\n}\n\nfunction areInputsEqual(next, prev) {\n if (next.length !== prev.length) {\n return false;\n }\n\n for (let i = 0; i < next.length; i++) {\n if (next[i] !== prev[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction usePrev(value) {\n const prevRef = useRef();\n useEffect(() => {\n prevRef.current = value;\n });\n return prevRef.current;\n}\n\nconst useLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;\n\nexport { FluidValue, globals as Globals, addFluidObserver, callFluidObserver, callFluidObservers, colorToRgba, colors, createInterpolator, createStringInterpolator, defineHidden, deprecateDirectCall, deprecateInterpolate, each, eachProp, flush, flushCalls, frameLoop, getFluidObservers, getFluidValue, hasFluidValue, hex3, hex4, hex6, hex8, hsl, hsla, is, isAnimatedString, isEqual, noop, removeFluidObserver, rgb, rgba, setFluidGetter, toArray, useForceUpdate, useLayoutEffect, useMemoOne, useOnce, usePrev };\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react.production.min.js');\n} else {\n module.exports = require('./cjs/react.development.js');\n}\n","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport PropTypes from 'prop-types'\n\nconst textProps = {\n fill: PropTypes.string,\n fontSize: PropTypes.number,\n fontFamily: PropTypes.string,\n}\n\nexport const axisThemePropType = PropTypes.shape({\n domain: PropTypes.shape({\n line: PropTypes.shape({\n stroke: PropTypes.string.isRequired,\n strokeWidth: PropTypes.number.isRequired,\n strokeDasharray: PropTypes.string,\n }).isRequired,\n }).isRequired,\n ticks: PropTypes.shape({\n line: PropTypes.shape({\n stroke: PropTypes.string.isRequired,\n strokeWidth: PropTypes.number.isRequired,\n strokeDasharray: PropTypes.string,\n }).isRequired,\n text: PropTypes.shape({ ...textProps }).isRequired,\n }).isRequired,\n legend: PropTypes.shape({\n text: PropTypes.shape({ ...textProps }).isRequired,\n }).isRequired,\n})\n\nexport const gridThemePropType = PropTypes.shape({\n line: PropTypes.shape({\n stroke: PropTypes.string.isRequired,\n strokeWidth: PropTypes.number.isRequired,\n strokeDasharray: PropTypes.string,\n }).isRequired,\n})\n\nexport const legendsThemePropType = PropTypes.shape({\n hidden: PropTypes.shape({\n symbol: PropTypes.shape({\n fill: PropTypes.string.isRequired,\n opacity: PropTypes.number,\n }).isRequired,\n text: PropTypes.shape({ ...textProps, opacity: PropTypes.number }).isRequired,\n }).isRequired,\n text: PropTypes.shape({ ...textProps }).isRequired,\n})\n\nexport const labelsThemePropType = PropTypes.shape({\n text: PropTypes.shape({ ...textProps }).isRequired,\n})\n\nexport const dotsThemePropType = PropTypes.shape({\n text: PropTypes.shape({ ...textProps }).isRequired,\n})\n\nexport const markersThemePropType = PropTypes.shape({\n text: PropTypes.shape({ ...textProps }).isRequired,\n})\n\nexport const crosshairPropType = PropTypes.shape({\n line: PropTypes.shape({\n stroke: PropTypes.string.isRequired,\n strokeWidth: PropTypes.number.isRequired,\n strokeDasharray: PropTypes.string,\n }).isRequired,\n})\n\nexport const annotationsPropType = PropTypes.shape({\n text: PropTypes.shape({\n ...textProps,\n outlineWidth: PropTypes.number.isRequired,\n outlineColor: PropTypes.string.isRequired,\n }).isRequired,\n link: PropTypes.shape({\n stroke: PropTypes.string.isRequired,\n strokeWidth: PropTypes.number.isRequired,\n outlineWidth: PropTypes.number.isRequired,\n outlineColor: PropTypes.string.isRequired,\n }).isRequired,\n outline: PropTypes.shape({\n stroke: PropTypes.string.isRequired,\n strokeWidth: PropTypes.number.isRequired,\n outlineWidth: PropTypes.number.isRequired,\n outlineColor: PropTypes.string.isRequired,\n }).isRequired,\n symbol: PropTypes.shape({\n fill: PropTypes.string.isRequired,\n outlineWidth: PropTypes.number.isRequired,\n outlineColor: PropTypes.string.isRequired,\n }).isRequired,\n})\n\nexport const themePropType = PropTypes.shape({\n background: PropTypes.string.isRequired,\n fontFamily: PropTypes.string.isRequired,\n fontSize: PropTypes.number.isRequired,\n textColor: PropTypes.string.isRequired,\n axis: axisThemePropType.isRequired,\n grid: gridThemePropType.isRequired,\n legends: legendsThemePropType.isRequired,\n labels: labelsThemePropType.isRequired,\n dots: dotsThemePropType.isRequired,\n markers: markersThemePropType,\n crosshair: crosshairPropType.isRequired,\n annotations: annotationsPropType.isRequired,\n})\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nexport const defaultTheme = {\n background: 'transparent',\n fontFamily: 'sans-serif',\n fontSize: 11,\n textColor: '#333333',\n axis: {\n domain: {\n line: {\n stroke: 'transparent',\n strokeWidth: 1,\n },\n },\n ticks: {\n line: {\n stroke: '#777777',\n strokeWidth: 1,\n },\n text: {},\n },\n legend: {\n text: {\n fontSize: 12,\n },\n },\n },\n grid: {\n line: {\n stroke: '#dddddd',\n strokeWidth: 1,\n },\n },\n legends: {\n hidden: {\n symbol: {\n fill: '#333333',\n opacity: 0.6,\n },\n text: {\n fill: '#333333',\n opacity: 0.6,\n },\n },\n text: {},\n },\n labels: {\n text: {},\n },\n markers: {\n lineColor: '#000000',\n lineStrokeWidth: 1,\n text: {},\n },\n dots: {\n text: {},\n },\n tooltip: {\n container: {\n background: 'white',\n color: 'inherit',\n fontSize: 'inherit',\n borderRadius: '2px',\n boxShadow: '0 1px 2px rgba(0, 0, 0, 0.25)',\n padding: '5px 9px',\n },\n basic: {\n whiteSpace: 'pre',\n display: 'flex',\n alignItems: 'center',\n },\n chip: {\n marginRight: 7,\n },\n table: {},\n tableCell: {\n padding: '3px 5px',\n },\n tableCellValue: {\n fontWeight: 'bold',\n },\n },\n crosshair: {\n line: {\n stroke: '#000000',\n strokeWidth: 1,\n strokeOpacity: 0.75,\n strokeDasharray: '6 6',\n },\n },\n annotations: {\n text: {\n fontSize: 13,\n outlineWidth: 2,\n outlineColor: '#ffffff',\n },\n link: {\n stroke: '#000000',\n strokeWidth: 1,\n outlineWidth: 2,\n outlineColor: '#ffffff',\n },\n outline: {\n fill: 'none',\n stroke: '#000000',\n strokeWidth: 2,\n outlineWidth: 2,\n outlineColor: '#ffffff',\n },\n symbol: {\n fill: '#000000',\n outlineWidth: 2,\n outlineColor: '#ffffff',\n },\n },\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport merge from 'lodash/merge'\nimport get from 'lodash/get'\nimport set from 'lodash/set'\n\nconst fontProps = [\n 'axis.ticks.text',\n 'axis.legend.text',\n 'legends.text',\n 'labels.text',\n 'dots.text',\n 'markers.text',\n 'annotations.text',\n]\n\nexport const extendDefaultTheme = (defaultTheme, customTheme) => {\n const theme = merge({}, defaultTheme, customTheme)\n\n fontProps.forEach(prop => {\n if (get(theme, `${prop}.fontFamily`) === undefined) {\n set(theme, `${prop}.fontFamily`, theme.fontFamily)\n }\n if (get(theme, `${prop}.fontSize`) === undefined) {\n set(theme, `${prop}.fontSize`, theme.fontSize)\n }\n if (get(theme, `${prop}.fill`) === undefined) {\n set(theme, `${prop}.fill`, theme.textColor)\n }\n })\n\n return theme\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { createContext, useMemo } from 'react'\nimport { isString } from 'lodash'\nimport PropTypes from 'prop-types'\nimport { config as presets } from '@react-spring/web'\n\nexport const motionConfigContext = createContext()\n\n/**\n * For now we're supporting both react-motion and react-spring,\n * however, react-motion will be gradually replaced by react-spring.\n */\nexport const MotionConfigProvider = ({ children, animate, stiffness, damping, config }) => {\n const value = useMemo(() => {\n const reactSpringConfig = isString(config) ? presets[config] : config\n\n return {\n animate,\n springConfig: { stiffness, damping },\n config: reactSpringConfig,\n }\n }, [animate, stiffness, damping, config])\n\n return {children} \n}\n\nexport const motionPropTypes = {\n animate: PropTypes.bool,\n motionStiffness: PropTypes.number,\n motionDamping: PropTypes.number,\n motionConfig: PropTypes.oneOfType([\n PropTypes.oneOf(Object.keys(presets)),\n PropTypes.shape({\n mass: PropTypes.number,\n tension: PropTypes.number,\n friction: PropTypes.number,\n clamp: PropTypes.bool,\n precision: PropTypes.number,\n velocity: PropTypes.number,\n duration: PropTypes.number,\n easing: PropTypes.func,\n }),\n ]),\n}\n\nMotionConfigProvider.propTypes = {\n children: PropTypes.node.isRequired,\n animate: motionPropTypes.animate,\n stiffness: motionPropTypes.motionStiffness,\n damping: motionPropTypes.motionDamping,\n config: motionPropTypes.motionConfig,\n}\n\nexport const motionDefaultProps = {\n animate: true,\n stiffness: 90,\n damping: 15,\n config: 'default',\n}\n\nMotionConfigProvider.defaultProps = motionDefaultProps\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { useContext } from 'react'\nimport { motionConfigContext } from './context'\n\nexport const useMotionConfig = () => useContext(motionConfigContext)\n","import { interpolateString } from 'd3-interpolate'\nimport { useEffect, useMemo, useRef } from 'react'\nimport { useSpring, to } from '@react-spring/web'\nimport { useMotionConfig } from '../motion'\n\nconst usePrevious = value => {\n const ref = useRef()\n\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n\nexport const useAnimatedPath = path => {\n const { animate, config: springConfig } = useMotionConfig()\n\n const previousPath = usePrevious(path)\n const interpolator = useMemo(() => interpolateString(previousPath, path), [previousPath, path])\n\n const { value } = useSpring({\n from: { value: 0 },\n to: { value: 1 },\n reset: true,\n config: springConfig,\n immediate: !animate,\n })\n\n return to(value, interpolator)\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport last from 'lodash/last'\nimport isArray from 'lodash/isArray'\nimport isFunction from 'lodash/isFunction'\nimport { scaleQuantize } from 'd3-scale'\nimport {\n // Diverging\n schemeBrBG,\n schemePRGn,\n schemePiYG,\n schemePuOr,\n schemeRdBu,\n schemeRdGy,\n schemeRdYlBu,\n schemeRdYlGn,\n schemeSpectral,\n\n // Sequential (Single Hue)\n schemeBlues,\n schemeGreens,\n schemeGreys,\n schemeOranges,\n schemePurples,\n schemeReds,\n\n // Sequential (Multi-Hue)\n schemeBuGn,\n schemeBuPu,\n schemeGnBu,\n schemeOrRd,\n schemePuBuGn,\n schemePuBu,\n schemePuRd,\n schemeRdPu,\n schemeYlGnBu,\n schemeYlGn,\n schemeYlOrBr,\n schemeYlOrRd,\n} from 'd3-scale-chromatic'\n\nexport const quantizeColorScales = {\n nivo: ['#d76445', '#f47560', '#e8c1a0', '#97e3d5', '#61cdbb', '#00b0a7'],\n\n // Diverging\n BrBG: last(schemeBrBG),\n PRGn: last(schemePRGn),\n PiYG: last(schemePiYG),\n PuOr: last(schemePuOr),\n RdBu: last(schemeRdBu),\n RdGy: last(schemeRdGy),\n RdYlBu: last(schemeRdYlBu),\n RdYlGn: last(schemeRdYlGn),\n spectral: last(schemeSpectral),\n\n // Sequential (Single Hue)\n blues: last(schemeBlues),\n greens: last(schemeGreens),\n greys: last(schemeGreys),\n oranges: last(schemeOranges),\n purples: last(schemePurples),\n reds: last(schemeReds),\n\n // Sequential (Multi-Hue)\n BuGn: last(schemeBuGn),\n BuPu: last(schemeBuPu),\n GnBu: last(schemeGnBu),\n OrRd: last(schemeOrRd),\n PuBuGn: last(schemePuBuGn),\n PuBu: last(schemePuBu),\n PuRd: last(schemePuRd),\n RdPu: last(schemeRdPu),\n YlGnBu: last(schemeYlGnBu),\n YlGn: last(schemeYlGn),\n YlOrBr: last(schemeYlOrBr),\n YlOrRd: last(schemeYlOrRd),\n}\n\nexport const quantizeColorScalesKeys = Object.keys(quantizeColorScales)\n\nexport const guessQuantizeColorScale = colors => {\n // colors is already a valid scale\n if (isFunction(colors)) {\n if (!isFunction(colors.domain)) {\n throw new Error(\n `Provided colors should be a valid quantize scale providing a 'domain()' function`\n )\n }\n\n return colors\n }\n\n if (quantizeColorScales[colors]) {\n // use predefined d3 quantize color scale\n return scaleQuantize().range(quantizeColorScales[colors])\n }\n\n // user defined colors\n if (isArray(colors)) return scaleQuantize().range(colors)\n\n throw new Error(\n `Unable to guess quantize color scale from '${colors}',\\nmust be a function or one of:\\n'${quantizeColorScalesKeys.join(\n `', '`\n )}'`\n )\n}\n","import PropTypes from 'prop-types'\nimport { quantizeColorScalesKeys } from '../lib/colors'\n\nexport const quantizeColorScalePropType = PropTypes.oneOfType([\n PropTypes.oneOf(quantizeColorScalesKeys),\n PropTypes.func,\n PropTypes.arrayOf(PropTypes.string),\n])\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport last from 'lodash/last'\nimport isArray from 'lodash/isArray'\nimport isString from 'lodash/isString'\nimport { scaleOrdinal, scaleSequential } from 'd3-scale'\nimport {\n // categorical\n schemeCategory10,\n schemeAccent,\n schemeDark2,\n schemePaired,\n schemePastel1,\n schemePastel2,\n schemeSet1,\n schemeSet2,\n schemeSet3,\n // diverging\n interpolateBrBG,\n schemeBrBG,\n interpolatePRGn,\n schemePRGn,\n interpolatePiYG,\n schemePiYG,\n interpolatePuOr,\n schemePuOr,\n interpolateRdBu,\n schemeRdBu,\n interpolateRdGy,\n schemeRdGy,\n interpolateRdYlBu,\n schemeRdYlBu,\n interpolateRdYlGn,\n schemeRdYlGn,\n interpolateSpectral,\n schemeSpectral,\n // sequential single hue\n interpolateBlues,\n schemeBlues,\n interpolateGreens,\n schemeGreens,\n interpolateGreys,\n schemeGreys,\n interpolateOranges,\n schemeOranges,\n interpolatePurples,\n schemePurples,\n interpolateReds,\n schemeReds,\n // sequential multi hue\n interpolateViridis,\n interpolateInferno,\n interpolateMagma,\n interpolatePlasma,\n interpolateWarm,\n interpolateCool,\n interpolateCubehelixDefault,\n interpolateBuGn,\n schemeBuGn,\n interpolateBuPu,\n schemeBuPu,\n interpolateGnBu,\n schemeGnBu,\n interpolateOrRd,\n schemeOrRd,\n interpolatePuBuGn,\n schemePuBuGn,\n interpolatePuBu,\n schemePuBu,\n interpolatePuRd,\n schemePuRd,\n interpolateRdPu,\n schemeRdPu,\n interpolateYlGnBu,\n schemeYlGnBu,\n interpolateYlGn,\n schemeYlGn,\n interpolateYlOrBr,\n schemeYlOrBr,\n interpolateYlOrRd,\n schemeYlOrRd,\n // cyclical\n interpolateRainbow,\n interpolateSinebow,\n} from 'd3-scale-chromatic'\n\n// used for ordinal color scales\nconst colorSchemes = {\n nivo: ['#e8c1a0', '#f47560', '#f1e15b', '#e8a838', '#61cdbb', '#97e3d5'],\n // categorical\n category10: schemeCategory10,\n accent: schemeAccent,\n dark2: schemeDark2,\n paired: schemePaired,\n pastel1: schemePastel1,\n pastel2: schemePastel2,\n set1: schemeSet1,\n set2: schemeSet2,\n set3: schemeSet3,\n // diverging\n brown_blueGreen: last(schemeBrBG),\n purpleRed_green: last(schemePRGn),\n pink_yellowGreen: last(schemePiYG),\n purple_orange: last(schemePuOr),\n red_blue: last(schemeRdBu),\n red_grey: last(schemeRdGy),\n red_yellow_blue: last(schemeRdYlBu),\n red_yellow_green: last(schemeRdYlGn),\n spectral: last(schemeSpectral),\n // sequential single hue\n blues: last(schemeBlues),\n greens: last(schemeGreens),\n greys: last(schemeGreys),\n oranges: last(schemeOranges),\n purples: last(schemePurples),\n reds: last(schemeReds),\n // sequential multi hue\n blue_green: last(schemeBuGn),\n blue_purple: last(schemeBuPu),\n green_blue: last(schemeGnBu),\n orange_red: last(schemeOrRd),\n purple_blue_green: last(schemePuBuGn),\n purple_blue: last(schemePuBu),\n purple_red: last(schemePuRd),\n red_purple: last(schemeRdPu),\n yellow_green_blue: last(schemeYlGnBu),\n yellow_green: last(schemeYlGn),\n yellow_orange_brown: last(schemeYlOrBr),\n yellow_orange_red: last(schemeYlOrRd),\n}\n\nexport const colorSchemeIds = [\n 'nivo',\n // categorical\n 'category10',\n 'accent',\n 'dark2',\n 'paired',\n 'pastel1',\n 'pastel2',\n 'set1',\n 'set2',\n 'set3',\n // diverging\n 'brown_blueGreen',\n 'purpleRed_green',\n 'pink_yellowGreen',\n 'purple_orange',\n 'red_blue',\n 'red_grey',\n 'red_yellow_blue',\n 'red_yellow_green',\n 'spectral',\n // sequential single hue\n 'blues',\n 'greens',\n 'greys',\n 'oranges',\n 'purples',\n 'reds',\n // sequential multi hue\n 'blue_green',\n 'blue_purple',\n 'green_blue',\n 'orange_red',\n 'purple_blue_green',\n 'purple_blue',\n 'purple_red',\n 'red_purple',\n 'yellow_green_blue',\n 'yellow_green',\n 'yellow_orange_brown',\n 'yellow_orange_red',\n]\n\n// used for sequential color scales\nexport const colorInterpolators = {\n // diverging\n brown_blueGreen: interpolateBrBG,\n purpleRed_green: interpolatePRGn,\n pink_yellowGreen: interpolatePiYG,\n purple_orange: interpolatePuOr,\n red_blue: interpolateRdBu,\n red_grey: interpolateRdGy,\n red_yellow_blue: interpolateRdYlBu,\n red_yellow_green: interpolateRdYlGn,\n spectral: interpolateSpectral,\n // sequential single hue\n blues: interpolateBlues,\n greens: interpolateGreens,\n greys: interpolateGreys,\n oranges: interpolateOranges,\n purples: interpolatePurples,\n reds: interpolateReds,\n // sequential multi hue\n viridis: interpolateViridis,\n inferno: interpolateInferno,\n magma: interpolateMagma,\n plasma: interpolatePlasma,\n warm: interpolateWarm,\n cool: interpolateCool,\n cubehelixDefault: interpolateCubehelixDefault,\n blue_green: interpolateBuGn,\n blue_purple: interpolateBuPu,\n green_blue: interpolateGnBu,\n orange_red: interpolateOrRd,\n purple_blue_green: interpolatePuBuGn,\n purple_blue: interpolatePuBu,\n purple_red: interpolatePuRd,\n red_purple: interpolateRdPu,\n yellow_green_blue: interpolateYlGnBu,\n yellow_green: interpolateYlGn,\n yellow_orange_brown: interpolateYlOrBr,\n yellow_orange_red: interpolateYlOrRd,\n // cyclical\n rainbow: interpolateRainbow,\n sinebow: interpolateSinebow,\n}\n\nexport const colorInterpolatorIds = [\n // diverging\n 'brown_blueGreen',\n 'purpleRed_green',\n 'pink_yellowGreen',\n 'purple_orange',\n 'red_blue',\n 'red_grey',\n 'red_yellow_blue',\n 'red_yellow_green',\n 'spectral',\n // sequential single hue\n 'blues',\n 'greens',\n 'greys',\n 'oranges',\n 'purples',\n 'reds',\n // sequential multi hue\n 'viridis',\n 'inferno',\n 'magma',\n 'plasma',\n 'warm',\n 'cool',\n 'cubehelixDefault',\n 'blue_green',\n 'blue_purple',\n 'green_blue',\n 'orange_red',\n 'purple_blue_green',\n 'purple_blue',\n 'purple_red',\n 'red_purple',\n 'yellow_green_blue',\n 'yellow_green',\n 'yellow_orange_brown',\n 'yellow_orange_red',\n // cyclical\n 'rainbow',\n 'sinebow',\n]\n\nexport const nivoCategoricalColors = () =>\n scaleOrdinal(['#e8c1a0', '#f47560', '#f1e15b', '#e8a838', '#61cdbb', '#97e3d5'])\n\nexport const getColorScale = (colors, dataScale) => {\n if (isString(colors)) {\n const scheme = colorSchemes[colors]\n if (scheme !== undefined) {\n const scale = scaleOrdinal(scheme)\n scale.type = 'ordinal'\n\n return scale\n }\n\n if (dataScale !== undefined && colors.indexOf('seq:') === 0) {\n const interpolator = colorInterpolators[colors.slice(4)]\n if (interpolator !== undefined) {\n const scale = scaleSequential(interpolator).domain(dataScale.domain())\n scale.type = 'sequential'\n\n return scale\n }\n }\n }\n\n if (isArray(colors)) {\n const scale = scaleOrdinal(colors)\n scale.type = 'ordinal'\n\n return scale\n }\n\n // just use provided value,\n // all elements will have identical color\n return () => colors\n}\n\nexport * from './quantize'\n","import PropTypes from 'prop-types'\nimport without from 'lodash/without'\nimport {\n curveBasis,\n curveBasisClosed,\n curveBasisOpen,\n curveBundle,\n curveCardinal,\n curveCardinalClosed,\n curveCardinalOpen,\n curveCatmullRom,\n curveCatmullRomClosed,\n curveCatmullRomOpen,\n curveLinear,\n curveLinearClosed,\n curveMonotoneX,\n curveMonotoneY,\n curveNatural,\n curveStep,\n curveStepAfter,\n curveStepBefore,\n} from 'd3-shape'\n\nexport const curvePropMapping = {\n basis: curveBasis,\n basisClosed: curveBasisClosed,\n basisOpen: curveBasisOpen,\n bundle: curveBundle,\n cardinal: curveCardinal,\n cardinalClosed: curveCardinalClosed,\n cardinalOpen: curveCardinalOpen,\n catmullRom: curveCatmullRom,\n catmullRomClosed: curveCatmullRomClosed,\n catmullRomOpen: curveCatmullRomOpen,\n linear: curveLinear,\n linearClosed: curveLinearClosed,\n monotoneX: curveMonotoneX,\n monotoneY: curveMonotoneY,\n natural: curveNatural,\n step: curveStep,\n stepAfter: curveStepAfter,\n stepBefore: curveStepBefore,\n}\n\nexport const curvePropKeys = Object.keys(curvePropMapping)\n\nexport const curvePropType = PropTypes.oneOf(curvePropKeys)\n\nexport const closedCurvePropKeys = curvePropKeys.filter(c => c.endsWith('Closed'))\n\n// Safe curves to be used with d3 area shape generator\nexport const areaCurvePropKeys = without(\n curvePropKeys,\n 'bundle',\n 'basisClosed',\n 'basisOpen',\n 'cardinalClosed',\n 'cardinalOpen',\n 'catmullRomClosed',\n 'catmullRomOpen',\n 'linearClosed'\n)\n\n// Safe curves to be used with d3 line shape generator\nexport const lineCurvePropKeys = without(\n curvePropKeys,\n 'bundle',\n 'basisClosed',\n 'basisOpen',\n 'cardinalClosed',\n 'cardinalOpen',\n 'catmullRomClosed',\n 'catmullRomOpen',\n 'linearClosed'\n)\n\nexport const lineCurvePropType = PropTypes.oneOf(lineCurvePropKeys)\n\n/**\n * Returns curve interpolator from given identifier.\n *\n * @param {string} id - Curve interpolator identifier\n * @return {Function}\n */\nexport const curveFromProp = id => {\n const curveInterpolator = curvePropMapping[id]\n if (!curveInterpolator) {\n throw new TypeError(`'${id}', is not a valid curve interpolator identifier.`)\n }\n\n return curvePropMapping[id]\n}\n","import PropTypes from 'prop-types'\nimport {\n // order\n stackOrderAscending,\n stackOrderDescending,\n stackOrderInsideOut,\n stackOrderNone,\n stackOrderReverse,\n // offset\n stackOffsetExpand,\n stackOffsetDiverging,\n stackOffsetNone,\n stackOffsetSilhouette,\n stackOffsetWiggle,\n} from 'd3-shape'\n\nexport const stackOrderPropMapping = {\n ascending: stackOrderAscending,\n descending: stackOrderDescending,\n insideOut: stackOrderInsideOut,\n none: stackOrderNone,\n reverse: stackOrderReverse,\n}\n\nexport const stackOrderPropKeys = Object.keys(stackOrderPropMapping)\n\nexport const stackOrderPropType = PropTypes.oneOf(stackOrderPropKeys)\n\nexport const stackOrderFromProp = prop => stackOrderPropMapping[prop]\n\nexport const stackOffsetPropMapping = {\n expand: stackOffsetExpand,\n diverging: stackOffsetDiverging,\n none: stackOffsetNone,\n silhouette: stackOffsetSilhouette,\n wiggle: stackOffsetWiggle,\n}\n\nexport const stackOffsetPropKeys = Object.keys(stackOffsetPropMapping)\n\nexport const stackOffsetPropType = PropTypes.oneOf(stackOffsetPropKeys)\n\nexport const stackOffsetFromProp = prop => stackOffsetPropMapping[prop]\n","import PropTypes from 'prop-types'\n\nexport const defsPropTypes = {\n defs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n })\n ).isRequired,\n fill: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n match: PropTypes.oneOfType([PropTypes.oneOf(['*']), PropTypes.object, PropTypes.func])\n .isRequired,\n })\n ).isRequired,\n}\n","import PropTypes from 'prop-types'\nimport {\n treemapBinary,\n treemapDice,\n treemapSlice,\n treemapSliceDice,\n treemapSquarify,\n treemapResquarify,\n} from 'd3-hierarchy'\n\nexport const treeMapTilePropMapping = {\n binary: treemapBinary,\n dice: treemapDice,\n slice: treemapSlice,\n sliceDice: treemapSliceDice,\n squarify: treemapSquarify,\n resquarify: treemapResquarify,\n}\n\nexport const treeMapTilePropKeys = Object.keys(treeMapTilePropMapping)\n\nexport const treeMapTilePropType = PropTypes.oneOf(treeMapTilePropKeys)\n\nexport const treeMapTileFromProp = prop => treeMapTilePropMapping[prop]\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { scaleOrdinal } from 'd3-scale'\nimport { schemeSet3 } from 'd3-scale-chromatic'\nimport { nivoCategoricalColors } from '../lib/colors'\n\n// motion\nexport const defaultAnimate = true\nexport const defaultMotionStiffness = 90\nexport const defaultMotionDamping = 15\n\n// colors\nexport const defaultCategoricalColors = nivoCategoricalColors\nexport const defaultColorRange = scaleOrdinal(schemeSet3)\n\n// margin\nexport const defaultMargin = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n}\n","import PropTypes from 'prop-types'\n\nexport const marginPropType = PropTypes.shape({\n top: PropTypes.number,\n right: PropTypes.number,\n bottom: PropTypes.number,\n left: PropTypes.number,\n}).isRequired\n\nexport const blendModes = [\n 'normal',\n 'multiply',\n 'screen',\n 'overlay',\n 'darken',\n 'lighten',\n 'color-dodge',\n 'color-burn',\n 'hard-light',\n 'soft-light',\n 'difference',\n 'exclusion',\n 'hue',\n 'saturation',\n 'color',\n 'luminosity',\n]\n\nexport const blendModePropType = PropTypes.oneOf(blendModes)\n\nexport * from './colors'\nexport * from './curve'\nexport * from './defs'\nexport * from './stack'\nexport * from './treeMap'\n","import { useMemo } from 'react'\nimport { defaultMargin } from '../defaults'\n\nexport const useDimensions = (width, height, partialMargin = {}) =>\n useMemo(() => {\n const margin = {\n ...defaultMargin,\n ...partialMargin,\n }\n\n return {\n margin,\n innerWidth: width - margin.left - margin.right,\n innerHeight: height - margin.top - margin.bottom,\n outerWidth: width,\n outerHeight: height,\n }\n }, [\n width,\n height,\n partialMargin.top,\n partialMargin.right,\n partialMargin.bottom,\n partialMargin.left,\n ])\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"@babel/runtime/helpers/esm/arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","import arrayWithHoles from \"@babel/runtime/helpers/esm/arrayWithHoles\";\nimport iterableToArrayLimit from \"@babel/runtime/helpers/esm/iterableToArrayLimit\";\nimport unsupportedIterableToArray from \"@babel/runtime/helpers/esm/unsupportedIterableToArray\";\nimport nonIterableRest from \"@babel/runtime/helpers/esm/nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","/**\r\n * A collection of shims that provide minimal functionality of the ES6 collections.\r\n *\r\n * These implementations are not meant to be used outside of the ResizeObserver\r\n * modules as they cover only a limited range of use cases.\r\n */\r\n/* eslint-disable require-jsdoc, valid-jsdoc */\r\nvar MapShim = (function () {\r\n if (typeof Map !== 'undefined') {\r\n return Map;\r\n }\r\n /**\r\n * Returns index in provided array that matches the specified key.\r\n *\r\n * @param {Array} arr\r\n * @param {*} key\r\n * @returns {number}\r\n */\r\n function getIndex(arr, key) {\r\n var result = -1;\r\n arr.some(function (entry, index) {\r\n if (entry[0] === key) {\r\n result = index;\r\n return true;\r\n }\r\n return false;\r\n });\r\n return result;\r\n }\r\n return /** @class */ (function () {\r\n function class_1() {\r\n this.__entries__ = [];\r\n }\r\n Object.defineProperty(class_1.prototype, \"size\", {\r\n /**\r\n * @returns {boolean}\r\n */\r\n get: function () {\r\n return this.__entries__.length;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @param {*} key\r\n * @returns {*}\r\n */\r\n class_1.prototype.get = function (key) {\r\n var index = getIndex(this.__entries__, key);\r\n var entry = this.__entries__[index];\r\n return entry && entry[1];\r\n };\r\n /**\r\n * @param {*} key\r\n * @param {*} value\r\n * @returns {void}\r\n */\r\n class_1.prototype.set = function (key, value) {\r\n var index = getIndex(this.__entries__, key);\r\n if (~index) {\r\n this.__entries__[index][1] = value;\r\n }\r\n else {\r\n this.__entries__.push([key, value]);\r\n }\r\n };\r\n /**\r\n * @param {*} key\r\n * @returns {void}\r\n */\r\n class_1.prototype.delete = function (key) {\r\n var entries = this.__entries__;\r\n var index = getIndex(entries, key);\r\n if (~index) {\r\n entries.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * @param {*} key\r\n * @returns {void}\r\n */\r\n class_1.prototype.has = function (key) {\r\n return !!~getIndex(this.__entries__, key);\r\n };\r\n /**\r\n * @returns {void}\r\n */\r\n class_1.prototype.clear = function () {\r\n this.__entries__.splice(0);\r\n };\r\n /**\r\n * @param {Function} callback\r\n * @param {*} [ctx=null]\r\n * @returns {void}\r\n */\r\n class_1.prototype.forEach = function (callback, ctx) {\r\n if (ctx === void 0) { ctx = null; }\r\n for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {\r\n var entry = _a[_i];\r\n callback.call(ctx, entry[1], entry[0]);\r\n }\r\n };\r\n return class_1;\r\n }());\r\n})();\n\n/**\r\n * Detects whether window and document objects are available in current environment.\r\n */\r\nvar isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;\n\n// Returns global object of a current environment.\r\nvar global$1 = (function () {\r\n if (typeof global !== 'undefined' && global.Math === Math) {\r\n return global;\r\n }\r\n if (typeof self !== 'undefined' && self.Math === Math) {\r\n return self;\r\n }\r\n if (typeof window !== 'undefined' && window.Math === Math) {\r\n return window;\r\n }\r\n // eslint-disable-next-line no-new-func\r\n return Function('return this')();\r\n})();\n\n/**\r\n * A shim for the requestAnimationFrame which falls back to the setTimeout if\r\n * first one is not supported.\r\n *\r\n * @returns {number} Requests' identifier.\r\n */\r\nvar requestAnimationFrame$1 = (function () {\r\n if (typeof requestAnimationFrame === 'function') {\r\n // It's required to use a bounded function because IE sometimes throws\r\n // an \"Invalid calling object\" error if rAF is invoked without the global\r\n // object on the left hand side.\r\n return requestAnimationFrame.bind(global$1);\r\n }\r\n return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };\r\n})();\n\n// Defines minimum timeout before adding a trailing call.\r\nvar trailingTimeout = 2;\r\n/**\r\n * Creates a wrapper function which ensures that provided callback will be\r\n * invoked only once during the specified delay period.\r\n *\r\n * @param {Function} callback - Function to be invoked after the delay period.\r\n * @param {number} delay - Delay after which to invoke callback.\r\n * @returns {Function}\r\n */\r\nfunction throttle (callback, delay) {\r\n var leadingCall = false, trailingCall = false, lastCallTime = 0;\r\n /**\r\n * Invokes the original callback function and schedules new invocation if\r\n * the \"proxy\" was called during current request.\r\n *\r\n * @returns {void}\r\n */\r\n function resolvePending() {\r\n if (leadingCall) {\r\n leadingCall = false;\r\n callback();\r\n }\r\n if (trailingCall) {\r\n proxy();\r\n }\r\n }\r\n /**\r\n * Callback invoked after the specified delay. It will further postpone\r\n * invocation of the original function delegating it to the\r\n * requestAnimationFrame.\r\n *\r\n * @returns {void}\r\n */\r\n function timeoutCallback() {\r\n requestAnimationFrame$1(resolvePending);\r\n }\r\n /**\r\n * Schedules invocation of the original function.\r\n *\r\n * @returns {void}\r\n */\r\n function proxy() {\r\n var timeStamp = Date.now();\r\n if (leadingCall) {\r\n // Reject immediately following calls.\r\n if (timeStamp - lastCallTime < trailingTimeout) {\r\n return;\r\n }\r\n // Schedule new call to be in invoked when the pending one is resolved.\r\n // This is important for \"transitions\" which never actually start\r\n // immediately so there is a chance that we might miss one if change\r\n // happens amids the pending invocation.\r\n trailingCall = true;\r\n }\r\n else {\r\n leadingCall = true;\r\n trailingCall = false;\r\n setTimeout(timeoutCallback, delay);\r\n }\r\n lastCallTime = timeStamp;\r\n }\r\n return proxy;\r\n}\n\n// Minimum delay before invoking the update of observers.\r\nvar REFRESH_DELAY = 20;\r\n// A list of substrings of CSS properties used to find transition events that\r\n// might affect dimensions of observed elements.\r\nvar transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];\r\n// Check if MutationObserver is available.\r\nvar mutationObserverSupported = typeof MutationObserver !== 'undefined';\r\n/**\r\n * Singleton controller class which handles updates of ResizeObserver instances.\r\n */\r\nvar ResizeObserverController = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of ResizeObserverController.\r\n *\r\n * @private\r\n */\r\n function ResizeObserverController() {\r\n /**\r\n * Indicates whether DOM listeners have been added.\r\n *\r\n * @private {boolean}\r\n */\r\n this.connected_ = false;\r\n /**\r\n * Tells that controller has subscribed for Mutation Events.\r\n *\r\n * @private {boolean}\r\n */\r\n this.mutationEventsAdded_ = false;\r\n /**\r\n * Keeps reference to the instance of MutationObserver.\r\n *\r\n * @private {MutationObserver}\r\n */\r\n this.mutationsObserver_ = null;\r\n /**\r\n * A list of connected observers.\r\n *\r\n * @private {Array}\r\n */\r\n this.observers_ = [];\r\n this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);\r\n this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);\r\n }\r\n /**\r\n * Adds observer to observers list.\r\n *\r\n * @param {ResizeObserverSPI} observer - Observer to be added.\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.addObserver = function (observer) {\r\n if (!~this.observers_.indexOf(observer)) {\r\n this.observers_.push(observer);\r\n }\r\n // Add listeners if they haven't been added yet.\r\n if (!this.connected_) {\r\n this.connect_();\r\n }\r\n };\r\n /**\r\n * Removes observer from observers list.\r\n *\r\n * @param {ResizeObserverSPI} observer - Observer to be removed.\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.removeObserver = function (observer) {\r\n var observers = this.observers_;\r\n var index = observers.indexOf(observer);\r\n // Remove observer if it's present in registry.\r\n if (~index) {\r\n observers.splice(index, 1);\r\n }\r\n // Remove listeners if controller has no connected observers.\r\n if (!observers.length && this.connected_) {\r\n this.disconnect_();\r\n }\r\n };\r\n /**\r\n * Invokes the update of observers. It will continue running updates insofar\r\n * it detects changes.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.refresh = function () {\r\n var changesDetected = this.updateObservers_();\r\n // Continue running updates if changes have been detected as there might\r\n // be future ones caused by CSS transitions.\r\n if (changesDetected) {\r\n this.refresh();\r\n }\r\n };\r\n /**\r\n * Updates every observer from observers list and notifies them of queued\r\n * entries.\r\n *\r\n * @private\r\n * @returns {boolean} Returns \"true\" if any observer has detected changes in\r\n * dimensions of it's elements.\r\n */\r\n ResizeObserverController.prototype.updateObservers_ = function () {\r\n // Collect observers that have active observations.\r\n var activeObservers = this.observers_.filter(function (observer) {\r\n return observer.gatherActive(), observer.hasActive();\r\n });\r\n // Deliver notifications in a separate cycle in order to avoid any\r\n // collisions between observers, e.g. when multiple instances of\r\n // ResizeObserver are tracking the same element and the callback of one\r\n // of them changes content dimensions of the observed target. Sometimes\r\n // this may result in notifications being blocked for the rest of observers.\r\n activeObservers.forEach(function (observer) { return observer.broadcastActive(); });\r\n return activeObservers.length > 0;\r\n };\r\n /**\r\n * Initializes DOM listeners.\r\n *\r\n * @private\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.connect_ = function () {\r\n // Do nothing if running in a non-browser environment or if listeners\r\n // have been already added.\r\n if (!isBrowser || this.connected_) {\r\n return;\r\n }\r\n // Subscription to the \"Transitionend\" event is used as a workaround for\r\n // delayed transitions. This way it's possible to capture at least the\r\n // final state of an element.\r\n document.addEventListener('transitionend', this.onTransitionEnd_);\r\n window.addEventListener('resize', this.refresh);\r\n if (mutationObserverSupported) {\r\n this.mutationsObserver_ = new MutationObserver(this.refresh);\r\n this.mutationsObserver_.observe(document, {\r\n attributes: true,\r\n childList: true,\r\n characterData: true,\r\n subtree: true\r\n });\r\n }\r\n else {\r\n document.addEventListener('DOMSubtreeModified', this.refresh);\r\n this.mutationEventsAdded_ = true;\r\n }\r\n this.connected_ = true;\r\n };\r\n /**\r\n * Removes DOM listeners.\r\n *\r\n * @private\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.disconnect_ = function () {\r\n // Do nothing if running in a non-browser environment or if listeners\r\n // have been already removed.\r\n if (!isBrowser || !this.connected_) {\r\n return;\r\n }\r\n document.removeEventListener('transitionend', this.onTransitionEnd_);\r\n window.removeEventListener('resize', this.refresh);\r\n if (this.mutationsObserver_) {\r\n this.mutationsObserver_.disconnect();\r\n }\r\n if (this.mutationEventsAdded_) {\r\n document.removeEventListener('DOMSubtreeModified', this.refresh);\r\n }\r\n this.mutationsObserver_ = null;\r\n this.mutationEventsAdded_ = false;\r\n this.connected_ = false;\r\n };\r\n /**\r\n * \"Transitionend\" event handler.\r\n *\r\n * @private\r\n * @param {TransitionEvent} event\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {\r\n var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;\r\n // Detect whether transition may affect dimensions of an element.\r\n var isReflowProperty = transitionKeys.some(function (key) {\r\n return !!~propertyName.indexOf(key);\r\n });\r\n if (isReflowProperty) {\r\n this.refresh();\r\n }\r\n };\r\n /**\r\n * Returns instance of the ResizeObserverController.\r\n *\r\n * @returns {ResizeObserverController}\r\n */\r\n ResizeObserverController.getInstance = function () {\r\n if (!this.instance_) {\r\n this.instance_ = new ResizeObserverController();\r\n }\r\n return this.instance_;\r\n };\r\n /**\r\n * Holds reference to the controller's instance.\r\n *\r\n * @private {ResizeObserverController}\r\n */\r\n ResizeObserverController.instance_ = null;\r\n return ResizeObserverController;\r\n}());\n\n/**\r\n * Defines non-writable/enumerable properties of the provided target object.\r\n *\r\n * @param {Object} target - Object for which to define properties.\r\n * @param {Object} props - Properties to be defined.\r\n * @returns {Object} Target object.\r\n */\r\nvar defineConfigurable = (function (target, props) {\r\n for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n Object.defineProperty(target, key, {\r\n value: props[key],\r\n enumerable: false,\r\n writable: false,\r\n configurable: true\r\n });\r\n }\r\n return target;\r\n});\n\n/**\r\n * Returns the global object associated with provided element.\r\n *\r\n * @param {Object} target\r\n * @returns {Object}\r\n */\r\nvar getWindowOf = (function (target) {\r\n // Assume that the element is an instance of Node, which means that it\r\n // has the \"ownerDocument\" property from which we can retrieve a\r\n // corresponding global object.\r\n var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;\r\n // Return the local global object if it's not possible extract one from\r\n // provided element.\r\n return ownerGlobal || global$1;\r\n});\n\n// Placeholder of an empty content rectangle.\r\nvar emptyRect = createRectInit(0, 0, 0, 0);\r\n/**\r\n * Converts provided string to a number.\r\n *\r\n * @param {number|string} value\r\n * @returns {number}\r\n */\r\nfunction toFloat(value) {\r\n return parseFloat(value) || 0;\r\n}\r\n/**\r\n * Extracts borders size from provided styles.\r\n *\r\n * @param {CSSStyleDeclaration} styles\r\n * @param {...string} positions - Borders positions (top, right, ...)\r\n * @returns {number}\r\n */\r\nfunction getBordersSize(styles) {\r\n var positions = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n positions[_i - 1] = arguments[_i];\r\n }\r\n return positions.reduce(function (size, position) {\r\n var value = styles['border-' + position + '-width'];\r\n return size + toFloat(value);\r\n }, 0);\r\n}\r\n/**\r\n * Extracts paddings sizes from provided styles.\r\n *\r\n * @param {CSSStyleDeclaration} styles\r\n * @returns {Object} Paddings box.\r\n */\r\nfunction getPaddings(styles) {\r\n var positions = ['top', 'right', 'bottom', 'left'];\r\n var paddings = {};\r\n for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {\r\n var position = positions_1[_i];\r\n var value = styles['padding-' + position];\r\n paddings[position] = toFloat(value);\r\n }\r\n return paddings;\r\n}\r\n/**\r\n * Calculates content rectangle of provided SVG element.\r\n *\r\n * @param {SVGGraphicsElement} target - Element content rectangle of which needs\r\n * to be calculated.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction getSVGContentRect(target) {\r\n var bbox = target.getBBox();\r\n return createRectInit(0, 0, bbox.width, bbox.height);\r\n}\r\n/**\r\n * Calculates content rectangle of provided HTMLElement.\r\n *\r\n * @param {HTMLElement} target - Element for which to calculate the content rectangle.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction getHTMLElementContentRect(target) {\r\n // Client width & height properties can't be\r\n // used exclusively as they provide rounded values.\r\n var clientWidth = target.clientWidth, clientHeight = target.clientHeight;\r\n // By this condition we can catch all non-replaced inline, hidden and\r\n // detached elements. Though elements with width & height properties less\r\n // than 0.5 will be discarded as well.\r\n //\r\n // Without it we would need to implement separate methods for each of\r\n // those cases and it's not possible to perform a precise and performance\r\n // effective test for hidden elements. E.g. even jQuery's ':visible' filter\r\n // gives wrong results for elements with width & height less than 0.5.\r\n if (!clientWidth && !clientHeight) {\r\n return emptyRect;\r\n }\r\n var styles = getWindowOf(target).getComputedStyle(target);\r\n var paddings = getPaddings(styles);\r\n var horizPad = paddings.left + paddings.right;\r\n var vertPad = paddings.top + paddings.bottom;\r\n // Computed styles of width & height are being used because they are the\r\n // only dimensions available to JS that contain non-rounded values. It could\r\n // be possible to utilize the getBoundingClientRect if only it's data wasn't\r\n // affected by CSS transformations let alone paddings, borders and scroll bars.\r\n var width = toFloat(styles.width), height = toFloat(styles.height);\r\n // Width & height include paddings and borders when the 'border-box' box\r\n // model is applied (except for IE).\r\n if (styles.boxSizing === 'border-box') {\r\n // Following conditions are required to handle Internet Explorer which\r\n // doesn't include paddings and borders to computed CSS dimensions.\r\n //\r\n // We can say that if CSS dimensions + paddings are equal to the \"client\"\r\n // properties then it's either IE, and thus we don't need to subtract\r\n // anything, or an element merely doesn't have paddings/borders styles.\r\n if (Math.round(width + horizPad) !== clientWidth) {\r\n width -= getBordersSize(styles, 'left', 'right') + horizPad;\r\n }\r\n if (Math.round(height + vertPad) !== clientHeight) {\r\n height -= getBordersSize(styles, 'top', 'bottom') + vertPad;\r\n }\r\n }\r\n // Following steps can't be applied to the document's root element as its\r\n // client[Width/Height] properties represent viewport area of the window.\r\n // Besides, it's as well not necessary as the itself neither has\r\n // rendered scroll bars nor it can be clipped.\r\n if (!isDocumentElement(target)) {\r\n // In some browsers (only in Firefox, actually) CSS width & height\r\n // include scroll bars size which can be removed at this step as scroll\r\n // bars are the only difference between rounded dimensions + paddings\r\n // and \"client\" properties, though that is not always true in Chrome.\r\n var vertScrollbar = Math.round(width + horizPad) - clientWidth;\r\n var horizScrollbar = Math.round(height + vertPad) - clientHeight;\r\n // Chrome has a rather weird rounding of \"client\" properties.\r\n // E.g. for an element with content width of 314.2px it sometimes gives\r\n // the client width of 315px and for the width of 314.7px it may give\r\n // 314px. And it doesn't happen all the time. So just ignore this delta\r\n // as a non-relevant.\r\n if (Math.abs(vertScrollbar) !== 1) {\r\n width -= vertScrollbar;\r\n }\r\n if (Math.abs(horizScrollbar) !== 1) {\r\n height -= horizScrollbar;\r\n }\r\n }\r\n return createRectInit(paddings.left, paddings.top, width, height);\r\n}\r\n/**\r\n * Checks whether provided element is an instance of the SVGGraphicsElement.\r\n *\r\n * @param {Element} target - Element to be checked.\r\n * @returns {boolean}\r\n */\r\nvar isSVGGraphicsElement = (function () {\r\n // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement\r\n // interface.\r\n if (typeof SVGGraphicsElement !== 'undefined') {\r\n return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };\r\n }\r\n // If it's so, then check that element is at least an instance of the\r\n // SVGElement and that it has the \"getBBox\" method.\r\n // eslint-disable-next-line no-extra-parens\r\n return function (target) { return (target instanceof getWindowOf(target).SVGElement &&\r\n typeof target.getBBox === 'function'); };\r\n})();\r\n/**\r\n * Checks whether provided element is a document element ().\r\n *\r\n * @param {Element} target - Element to be checked.\r\n * @returns {boolean}\r\n */\r\nfunction isDocumentElement(target) {\r\n return target === getWindowOf(target).document.documentElement;\r\n}\r\n/**\r\n * Calculates an appropriate content rectangle for provided html or svg element.\r\n *\r\n * @param {Element} target - Element content rectangle of which needs to be calculated.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction getContentRect(target) {\r\n if (!isBrowser) {\r\n return emptyRect;\r\n }\r\n if (isSVGGraphicsElement(target)) {\r\n return getSVGContentRect(target);\r\n }\r\n return getHTMLElementContentRect(target);\r\n}\r\n/**\r\n * Creates rectangle with an interface of the DOMRectReadOnly.\r\n * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly\r\n *\r\n * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.\r\n * @returns {DOMRectReadOnly}\r\n */\r\nfunction createReadOnlyRect(_a) {\r\n var x = _a.x, y = _a.y, width = _a.width, height = _a.height;\r\n // If DOMRectReadOnly is available use it as a prototype for the rectangle.\r\n var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;\r\n var rect = Object.create(Constr.prototype);\r\n // Rectangle's properties are not writable and non-enumerable.\r\n defineConfigurable(rect, {\r\n x: x, y: y, width: width, height: height,\r\n top: y,\r\n right: x + width,\r\n bottom: height + y,\r\n left: x\r\n });\r\n return rect;\r\n}\r\n/**\r\n * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.\r\n * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit\r\n *\r\n * @param {number} x - X coordinate.\r\n * @param {number} y - Y coordinate.\r\n * @param {number} width - Rectangle's width.\r\n * @param {number} height - Rectangle's height.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction createRectInit(x, y, width, height) {\r\n return { x: x, y: y, width: width, height: height };\r\n}\n\n/**\r\n * Class that is responsible for computations of the content rectangle of\r\n * provided DOM element and for keeping track of it's changes.\r\n */\r\nvar ResizeObservation = /** @class */ (function () {\r\n /**\r\n * Creates an instance of ResizeObservation.\r\n *\r\n * @param {Element} target - Element to be observed.\r\n */\r\n function ResizeObservation(target) {\r\n /**\r\n * Broadcasted width of content rectangle.\r\n *\r\n * @type {number}\r\n */\r\n this.broadcastWidth = 0;\r\n /**\r\n * Broadcasted height of content rectangle.\r\n *\r\n * @type {number}\r\n */\r\n this.broadcastHeight = 0;\r\n /**\r\n * Reference to the last observed content rectangle.\r\n *\r\n * @private {DOMRectInit}\r\n */\r\n this.contentRect_ = createRectInit(0, 0, 0, 0);\r\n this.target = target;\r\n }\r\n /**\r\n * Updates content rectangle and tells whether it's width or height properties\r\n * have changed since the last broadcast.\r\n *\r\n * @returns {boolean}\r\n */\r\n ResizeObservation.prototype.isActive = function () {\r\n var rect = getContentRect(this.target);\r\n this.contentRect_ = rect;\r\n return (rect.width !== this.broadcastWidth ||\r\n rect.height !== this.broadcastHeight);\r\n };\r\n /**\r\n * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data\r\n * from the corresponding properties of the last observed content rectangle.\r\n *\r\n * @returns {DOMRectInit} Last observed content rectangle.\r\n */\r\n ResizeObservation.prototype.broadcastRect = function () {\r\n var rect = this.contentRect_;\r\n this.broadcastWidth = rect.width;\r\n this.broadcastHeight = rect.height;\r\n return rect;\r\n };\r\n return ResizeObservation;\r\n}());\n\nvar ResizeObserverEntry = /** @class */ (function () {\r\n /**\r\n * Creates an instance of ResizeObserverEntry.\r\n *\r\n * @param {Element} target - Element that is being observed.\r\n * @param {DOMRectInit} rectInit - Data of the element's content rectangle.\r\n */\r\n function ResizeObserverEntry(target, rectInit) {\r\n var contentRect = createReadOnlyRect(rectInit);\r\n // According to the specification following properties are not writable\r\n // and are also not enumerable in the native implementation.\r\n //\r\n // Property accessors are not being used as they'd require to define a\r\n // private WeakMap storage which may cause memory leaks in browsers that\r\n // don't support this type of collections.\r\n defineConfigurable(this, { target: target, contentRect: contentRect });\r\n }\r\n return ResizeObserverEntry;\r\n}());\n\nvar ResizeObserverSPI = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of ResizeObserver.\r\n *\r\n * @param {ResizeObserverCallback} callback - Callback function that is invoked\r\n * when one of the observed elements changes it's content dimensions.\r\n * @param {ResizeObserverController} controller - Controller instance which\r\n * is responsible for the updates of observer.\r\n * @param {ResizeObserver} callbackCtx - Reference to the public\r\n * ResizeObserver instance which will be passed to callback function.\r\n */\r\n function ResizeObserverSPI(callback, controller, callbackCtx) {\r\n /**\r\n * Collection of resize observations that have detected changes in dimensions\r\n * of elements.\r\n *\r\n * @private {Array}\r\n */\r\n this.activeObservations_ = [];\r\n /**\r\n * Registry of the ResizeObservation instances.\r\n *\r\n * @private {Map}\r\n */\r\n this.observations_ = new MapShim();\r\n if (typeof callback !== 'function') {\r\n throw new TypeError('The callback provided as parameter 1 is not a function.');\r\n }\r\n this.callback_ = callback;\r\n this.controller_ = controller;\r\n this.callbackCtx_ = callbackCtx;\r\n }\r\n /**\r\n * Starts observing provided element.\r\n *\r\n * @param {Element} target - Element to be observed.\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.observe = function (target) {\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n // Do nothing if current environment doesn't have the Element interface.\r\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\r\n return;\r\n }\r\n if (!(target instanceof getWindowOf(target).Element)) {\r\n throw new TypeError('parameter 1 is not of type \"Element\".');\r\n }\r\n var observations = this.observations_;\r\n // Do nothing if element is already being observed.\r\n if (observations.has(target)) {\r\n return;\r\n }\r\n observations.set(target, new ResizeObservation(target));\r\n this.controller_.addObserver(this);\r\n // Force the update of observations.\r\n this.controller_.refresh();\r\n };\r\n /**\r\n * Stops observing provided element.\r\n *\r\n * @param {Element} target - Element to stop observing.\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.unobserve = function (target) {\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n // Do nothing if current environment doesn't have the Element interface.\r\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\r\n return;\r\n }\r\n if (!(target instanceof getWindowOf(target).Element)) {\r\n throw new TypeError('parameter 1 is not of type \"Element\".');\r\n }\r\n var observations = this.observations_;\r\n // Do nothing if element is not being observed.\r\n if (!observations.has(target)) {\r\n return;\r\n }\r\n observations.delete(target);\r\n if (!observations.size) {\r\n this.controller_.removeObserver(this);\r\n }\r\n };\r\n /**\r\n * Stops observing all elements.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.disconnect = function () {\r\n this.clearActive();\r\n this.observations_.clear();\r\n this.controller_.removeObserver(this);\r\n };\r\n /**\r\n * Collects observation instances the associated element of which has changed\r\n * it's content rectangle.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.gatherActive = function () {\r\n var _this = this;\r\n this.clearActive();\r\n this.observations_.forEach(function (observation) {\r\n if (observation.isActive()) {\r\n _this.activeObservations_.push(observation);\r\n }\r\n });\r\n };\r\n /**\r\n * Invokes initial callback function with a list of ResizeObserverEntry\r\n * instances collected from active resize observations.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.broadcastActive = function () {\r\n // Do nothing if observer doesn't have active observations.\r\n if (!this.hasActive()) {\r\n return;\r\n }\r\n var ctx = this.callbackCtx_;\r\n // Create ResizeObserverEntry instance for every active observation.\r\n var entries = this.activeObservations_.map(function (observation) {\r\n return new ResizeObserverEntry(observation.target, observation.broadcastRect());\r\n });\r\n this.callback_.call(ctx, entries, ctx);\r\n this.clearActive();\r\n };\r\n /**\r\n * Clears the collection of active observations.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.clearActive = function () {\r\n this.activeObservations_.splice(0);\r\n };\r\n /**\r\n * Tells whether observer has active observations.\r\n *\r\n * @returns {boolean}\r\n */\r\n ResizeObserverSPI.prototype.hasActive = function () {\r\n return this.activeObservations_.length > 0;\r\n };\r\n return ResizeObserverSPI;\r\n}());\n\n// Registry of internal observers. If WeakMap is not available use current shim\r\n// for the Map collection as it has all required methods and because WeakMap\r\n// can't be fully polyfilled anyway.\r\nvar observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();\r\n/**\r\n * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation\r\n * exposing only those methods and properties that are defined in the spec.\r\n */\r\nvar ResizeObserver = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of ResizeObserver.\r\n *\r\n * @param {ResizeObserverCallback} callback - Callback that is invoked when\r\n * dimensions of the observed elements change.\r\n */\r\n function ResizeObserver(callback) {\r\n if (!(this instanceof ResizeObserver)) {\r\n throw new TypeError('Cannot call a class as a function.');\r\n }\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n var controller = ResizeObserverController.getInstance();\r\n var observer = new ResizeObserverSPI(callback, controller, this);\r\n observers.set(this, observer);\r\n }\r\n return ResizeObserver;\r\n}());\r\n// Expose public methods of ResizeObserver.\r\n[\r\n 'observe',\r\n 'unobserve',\r\n 'disconnect'\r\n].forEach(function (method) {\r\n ResizeObserver.prototype[method] = function () {\r\n var _a;\r\n return (_a = observers.get(this))[method].apply(_a, arguments);\r\n };\r\n});\n\nvar index = (function () {\r\n // Export existing implementation if available.\r\n if (typeof global$1.ResizeObserver !== 'undefined') {\r\n return global$1.ResizeObserver;\r\n }\r\n return ResizeObserver;\r\n})();\n\nexport default index;\n","import { useRef, useState, useEffect } from 'react'\nimport ResizeObserver from 'resize-observer-polyfill'\n\nexport const useMeasure = () => {\n const measureRef = useRef(null)\n const [bounds, setBounds] = useState({\n left: 0,\n top: 0,\n width: 0,\n height: 0,\n })\n const [observer] = useState(() => new ResizeObserver(([entry]) => setBounds(entry.contentRect)))\n\n useEffect(() => {\n if (measureRef.current) {\n observer.observe(measureRef.current)\n }\n\n return () => observer.disconnect()\n }, [])\n\n return [measureRef, bounds]\n}\n","import { useMemo } from 'react'\nimport { format as d3Format } from 'd3-format'\nimport { timeFormat as d3TimeFormat } from 'd3-time-format'\n\nexport const getValueFormatter = format => {\n // user defined function\n if (typeof format === 'function') return format\n\n if (typeof format === 'string') {\n // time format specifier\n if (format.indexOf('time:') === 0) {\n return d3TimeFormat(format.slice('5'))\n }\n\n // standard format specifier\n return d3Format(format)\n }\n\n // no formatting\n return value => `${value}`\n}\n\nexport const useValueFormatter = format => useMemo(() => getValueFormatter(format), [format])\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { createContext, useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { usePartialTheme } from '../hooks'\n\nexport const themeContext = createContext()\n\n// required to preserve equality\nconst defaultPartialTheme = {}\n\nexport const ThemeProvider = ({ theme: partialTheme = defaultPartialTheme, children }) => {\n const theme = usePartialTheme(partialTheme)\n\n return {children} \n}\n\nThemeProvider.propTypes = {\n children: PropTypes.node.isRequired,\n theme: PropTypes.object,\n}\n\nexport const useTheme = () => useContext(themeContext)\n","import { useMemo } from 'react'\nimport { defaultTheme, extendDefaultTheme } from '../theming'\n\nexport const usePartialTheme = partialTheme =>\n useMemo(() => extendDefaultTheme(defaultTheme, partialTheme), [partialTheme])\n","import { cloneElement } from 'react'\nimport PropTypes from 'prop-types'\n\n// type ConditionalWrapperProps = {\n// children: JSX.Element\n// condition: boolean\n// wrapper: (children: JSX.Element) => JSX.Element\n// }\n\nexport const ConditionalWrapper = ({ children, condition, wrapper }) => {\n if (!condition) return children\n\n return cloneElement(wrapper, {}, children)\n}\n\nConditionalWrapper.propTypes = {\n children: PropTypes.node.isRequired,\n condition: PropTypes.bool.isRequired,\n wrapper: PropTypes.element.isRequired,\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { TooltipProvider, Tooltip } from '@nivo/tooltip'\nimport { ThemeProvider } from '../theming'\nimport { MotionConfigProvider } from '../motion'\nimport { ConditionalWrapper } from './ConditionalWrapper'\n\nconst containerStyle = {\n position: 'relative',\n}\n\nexport const Container = ({\n children,\n theme,\n renderWrapper = true,\n isInteractive = true,\n animate,\n motionStiffness,\n motionDamping,\n motionConfig,\n}) => {\n const container = useRef(null)\n\n return (\n \n \n \n {/* we should not render the div element if using the HTTP API */}\n }\n >\n {children}\n {isInteractive && }\n \n \n \n \n )\n}\n\nContainer.propTypes = {\n children: PropTypes.element.isRequired,\n isInteractive: PropTypes.bool,\n renderWrapper: PropTypes.bool,\n theme: PropTypes.object,\n animate: PropTypes.bool,\n motionStiffness: PropTypes.number,\n motionDamping: PropTypes.number,\n motionConfig: PropTypes.string,\n}\n\nexport default Container\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport PropTypes from 'prop-types'\nimport { useMeasure } from '../hooks'\n\nconst ResponsiveWrapper = ({ children }) => {\n const [measureRef, bounds] = useMeasure()\n const shouldRender = bounds.width > 0 && bounds.height > 0\n\n return (\n \n {shouldRender && children({ width: bounds.width, height: bounds.height })}\n
\n )\n}\n\nResponsiveWrapper.propTypes = {\n children: PropTypes.func.isRequired,\n}\n\nexport default ResponsiveWrapper\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { LinearGradient } from './LinearGradient'\n\nexport const gradientTypes = {\n linearGradient: LinearGradient,\n}\n\nexport * from './LinearGradient'\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport PropTypes from 'prop-types'\n\nexport const LinearGradient = ({ id, colors }) => (\n \n {colors.map(({ offset, color, opacity }) => (\n \n ))}\n \n)\n\nLinearGradient.propTypes = {\n id: PropTypes.string.isRequired,\n colors: PropTypes.arrayOf(\n PropTypes.shape({\n offset: PropTypes.number.isRequired,\n color: PropTypes.string.isRequired,\n opacity: PropTypes.number,\n })\n ).isRequired,\n}\n\nexport const linearGradientDef = (id, colors, options = {}) => ({\n id,\n type: 'linearGradient',\n colors,\n ...options,\n})\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { memo } from 'react'\nimport PropTypes from 'prop-types'\n\nexport const PatternDots = memo(({ id, background, color, size, padding, stagger }) => {\n let fullSize = size + padding\n const radius = size / 2\n const halfPadding = padding / 2\n if (stagger === true) {\n fullSize = size * 2 + padding * 2\n }\n\n return (\n \n \n \n {stagger && (\n \n )}\n \n )\n})\n\nPatternDots.displayName = 'PatternDots'\nPatternDots.propTypes = {\n id: PropTypes.string.isRequired,\n color: PropTypes.string.isRequired,\n background: PropTypes.string.isRequired,\n size: PropTypes.number.isRequired,\n padding: PropTypes.number.isRequired,\n stagger: PropTypes.bool.isRequired,\n}\n\nPatternDots.defaultProps = {\n color: '#000000',\n background: '#ffffff',\n size: 4,\n padding: 4,\n stagger: false,\n}\n\nexport const patternDotsDef = (id, options = {}) => ({\n id,\n type: 'patternDots',\n ...options,\n})\n","export const TWO_PI = Math.PI * 2\n\nexport const degreesToRadians = degrees => (degrees * Math.PI) / 180\n\nexport const radiansToDegrees = radians => (180 * radians) / Math.PI\n\nexport const midAngle = arc => arc.startAngle + (arc.endAngle - arc.startAngle) / 2\n\nexport const positionFromAngle = (angle, distance) => ({\n x: Math.cos(angle) * distance,\n y: Math.sin(angle) * distance,\n})\n\n/**\n * Normalize given angle (degrees) in the 0~360 range.\n *\n * @param {number} angle\n *\n * @return {number}\n */\nexport const absoluteAngleDegrees = angle => {\n let absAngle = angle % 360\n if (absAngle < 0) {\n absAngle += 360\n }\n\n return absAngle\n}\n\nexport const absoluteAngleRadians = angle => angle - TWO_PI * Math.floor((angle + Math.PI) / TWO_PI)\n\n/**\n * Ensure angle is always between 0~360.\n *\n * @param {number} rawAngle - in degrees\n *\n * @returns {number}\n */\nexport const normalizeAngle = rawAngle => {\n if (rawAngle < 0) {\n return 360 - (-rawAngle % 360)\n }\n\n return rawAngle % 360\n}\n\n/**\n * Ensure the absolute difference between start and end angles\n * is at most given length.\n *\n * @param startAngle - in degrees\n * @param endAngle - in degrees\n * @param length - in degrees\n *\n * @returns {[number, number]}\n */\nexport const clampArc = (startAngle, endAngle, length = 360) => {\n let clampedEndAngle = endAngle\n if (Math.abs(endAngle - startAngle) > length) {\n clampedEndAngle = startAngle + (endAngle > startAngle ? length : -length)\n }\n\n return [startAngle, clampedEndAngle]\n}\n","export const textPropsByEngine = {\n svg: {\n align: {\n left: 'start',\n center: 'middle',\n right: 'end',\n start: 'start',\n middle: 'middle',\n end: 'end',\n },\n baseline: {\n top: 'text-before-edge',\n center: 'central',\n bottom: 'alphabetic',\n },\n },\n canvas: {\n align: {\n left: 'left',\n center: 'center',\n right: 'right',\n start: 'left',\n middle: 'center',\n end: 'right',\n },\n baseline: {\n top: 'top',\n center: 'middle',\n bottom: 'bottom',\n },\n },\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { degreesToRadians } from '../../../lib/polar'\n\nexport const PatternLines = memo(\n ({ id, spacing: _spacing, rotation: _rotation, background, color, lineWidth }) => {\n let rotation = Math.round(_rotation) % 360\n const spacing = Math.abs(_spacing)\n\n if (rotation > 180) rotation = rotation - 360\n else if (rotation > 90) rotation = rotation - 180\n else if (rotation < -180) rotation = rotation + 360\n else if (rotation < -90) rotation = rotation + 180\n\n let width = spacing\n let height = spacing\n let path\n\n if (rotation === 0) {\n path = `\n M 0 0 L ${width} 0\n M 0 ${height} L ${width} ${height}\n `\n } else if (rotation === 90) {\n path = `\n M 0 0 L 0 ${height}\n M ${width} 0 L ${width} ${height}\n `\n } else {\n width = Math.abs(spacing / Math.sin(degreesToRadians(rotation)))\n height = spacing / Math.sin(degreesToRadians(90 - rotation))\n\n if (rotation > 0) {\n path = `\n M 0 ${-height} L ${width * 2} ${height}\n M ${-width} ${-height} L ${width} ${height}\n M ${-width} 0 L ${width} ${height * 2}\n `\n } else {\n path = `\n M ${-width} ${height} L ${width} ${-height}\n M ${-width} ${height * 2} L ${width * 2} ${-height}\n M 0 ${height * 2} L ${width * 2} 0\n `\n }\n }\n\n return (\n \n \n \n \n )\n }\n)\n\nPatternLines.displayName = 'PatternLines'\nPatternLines.propTypes = {\n id: PropTypes.string.isRequired,\n spacing: PropTypes.number.isRequired,\n rotation: PropTypes.number.isRequired,\n background: PropTypes.string.isRequired,\n color: PropTypes.string.isRequired,\n lineWidth: PropTypes.number.isRequired,\n}\nPatternLines.defaultProps = {\n spacing: 5,\n rotation: 0,\n color: '#000000',\n background: '#ffffff',\n lineWidth: 2,\n}\n\nexport const patternLinesDef = (id, options = {}) => ({\n id,\n type: 'patternLines',\n ...options,\n})\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { memo } from 'react'\nimport PropTypes from 'prop-types'\n\nexport const PatternSquares = memo(({ id, background, color, size, padding, stagger }) => {\n let fullSize = size + padding\n const halfPadding = padding / 2\n if (stagger === true) {\n fullSize = size * 2 + padding * 2\n }\n\n return (\n \n \n \n {stagger && (\n \n )}\n \n )\n})\n\nPatternSquares.displayName = 'PatternSquares'\nPatternSquares.propTypes = {\n id: PropTypes.string.isRequired,\n color: PropTypes.string.isRequired,\n background: PropTypes.string.isRequired,\n size: PropTypes.number.isRequired,\n padding: PropTypes.number.isRequired,\n stagger: PropTypes.bool.isRequired,\n}\nPatternSquares.defaultProps = {\n color: '#000000',\n background: '#ffffff',\n size: 4,\n padding: 4,\n stagger: false,\n}\n\nexport const patternSquaresDef = (id, options = {}) => ({\n id,\n type: 'patternSquares',\n ...options,\n})\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { PatternDots } from './PatternDots'\nimport { PatternLines } from './PatternLines'\nimport { PatternSquares } from './PatternSquares'\n\nexport const patternTypes = {\n patternDots: PatternDots,\n patternLines: PatternLines,\n patternSquares: PatternSquares,\n}\n\nexport * from './PatternDots'\nexport * from './PatternLines'\nexport * from './PatternSquares'\n","import objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { createElement, memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { gradientTypes } from './gradients'\nimport { patternTypes } from './patterns'\n\nexport const defsMapping = {\n ...gradientTypes,\n ...patternTypes,\n}\n\nconst Defs = ({ defs: definitions }) => {\n if (!definitions || definitions.length < 1) return null\n\n return (\n \n {definitions.map(({ type, ...def }) => {\n if (defsMapping[type])\n return createElement(defsMapping[type], { key: def.id, ...def })\n\n return null\n })}\n \n )\n}\n\nDefs.propTypes = {\n defs: PropTypes.arrayOf(\n PropTypes.shape({\n type: PropTypes.oneOf(Object.keys(defsMapping)).isRequired,\n id: PropTypes.string.isRequired,\n })\n ),\n}\n\nexport default memo(Defs)\n","import PropTypes from 'prop-types'\nimport { Defs } from './defs'\nimport { useTheme } from '../theming'\n\nconst SvgWrapper = ({\n width,\n height,\n margin,\n defs,\n children,\n role,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isFocusable,\n}) => {\n const theme = useTheme()\n\n return (\n \n \n \n {children} \n \n )\n}\n\nSvgWrapper.propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n margin: PropTypes.shape({\n top: PropTypes.number.isRequired,\n left: PropTypes.number.isRequired,\n }).isRequired,\n defs: PropTypes.array,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n role: PropTypes.string,\n isFocusable: PropTypes.bool,\n ariaLabel: PropTypes.string,\n ariaLabelledBy: PropTypes.string,\n ariaDescribedBy: PropTypes.string,\n}\n\nexport default SvgWrapper\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { memo } from 'react'\nimport PropTypes from 'prop-types'\n\nconst DotsItemSymbol = ({ size, color, borderWidth, borderColor }) => (\n \n)\n\nDotsItemSymbol.propTypes = {\n size: PropTypes.number.isRequired,\n color: PropTypes.string.isRequired,\n borderWidth: PropTypes.number.isRequired,\n borderColor: PropTypes.string.isRequired,\n}\n\nexport default memo(DotsItemSymbol)\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme } from '../../../theming'\n\n/**\n *\n * @param {string} axis\n * @param {number} width\n * @param {number} height\n * @param {string} position\n * @param {number} offsetX\n * @param {number} offsetY\n * @param {string} orientation\n * @return {{ x: number, y: number, textAnchor: string }}\n */\nconst computeLabel = ({ axis, width, height, position, offsetX, offsetY, orientation }) => {\n let x = 0\n let y = 0\n const rotation = orientation === 'vertical' ? -90 : 0\n let textAnchor = 'start'\n\n if (axis === 'x') {\n switch (position) {\n case 'top-left':\n x = -offsetX\n y = offsetY\n textAnchor = 'end'\n break\n case 'top':\n y = -offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'start'\n }\n break\n case 'top-right':\n x = offsetX\n y = offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'end'\n }\n break\n case 'right':\n x = offsetX\n y = height / 2\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'middle'\n }\n break\n case 'bottom-right':\n x = offsetX\n y = height - offsetY\n textAnchor = 'start'\n break\n case 'bottom':\n y = height + offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'end'\n }\n break\n case 'bottom-left':\n y = height - offsetY\n x = -offsetX\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'start'\n }\n break\n case 'left':\n x = -offsetX\n y = height / 2\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'middle'\n }\n break\n }\n } else {\n switch (position) {\n case 'top-left':\n x = offsetX\n y = -offsetY\n textAnchor = 'start'\n break\n case 'top':\n x = width / 2\n y = -offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'start'\n }\n break\n case 'top-right':\n x = width - offsetX\n y = -offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'start'\n }\n break\n case 'right':\n x = width + offsetX\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'middle'\n }\n break\n case 'bottom-right':\n x = width - offsetX\n y = offsetY\n textAnchor = 'end'\n break\n case 'bottom':\n x = width / 2\n y = offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'end'\n }\n break\n case 'bottom-left':\n x = offsetX\n y = offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'end'\n }\n break\n case 'left':\n x = -offsetX\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'middle'\n }\n break\n }\n }\n\n return { x, y, rotation, textAnchor }\n}\n\nconst CartesianMarkersItem = ({\n width,\n height,\n axis,\n scale,\n value,\n lineStyle,\n textStyle,\n legend,\n legendPosition,\n legendOffsetX,\n legendOffsetY,\n legendOrientation,\n}) => {\n const theme = useTheme()\n\n let x = 0\n let x2 = 0\n let y = 0\n let y2 = 0\n\n if (axis === 'y') {\n y = scale(value)\n x2 = width\n } else {\n x = scale(value)\n y2 = height\n }\n\n let legendNode = null\n if (legend) {\n const legendProps = computeLabel({\n axis,\n width,\n height,\n position: legendPosition,\n offsetX: legendOffsetX,\n offsetY: legendOffsetY,\n orientation: legendOrientation,\n })\n legendNode = (\n \n {legend}\n \n )\n }\n\n return (\n \n \n {legendNode}\n \n )\n}\n\nCartesianMarkersItem.propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n\n axis: PropTypes.oneOf(['x', 'y']).isRequired,\n scale: PropTypes.func.isRequired,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.instanceOf(Date)])\n .isRequired,\n lineStyle: PropTypes.object,\n textStyle: PropTypes.object,\n\n legend: PropTypes.string,\n legendPosition: PropTypes.oneOf([\n 'top-left',\n 'top',\n 'top-right',\n 'right',\n 'bottom-right',\n 'bottom',\n 'bottom-left',\n 'left',\n ]),\n legendOffsetX: PropTypes.number.isRequired,\n legendOffsetY: PropTypes.number.isRequired,\n legendOrientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired,\n}\nCartesianMarkersItem.defaultProps = {\n legendPosition: 'top-right',\n legendOffsetX: 14,\n legendOffsetY: 14,\n legendOrientation: 'horizontal',\n}\n\nexport default memo(CartesianMarkersItem)\n","import { createElement, memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useSpring, animated } from '@react-spring/web'\nimport { useTheme } from '../../theming'\nimport { useMotionConfig } from '../../motion'\nimport DotsItemSymbol from './DotsItemSymbol'\n\nconst DotsItem = ({\n x,\n y,\n symbol = DotsItemSymbol,\n size,\n datum,\n color,\n borderWidth,\n borderColor,\n label,\n labelTextAnchor = 'middle',\n labelYOffset = -12,\n}) => {\n const theme = useTheme()\n\n const { animate, config: springConfig } = useMotionConfig()\n const animatedProps = useSpring({\n transform: `translate(${x}, ${y})`,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n \n {createElement(symbol, {\n size,\n color,\n datum,\n borderWidth,\n borderColor,\n })}\n {label && (\n \n {label}\n \n )}\n \n )\n}\n\nDotsItem.propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n datum: PropTypes.object.isRequired,\n\n size: PropTypes.number.isRequired,\n color: PropTypes.string.isRequired,\n borderWidth: PropTypes.number.isRequired,\n borderColor: PropTypes.string.isRequired,\n\n symbol: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n labelTextAnchor: PropTypes.oneOf(['start', 'middle', 'end']),\n labelYOffset: PropTypes.number.isRequired,\n}\n\nexport default memo(DotsItem)\n","import { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport CartesianMarkersItem from './CartesianMarkersItem'\n\nconst CartesianMarkers = ({ markers, width, height, xScale, yScale }) => {\n if (!markers || markers.length === 0) return null\n\n return markers.map((marker, i) => (\n \n ))\n}\n\nCartesianMarkers.propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n\n xScale: PropTypes.func.isRequired,\n yScale: PropTypes.func.isRequired,\n\n markers: PropTypes.arrayOf(\n PropTypes.shape({\n axis: PropTypes.oneOf(['x', 'y']).isRequired,\n value: PropTypes.oneOfType([\n PropTypes.number,\n PropTypes.string,\n PropTypes.instanceOf(Date),\n ]).isRequired,\n lineStyle: PropTypes.object,\n textStyle: PropTypes.object,\n })\n ),\n}\n\nexport default memo(CartesianMarkers)\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import getPrototypeOf from \"@babel/runtime/helpers/esm/getPrototypeOf\";\nimport isNativeReflectConstruct from \"@babel/runtime/helpers/esm/isNativeReflectConstruct\";\nimport possibleConstructorReturn from \"@babel/runtime/helpers/esm/possibleConstructorReturn\";\nexport default function _createSuper(Derived) {\n var hasNativeReflectConstruct = isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { Component } from 'react'\nimport { Container } from '../components/Container'\n\nexport const withContainer = WrappedComponent => {\n // eslint-disable-next-line react/display-name\n return class extends Component {\n render() {\n // eslint-disable-next-line react/prop-types\n const {\n theme,\n renderWrapper,\n animate,\n motionStiffness,\n motionDamping,\n motionConfig,\n ...childProps\n } = this.props\n\n return (\n \n \n \n )\n }\n }\n}\n","import setPrototypeOf from \"@babel/runtime/helpers/esm/setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import isFunction from 'lodash/isFunction'\nimport get from 'lodash/get'\nimport { format } from 'd3-format'\nimport { useMemo } from 'react'\n\nexport const getLabelGenerator = (_label, labelFormat) => {\n const getRawLabel = isFunction(_label) ? _label : d => get(d, _label)\n let formatter\n if (labelFormat) {\n formatter = isFunction(labelFormat) ? labelFormat : format(labelFormat)\n }\n\n if (formatter) return d => formatter(getRawLabel(d))\n return getRawLabel\n}\n\nexport const getPropertyAccessor = accessor =>\n isFunction(accessor) ? accessor : d => get(d, accessor)\n\nexport const usePropertyAccessor = accessor =>\n useMemo(() => getPropertyAccessor(accessor), [accessor])\n","/**\n * Computes distance between two points.\n *\n * @param {number} x1\n * @param {number} y1\n * @param {number} x2\n * @param {number} y2\n * @return {number}\n */\nexport const getDistance = (x1, y1, x2, y2) => {\n let deltaX = x2 - x1\n let deltaY = y2 - y1\n\n deltaX *= deltaX\n deltaY *= deltaY\n\n return Math.sqrt(deltaX + deltaY)\n}\n\n/**\n * Computes angle (radians) between two points.\n *\n * @param {number} x1\n * @param {number} y1\n * @param {number} x2\n * @param {number} y2\n * @return {number}\n */\nexport const getAngle = (x1, y1, x2, y2) => {\n const angle = Math.atan2(y2 - y1, x2 - x1) - Math.PI / 2\n\n return angle > 0 ? angle : Math.PI * 2 + angle\n}\n\n/**\n * Check if cursor is in given rectangle.\n *\n * @param {number} x\n * @param {number} y\n * @param {number} width\n * @param {number} height\n * @param {number} cursorX\n * @param {number} cursorY\n * @return {boolean}\n */\nexport const isCursorInRect = (x, y, width, height, cursorX, cursorY) =>\n x <= cursorX && cursorX <= x + width && y <= cursorY && cursorY <= y + height\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nexport * from './detect'\n\nexport const getRelativeCursor = (el, event) => {\n const { clientX, clientY } = event\n const bounds = el.getBoundingClientRect()\n\n return [clientX - bounds.left, clientY - bounds.top]\n}\n","import arrayWithoutHoles from \"@babel/runtime/helpers/esm/arrayWithoutHoles\";\nimport iterableToArray from \"@babel/runtime/helpers/esm/iterableToArray\";\nimport unsupportedIterableToArray from \"@babel/runtime/helpers/esm/unsupportedIterableToArray\";\nimport nonIterableSpread from \"@babel/runtime/helpers/esm/nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"@babel/runtime/helpers/esm/arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import isFunction from 'lodash/isFunction'\nimport isPlainObject from 'lodash/isPlainObject'\nimport pick from 'lodash/pick'\nimport isEqual from 'lodash/isEqual'\nimport get from 'lodash/get'\nimport set from 'lodash/set'\nimport { gradientTypes, patternTypes } from '../components/defs'\n\nconst gradientKeys = Object.keys(gradientTypes)\nconst patternKeys = Object.keys(patternTypes)\n\n/**\n * Check a node matches given def predicate.\n *\n * @param {string|Function|Object} predicate\n * @param {Object} node\n * @param {string} [dataKey] - Optional path to access node data\n * @returns {boolean}\n */\nexport const isMatchingDef = (predicate, node, dataKey) => {\n if (predicate === '*') {\n return true\n } else if (isFunction(predicate)) {\n return predicate(node)\n } else if (isPlainObject(predicate)) {\n const data = dataKey ? get(node, dataKey) : node\n return isEqual(pick(data, Object.keys(predicate)), predicate)\n }\n\n return false\n}\n\n/**\n * Compute SVG defs.\n *\n * @param {Array.} defs - Base SVG defs configs\n * @param {Array.} nodes - Data nodes to apply defs on\n * @param {Array.} rules - Rules used to conditionally apply defs on data nodes\n * @param {string} [dataKey] - Path to node data, used for rule object query based predicate\n * @param {string} [colorKey='color'] - Node color path, required when inheritance is involved\n * @param {string} [targetKey='fill'] - Node target property to apply def ID on\n * @returns {Array}\n */\nexport const bindDefs = (\n defs,\n nodes,\n rules,\n { dataKey, colorKey = 'color', targetKey = 'fill' } = {}\n) => {\n let boundDefs = []\n\n // will hold generated variation ids,\n // to avoid generating multiple identical defs\n const generatedIds = {}\n\n if (defs.length && nodes.length) {\n // first, add base defs\n boundDefs = [...defs]\n\n nodes.forEach(node => {\n for (let i = 0; i < rules.length; i++) {\n const { id, match } = rules[i]\n if (isMatchingDef(match, node, dataKey)) {\n const def = defs.find(({ id: defId }) => defId === id)\n if (def) {\n if (patternKeys.includes(def.type)) {\n if (def.background === 'inherit' || def.color === 'inherit') {\n const nodeColor = get(node, colorKey)\n let background = def.background\n let color = def.color\n\n let inheritedId = id\n if (def.background === 'inherit') {\n inheritedId = `${inheritedId}.bg.${nodeColor}`\n background = nodeColor\n }\n if (def.color === 'inherit') {\n inheritedId = `${inheritedId}.fg.${nodeColor}`\n color = nodeColor\n }\n\n set(node, targetKey, `url(#${inheritedId})`)\n if (!generatedIds[inheritedId]) {\n boundDefs.push({\n ...def,\n id: inheritedId,\n background,\n color,\n })\n generatedIds[inheritedId] = 1\n }\n } else {\n // do not generate new def as there's no inheritance involved\n set(node, targetKey, `url(#${id})`)\n }\n } else if (gradientKeys.includes(def.type)) {\n const allColors = def.colors.map(({ color }) => color)\n\n if (allColors.includes('inherit')) {\n const nodeColor = get(node, colorKey)\n\n let inheritedId = id\n const inheritedDef = {\n ...def,\n colors: def.colors.map((colorStop, i) => {\n if (colorStop.color !== 'inherit') return colorStop\n\n inheritedId = `${inheritedId}.${i}.${nodeColor}`\n\n return {\n ...colorStop,\n color:\n colorStop.color === 'inherit'\n ? nodeColor\n : colorStop.color,\n }\n }),\n }\n inheritedDef.id = inheritedId\n\n set(node, targetKey, `url(#${inheritedId})`)\n if (!generatedIds[inheritedId]) {\n boundDefs.push(inheritedDef)\n generatedIds[inheritedId] = 1\n }\n } else {\n // do not generate new def as there's no inheritance involved\n set(node, targetKey, `url(#${id})`)\n }\n }\n }\n\n // break loop on first match\n break\n }\n }\n })\n }\n\n return boundDefs\n}\n","export default function(specifier) {\n var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;\n while (i < n) colors[i] = \"#\" + specifier.slice(i * 6, ++i * 6);\n return colors;\n}\n","export var abs = Math.abs;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var max = Math.max;\nexport var min = Math.min;\nexport var sin = Math.sin;\nexport var sqrt = Math.sqrt;\n\nexport var epsilon = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nmodule.exports = last;\n","import {interpolateRgbBasis} from \"d3-interpolate\";\n\nexport default scheme => interpolateRgbBasis(scheme[scheme.length - 1]);\n","import interval from \"./interval.js\";\n\nvar millisecond = interval(function() {\n // noop\n}, function(date, step) {\n date.setTime(+date + step);\n}, function(start, end) {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return interval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n};\n\nexport default millisecond;\nexport var milliseconds = millisecond.range;\n","import interval from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nvar second = interval(function(date) {\n date.setTime(date - date.getMilliseconds());\n}, function(date, step) {\n date.setTime(+date + step * durationSecond);\n}, function(start, end) {\n return (end - start) / durationSecond;\n}, function(date) {\n return date.getUTCSeconds();\n});\n\nexport default second;\nexport var seconds = second.range;\n","import interval from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nvar minute = interval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getMinutes();\n});\n\nexport default minute;\nexport var minutes = minute.range;\n","import interval from \"./interval.js\";\nimport {durationMinute} from \"./duration.js\";\n\nvar utcMinute = interval(function(date) {\n date.setUTCSeconds(0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getUTCMinutes();\n});\n\nexport default utcMinute;\nexport var utcMinutes = utcMinute.range;\n","import interval from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nvar hour = interval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getHours();\n});\n\nexport default hour;\nexport var hours = hour.range;\n","import interval from \"./interval.js\";\nimport {durationHour} from \"./duration.js\";\n\nvar utcHour = interval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getUTCHours();\n});\n\nexport default utcHour;\nexport var utcHours = utcHour.range;\n","import interval from \"./interval.js\";\n\nvar month = interval(function(date) {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setMonth(date.getMonth() + step);\n}, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, function(date) {\n return date.getMonth();\n});\n\nexport default month;\nexport var months = month.range;\n","import interval from \"./interval.js\";\n\nvar utcMonth = interval(function(date) {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, function(date) {\n return date.getUTCMonth();\n});\n\nexport default utcMonth;\nexport var utcMonths = utcMonth.range;\n","import { BoxLegendSvgProps, LegendAnchor, LegendItemDirection } from './types'\n\nconst isObject = (item: unknown): item is T =>\n typeof item === 'object' && !Array.isArray(item) && item !== null\n\nconst zeroPadding = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n}\n\nexport const computeDimensions = ({\n direction,\n itemsSpacing,\n padding: _padding,\n itemCount,\n itemWidth,\n itemHeight,\n}: Pick &\n Record<'itemsSpacing' | 'itemCount' | 'itemWidth' | 'itemHeight', number>) => {\n if (typeof _padding !== 'number' && !isObject(_padding)) {\n throw new Error('Invalid property padding, must be one of: number, object')\n }\n\n const padding =\n typeof _padding === 'number'\n ? {\n top: _padding,\n right: _padding,\n bottom: _padding,\n left: _padding,\n }\n : {\n ...zeroPadding,\n ..._padding,\n }\n\n const horizontalPadding = padding.left + padding.right\n const verticalPadding = padding.top + padding.bottom\n let width = itemWidth + horizontalPadding\n let height = itemHeight + verticalPadding\n const spacing = (itemCount - 1) * itemsSpacing\n if (direction === 'row') {\n width = itemWidth * itemCount + spacing + horizontalPadding\n } else if (direction === 'column') {\n height = itemHeight * itemCount + spacing + verticalPadding\n }\n\n return { width, height, padding }\n}\n\nexport const computePositionFromAnchor = ({\n anchor,\n translateX,\n translateY,\n containerWidth,\n containerHeight,\n width,\n height,\n}: { anchor: LegendAnchor } & Record<\n 'translateX' | 'translateY' | 'containerWidth' | 'containerHeight' | 'width' | 'height',\n number\n>) => {\n let x = translateX\n let y = translateY\n\n switch (anchor) {\n case 'top':\n x += (containerWidth - width) / 2\n break\n\n case 'top-right':\n x += containerWidth - width\n break\n\n case 'right':\n x += containerWidth - width\n y += (containerHeight - height) / 2\n break\n\n case 'bottom-right':\n x += containerWidth - width\n y += containerHeight - height\n break\n\n case 'bottom':\n x += (containerWidth - width) / 2\n y += containerHeight - height\n break\n\n case 'bottom-left':\n y += containerHeight - height\n break\n\n case 'left':\n y += (containerHeight - height) / 2\n break\n\n case 'center':\n x += (containerWidth - width) / 2\n y += (containerHeight - height) / 2\n break\n }\n\n return { x, y }\n}\n\nexport const computeItemLayout = ({\n direction,\n justify,\n symbolSize,\n symbolSpacing,\n width,\n height,\n}: {\n direction: LegendItemDirection\n justify: boolean\n} & Record<'symbolSize' | 'symbolSpacing' | 'width' | 'height', number>) => {\n let symbolX\n let symbolY\n\n let labelX\n let labelY\n let labelAnchor: 'start' | 'middle' | 'end'\n let labelAlignment: 'alphabetic' | 'central' | 'text-before-edge'\n\n switch (direction) {\n case 'left-to-right':\n symbolX = 0\n symbolY = (height - symbolSize) / 2\n\n labelY = height / 2\n labelAlignment = 'central'\n if (justify === true) {\n labelX = width\n labelAnchor = 'end'\n } else {\n labelX = symbolSize + symbolSpacing\n labelAnchor = 'start'\n }\n break\n\n case 'right-to-left':\n symbolX = width - symbolSize\n symbolY = (height - symbolSize) / 2\n\n labelY = height / 2\n labelAlignment = 'central'\n if (justify === true) {\n labelX = 0\n labelAnchor = 'start'\n } else {\n labelX = width - symbolSize - symbolSpacing\n labelAnchor = 'end'\n }\n break\n\n case 'top-to-bottom':\n symbolX = (width - symbolSize) / 2\n symbolY = 0\n\n labelX = width / 2\n\n labelAnchor = 'middle'\n if (justify === true) {\n labelY = height\n labelAlignment = 'alphabetic'\n } else {\n labelY = symbolSize + symbolSpacing\n labelAlignment = 'text-before-edge'\n }\n break\n\n case 'bottom-to-top':\n symbolX = (width - symbolSize) / 2\n symbolY = height - symbolSize\n\n labelX = width / 2\n labelAnchor = 'middle'\n if (justify === true) {\n labelY = 0\n labelAlignment = 'text-before-edge'\n } else {\n labelY = height - symbolSize - symbolSpacing\n labelAlignment = 'alphabetic'\n }\n break\n }\n\n return {\n symbolX,\n symbolY,\n\n labelX,\n labelY,\n labelAnchor,\n labelAlignment,\n }\n}\n","import { useMemo, memo } from 'react'\nimport * as React from 'react'\nimport { animated } from '@react-spring/web'\nimport { useTheme } from '@nivo/core'\nimport { AxisTickProps, AxisValue } from '../types'\n\nconst AxisTick = ({\n value: _value,\n format,\n lineX,\n lineY,\n onClick,\n textBaseline,\n textAnchor,\n animatedProps,\n}: AxisTickProps) => {\n const theme = useTheme()\n\n const value = format?.(_value) ?? _value\n\n const props = useMemo(() => {\n const style = { opacity: animatedProps.opacity }\n\n if (!onClick) {\n return { style }\n }\n\n return {\n style: { ...style, cursor: 'pointer' },\n onClick: (event: React.MouseEvent) => onClick(event, value),\n }\n }, [animatedProps.opacity, onClick, value])\n\n return (\n \n \n \n {value}\n \n \n )\n}\n\nconst memoizedAxisTick = memo(AxisTick) as typeof AxisTick\n\nexport { memoizedAxisTick as AxisTick }\n","import { useMemo, memo } from 'react'\nimport * as React from 'react'\nimport { useSpring, useTransition, animated } from '@react-spring/web'\nimport { useTheme, useMotionConfig } from '@nivo/core'\nimport { computeCartesianTicks, getFormatter } from '../compute'\nimport { AxisTick } from './AxisTick'\nimport { AnyScale, AxisProps, AxisValue } from '../types'\n\nconst Axis = ({\n axis,\n scale,\n x = 0,\n y = 0,\n length,\n ticksPosition,\n tickValues,\n tickSize = 5,\n tickPadding = 5,\n tickRotation = 0,\n format,\n renderTick = AxisTick,\n legend,\n legendPosition = 'end',\n legendOffset = 0,\n onClick,\n ariaHidden,\n}: AxisProps & {\n axis: 'x' | 'y'\n scale: AnyScale\n x?: number\n y?: number\n length: number\n onClick?: (event: React.MouseEvent, value: Value | string) => void\n}) => {\n const theme = useTheme()\n\n const formatValue = useMemo(() => getFormatter(format, scale), [format, scale])\n\n const { ticks, textAlign, textBaseline } = computeCartesianTicks({\n axis,\n scale,\n ticksPosition,\n tickValues,\n tickSize,\n tickPadding,\n tickRotation,\n })\n\n let legendNode = null\n if (legend !== undefined) {\n let legendX = 0\n let legendY = 0\n let legendRotation = 0\n let textAnchor\n\n if (axis === 'y') {\n legendRotation = -90\n legendX = legendOffset\n if (legendPosition === 'start') {\n textAnchor = 'start'\n legendY = length\n } else if (legendPosition === 'middle') {\n textAnchor = 'middle'\n legendY = length / 2\n } else if (legendPosition === 'end') {\n textAnchor = 'end'\n }\n } else {\n legendY = legendOffset\n if (legendPosition === 'start') {\n textAnchor = 'start'\n } else if (legendPosition === 'middle') {\n textAnchor = 'middle'\n legendX = length / 2\n } else if (legendPosition === 'end') {\n textAnchor = 'end'\n legendX = length\n }\n }\n\n legendNode = (\n \n {legend}\n \n )\n }\n\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n transform: `translate(${x},${y})`,\n lineX2: axis === 'x' ? length : 0,\n lineY2: axis === 'x' ? 0 : length,\n config: springConfig,\n immediate: !animate,\n })\n\n const transition = useTransition<\n typeof ticks[0],\n { opacity: number; transform: string; textTransform: string }\n >(ticks, {\n keys: tick => tick.key,\n initial: tick => ({\n opacity: 1,\n transform: `translate(${tick.x},${tick.y})`,\n textTransform: `translate(${tick.textX},${tick.textY}) rotate(${tickRotation})`,\n }),\n from: tick => ({\n opacity: 0,\n transform: `translate(${tick.x},${tick.y})`,\n textTransform: `translate(${tick.textX},${tick.textY}) rotate(${tickRotation})`,\n }),\n enter: tick => ({\n opacity: 1,\n transform: `translate(${tick.x},${tick.y})`,\n textTransform: `translate(${tick.textX},${tick.textY}) rotate(${tickRotation})`,\n }),\n update: tick => ({\n opacity: 1,\n transform: `translate(${tick.x},${tick.y})`,\n textTransform: `translate(${tick.textX},${tick.textY}) rotate(${tickRotation})`,\n }),\n leave: {\n opacity: 0,\n },\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n \n {transition((transitionProps, tick, _state, tickIndex) => {\n return React.createElement(renderTick, {\n tickIndex,\n format: formatValue,\n rotate: tickRotation,\n textBaseline,\n textAnchor: textAlign,\n animatedProps: transitionProps,\n ...tick,\n ...(onClick ? { onClick } : {}),\n })\n })}\n \n {legendNode}\n \n )\n}\n\nconst memoizedAxis = memo(Axis) as typeof Axis\n\nexport { memoizedAxis as Axis }\n","import { OrdinalColorScaleConfig } from '@nivo/colors'\nimport { ArcTransitionMode } from '@nivo/arcs'\nimport { PieTooltip } from './PieTooltip'\n\nexport const defaultProps = {\n id: 'id',\n value: 'value',\n sortByValue: false,\n innerRadius: 0,\n padAngle: 0,\n cornerRadius: 0,\n\n layers: ['arcLinkLabels', 'arcs', 'arcLabels', 'legends'],\n\n // layout\n startAngle: 0,\n endAngle: 360,\n fit: true,\n activeInnerRadiusOffset: 0,\n activeOuterRadiusOffset: 0,\n\n // border\n borderWidth: 0,\n borderColor: {\n from: 'color',\n modifiers: [['darker', 1]],\n },\n\n // arc labels\n enableArcLabels: true,\n arcLabel: 'formattedValue',\n arcLabelsSkipAngle: 0,\n arcLabelsRadiusOffset: 0.5,\n arcLabelsTextColor: { theme: 'labels.text.fill' },\n\n // arc link labels\n enableArcLinkLabels: true,\n arcLinkLabel: 'id',\n arcLinkLabelsSkipAngle: 0,\n arcLinkLabelsOffset: 0,\n arcLinkLabelsDiagonalLength: 16,\n arcLinkLabelsStraightLength: 24,\n arcLinkLabelsThickness: 1,\n arcLinkLabelsTextOffset: 6,\n arcLinkLabelsTextColor: { theme: 'labels.text.fill' },\n arcLinkLabelsColor: { theme: 'axis.ticks.line.stroke' },\n\n colors: ({ scheme: 'nivo' } as unknown) as OrdinalColorScaleConfig,\n defs: [],\n fill: [],\n\n isInteractive: true,\n\n animate: true,\n motionConfig: 'gentle',\n transitionMode: 'innerRadius' as ArcTransitionMode,\n\n tooltip: PieTooltip,\n\n legends: [],\n\n role: 'img',\n\n pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio ?? 1 : 1,\n}\n","import { memo } from 'react'\nimport { Axis } from './Axis'\nimport { positions } from '../props'\nimport { AnyScale, AxisProps, AxisValue } from '../types'\n\nexport const Axes = memo(\n ({\n xScale,\n yScale,\n width,\n height,\n top,\n right,\n bottom,\n left,\n }: {\n xScale: AnyScale\n yScale: AnyScale\n width: number\n height: number\n top?: AxisProps | null\n right?: AxisProps | null\n bottom?: AxisProps | null\n left?: AxisProps | null\n }) => {\n const axes = { top, right, bottom, left }\n\n return (\n <>\n {positions.map(position => {\n const axis = axes[position] as typeof position extends 'bottom' | 'top'\n ? AxisProps | undefined\n : AxisProps | undefined\n\n if (!axis) return null\n\n const isXAxis = position === 'top' || position === 'bottom'\n const ticksPosition =\n position === 'top' || position === 'left' ? 'before' : 'after'\n\n return (\n \n )\n })}\n >\n )\n }\n)\n","import { memo } from 'react'\nimport { SpringValues, animated } from '@react-spring/web'\nimport { useTheme } from '@nivo/core'\n\nexport const GridLine = memo(\n ({\n animatedProps,\n }: {\n animatedProps: SpringValues<{\n opacity: number\n x1: number\n x2: number\n y1: number\n y2: number\n }>\n }) => {\n const theme = useTheme()\n\n return \n }\n)\n","import { memo } from 'react'\nimport { useTransition } from '@react-spring/web'\nimport { useMotionConfig } from '@nivo/core'\nimport { GridLine } from './GridLine'\nimport { Line } from '../types'\n\nexport const GridLines = memo(({ lines }: { lines: Line[] }) => {\n const { animate, config: springConfig } = useMotionConfig()\n\n const transition = useTransition>(\n lines,\n {\n keys: line => line.key,\n initial: line => ({\n opacity: 1,\n x1: line.x1,\n x2: line.x2,\n y1: line.y1,\n y2: line.y2,\n }),\n from: line => ({\n opacity: 0,\n x1: line.x1,\n x2: line.x2,\n y1: line.y1,\n y2: line.y2,\n }),\n enter: line => ({\n opacity: 1,\n x1: line.x1,\n x2: line.x2,\n y1: line.y1,\n y2: line.y2,\n }),\n update: line => ({\n opacity: 1,\n x1: line.x1,\n x2: line.x2,\n y1: line.y1,\n y2: line.y2,\n }),\n leave: {\n opacity: 0,\n },\n config: springConfig,\n immediate: !animate,\n }\n )\n\n return (\n \n {transition((animatedProps, line) => (\n \n ))}\n \n )\n})\n","import { useMemo, memo } from 'react'\nimport { GridLines } from './GridLines'\nimport { computeGridLines } from '../compute'\nimport { AnyScale, AxisValue, TicksSpec } from '../types'\n\nexport const Grid = memo(\n ({\n width,\n height,\n xScale,\n yScale,\n xValues,\n yValues,\n }: {\n width: number\n height: number\n xScale?: AnyScale | null\n xValues?: TicksSpec\n yScale?: AnyScale | null\n yValues?: TicksSpec\n }) => {\n const xLines = useMemo(() => {\n if (!xScale) return false\n\n return computeGridLines({\n width,\n height,\n scale: xScale,\n axis: 'x',\n values: xValues,\n })\n }, [xScale, xValues, width, height])\n\n const yLines = useMemo(() => {\n if (!yScale) return false\n\n return computeGridLines({\n width,\n height,\n scale: yScale,\n axis: 'y',\n values: yValues,\n })\n }, [height, width, yScale, yValues])\n\n return (\n <>\n {xLines && }\n {yLines && }\n >\n )\n }\n)\n","import { computeDimensions, computePositionFromAnchor, computeItemLayout } from './compute'\nimport { LegendCanvasProps } from './types'\n\nconst textAlignMapping = {\n start: 'left',\n middle: 'center',\n end: 'right',\n} as const\n\nexport const renderLegendToCanvas = (\n ctx: CanvasRenderingContext2D,\n {\n data,\n\n containerWidth,\n containerHeight,\n translateX = 0,\n translateY = 0,\n anchor,\n direction,\n padding: _padding = 0,\n justify = false,\n\n // items\n itemsSpacing = 0,\n itemWidth,\n itemHeight,\n itemDirection = 'left-to-right',\n itemTextColor,\n\n // symbol\n symbolSize = 16,\n symbolSpacing = 8,\n // @todo add support for shapes\n // symbolShape = LegendSvgItem.defaultProps.symbolShape,\n\n theme,\n }: LegendCanvasProps\n) => {\n const { width, height, padding } = computeDimensions({\n itemCount: data.length,\n itemWidth,\n itemHeight,\n itemsSpacing,\n direction,\n padding: _padding,\n })\n\n const { x, y } = computePositionFromAnchor({\n anchor,\n translateX,\n translateY,\n containerWidth,\n containerHeight,\n width,\n height,\n })\n\n const xStep = direction === 'row' ? itemWidth + itemsSpacing : 0\n const yStep = direction === 'column' ? itemHeight + itemsSpacing : 0\n\n ctx.save()\n ctx.translate(x, y)\n\n ctx.font = `${theme.legends.text.fontSize}px ${theme.legends.text.fontFamily || 'sans-serif'}`\n\n data.forEach((d, i) => {\n const itemX = i * xStep + padding.left\n const itemY = i * yStep + padding.top\n\n const { symbolX, symbolY, labelX, labelY, labelAnchor, labelAlignment } = computeItemLayout(\n {\n direction: itemDirection,\n justify,\n symbolSize,\n symbolSpacing,\n width: itemWidth,\n height: itemHeight,\n }\n )\n\n ctx.fillStyle = d.color ?? 'black'\n ctx.fillRect(itemX + symbolX, itemY + symbolY, symbolSize, symbolSize)\n\n ctx.textAlign = textAlignMapping[labelAnchor]\n\n if (labelAlignment === 'central') {\n ctx.textBaseline = 'middle'\n }\n\n ctx.fillStyle = itemTextColor ?? theme.legends.text.fill ?? 'black'\n ctx.fillText(String(d.label), itemX + labelX, itemY + labelY)\n })\n\n ctx.restore()\n}\n","import { useMemo } from 'react'\nimport { radiansToDegrees, positionFromAngle, degreesToRadians } from '@nivo/core'\nimport { DatumWithArc } from './types'\n\n/**\n * Make sure an angle (expressed in radians)\n * always falls in the range 0~2*PI.\n */\nexport const getNormalizedAngle = (angle: number) => {\n let normalizedAngle = angle % (Math.PI * 2)\n if (normalizedAngle < 0) {\n normalizedAngle += Math.PI * 2\n }\n\n return normalizedAngle\n}\n\n/**\n * Filter out arcs with a length below `skipAngle`.\n */\nexport const filterDataBySkipAngle = (\n data: Datum[],\n skipAngle: number\n) =>\n data.filter(\n datum => Math.abs(radiansToDegrees(datum.arc.endAngle - datum.arc.startAngle)) >= skipAngle\n )\n\n/**\n * Memoized version of `filterDataBySkipAngle`.\n */\nexport const useFilteredDataBySkipAngle = (\n data: Datum[],\n skipAngle: number\n) => useMemo(() => filterDataBySkipAngle(data, skipAngle), [data, skipAngle])\n\nexport const svgEllipticalArcCommand = (\n radius: number,\n largeArcFlag: 0 | 1,\n sweepFlag: 0 | 1,\n x: number,\n y: number\n) =>\n [\n 'A',\n radius,\n radius,\n 0, // x-axis-rotation\n largeArcFlag,\n sweepFlag,\n x,\n y,\n ].join(' ')\n\nexport const generateSvgArc = (\n radius: number,\n originalStartAngle: number,\n originalEndAngle: number\n): string => {\n const startAngle = Math.min(originalStartAngle, originalEndAngle)\n const endAngle = Math.max(originalStartAngle, originalEndAngle)\n\n const start = positionFromAngle(degreesToRadians(endAngle), radius)\n const end = positionFromAngle(degreesToRadians(startAngle), radius)\n\n // we have a full circle, we cannot use a single elliptical arc\n // to draw it, so we use 2 in that case.\n if (endAngle - startAngle >= 360) {\n const mid = positionFromAngle(degreesToRadians(startAngle + 180), radius)\n\n return [\n `M ${start.x} ${start.y}`,\n svgEllipticalArcCommand(radius, 1, 1, mid.x, mid.y),\n `M ${start.x} ${start.y}`,\n svgEllipticalArcCommand(radius, 1, 0, mid.x, mid.y),\n ].join(' ')\n }\n\n const largeArcFlag = endAngle - startAngle <= 180 ? 0 : 1\n\n return [\n `M ${start.x} ${start.y}`,\n svgEllipticalArcCommand(radius, largeArcFlag, 0, end.x, end.y),\n ].join(' ')\n}\n","import { useCallback, useMemo, useState } from 'react'\nimport { pie as d3Pie } from 'd3-shape'\nimport { useArcGenerator, computeArcBoundingBox } from '@nivo/arcs'\nimport {\n degreesToRadians,\n radiansToDegrees,\n useValueFormatter,\n usePropertyAccessor,\n} from '@nivo/core'\nimport { OrdinalColorScaleConfig, useOrdinalColorScale } from '@nivo/colors'\nimport { defaultProps } from './props'\nimport { CompletePieSvgProps, ComputedDatum, DatumId, PieArc, PieCustomLayerProps } from './types'\n\ninterface MayHaveLabel {\n label?: string | number\n}\n\n/**\n * Format data so that we get a consistent data structure.\n * It will also add the `formattedValue` and `color` property.\n */\nexport const useNormalizedData = ({\n data,\n id = defaultProps.id,\n value = defaultProps.value,\n valueFormat,\n colors = defaultProps.colors as OrdinalColorScaleConfig<\n Omit, 'arc' | 'color' | 'fill'>\n >,\n}: Pick, 'id' | 'value' | 'valueFormat' | 'colors'> & {\n data: RawDatum[]\n}): Omit, 'arc' | 'fill'>[] => {\n const getId = usePropertyAccessor(id)\n const getValue = usePropertyAccessor(value)\n const formatValue = useValueFormatter(valueFormat)\n\n const getColor = useOrdinalColorScale, 'arc' | 'color' | 'fill'>>(\n colors,\n 'id'\n )\n\n return useMemo(\n () =>\n data.map(datum => {\n const datumId = getId(datum)\n const datumValue = getValue(datum)\n\n const normalizedDatum: Omit, 'arc' | 'color' | 'fill'> = {\n id: datumId,\n label: datum.label ?? datumId,\n hidden: false,\n value: datumValue,\n formattedValue: formatValue(datumValue),\n data: datum,\n }\n\n return {\n ...normalizedDatum,\n color: getColor(normalizedDatum),\n }\n }),\n [data, getId, getValue, formatValue, getColor]\n )\n}\n\n/**\n * Compute arcs, which don't depend yet on radius.\n */\nexport const usePieArcs = ({\n data,\n startAngle,\n endAngle,\n innerRadius,\n outerRadius,\n padAngle,\n sortByValue,\n activeId,\n activeInnerRadiusOffset,\n activeOuterRadiusOffset,\n hiddenIds,\n}: {\n data: Omit, 'arc' | 'fill'>[]\n // in degrees\n startAngle: number\n // in degrees\n endAngle: number\n // in pixels\n innerRadius: number\n // in pixels\n outerRadius: number\n padAngle: number\n sortByValue: boolean\n activeId: null | DatumId\n activeInnerRadiusOffset: number\n activeOuterRadiusOffset: number\n hiddenIds: DatumId[]\n}): {\n dataWithArc: Omit, 'fill'>[]\n legendData: Omit, 'arc' | 'fill'>[]\n} => {\n const pie = useMemo(() => {\n const innerPie = d3Pie, 'arc' | 'fill'>>()\n .value(d => d.value)\n .startAngle(degreesToRadians(startAngle))\n .endAngle(degreesToRadians(endAngle))\n .padAngle(degreesToRadians(padAngle))\n\n if (!sortByValue) {\n innerPie.sortValues(null)\n }\n\n return innerPie\n }, [startAngle, endAngle, padAngle, sortByValue])\n\n return useMemo(() => {\n const hiddenData = data.filter(item => !hiddenIds.includes(item.id))\n const dataWithArc = pie(hiddenData).map(\n (\n arc: Omit<\n PieArc,\n 'angle' | 'angleDeg' | 'innerRadius' | 'outerRadius' | 'thickness'\n > & {\n data: Omit, 'arc' | 'fill'>\n }\n ) => {\n const angle = Math.abs(arc.endAngle - arc.startAngle)\n\n return {\n ...arc.data,\n arc: {\n index: arc.index,\n startAngle: arc.startAngle,\n endAngle: arc.endAngle,\n innerRadius:\n activeId === arc.data.id\n ? innerRadius - activeInnerRadiusOffset\n : innerRadius,\n outerRadius:\n activeId === arc.data.id\n ? outerRadius + activeOuterRadiusOffset\n : outerRadius,\n thickness: outerRadius - innerRadius,\n padAngle: arc.padAngle,\n angle,\n angleDeg: radiansToDegrees(angle),\n },\n }\n }\n )\n const legendData = data.map(item => ({ ...item, hidden: hiddenIds.includes(item.id) }))\n\n return { dataWithArc, legendData }\n }, [\n pie,\n data,\n hiddenIds,\n activeId,\n innerRadius,\n activeInnerRadiusOffset,\n outerRadius,\n activeOuterRadiusOffset,\n ])\n}\n\n/**\n * Compute pie layout using explicit radius/innerRadius,\n * expressed in pixels.\n */\nexport const usePie = ({\n data,\n radius,\n innerRadius,\n startAngle = defaultProps.startAngle,\n endAngle = defaultProps.endAngle,\n padAngle = defaultProps.padAngle,\n sortByValue = defaultProps.sortByValue,\n cornerRadius = defaultProps.cornerRadius,\n activeInnerRadiusOffset = defaultProps.activeInnerRadiusOffset,\n activeOuterRadiusOffset = defaultProps.activeOuterRadiusOffset,\n}: Pick<\n Partial>,\n | 'startAngle'\n | 'endAngle'\n | 'padAngle'\n | 'sortByValue'\n | 'cornerRadius'\n | 'activeInnerRadiusOffset'\n | 'activeOuterRadiusOffset'\n> & {\n data: Omit, 'arc'>[]\n radius: number\n innerRadius: number\n}) => {\n const [activeId, setActiveId] = useState(null)\n const [hiddenIds, setHiddenIds] = useState([])\n const pieArcs = usePieArcs({\n data,\n startAngle,\n endAngle,\n innerRadius,\n outerRadius: radius,\n padAngle,\n sortByValue,\n activeId,\n activeInnerRadiusOffset,\n activeOuterRadiusOffset,\n hiddenIds,\n })\n\n const toggleSerie = useCallback((id: DatumId) => {\n setHiddenIds(state =>\n state.indexOf(id) > -1 ? state.filter(item => item !== id) : [...state, id]\n )\n }, [])\n\n const arcGenerator = useArcGenerator({ cornerRadius, padAngle: degreesToRadians(padAngle) })\n\n return { ...pieArcs, arcGenerator, setActiveId, toggleSerie }\n}\n\n/**\n * Compute pie layout using a box to find radius/innerRadius,\n * expressed in ratio (0~1), can optionally use the `fit`\n * attribute to find the most space efficient layout.\n *\n * It also returns `centerX`/`centerY` as those can be altered\n * if `fit` is `true`.\n */\nexport const usePieFromBox = ({\n data,\n width,\n height,\n innerRadius: innerRadiusRatio = defaultProps.innerRadius,\n startAngle = defaultProps.startAngle,\n endAngle = defaultProps.endAngle,\n padAngle = defaultProps.padAngle,\n sortByValue = defaultProps.sortByValue,\n cornerRadius = defaultProps.cornerRadius,\n fit = defaultProps.fit,\n activeInnerRadiusOffset = defaultProps.activeInnerRadiusOffset,\n activeOuterRadiusOffset = defaultProps.activeOuterRadiusOffset,\n}: Pick<\n CompletePieSvgProps,\n | 'width'\n | 'height'\n | 'innerRadius'\n | 'startAngle'\n | 'endAngle'\n | 'padAngle'\n | 'sortByValue'\n | 'cornerRadius'\n | 'fit'\n | 'activeInnerRadiusOffset'\n | 'activeOuterRadiusOffset'\n> & {\n data: Omit, 'arc'>[]\n}) => {\n const [activeId, setActiveId] = useState(null)\n const [hiddenIds, setHiddenIds] = useState([])\n const computedProps = useMemo(() => {\n let radius = Math.min(width, height) / 2\n let innerRadius = radius * Math.min(innerRadiusRatio, 1)\n\n let centerX = width / 2\n let centerY = height / 2\n\n let boundingBox\n if (fit) {\n const { points, ...box } = computeArcBoundingBox(\n centerX,\n centerY,\n radius,\n startAngle - 90,\n endAngle - 90\n )\n const ratio = Math.min(width / box.width, height / box.height)\n\n const adjustedBox: {\n width: number\n height: number\n x?: number\n y?: number\n } = {\n width: box.width * ratio,\n height: box.height * ratio,\n }\n adjustedBox.x = (width - adjustedBox.width) / 2\n adjustedBox.y = (height - adjustedBox.height) / 2\n\n centerX = ((centerX - box.x) / box.width) * box.width * ratio + adjustedBox.x\n centerY = ((centerY - box.y) / box.height) * box.height * ratio + adjustedBox.y\n\n boundingBox = { box, ratio, points }\n\n radius = radius * ratio\n innerRadius = innerRadius * ratio\n }\n\n return {\n centerX,\n centerY,\n radius,\n innerRadius,\n debug: boundingBox,\n }\n }, [width, height, innerRadiusRatio, startAngle, endAngle, fit, cornerRadius])\n\n const pieArcs = usePieArcs({\n data,\n startAngle,\n endAngle,\n innerRadius: computedProps.innerRadius,\n outerRadius: computedProps.radius,\n padAngle,\n sortByValue,\n activeId,\n activeInnerRadiusOffset,\n activeOuterRadiusOffset,\n hiddenIds,\n })\n\n const toggleSerie = useCallback((id: DatumId) => {\n setHiddenIds(state =>\n state.indexOf(id) > -1 ? state.filter(item => item !== id) : [...state, id]\n )\n }, [])\n\n const arcGenerator = useArcGenerator({\n cornerRadius,\n padAngle: degreesToRadians(padAngle),\n })\n\n return {\n arcGenerator,\n setActiveId,\n toggleSerie,\n ...pieArcs,\n ...computedProps,\n }\n}\n\n/**\n * Memoize the context to pass to custom layers.\n */\nexport const usePieLayerContext = ({\n dataWithArc,\n arcGenerator,\n centerX,\n centerY,\n radius,\n innerRadius,\n}: PieCustomLayerProps): PieCustomLayerProps =>\n useMemo(\n () => ({\n dataWithArc,\n arcGenerator,\n centerX,\n centerY,\n radius,\n innerRadius,\n }),\n [dataWithArc, arcGenerator, centerX, centerY, radius, innerRadius]\n )\n","import { createElement } from 'react'\nimport omit from 'lodash/omit'\nimport { useSpring, animated } from '@react-spring/web'\nimport { useTheme, useMotionConfig } from '@nivo/core'\nimport { NoteSvg } from './types'\n\nexport const AnnotationNote = ({\n datum,\n x,\n y,\n note,\n}: {\n datum: Datum\n x: number\n y: number\n note: NoteSvg\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n config: springConfig,\n immediate: !animate,\n })\n\n if (typeof note === 'function') {\n return createElement(note, { x, y, datum })\n }\n\n return (\n <>\n {theme.annotations.text.outlineWidth > 0 && (\n \n {note}\n \n )}\n \n {note}\n \n >\n )\n}\n","import { useMemo } from 'react'\nimport { animated } from '@react-spring/web'\nimport { useAnimatedPath, useTheme } from '@nivo/core'\n\nexport const AnnotationLink = ({\n points,\n isOutline = false,\n}: {\n points: [number, number][]\n isOutline?: boolean\n}) => {\n const theme = useTheme()\n\n const path = useMemo(() => {\n const [firstPoint, ...otherPoints] = points\n\n return otherPoints.reduce(\n (acc, [x, y]) => `${acc} L${x},${y}`,\n `M${firstPoint[0]},${firstPoint[1]}`\n )\n }, [points])\n\n const animatedPath = useAnimatedPath(path)\n\n if (isOutline && theme.annotations.link.outlineWidth <= 0) {\n return null\n }\n\n const style = { ...theme.annotations.link }\n if (isOutline) {\n style.strokeLinecap = 'square'\n style.strokeWidth =\n theme.annotations.link.strokeWidth + theme.annotations.link.outlineWidth * 2\n style.stroke = theme.annotations.link.outlineColor\n }\n\n return \n}\n","import arrayWithHoles from \"@babel/runtime/helpers/esm/arrayWithHoles\";\nimport iterableToArray from \"@babel/runtime/helpers/esm/iterableToArray\";\nimport unsupportedIterableToArray from \"@babel/runtime/helpers/esm/unsupportedIterableToArray\";\nimport nonIterableRest from \"@babel/runtime/helpers/esm/nonIterableRest\";\nexport default function _toArray(arr) {\n return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();\n}","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\n\nexport const CircleAnnotationOutline = ({ x, y, size }: { x: number; y: number; size: number }) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n \n )}\n \n >\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\nimport { defaultProps } from './props'\n\nexport const DotAnnotationOutline = ({\n x,\n y,\n size = defaultProps.dotSize,\n}: {\n x: number\n y: number\n size?: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x,\n y,\n radius: size / 2,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n \n )}\n \n >\n )\n}\n","import { useSpring, animated } from '@react-spring/web'\nimport { useMotionConfig, useTheme } from '@nivo/core'\n\nexport const RectAnnotationOutline = ({\n x,\n y,\n width,\n height,\n}: {\n x: number\n y: number\n width: number\n height: number\n}) => {\n const theme = useTheme()\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n x: x - width / 2,\n y: y - height / 2,\n width,\n height,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n <>\n {theme.annotations.outline.outlineWidth > 0 && (\n \n )}\n \n >\n )\n}\n","import { useComputedAnnotation } from './hooks'\nimport { AnnotationNote } from './AnnotationNote'\nimport { AnnotationLink } from './AnnotationLink'\nimport { CircleAnnotationOutline } from './CircleAnnotationOutline'\nimport { DotAnnotationOutline } from './DotAnnotationOutline'\nimport { RectAnnotationOutline } from './RectAnnotationOutline'\nimport { BoundAnnotation } from './types'\nimport { isCircleAnnotation, isDotAnnotation, isRectAnnotation, isSvgNote } from './utils'\n\nexport const Annotation = (annotation: BoundAnnotation) => {\n const { datum, x, y, note } = annotation\n const computed = useComputedAnnotation(annotation)\n\n if (!isSvgNote(note)) {\n throw new Error('note should be a valid react element')\n }\n\n return (\n <>\n \n {isCircleAnnotation(annotation) && (\n \n )}\n {isDotAnnotation(annotation) && (\n \n )}\n {isRectAnnotation(annotation) && (\n \n )}\n \n \n >\n )\n}\n","export default function(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n","import {range as sequence} from \"d3-array\";\nimport {initRange} from \"./init.js\";\nimport ordinal from \"./ordinal.js\";\n\nexport default function band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n r0 = 0,\n r1 = 1,\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = r1 < r0,\n start = reverse ? r1 : r0,\n stop = reverse ? r0 : r1;\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];\n };\n\n scale.rangeRound = function(_) {\n return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band(domain(), [r0, r1])\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return initRange.apply(rescale(), arguments);\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nexport function point() {\n return pointish(band.apply(null, arguments).paddingInner(1));\n}\n","export const durationSecond = 1000;\nexport const durationMinute = durationSecond * 60;\nexport const durationHour = durationMinute * 60;\nexport const durationDay = durationHour * 24;\nexport const durationWeek = durationDay * 7;\nexport const durationMonth = durationDay * 30;\nexport const durationYear = durationDay * 365;\n","var t0 = new Date,\n t1 = new Date;\n\nexport default function newInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = function(date) {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = function(date) {\n var d0 = interval(date),\n d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [], previous;\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = function(step) {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? function(d) { return field(d) % step === 0; }\n : function(d) { return interval.count(0, d) % step === 0; });\n };\n }\n\n return interval;\n}\n","import interval from \"./interval.js\";\n\nvar millisecond = interval(function() {\n // noop\n}, function(date, step) {\n date.setTime(+date + step);\n}, function(start, end) {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return interval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n};\n\nexport default millisecond;\nexport var milliseconds = millisecond.range;\n","import interval from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nvar second = interval(function(date) {\n date.setTime(date - date.getMilliseconds());\n}, function(date, step) {\n date.setTime(+date + step * durationSecond);\n}, function(start, end) {\n return (end - start) / durationSecond;\n}, function(date) {\n return date.getUTCSeconds();\n});\n\nexport default second;\nexport var seconds = second.range;\n","import interval from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nvar minute = interval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getMinutes();\n});\n\nexport default minute;\nexport var minutes = minute.range;\n","import interval from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nvar hour = interval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getHours();\n});\n\nexport default hour;\nexport var hours = hour.range;\n","import interval from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nvar day = interval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport default day;\nexport var days = day.range;\n","import interval from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction weekday(i) {\n return interval(function(date) {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport var sunday = weekday(0);\nexport var monday = weekday(1);\nexport var tuesday = weekday(2);\nexport var wednesday = weekday(3);\nexport var thursday = weekday(4);\nexport var friday = weekday(5);\nexport var saturday = weekday(6);\n\nexport var sundays = sunday.range;\nexport var mondays = monday.range;\nexport var tuesdays = tuesday.range;\nexport var wednesdays = wednesday.range;\nexport var thursdays = thursday.range;\nexport var fridays = friday.range;\nexport var saturdays = saturday.range;\n","import interval from \"./interval.js\";\n\nvar month = interval(function(date) {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setMonth(date.getMonth() + step);\n}, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, function(date) {\n return date.getMonth();\n});\n\nexport default month;\nexport var months = month.range;\n","import interval from \"./interval.js\";\n\nvar year = interval(function(date) {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n}, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n}, function(date) {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\nyear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(date) {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport default year;\nexport var years = year.range;\n","import interval from \"./interval.js\";\nimport {durationMinute} from \"./duration.js\";\n\nvar utcMinute = interval(function(date) {\n date.setUTCSeconds(0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getUTCMinutes();\n});\n\nexport default utcMinute;\nexport var utcMinutes = utcMinute.range;\n","import interval from \"./interval.js\";\nimport {durationHour} from \"./duration.js\";\n\nvar utcHour = interval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getUTCHours();\n});\n\nexport default utcHour;\nexport var utcHours = utcHour.range;\n","import interval from \"./interval.js\";\nimport {durationDay} from \"./duration.js\";\n\nvar utcDay = interval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n}, function(start, end) {\n return (end - start) / durationDay;\n}, function(date) {\n return date.getUTCDate() - 1;\n});\n\nexport default utcDay;\nexport var utcDays = utcDay.range;\n","import interval from \"./interval.js\";\nimport {durationWeek} from \"./duration.js\";\n\nfunction utcWeekday(i) {\n return interval(function(date) {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / durationWeek;\n });\n}\n\nexport var utcSunday = utcWeekday(0);\nexport var utcMonday = utcWeekday(1);\nexport var utcTuesday = utcWeekday(2);\nexport var utcWednesday = utcWeekday(3);\nexport var utcThursday = utcWeekday(4);\nexport var utcFriday = utcWeekday(5);\nexport var utcSaturday = utcWeekday(6);\n\nexport var utcSundays = utcSunday.range;\nexport var utcMondays = utcMonday.range;\nexport var utcTuesdays = utcTuesday.range;\nexport var utcWednesdays = utcWednesday.range;\nexport var utcThursdays = utcThursday.range;\nexport var utcFridays = utcFriday.range;\nexport var utcSaturdays = utcSaturday.range;\n","import interval from \"./interval.js\";\n\nvar utcMonth = interval(function(date) {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, function(date) {\n return date.getUTCMonth();\n});\n\nexport default utcMonth;\nexport var utcMonths = utcMonth.range;\n","import interval from \"./interval.js\";\n\nvar utcYear = interval(function(date) {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, function(date) {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(date) {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport default utcYear;\nexport var utcYears = utcYear.range;\n","import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport millisecond from \"./millisecond.js\";\nimport second from \"./second.js\";\nimport minute from \"./minute.js\";\nimport hour from \"./hour.js\";\nimport day from \"./day.js\";\nimport {sunday as week} from \"./week.js\";\nimport month from \"./month.js\";\nimport year from \"./year.js\";\nimport utcMinute from \"./utcMinute.js\";\nimport utcHour from \"./utcHour.js\";\nimport utcDay from \"./utcDay.js\";\nimport {utcSunday as utcWeek} from \"./utcWeek.js\";\nimport utcMonth from \"./utcMonth.js\";\nimport utcYear from \"./utcYear.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(year, month, week, day, hour, minute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n","import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport nice from \"./nice.js\";\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {\n var scale = continuous(),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(Array.from(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval) {\n var d = domain();\n if (!interval || typeof interval.range !== \"function\") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);\n return interval ? domain(nice(d, interval)) : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));\n };\n\n return scale;\n}\n\nexport default function time() {\n return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);\n}\n","import { timeParse, utcParse } from 'd3-time-format'\n\nexport const timePrecisions = [\n 'millisecond',\n 'second',\n 'minute',\n 'hour',\n 'day',\n 'month',\n 'year',\n] as const\n\nexport type TIME_PRECISION = typeof timePrecisions[number]\n\nexport const precisionCutOffs: ((date: Date) => void)[] = [\n date => date.setMilliseconds(0),\n date => date.setSeconds(0),\n date => date.setMinutes(0),\n date => date.setHours(0),\n date => date.setDate(1),\n date => date.setMonth(0),\n]\n\nexport const precisionCutOffsByType: Record void)[]> = {\n millisecond: [],\n second: precisionCutOffs.slice(0, 1),\n minute: precisionCutOffs.slice(0, 2),\n hour: precisionCutOffs.slice(0, 3),\n day: precisionCutOffs.slice(0, 4),\n month: precisionCutOffs.slice(0, 5),\n year: precisionCutOffs.slice(0, 6),\n}\n\nexport const createPrecisionMethod = (precision: TIME_PRECISION) => (date: Date) => {\n precisionCutOffsByType[precision].forEach(cutOff => {\n cutOff(date)\n })\n\n return date\n}\n\nexport const createDateNormalizer = ({\n format = 'native',\n precision = 'millisecond',\n useUTC = true,\n}: {\n format?: 'native' | string\n precision?: TIME_PRECISION\n useUTC?: boolean\n}) => {\n const precisionFn = createPrecisionMethod(precision)\n\n return (value: Date | string | undefined) => {\n if (value === undefined) {\n return value\n }\n\n if (format === 'native' || value instanceof Date) {\n return precisionFn(value as Date)\n }\n\n const parseTime = useUTC ? utcParse(format) : timeParse(format)\n return precisionFn(parseTime(value as string) as Date)\n }\n}\n","import { scalePoint } from 'd3-scale'\nimport { ComputedSerieAxis, ScalePoint, ScalePointSpec, StringValue } from './types'\n\nexport const createPointScale = (\n _spec: ScalePointSpec,\n data: ComputedSerieAxis ,\n size: number\n) => {\n const scale = scalePoint ().range([0, size]).domain(data.all)\n\n const typedScale = scale as ScalePoint \n typedScale.type = 'point'\n\n return typedScale\n}\n","import { NumberValue, scaleTime, scaleUtc } from 'd3-scale'\nimport { createDateNormalizer } from './timeHelpers'\nimport { ComputedSerieAxis, ScaleTime, ScaleTimeSpec } from './types'\n\nexport const createTimeScale = (\n {\n format = 'native',\n precision = 'millisecond',\n min = 'auto',\n max = 'auto',\n useUTC = true,\n nice = false,\n }: ScaleTimeSpec,\n data: ComputedSerieAxis,\n size: number\n) => {\n const normalize = createDateNormalizer({ format, precision, useUTC })\n\n let minValue: Date | undefined\n if (min === 'auto') {\n minValue = normalize(data.min)\n } else if (format !== 'native') {\n minValue = normalize(min)\n } else {\n minValue = min as Date\n }\n\n let maxValue: Date | undefined\n if (max === 'auto') {\n maxValue = normalize(data.max)\n } else if (format !== 'native') {\n maxValue = normalize(max)\n } else {\n maxValue = max as Date\n }\n\n const scale = useUTC ? scaleUtc() : scaleTime()\n\n scale.range([0, size])\n\n if (minValue && maxValue) scale.domain([minValue, maxValue])\n\n if (nice === true) scale.nice()\n else if (typeof nice === 'object' || typeof nice === 'number') scale.nice(nice)\n\n const typedScale = (scale as unknown) as ScaleTime \n\n typedScale.type = 'time'\n typedScale.useUTC = useUTC\n\n return typedScale\n}\n","import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcTicks, utcTickInterval} from \"d3-time\";\nimport {utcFormat} from \"d3-time-format\";\nimport {calendar} from \"./time.js\";\nimport {initRange} from \"./init.js\";\n\nexport default function utcTime() {\n return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);\n}\n","import { NumberValue, scaleLinear } from 'd3-scale'\nimport { ScaleLinearSpec, ScaleLinear, ComputedSerieAxis, ScaleAxis } from './types'\n\nexport const createLinearScale = (\n {\n min = 0,\n max = 'auto',\n stacked = false,\n reverse = false,\n clamp = false,\n nice = false,\n }: ScaleLinearSpec,\n data: ComputedSerieAxis,\n size: number,\n axis: ScaleAxis\n) => {\n let minValue: NumberValue\n if (min === 'auto') {\n minValue = stacked === true ? data.minStacked ?? 0 : data.min\n } else {\n minValue = min\n }\n\n let maxValue: NumberValue\n if (max === 'auto') {\n maxValue = stacked === true ? data.maxStacked ?? 0 : data.max\n } else {\n maxValue = max\n }\n\n const scale = scaleLinear()\n .rangeRound(axis === 'x' ? [0, size] : [size, 0])\n .domain(reverse ? [maxValue, minValue] : [minValue, maxValue])\n .clamp(clamp)\n\n if (nice === true) scale.nice()\n else if (typeof nice === 'number') scale.nice(nice)\n\n const typedScale = (scale as unknown) as ScaleLinear\n typedScale.type = 'linear'\n typedScale.stacked = stacked\n\n return typedScale\n}\n","import { scaleBand } from 'd3-scale'\nimport { ComputedSerieAxis, ScaleBand, ScaleBandSpec, StringValue, ScaleAxis } from './types'\n\nexport const createBandScale = (\n { round = true }: ScaleBandSpec,\n data: ComputedSerieAxis ,\n size: number,\n axis: ScaleAxis\n) => {\n const scale = scaleBand ()\n .range(axis === 'x' ? [0, size] : [size, 0])\n .domain(data.all)\n .round(round)\n\n const typedScale = scale as ScaleBand \n typedScale.type = 'band'\n\n return typedScale\n}\n","import { scaleLog } from 'd3-scale'\nimport { ComputedSerieAxis, ScaleAxis, ScaleLog, ScaleLogSpec } from './types'\n\nexport const createLogScale = (\n { base = 10, min = 'auto', max = 'auto' }: ScaleLogSpec,\n data: ComputedSerieAxis,\n size: number,\n axis: ScaleAxis\n) => {\n const hasZero = data.all.some(v => v === 0)\n if (hasZero) {\n throw new Error(`a log scale domain must not include or cross zero`)\n }\n\n let sign: number\n let hasMixedSign = false\n data.all\n .filter(v => v != null)\n .forEach(v => {\n if (hasMixedSign) return\n if (sign === undefined) {\n sign = Math.sign(v)\n } else if (Math.sign(v) !== sign) {\n hasMixedSign = true\n }\n })\n\n if (hasMixedSign) {\n throw new Error(`a log scale domain must be strictly-positive or strictly-negative`)\n }\n\n let minValue: number\n if (min === 'auto') {\n minValue = data.min\n } else {\n minValue = min\n }\n\n let maxValue: number\n if (max === 'auto') {\n maxValue = data.max\n } else {\n maxValue = max\n }\n\n const scale = scaleLog()\n .domain([minValue, maxValue])\n .rangeRound(axis === 'x' ? [0, size] : [size, 0])\n .base(base)\n .nice()\n\n const typedScale = scale as ScaleLog\n typedScale.type = 'log'\n\n return scale\n}\n","import { scaleSymlog } from 'd3-scale'\nimport { ComputedSerieAxis, ScaleAxis, ScaleSymlog, ScaleSymlogSpec } from './types'\n\nexport const createSymlogScale = (\n { constant = 1, min = 'auto', max = 'auto', reverse = false }: ScaleSymlogSpec,\n data: ComputedSerieAxis,\n size: number,\n axis: ScaleAxis\n) => {\n let minValue: number\n if (min === 'auto') {\n minValue = data.min\n } else {\n minValue = min\n }\n\n let maxValue: number\n if (max === 'auto') {\n maxValue = data.max\n } else {\n maxValue = max\n }\n\n const scale = scaleSymlog()\n .constant(constant)\n .rangeRound(axis === 'x' ? [0, size] : [size, 0])\n .nice()\n\n if (reverse === true) scale.domain([maxValue, minValue])\n else scale.domain([minValue, maxValue])\n\n const typedScale = scale as ScaleSymlog\n typedScale.type = 'symlog'\n\n return typedScale\n}\n","export var slice = Array.prototype.slice;\n","import {slice} from \"./array.js\";\nimport constant from \"./constant.js\";\nimport offsetNone from \"./offset/none.js\";\nimport orderNone from \"./order/none.js\";\n\nfunction stackValue(d, key) {\n return d[key];\n}\n\nexport default function() {\n var keys = constant([]),\n order = orderNone,\n offset = offsetNone,\n value = stackValue;\n\n function stack(data) {\n var kz = keys.apply(this, arguments),\n i,\n m = data.length,\n n = kz.length,\n sz = new Array(n),\n oz;\n\n for (i = 0; i < n; ++i) {\n for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {\n si[j] = sij = [0, +value(data[j], ki, j, data)];\n sij.data = data[j];\n }\n si.key = ki;\n }\n\n for (i = 0, oz = order(sz); i < n; ++i) {\n sz[oz[i]].index = i;\n }\n\n offset(sz, oz);\n return sz;\n }\n\n stack.keys = function(_) {\n return arguments.length ? (keys = typeof _ === \"function\" ? _ : constant(slice.call(_)), stack) : keys;\n };\n\n stack.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), stack) : value;\n };\n\n stack.order = function(_) {\n return arguments.length ? (order = _ == null ? orderNone : typeof _ === \"function\" ? _ : constant(slice.call(_)), stack) : order;\n };\n\n stack.offset = function(_) {\n return arguments.length ? (offset = _ == null ? offsetNone : _, stack) : offset;\n };\n\n return stack;\n}\n","import { Annotation, useAnnotations } from '@nivo/annotations'\nimport { BarAnnotationsProps } from './types'\n\nexport const BarAnnotations = ({ bars, annotations }: BarAnnotationsProps) => {\n const boundAnnotations = useAnnotations({\n data: bars,\n annotations,\n getPosition: bar => ({\n x: bar.x + bar.width / 2,\n y: bar.y + bar.height / 2,\n }),\n getDimensions: ({ height, width }) => ({\n width,\n height,\n size: Math.max(width, height),\n }),\n })\n\n return (\n <>\n {boundAnnotations.map((annotation, i) => (\n \n ))}\n >\n )\n}\n","import { BoxLegendSvg } from '@nivo/legends'\nimport { BarCommonProps, LegendData } from './types'\n\ninterface BarLegendsProps {\n width: number\n height: number\n legends: BarCommonProps['legends']\n data: LegendData[]\n toggleSerie: (id: string | number) => void\n}\n\nexport const BarLegends = ({\n width,\n height,\n legends,\n data,\n toggleSerie,\n}: BarLegendsProps) => {\n return (\n <>\n {legends.map((legend, i) => (\n \n ))}\n >\n )\n}\n","import { ScaleBandSpec, ScaleBand, computeScale } from '@nivo/scales'\n\n/**\n * Generates indexed scale.\n */\nexport const getIndexScale = (\n data: RawDatum[],\n getIndex: (datum: RawDatum) => string,\n padding: number,\n indexScale: ScaleBandSpec,\n size: number,\n axis: 'x' | 'y'\n) => {\n return (computeScale(\n indexScale,\n { all: data.map(getIndex), min: 0, max: 0 },\n size,\n axis\n ) as ScaleBand).padding(padding)\n}\n\n/**\n * This method ensures all the provided keys exist in the entire series.\n */\nexport const normalizeData = (data: RawDatum[], keys: string[]) =>\n data.map(\n item =>\n ({\n ...keys.reduce>((acc, key) => {\n acc[key] = null\n return acc\n }, {}),\n ...item,\n } as RawDatum)\n )\n\nexport const filterNullValues = >(data: RawDatum) =>\n Object.keys(data).reduce