@equinor/esv-intersection
Version:
Intersection component package with testing and automatic documentation.
14 lines (12 loc) • 224 kB
JavaScript
(function(P,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("pixi.js")):typeof define=="function"&&define.amd?define(["exports","pixi.js"],F):(P=typeof globalThis<"u"?globalThis:P||self,F(P.esvintersection={},P.PIXI))})(this,(function(P,F){"use strict";function Ms(e){return e}var We=1,ie=2,Ye=3,re=4,jn=1e-6;function As(e){return"translate("+e+",0)"}function Ps(e){return"translate(0,"+e+")"}function Cs(e){return t=>+e(t)}function Ls(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function ks(){return!this.__axis}function Kn(e,t){var n=[],i=null,r=null,s=6,o=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,h=e===We||e===re?-1:1,l=e===re||e===ie?"x":"y",u=e===We||e===Ye?As:Ps;function f(d){var g=i??(t.ticks?t.ticks.apply(t,n):t.domain()),p=r??(t.tickFormat?t.tickFormat.apply(t,n):Ms),y=Math.max(s,0)+a,m=t.range(),_=+m[0]+c,x=+m[m.length-1]+c,M=(t.bandwidth?Ls:Cs)(t.copy(),c),b=d.selection?d.selection():d,T=b.selectAll(".domain").data([null]),S=b.selectAll(".tick").data(g,t).order(),L=S.exit(),E=S.enter().append("g").attr("class","tick"),O=S.select("line"),C=S.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(E),O=O.merge(E.append("line").attr("stroke","currentColor").attr(l+"2",h*s)),C=C.merge(E.append("text").attr("fill","currentColor").attr(l,h*y).attr("dy",e===We?"0em":e===Ye?"0.71em":"0.32em")),d!==b&&(T=T.transition(d),S=S.transition(d),O=O.transition(d),C=C.transition(d),L=L.transition(d).attr("opacity",jn).attr("transform",function(z){return isFinite(z=M(z))?u(z+c):this.getAttribute("transform")}),E.attr("opacity",jn).attr("transform",function(z){var B=this.parentNode.__axis;return u((B&&isFinite(B=B(z))?B:M(z))+c)})),L.remove(),T.attr("d",e===re||e===ie?o?"M"+h*o+","+_+"H"+c+"V"+x+"H"+h*o:"M"+c+","+_+"V"+x:o?"M"+_+","+h*o+"V"+c+"H"+x+"V"+h*o:"M"+_+","+c+"H"+x),S.attr("opacity",1).attr("transform",function(z){return u(M(z)+c)}),O.attr(l+"2",h*s),C.attr(l,h*y).text(p),b.filter(ks).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===ie?"start":e===re?"end":"middle"),b.each(function(){this.__axis=M})}return f.scale=function(d){return arguments.length?(t=d,f):t},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),f):n.slice()},f.tickValues=function(d){return arguments.length?(i=d==null?null:Array.from(d),f):i&&i.slice()},f.tickFormat=function(d){return arguments.length?(r=d,f):r},f.tickSize=function(d){return arguments.length?(s=o=+d,f):s},f.tickSizeInner=function(d){return arguments.length?(s=+d,f):s},f.tickSizeOuter=function(d){return arguments.length?(o=+d,f):o},f.tickPadding=function(d){return arguments.length?(a=+d,f):a},f.offset=function(d){return arguments.length?(c=+d,f):c},f}function Es(e){return Kn(ie,e)}function Fs(e){return Kn(Ye,e)}function se(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Rs(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Qn(e){let t,n,i;e.length!==2?(t=se,n=(a,c)=>se(e(a),c),i=(a,c)=>e(a)-c):(t=e===se||e===Rs?e:Is,n=e,i=e);function r(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<0?h=u+1:l=u}while(h<l)}return h}function s(a,c,h=0,l=a.length){if(h<l){if(t(c,c)!==0)return l;do{const u=h+l>>>1;n(a[u],c)<=0?h=u+1:l=u}while(h<l)}return h}function o(a,c,h=0,l=a.length){const u=r(a,c,h,l-1);return u>h&&i(a[u-1],c)>-i(a[u],c)?u-1:u}return{left:r,center:o,right:s}}function Is(){return 0}function Os(e){return e===null?NaN:+e}const zs=Qn(se).right;Qn(Os).center;class Jn extends Map{constructor(t,n=$s){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[i,r]of t)this.set(i,r)}get(t){return super.get(ti(this,t))}has(t){return super.has(ti(this,t))}set(t,n){return super.set(Ds(this,t),n)}delete(t){return super.delete(Ns(this,t))}}function ti({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function Ds({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function Ns({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(n),e.delete(i)),n}function $s(e){return e!==null&&typeof e=="object"?e.valueOf():e}const Bs=Math.sqrt(50),Hs=Math.sqrt(10),Xs=Math.sqrt(2);function oe(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=Bs?10:s>=Hs?5:s>=Xs?2:1;let a,c,h;return r<0?(h=Math.pow(10,-r)/o,a=Math.round(e*h),c=Math.round(t*h),a/h<e&&++a,c/h>t&&--c,h=-h):(h=Math.pow(10,r)*o,a=Math.round(e/h),c=Math.round(t/h),a*h<e&&++a,c*h>t&&--c),c<a&&.5<=n&&n<2?oe(e,t,n*2):[a,c,h]}function Us(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const i=t<e,[r,s,o]=i?oe(t,e,n):oe(e,t,n);if(!(s>=r))return[];const a=s-r+1,c=new Array(a);if(i)if(o<0)for(let h=0;h<a;++h)c[h]=(s-h)/-o;else for(let h=0;h<a;++h)c[h]=(s-h)*o;else if(o<0)for(let h=0;h<a;++h)c[h]=(r+h)/-o;else for(let h=0;h<a;++h)c[h]=(r+h)*o;return c}function Ge(e,t,n){return t=+t,e=+e,n=+n,oe(e,t,n)[2]}function Vs(e,t,n){t=+t,e=+e,n=+n;const i=t<e,r=i?Ge(t,e,n):Ge(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}function qe(e,t){let n;if(t===void 0)for(const i of e)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of e)(r=t(r,++i,e))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function Ze(e,t){let n=0;if(t===void 0)for(let i of e)(i=+i)&&(n+=i);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function ei(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const ni=Symbol("implicit");function ii(){var e=new Jn,t=[],n=[],i=ni;function r(s){let o=e.get(s);if(o===void 0){if(i!==ni)return i;e.set(s,o=t.push(s)-1)}return n[o%n.length]}return r.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new Jn;for(const o of s)e.has(o)||e.set(o,t.push(o)-1);return r},r.range=function(s){return arguments.length?(n=Array.from(s),r):n.slice()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return ii(t,n).unknown(i)},ei.apply(r,arguments),r}function je(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ri(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Ht(){}var Xt=.7,ae=1/Xt,Ft="\\s*([+-]?\\d+)\\s*",Ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ws=/^#([0-9a-f]{3,8})$/,Ys=new RegExp(`^rgb\\(${Ft},${Ft},${Ft}\\)$`),Gs=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),qs=new RegExp(`^rgba\\(${Ft},${Ft},${Ft},${Ut}\\)$`),Zs=new RegExp(`^rgba\\(${at},${at},${at},${Ut}\\)$`),js=new RegExp(`^hsl\\(${Ut},${at},${at}\\)$`),Ks=new RegExp(`^hsla\\(${Ut},${at},${at},${Ut}\\)$`),si={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};je(Ht,ft,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:oi,formatHex:oi,formatHex8:Qs,formatHsl:Js,formatRgb:ai,toString:ai});function oi(){return this.rgb().formatHex()}function Qs(){return this.rgb().formatHex8()}function Js(){return fi(this).formatHsl()}function ai(){return this.rgb().formatRgb()}function ft(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ws.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ci(t):n===3?new Y(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ce(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ce(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ys.exec(e))?new Y(t[1],t[2],t[3],1):(t=Gs.exec(e))?new Y(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qs.exec(e))?ce(t[1],t[2],t[3],t[4]):(t=Zs.exec(e))?ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=js.exec(e))?ui(t[1],t[2]/100,t[3]/100,1):(t=Ks.exec(e))?ui(t[1],t[2]/100,t[3]/100,t[4]):si.hasOwnProperty(e)?ci(si[e]):e==="transparent"?new Y(NaN,NaN,NaN,0):null}function ci(e){return new Y(e>>16&255,e>>8&255,e&255,1)}function ce(e,t,n,i){return i<=0&&(e=t=n=NaN),new Y(e,t,n,i)}function to(e){return e instanceof Ht||(e=ft(e)),e?(e=e.rgb(),new Y(e.r,e.g,e.b,e.opacity)):new Y}function Ke(e,t,n,i){return arguments.length===1?to(e):new Y(e,t,n,i??1)}function Y(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}je(Y,Ke,ri(Ht,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new Y(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Xt:Math.pow(Xt,e),new Y(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Y(Mt(this.r),Mt(this.g),Mt(this.b),he(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:hi,formatHex:hi,formatHex8:eo,formatRgb:li,toString:li}));function hi(){return`#${At(this.r)}${At(this.g)}${At(this.b)}`}function eo(){return`#${At(this.r)}${At(this.g)}${At(this.b)}${At((isNaN(this.opacity)?1:this.opacity)*255)}`}function li(){const e=he(this.opacity);return`${e===1?"rgb(":"rgba("}${Mt(this.r)}, ${Mt(this.g)}, ${Mt(this.b)}${e===1?")":`, ${e})`}`}function he(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function At(e){return e=Mt(e),(e<16?"0":"")+e.toString(16)}function ui(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new nt(e,t,n,i)}function fi(e){if(e instanceof nt)return new nt(e.h,e.s,e.l,e.opacity);if(e instanceof Ht||(e=ft(e)),!e)return new nt;if(e instanceof nt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,a=s-r,c=(s+r)/2;return a?(t===s?o=(n-i)/a+(n<i)*6:n===s?o=(i-t)/a+2:o=(t-n)/a+4,a/=c<.5?s+r:2-s-r,o*=60):a=c>0&&c<1?0:o,new nt(o,a,c,e.opacity)}function no(e,t,n,i){return arguments.length===1?fi(e):new nt(e,t,n,i??1)}function nt(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}je(nt,no,ri(Ht,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new nt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Xt:Math.pow(Xt,e),new nt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new Y(Qe(e>=240?e-240:e+120,r,i),Qe(e,r,i),Qe(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new nt(di(this.h),le(this.s),le(this.l),he(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=he(this.opacity);return`${e===1?"hsl(":"hsla("}${di(this.h)}, ${le(this.s)*100}%, ${le(this.l)*100}%${e===1?")":`, ${e})`}`}}));function di(e){return e=(e||0)%360,e<0?e+360:e}function le(e){return Math.max(0,Math.min(1,e||0))}function Qe(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Je=e=>()=>e;function io(e,t){return function(n){return e+n*t}}function ro(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function so(e){return(e=+e)==1?gi:function(t,n){return n-t?ro(t,n,e):Je(isNaN(t)?n:t)}}function gi(e,t){var n=t-e;return n?io(e,n):Je(isNaN(e)?t:e)}const Vt=(function e(t){var n=so(t);function i(r,s){var o=n((r=Ke(r)).r,(s=Ke(s)).r),a=n(r.g,s.g),c=n(r.b,s.b),h=gi(r.opacity,s.opacity);return function(l){return r.r=o(l),r.g=a(l),r.b=c(l),r.opacity=h(l),r+""}}return i.gamma=e,i})(1);function oo(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;r<n;++r)i[r]=e[r]*(1-s)+t[r]*s;return i}}function ao(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function co(e,t){var n=t?t.length:0,i=e?Math.min(n,e.length):0,r=new Array(i),s=new Array(n),o;for(o=0;o<i;++o)r[o]=nn(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(a){for(o=0;o<i;++o)s[o]=r[o](a);return s}}function ho(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function it(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function lo(e,t){var n={},i={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=nn(e[r],t[r]):i[r]=t[r];return function(s){for(r in n)i[r]=n[r](s);return i}}var tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,en=new RegExp(tn.source,"g");function uo(e){return function(){return e}}function fo(e){return function(t){return e(t)+""}}function pi(e,t){var n=tn.lastIndex=en.lastIndex=0,i,r,s,o=-1,a=[],c=[];for(e=e+"",t=t+"";(i=tn.exec(e))&&(r=en.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(i=i[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:it(i,r)})),n=en.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?fo(c[0].x):uo(t):(t=c.length,function(h){for(var l=0,u;l<t;++l)a[(u=c[l]).i]=u.x(h);return a.join("")})}function nn(e,t){var n=typeof t,i;return t==null||n==="boolean"?Je(t):(n==="number"?it:n==="string"?(i=ft(t))?(t=i,Vt):pi:t instanceof ft?Vt:t instanceof Date?ho:ao(t)?oo:Array.isArray(t)?co:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lo:it)(e,t)}function go(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var mi=180/Math.PI,rn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function yi(e,t,n,i,r,s){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*i)&&(n-=e*c,i-=t*c),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,c/=a),e*i<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*mi,skewX:Math.atan(c)*mi,scaleX:o,scaleY:a}}var ue;function po(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?rn:yi(t.a,t.b,t.c,t.d,t.e,t.f)}function mo(e){return e==null||(ue||(ue=document.createElementNS("http://www.w3.org/2000/svg","g")),ue.setAttribute("transform",e),!(e=ue.transform.baseVal.consolidate()))?rn:(e=e.matrix,yi(e.a,e.b,e.c,e.d,e.e,e.f))}function _i(e,t,n,i){function r(h){return h.length?h.pop()+" ":""}function s(h,l,u,f,d,g){if(h!==u||l!==f){var p=d.push("translate(",null,t,null,n);g.push({i:p-4,x:it(h,u)},{i:p-2,x:it(l,f)})}else(u||f)&&d.push("translate("+u+t+f+n)}function o(h,l,u,f){h!==l?(h-l>180?l+=360:l-h>180&&(h+=360),f.push({i:u.push(r(u)+"rotate(",null,i)-2,x:it(h,l)})):l&&u.push(r(u)+"rotate("+l+i)}function a(h,l,u,f){h!==l?f.push({i:u.push(r(u)+"skewX(",null,i)-2,x:it(h,l)}):l&&u.push(r(u)+"skewX("+l+i)}function c(h,l,u,f,d,g){if(h!==u||l!==f){var p=d.push(r(d)+"scale(",null,",",null,")");g.push({i:p-4,x:it(h,u)},{i:p-2,x:it(l,f)})}else(u!==1||f!==1)&&d.push(r(d)+"scale("+u+","+f+")")}return function(h,l){var u=[],f=[];return h=e(h),l=e(l),s(h.translateX,h.translateY,l.translateX,l.translateY,u,f),o(h.rotate,l.rotate,u,f),a(h.skewX,l.skewX,u,f),c(h.scaleX,h.scaleY,l.scaleX,l.scaleY,u,f),h=l=null,function(d){for(var g=-1,p=f.length,y;++g<p;)u[(y=f[g]).i]=y.x(d);return u.join("")}}}var yo=_i(po,"px, ","px)","deg)"),_o=_i(mo,", ",")",")"),vo=1e-12;function vi(e){return((e=Math.exp(e))+1/e)/2}function xo(e){return((e=Math.exp(e))-1/e)/2}function wo(e){return((e=Math.exp(2*e))-1)/(e+1)}const bo=(function e(t,n,i){function r(s,o){var a=s[0],c=s[1],h=s[2],l=o[0],u=o[1],f=o[2],d=l-a,g=u-c,p=d*d+g*g,y,m;if(p<vo)m=Math.log(f/h)/t,y=function(S){return[a+S*d,c+S*g,h*Math.exp(t*S*m)]};else{var _=Math.sqrt(p),x=(f*f-h*h+i*p)/(2*h*n*_),M=(f*f-h*h-i*p)/(2*f*n*_),b=Math.log(Math.sqrt(x*x+1)-x),T=Math.log(Math.sqrt(M*M+1)-M);m=(T-b)/t,y=function(S){var L=S*m,E=vi(b),O=h/(n*_)*(E*wo(t*L+b)-xo(b));return[a+O*d,c+O*g,h*E/vi(t*L+b)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(s){var o=Math.max(.001,+s),a=o*o,c=a*a;return e(o,a,c)},r})(Math.SQRT2,2,4);function So(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function To(e){return function(){return e}}function Mo(e){return+e}var xi=[0,1];function Rt(e){return e}function sn(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:To(isNaN(t)?NaN:.5)}function Ao(e,t){var n;return e>t&&(n=e,e=t,t=n),function(i){return Math.max(e,Math.min(t,i))}}function Po(e,t,n){var i=e[0],r=e[1],s=t[0],o=t[1];return r<i?(i=sn(r,i),s=n(o,s)):(i=sn(i,r),s=n(s,o)),function(a){return s(i(a))}}function Co(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),s=new Array(i),o=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)r[o]=sn(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(a){var c=zs(e,a,1,i)-1;return s[c](r[c](a))}}function Lo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ko(){var e=xi,t=xi,n=nn,i,r,s,o=Rt,a,c,h;function l(){var f=Math.min(e.length,t.length);return o!==Rt&&(o=Ao(e[0],e[f-1])),a=f>2?Co:Po,c=h=null,u}function u(f){return f==null||isNaN(f=+f)?s:(c||(c=a(e.map(i),t,n)))(i(o(f)))}return u.invert=function(f){return o(r((h||(h=a(t,e.map(i),it)))(f)))},u.domain=function(f){return arguments.length?(e=Array.from(f,Mo),l()):e.slice()},u.range=function(f){return arguments.length?(t=Array.from(f),l()):t.slice()},u.rangeRound=function(f){return t=Array.from(f),n=go,l()},u.clamp=function(f){return arguments.length?(o=f?!0:Rt,l()):o!==Rt},u.interpolate=function(f){return arguments.length?(n=f,l()):n},u.unknown=function(f){return arguments.length?(s=f,u):s},function(f,d){return i=f,r=d,l()}}function Eo(){return ko()(Rt,Rt)}function Fo(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function fe(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function It(e){return e=fe(Math.abs(e)),e?e[1]:NaN}function Ro(e,t){return function(n,i){for(var r=n.length,s=[],o=0,a=e[0],c=0;r>0&&a>0&&(c+a+1>i&&(a=Math.max(1,i-c)),s.push(n.substring(r-=a,r+a)),!((c+=a+1)>i));)a=e[o=(o+1)%e.length];return s.reverse().join(t)}}function Io(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Oo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function de(e){if(!(t=Oo.exec(e)))throw new Error("invalid format: "+e);var t;return new on({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}de.prototype=on.prototype;function on(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}on.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function zo(e){t:for(var t=e.length,n=1,i=-1,r;n<t;++n)switch(e[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+e[n])break t;i>0&&(i=0);break}return i>0?e.slice(0,i)+e.slice(r+1):e}var wi;function Do(e,t){var n=fe(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(wi=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+fe(e,Math.max(0,t+s-1))[0]}function bi(e,t){var n=fe(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const Si={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Fo,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>bi(e*100,t),r:bi,s:Do,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Ti(e){return e}var Mi=Array.prototype.map,Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function No(e){var t=e.grouping===void 0||e.thousands===void 0?Ti:Ro(Mi.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",r=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?Ti:Io(Mi.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function h(u){u=de(u);var f=u.fill,d=u.align,g=u.sign,p=u.symbol,y=u.zero,m=u.width,_=u.comma,x=u.precision,M=u.trim,b=u.type;b==="n"?(_=!0,b="g"):Si[b]||(x===void 0&&(x=12),M=!0,b="g"),(y||f==="0"&&d==="=")&&(y=!0,f="0",d="=");var T=p==="$"?n:p==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",S=p==="$"?i:/[%p]/.test(b)?o:"",L=Si[b],E=/[defgprs%]/.test(b);x=x===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function O(C){var z=T,B=S,v,A,w;if(b==="c")B=L(C)+B,C="";else{C=+C;var k=C<0||1/C<0;if(C=isNaN(C)?c:L(Math.abs(C),x),M&&(C=zo(C)),k&&+C==0&&g!=="+"&&(k=!1),z=(k?g==="("?g:a:g==="-"||g==="("?"":g)+z,B=(b==="s"?Ai[8+wi/3]:"")+B+(k&&g==="("?")":""),E){for(v=-1,A=C.length;++v<A;)if(w=C.charCodeAt(v),48>w||w>57){B=(w===46?r+C.slice(v+1):C.slice(v))+B,C=C.slice(0,v);break}}}_&&!y&&(C=t(C,1/0));var R=z.length+C.length+B.length,I=R<m?new Array(m-R+1).join(f):"";switch(_&&y&&(C=t(I+C,I.length?m-B.length:1/0),I=""),d){case"<":C=z+C+B+I;break;case"=":C=z+I+C+B;break;case"^":C=I.slice(0,R=I.length>>1)+z+C+B+I.slice(R);break;default:C=I+z+C+B;break}return s(C)}return O.toString=function(){return u+""},O}function l(u,f){var d=h((u=de(u),u.type="f",u)),g=Math.max(-8,Math.min(8,Math.floor(It(f)/3)))*3,p=Math.pow(10,-g),y=Ai[8+g/3];return function(m){return d(p*m)+y}}return{format:h,formatPrefix:l}}var ge,Pi,Ci;$o({thousands:",",grouping:[3],currency:["$",""]});function $o(e){return ge=No(e),Pi=ge.format,Ci=ge.formatPrefix,ge}function Bo(e){return Math.max(0,-It(Math.abs(e)))}function Ho(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(It(t)/3)))*3-It(Math.abs(e)))}function Xo(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,It(t)-It(e))+1}function Uo(e,t,n,i){var r=Vs(e,t,n),s;switch(i=de(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return i.precision==null&&!isNaN(s=Ho(r,o))&&(i.precision=s),Ci(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=Xo(r,Math.max(Math.abs(e),Math.abs(t))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=Bo(r))&&(i.precision=s-(i.type==="%")*2);break}}return Pi(i)}function Vo(e){var t=e.domain;return e.ticks=function(n){var i=t();return Us(i[0],i[i.length-1],n??10)},e.tickFormat=function(n,i){var r=t();return Uo(r[0],r[r.length-1],n??10,i)},e.nice=function(n){n==null&&(n=10);var i=t(),r=0,s=i.length-1,o=i[r],a=i[s],c,h,l=10;for(a<o&&(h=o,o=a,a=h,h=r,r=s,s=h);l-- >0;){if(h=Ge(o,a,n),h===c)return i[r]=o,i[s]=a,t(i);if(h>0)o=Math.floor(o/h)*h,a=Math.ceil(a/h)*h;else if(h<0)o=Math.ceil(o*h)/h,a=Math.floor(a*h)/h;else break;c=h}return e},e}function Pt(){var e=Eo();return e.copy=function(){return Lo(e,Pt())},ei.apply(e,arguments),Vo(e)}class Li{constructor(t,n=!0,i,r,s,o){this._showLabels=!0,this._offsetX=0,this._offsetY=0,this._flipX=!1,this._flipY=!1,this.visible=!0,this.createOrGet=a=>{const{mainGroup:c}=this;let h=c.select(`g.${a}`);return h.empty()&&(h=c.append("g").attr("class",a)),h},this.mainGroup=t,this._showLabels=n,this._labelXDesc=i,this._labelYDesc=r,this._unitOfMeasure=s,o&&o.offsetX&&(this._offsetX=o.offsetX),o&&o.offsetX&&(this._offsetY=o.offsetY),o&&o.visible&&(this.visible=o.visible),this.mainGroup.style("pointer-events","none"),this._scaleX=Pt().domain([0,1]).range([0,1]),this._scaleY=Pt().domain([0,1]).range([0,1])}renderLabelx(){const{_labelXDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleX:r}=this,[,s]=r.range(),o=this.renderGx();let a=o.select("text.axis-labelx");return i?a.empty()&&(a=o.append("text").attr("class","axis-labelx").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)):a.remove(),a.attr("transform",`translate(${s/2},-4)`),a}renderLabely(){const{_labelYDesc:t,_unitOfMeasure:n,_showLabels:i,_scaleY:r}=this,[,s]=r.range(),o=this.renderGy();let a=o.select("text.axis-labely");return i?(a.empty()&&(a=o.append("text").attr("class","axis-labely").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(`${t} (${n})`)),a.attr("transform",`translate(-10,${s/2})rotate(90)`)):a.remove(),a}renderGy(){const{_scaleX:t,_scaleY:n}=this,i=Es(n),[,r]=t.range(),s=this.createOrGet("y-axis");return s.call(i),s.attr("transform",`translate(${r},0)`),s}renderGx(){const{_scaleX:t,_scaleY:n}=this,i=Fs(t),[,r]=n.range(),s=this.createOrGet("x-axis");return s.attr("transform",`translate(0 ${r})`),s.call(i),s}render(){this.renderLabelx(),this.renderLabely()}onResize(t){this.mainGroup.attr("height",`${t.height}px`).attr("width",`${t.width}px`)}onRescale(t){const{_scaleX:n,_scaleY:i,offsetX:r,offsetY:s}=this,{xScale:o,yScale:a}=t,c=o.domain(),h=a.domain(),l=o.range(),u=a.range();n.domain([c[0]-r,c[1]-r]).range(l),i.domain([h[0]-s,h[1]-s]).range(u),this.flipX(this._flipX),this.flipY(this._flipY),this.visible&&this.render()}show(){return this.visible=!0,this.mainGroup.attr("visibility","visible"),this.render(),this}hide(){return this.visible=!1,this.mainGroup.attr("visibility","hidden"),this}flipX(t){this._flipX=t;const n=this._scaleX.domain(),i=t?-1:1;return this._scaleX.domain([i*n[0],i*n[1]]),this}flipY(t){this._flipY=t;const n=this._scaleY.domain(),i=t?-1:1;return this._scaleY.domain([i*n[0],i*n[1]]),this}showLabels(){return this._showLabels=!0,this.render(),this}hideLabels(){return this._showLabels=!1,this.render(),this}setLabelX(t){return this._labelXDesc=t,this}setLabelY(t){return this._labelYDesc=t,this}setUnitOfMeasure(t){return this._unitOfMeasure=t,this}setLabels(t,n,i){return this._labelXDesc=t,this._labelYDesc=n,this._unitOfMeasure=i,this}get offsetX(){return this._offsetX}set offsetX(t){this._offsetX=t}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY=t}get scaleX(){return this._scaleX.copy()}get scaleY(){return this._scaleY.copy()}}const Wo=Math.PI/180;function _t(e,t=0,n=1){return e<t?t:e>n?n:e}function Yo(e){return e*Wo}function ki(e){const t=new Array(e),n=1/(e-1);t[0]=0;for(let i=1;i<e-1;i++)t[i]=i*n;return t[e-1]=1,t}function Wt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]+t[i];return n}function Yt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]-t[i];return n}function Ct(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]*t;return n}function Go(e){for(var t=0,n=0;n<e.length;n++)t+=Math.pow(e[n],2);return t}function Gt(e){var t=Go(e);return t===0?t:Math.sqrt(t)}function Ei(e,t){t===void 0&&(t=e);var n=Gt(e);return n===0?qo(0,t):Ct(e,1/n,t)}function qo(e,t){for(var n=0;n<t.length;n++)t[n]=e;return t}function Zo(e,t){for(var n=0,i=0;i<e.length;i++)n+=Math.pow(t[i]-e[i],2);return n===0?n:Math.sqrt(n)}function jo(e,t){for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function Ko(e,t,n,i){i===void 0&&(i=e);for(var r=_t(n,0,1),s=1-r,o=0;o<e.length;o++)i[o]=e[o]*s+t[o]*r;return i}function Qo(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function Fi(e,t){t===void 0&&(t=0),t===void 0&&(t=0);for(var n=0;n<e.length;n++)if(Math.abs(e[n])>t)return!1;return!0}var an=180/Math.PI,Jo=Math.PI/180;function cn(e,t,n){var i=Math.cos(t),r=Math.sin(t),s=e[0];return n[0]=i*s-r*e[1],n[1]=r*s+i*e[1],n}function Ri(e){return Math.atan2(e[1],e[0])}function qt(e,t){var n=Math.atan2(t[1],t[0])-Math.atan2(e[1],e[0]);return n>Math.PI?n-=2*Math.PI:n<=-Math.PI&&(n+=2*Math.PI),n}var N=(function(){function e(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.isMutating=!1,this.length=2,typeof t=="number"?typeof n[0]=="number"?(this[0]=t,this[1]=n[0]):(this[0]=t,this[1]=t):"x"in t&&"y"in t?(this[0]=t.x,this[1]=t.y):(this[0]=t[0],this[1]=t[1])}return Object.defineProperty(e.prototype,"x",{get:function(){return this[0]},set:function(t){this[0]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this[1]},set:function(t){this[1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"magnitude",{get:function(){return Gt(this)},set:function(t){var n=Gt(this);Ct(this,t/n,this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mutable",{get:function(){return this.isMutating=!0,this},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"immutable",{get:function(){return this.isMutating=!1,this},enumerable:!1,configurable:!0}),e.prototype.set=function(t,n){return typeof t=="number"?typeof n=="number"?(this[0]=t,this[1]=n):(this[0]=t,this[1]=t):(this[0]=t[0],this[1]=t[1]),this},e.prototype.add=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Wt(this,[t,n]):Wt(this.clone(),[t,n]):this.isMutating?Wt(this,t):Wt(this.clone(),t)},e.add=function(t,n){var i=new e(t);return Wt(i,n)},e.prototype.sub=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Yt(this,[t,n]):Yt(this.clone(),[t,n]):this.isMutating?Yt(this,t):Yt(this.clone(),t)},e.sub=function(t,n){var i=new e(t);return Yt(i,n)},e.prototype.subFrom=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?(this[0]=t-this[0],this[1]=n-this[1],this):new e(t-this[0],n-this[1]):this.isMutating?(this[0]=t[0]-this[0],this[1]=t[1]-this[1],this):new e(t[0]-this[0],t[1]-this[1])},e.divide=function(t,n){var i=new e(t);return Ct(i,1/n)},e.multiply=function(t,n){var i=new e(t);return Ct(i,n)},e.prototype.scale=function(t){return Ct(this,t,this.isMutating?this:e.zero)},e.prototype.rescale=function(t){var n=Gt(this);return n<=0?this.isMutating?this:e.zero:Ct(this,t/n,this.isMutating?this:e.zero)},e.prototype.clampMagnitude=function(t){var n=Gt(this);return n>t?Ct(this,t/n,this.isMutating?this:e.zero):this.isMutating?this:this.clone()},e.prototype.rotate=function(t){return cn(this,t,this.isMutating?this:e.zero)},e.prototype.rotateDeg=function(t){return cn(this,t*Jo,this.isMutating?this:e.zero)},e.prototype.rotate90=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=-t[1],n[1]=i,n;var t,n,i},e.prototype.rotate180=function(){return t=this,(n=this.isMutating?this:e.zero)[0]=-t[0],n[1]=-t[1],n;var t,n},e.prototype.rotate270=function(){return t=this,n=this.isMutating?this:e.zero,i=t[0],n[0]=t[1],n[1]=-i,n;var t,n,i},e.prototype.normalize=function(){return Ei(this)},e.prototype.normalized=function(){return Ei(this,e.zero)},e.distance=function(t,n){return Zo(t,n)},e.dot=function(t,n){return jo(t,n)},e.cross=function(t,n){return(function(i,r){return i[0]*r[1]-i[1]*r[0]})(t,n)},e.angleRight=function(t){return Ri(t)},e.angleRightDeg=function(t){return Ri(t)*an},e.angle=function(t,n){return Math.abs(qt(t,n))},e.angleDeg=function(t,n){return Math.abs(qt(t,n))*an},e.signedAngle=function(t,n){return qt(t,n)},e.signedAngleDeg=function(t,n){return qt(t,n)*an},e.lerp=function(t,n,i){var r=new e(t);return Ko(r,n,i)},e.lerpRot=function(t,n,i){return(function(r,s,o,a){return a===void 0&&(a=r),cn(r,o*qt(r,s),a)})(t,n,i,e.zero)},e.prototype.clone=function(){return new e(this[0],this[1])},e.equals=function(t,n,i){return i===void 0&&(i=0),!(Math.abs(t[0]-n[0])>i)&&!(Math.abs(t[1]-n[1])>i)},e.prototype.equals=function(t,n){return n===void 0&&(n=0),e.equals(this,t,n)},e.isZeroVector=function(t,n){return n===void 0&&(n=0),Fi(t,n)},e.prototype.isZeroVector=function(t){return t===void 0&&(t=0),Fi(this,t)},e.prototype.toArray=function(){return[this[0],this[1]]},e.prototype.modify=function(t){return Qo(this,t)},e.prototype[Symbol.iterator]=function(){var t=this,n=0;return{next:function(){switch(n++){case 0:return{value:t[0],done:!1};case 1:return{value:t[1],done:!1};default:return{value:-1,done:!0}}}}},Object.defineProperty(e,"zero",{get:function(){return new e(0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return new e(1,1)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"positiveInfinity",{get:function(){return new e(1/0,1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"negativeInfinity",{get:function(){return new e(-1/0,-1/0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"up",{get:function(){return new e(0,1)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"right",{get:function(){return new e(1,0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"down",{get:function(){return new e(0,-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"left",{get:function(){return new e(-1,0)},enumerable:!1,configurable:!0}),e})();/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var hn=function(e,t){return hn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)i.hasOwnProperty(r)&&(n[r]=i[r])},hn(e,t)};function Ii(e,t){function n(){this.constructor=e}hn(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var pe=function(){return pe=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},pe.apply(this,arguments)};function Oi(e,t){for(var n=new Array(e.length),i=0;i<e.length;i++)n[i]=2*e[i]-t[i];return n}function ln(e,t,n){var i,r,s,o,a=t.length-1;if(n)i=t[e-1<0?a:e-1],r=t[e%t.length],s=t[(e+1)%t.length],o=t[(e+2)%t.length];else{if(e===a)throw Error("There is no spline segment at this index for a closed curve!");r=t[e],s=t[e+1],i=e>0?t[e-1]:Oi(r,s),o=e<a-1?t[e+2]:Oi(s,r)}return[i,r,s,o]}function ta(e,t,n){n===void 0&&(n=!1);var i=n?t.length:t.length-1;if(e===1)return{index:i-1,weight:1};var r=i*e,s=Math.floor(r);return{index:s,weight:r-s}}function ea(e,t){for(var n=0;n<e.length;n++)e[n]=t;return e}function na(e,t){for(var n=0;n<e.length;n++)e[n]=t(e[n],n);return e}function ia(e,t,n){n===void 0&&(n=0);for(var i=0;i<e.length;i++)n=t(n,e[i],i);return n}function me(e,t){t=t||new Array(e.length);for(var n=0;n<e.length;n++)t[n]=e[n];return t}function G(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e<t?t:e>n?n:e}function un(e,t){var n=t[0];if(e>=t[t.length-1])return t.length-1;if(e<=n)return 0;for(var i=0,r=t.length-1;i<=r;){var s=Math.floor((i+r)/2),o=t[s];if(o<e)i=s+1;else{if(!(o>e))return s;r=s-1}}return Math.max(0,r)}var et=Math.pow(2,-42);function zi(e){var t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}function Di(e,t,n){if(Math.abs(e)<et)return Math.abs(t)<et?[]:[-n/t];var i=t*t-4*e*n;return Math.abs(i)<et?[-t/(2*e)]:i>0?[(-t+Math.sqrt(i))/(2*e),(-t-Math.sqrt(i))/(2*e)]:[]}function ra(e,t,n,i){if(Math.abs(e)<et)return Di(t,n,i);var r,s=(3*e*n-t*t)/(3*e*e),o=(2*t*t*t-9*e*t*n+27*e*e*i)/(27*e*e*e);if(Math.abs(s)<et)r=[zi(-o)];else if(Math.abs(o)<et)r=[0].concat(s<0?[Math.sqrt(-s),-Math.sqrt(-s)]:[]);else{var a=o*o/4+s*s*s/27;if(Math.abs(a)<et)r=[-1.5*o/s,3*o/s];else if(a>0)r=[(c=zi(-o/2-Math.sqrt(a)))-s/(3*c)];else{var c=2*Math.sqrt(-s/3),h=Math.acos(3*o/s/c)/3,l=2*Math.PI/3;r=[c*Math.cos(h),c*Math.cos(h-l),c*Math.cos(h-2*l)]}}for(var u=0;u<r.length;u++)r[u]-=t/(3*e);return r}function ye(e,t){if(e.length!==t.length)throw Error("Vectors must be of equal length!");for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function rt(e,t,n){if(!(e.length>3)){n=n||new Array(3);var i=e[0],r=e[1],s=e[2]||0,o=t[0],a=t[1],c=t[2]||0;return n[0]=r*c-s*a,n[1]=s*o-i*c,n[2]=i*a-r*o,n}}function Ni(e,t){for(var n=0,i=0;i<e.length;i++)n+=(e[i]-t[i])*(e[i]-t[i]);return n}function Lt(e){for(var t=0,n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function _e(e,t){var n=Ni(e,t);return n===0?0:Math.sqrt(n)}function dt(e,t){var n=t?me(e,t):e,i=ia(n,(function(s,o){return s+Math.pow(o,2)})),r=Math.sqrt(i);return r===0?ea(n,0):na(n,(function(s){return s/r}))}function $i(e,t,n,i){t===void 0&&(t=[0,1,0]),n===void 0&&(n=0);var r=Math.cos(n),s=Math.sin(n),o=1-r,a=e[0],c=e[1],h=e[2],l=t[0],u=t[1],f=t[2],d=o*l,g=o*u;return(i=i||e)[0]=(d*l+r)*a+(d*u-s*f)*c+(d*f+s*u)*h,i[1]=(d*u+s*f)*a+(g*u+r)*c+(g*f-s*l)*h,i[2]=(d*f-s*u)*a+(g*f+s*l)*c+(o*f*f+r)*h,i}function sa(e,t,n,i,r){if(r===void 0&&(r=0),r===0)return[0,1,2,3];var s=function(c,h){return Math.pow(Ni(c,h),.5*r)},o=s(t,e),a=s(n,t)+o;return[0,o,a,s(i,n)+a]}function oa(e,t,n,i,r){for(var s=Number.isFinite(r.tension)?r.tension:.5,o=Number.isFinite(r.alpha)?r.alpha:null,a=o>0?sa(e,t,n,i,o):null,c=new Array(e.length),h=0;h<e.length;h++){var l=0,u=0,f=e[h],d=t[h],g=n[h],p=i[h];if(a){var y=a[0],m=a[1],_=a[2],x=a[3];m-_!=0&&(y-m!=0&&y-_!=0&&(l=(1-s)*(_-m)*((f-d)/(y-m)-(f-g)/(y-_)+(d-g)/(m-_))),m-x!=0&&_-x!=0&&(u=(1-s)*(_-m)*((d-g)/(m-_)-(d-p)/(m-x)+(g-p)/(_-x))))}else l=(1-s)*(g-f)*.5,u=(1-s)*(p-d)*.5;var M=2*d-2*g+l+u,b=-3*d+3*g-2*l-u,T=l,S=d;c[h]=[M,b,T,S]}return c}function Ot(e,t){var n=e*e,i=e*n;return t[0]*i+t[1]*n+t[2]*e+t[3]}function zt(e,t){var n=e*e;return 3*t[0]*n+2*t[1]*e+t[2]}function fn(e,t){return 6*t[0]*e+2*t[1]}function aa(e,t){var n=t[0],i=t[1],r=t[2],s=t[3]-e;return n===0&&i===0&&r===0&&s===0?[0]:ra(n,i,r,s).filter((function(o){return o>-et&&o<=1+et})).map((function(o){return G(o,0,1)}))}function dn(e,t,n,i){i===void 0&&(i=null),i=i||new Array(n.length);for(var r=0;r<n.length;r++)i[r]=e(t,n[r]);return i}var Bi=(function(){function e(t){t===void 0&&(t=null),this._alpha=0,this._tension=.5,this._closed=!1,this._onInvalidateCache=null,this._onInvalidateCache=t,this._cache={arcLengths:null,coefficients:null}}return e.prototype._invalidateCache=function(){this.points&&(this._cache={arcLengths:null,coefficients:null},this._onInvalidateCache&&this._onInvalidateCache())},Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){Number.isFinite(t)&&t!==this._alpha&&(this._invalidateCache(),this._alpha=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tension",{get:function(){return this._tension},set:function(t){Number.isFinite(t)&&t!==this._tension&&(this._invalidateCache(),this._tension=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"points",{get:function(){return this._points},set:function(t){if(!t||t.length<2)throw Error("At least 2 control points are required!");this._points=t,this._invalidateCache()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._closed},set:function(t){t=!!t,this._closed!==t&&(this._invalidateCache(),this._closed=t)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._invalidateCache()},e.prototype.evaluateForT=function(t,n,i){var r=ta(n,this.points,this.closed),s=r.index;return dn(t,r.weight,this.getCoefficients(s),i)},e.prototype.getCoefficients=function(t){if(this.points){if(this._cache.coefficients||(this._cache.coefficients=new Map),!this._cache.coefficients.has(t)){var n=ln(t,this.points,this.closed),i=oa(n[0],n[1],n[2],n[3],{tension:this.tension,alpha:this.alpha});this._cache.coefficients.set(t,i)}return this._cache.coefficients.get(t)}},e})(),ca=(function(e){function t(n,i){n===void 0&&(n=300),i===void 0&&(i=null);var r=e.call(this,i)||this;return r._subDivisions=n,r}return Ii(t,e),Object.defineProperty(t.prototype,"arcLengths",{get:function(){return this._cache.arcLengths||(this._cache.arcLengths=this.computeArcLengths()),this._cache.arcLengths},enumerable:!1,configurable:!0}),t.prototype._invalidateCache=function(){e.prototype._invalidateCache.call(this),this._cache.arcLengths=null},t.prototype.computeArcLengths=function(){var n,i=[],r=this.evaluateForT(Ot,0),s=0;i.push(0);for(var o=1;o<=this._subDivisions;o++)s+=_e(n=this.evaluateForT(Ot,o/this._subDivisions),r),i.push(s),r=n;return i},t.prototype.lengthAt=function(n){var i=this.arcLengths;return n*i[i.length-1]},t.prototype.getT=function(n){var i=this.arcLengths,r=i.length,s=n*i[r-1],o=un(s,i);if(i[o]===s)return o/(r-1);var a=i[o];return(o+(s-a)/(i[o+1]-a))/(r-1)},t.prototype.getU=function(n){if(n===0)return 0;if(n===1)return 1;var i=this.arcLengths,r=i.length-1,s=i[r],o=n*r,a=Math.floor(o),c=i[a];if(o===a)return c/s;var h=a/r;return(c+_e(this.evaluateForT(Ot,h),this.evaluateForT(Ot,n)))/s},t})(Bi),Hi=[[[-.906179845938664,.23692688505618908],[-.5384693101056831,.47862867049936647],[0,.5688888888888889],[.5384693101056831,.47862867049936647],[.906179845938664,.23692688505618908]],[[-.932469514203152,.17132449237917036],[-.6612093864662645,.3607615730481386],[-.2386191860831969,.46791393457269104],[.2386191860831969,.46791393457269104],[.6612093864662645,.3607615730481386],[.932469514203152,.17132449237917036]],[[-.9491079123427585,.1294849661688697],[-.7415311855993945,.27970539148927664],[-.4058451513773972,.3818300505051189],[0,.4179591836734694],[.4058451513773972,.3818300505051189],[.7415311855993945,.27970539148927664],[.9491079123427585,.1294849661688697]],[[-.9602898564975363,.10122853629037626],[-.7966664774136267,.22238103445337448],[-.525532409916329,.31370664587788727],[-.1834346424956498,.362683783378362],[.1834346424956498,.362683783378362],[.525532409916329,.31370664587788727],[.7966664774136267,.22238103445337448],[.9602898564975363,.10122853629037626]],[[-.9681602395076261,.08127438836157441],[-.8360311073266358,.1806481606948574],[-.6133714327005904,.26061069640293544],[-.3242534234038089,.31234707704000286],[0,.3302393550012598],[.3242534234038089,.31234707704000286],[.6133714327005904,.26061069640293544],[.8360311073266358,.1806481606948574],[.9681602395076261,.08127438836157441]],[[-.9739065285171717,.06667134430868814],[-.8650633666889845,.1494513491505806],[-.6794095682990244,.21908636251598204],[-.4333953941292472,.26926671930999635],[-.14887433898163122,.29552422471475287],[.14887433898163122,.29552422471475287],[.4333953941292472,.26926671930999635],[.6794095682990244,.21908636251598204],[.8650633666889845,.1494513491505806],[.9739065285171717,.06667134430868814]],[[-.978228658146056,.0556685671161736],[-.887062599768095,.125580369464904],[-.730152005574049,.186290210927734],[-.519096129206811,.23319376459199],[-.269543155952344,.262804544510246],[0,.2729250867779],[.269543155952344,.262804544510246],[.519096129206811,.23319376459199],[.730152005574049,.186290210927734],[.887062599768095,.125580369464904],[.978228658146056,.0556685671161736]],[[-.981560634246719,.0471753363865118],[-.904117256370474,.106939325995318],[-.769902674194304,.160078328543346],[-.587317954286617,.203167426723065],[-.36783149899818,.233492536538354],[-.125233408511468,.249147045813402],[.125233408511468,.249147045813402],[.36783149899818,.233492536538354],[.587317954286617,.203167426723065],[.769902674194304,.160078328543346],[.904117256370474,.106939325995318],[.981560634246719,.0471753363865118]],[[-.984183054718588,.0404840047653158],[-.917598399222977,.0921214998377284],[-.801578090733309,.138873510219787],[-.64234933944034,.178145980761945],[-.448492751036446,.207816047536888],[-.230458315955134,.226283180262897],[0,.232551553230873],[.230458315955134,.226283180262897],[.448492751036446,.207816047536888],[.64234933944034,.178145980761945],[.801578090733309,.138873510219787],[.917598399222977,.0921214998377284],[.984183054718588,.0404840047653158]],[[-.986283808696812,.0351194603317518],[-.928434883663573,.0801580871597602],[-.827201315069764,.121518570687903],[-.687292904811685,.157203167158193],[-.515248636358154,.185538397477937],[-.319112368927889,.205198463721295],[-.108054948707343,.215263853463157],[.108054948707343,.215263853463157],[.319112368927889,.205198463721295],[.515248636358154,.185538397477937],[.687292904811685,.157203167158193],[.827201315069764,.121518570687903],[.928434883663573,.0801580871597602],[.986283808696812,.0351194603317518]],[[-.987992518020485,.0307532419961172],[-.937273392400705,.0703660474881081],[-.848206583410427,.107159220467171],[-.72441773136017,.139570677926154],[-.570972172608538,.166269205816993],[-.394151347077563,.186161000015562],[-.201194093997434,.198431485327111],[0,.202578241925561],[.201194093997434,.198431485327111],[.394151347077563,.186161000015562],[.570972172608538,.166269205816993],[.72441773136017,.139570677926154],[.848206583410427,.107159220467171],[.937273392400705,.0703660474881081],[.987992518020485,.0307532419961172]],[[-.989400934991649,.027152459411754],[-.944575023073232,.0622535239386478],[-.865631202387831,.0951585116824927],[-.755404408355003,.124628971255533],[-.617876244402643,.149595988816576],[-.458016777657227,.169156519395002],[-.281603550779258,.182603415044923],[-.0950125098376374,.189450610455068],[.0950125098376374,.189450610455068],[.281603550779258,.182603415044923],[.458016777657227,.169156519395002],[.617876244402643,.149595988816576],[.755404408355003,.124628971255533],[.865631202387831,.0951585116824927],[.944575023073232,.0622535239386478],[.989400934991649,.027152459411754]],[[-.990575475314417,.0241483028685479],[-.950675521768767,.0554595293739872],[-.880239153726985,.0850361483171791],[-.781514003896801,.111883847193403],[-.65767115921669,.135136368468525],[-.512690537086476,.15404576107681],[-.351231763453876,.16800410215645],[-.178484181495847,.176562705366992],[0,.179446470356206],[.178484181495847,.176562705366992],[.351231763453876,.16800410215645],[.512690537086476,.15404576107681],[.65767115921669,.135136368468525],[.781514003896801,.111883847193403],[.880239153726985,.0850361483171791],[.950675521768767,.0554595293739872],[.990575475314417,.0241483028685479]],[[-.99156516842093,.0216160135264833],[-.955823949571397,.0497145488949698],[-.892602466497555,.076425730254889],[-.803704958972523,.100942044106287],[-.691687043060353,.122555206711478],[-.559770831073947,.14064291467065],[-.411751161462842,.154684675126265],[-.251886225691505,.164276483745832],[-.0847750130417353,.169142382963143],[.0847750130417353,.169142382963143],[.251886225691505,.164276483745832],[.411751161462842,.154684675126265],[.559770831073947,.14064291467065],[.691687043060353,.122555206711478],[.803704958972523,.100942044106287],[.892602466497555,.076425730254889],[.955823949571397,.0497145488949697],[.99156516842093,.0216160135264833]],[[-.992406843843584,.0194617882297264],[-.96020815213483,.0448142267656996],[-.903155903614817,.0690445427376412],[-.822714656537142,.0914900216224499],[-.720966177335229,.111566645547333],[-.600545304661681,.128753962539336],[-.46457074137596,.142606702173606],[-.316564099963629,.152766042065859],[-.160358645640225,.158968843393954],[0,.161054449848783],[.160358645640225,.158968843393954],[.316564099963629,.152766042065859],[.46457074137596,.142606702173606],[.600545304661681,.128753962539336],[.720966177335