@equinor/esv-intersection
Version:
Intersection component package with testing and automatic documentation.
14 lines (12 loc) • 225 kB
JavaScript
(function(C,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("pixi.js")):typeof define=="function"&&define.amd?define(["exports","pixi.js"],F):(C=typeof globalThis<"u"?globalThis:C||self,F(C.esvintersection={},C.PIXI))})(this,function(C,F){"use strict";function Ss(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ot=Ss(F);function Ms(e){return e}var Ue=1,ie=2,We=3,re=4,jn=1e-6;function As(e){return"translate("+e+",0)"}function Cs(e){return"translate(0,"+e+")"}function Ps(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 Zn(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===Ue||e===re?-1:1,l=e===re||e===ie?"x":"y",u=e===Ue||e===We?As:Cs;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(),v=+m[0]+c,x=+m[m.length-1]+c,M=(t.bandwidth?Ls:Ps)(t.copy(),c),b=d.selection?d.selection():d,S=b.selectAll(".domain").data([null]),T=b.selectAll(".tick").data(g,t).order(),L=T.exit(),E=T.enter().append("g").attr("class","tick"),D=T.select("line"),P=T.select("text");S=S.merge(S.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),D=D.merge(E.append("line").attr("stroke","currentColor").attr(l+"2",h*s)),P=P.merge(E.append("text").attr("fill","currentColor").attr(l,h*y).attr("dy",e===Ue?"0em":e===We?"0.71em":"0.32em")),d!==b&&(S=S.transition(d),T=T.transition(d),D=D.transition(d),P=P.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 I=this.parentNode.__axis;return u((I&&isFinite(I=I(z))?I:M(z))+c)})),L.remove(),S.attr("d",e===re||e===ie?o?"M"+h*o+","+v+"H"+c+"V"+x+"H"+h*o:"M"+c+","+v+"V"+x:o?"M"+v+","+h*o+"V"+c+"H"+x+"V"+h*o:"M"+v+","+c+"H"+x),T.attr("opacity",1).attr("transform",function(z){return u(M(z)+c)}),D.attr(l+"2",h*s),P.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 Zn(ie,e)}function Fs(e){return Zn(We,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 Kn(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:Os,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 Os(){return 0}function Ds(e){return e===null?NaN:+e}const zs=Kn(se).right;Kn(Ds).center;const Ns=zs;class Qn extends Map{constructor(t,n=Is){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(Jn(this,t))}has(t){return super.has(Jn(this,t))}set(t,n){return super.set($s(this,t),n)}delete(t){return super.delete(Bs(this,t))}}function Jn({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function $s({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function Bs({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(n),e.delete(i)),n}function Is(e){return e!==null&&typeof e=="object"?e.valueOf():e}const Hs=Math.sqrt(50),Vs=Math.sqrt(10),Us=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>=Hs?10:s>=Vs?5:s>=Us?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 Ws(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 Ye(e,t,n){return t=+t,e=+e,n=+n,oe(e,t,n)[2]}function Ys(e,t,n){t=+t,e=+e,n=+n;const i=t<e,r=i?Ye(t,e,n):Ye(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}function Ge(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 Xe(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 ti(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const ei=Symbol("implicit");function ni(){var e=new Qn,t=[],n=[],i=ei;function r(s){let o=e.get(s);if(o===void 0){if(i!==ei)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 Qn;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 ni(t,n).unknown(i)},ti.apply(r,arguments),r}function qe(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ii(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Ht(){}var Vt=.7,ae=1/Vt,Et="\\s*([+-]?\\d+)\\s*",Ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gs=/^#([0-9a-f]{3,8})$/,Xs=new RegExp(`^rgb\\(${Et},${Et},${Et}\\)$`),qs=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),js=new RegExp(`^rgba\\(${Et},${Et},${Et},${Ut}\\)$`),Zs=new RegExp(`^rgba\\(${at},${at},${at},${Ut}\\)$`),Ks=new RegExp(`^hsl\\(${Ut},${at},${at}\\)$`),Qs=new RegExp(`^hsla\\(${Ut},${at},${at},${Ut}\\)$`),ri={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};qe(Ht,ut,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:si,formatHex:si,formatHex8:Js,formatHsl:to,formatRgb:oi,toString:oi});function si(){return this.rgb().formatHex()}function Js(){return this.rgb().formatHex8()}function to(){return ui(this).formatHsl()}function oi(){return this.rgb().formatRgb()}function ut(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gs.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ai(t):n===3?new G(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=Xs.exec(e))?new G(t[1],t[2],t[3],1):(t=qs.exec(e))?new G(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=js.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=Ks.exec(e))?li(t[1],t[2]/100,t[3]/100,1):(t=Qs.exec(e))?li(t[1],t[2]/100,t[3]/100,t[4]):ri.hasOwnProperty(e)?ai(ri[e]):e==="transparent"?new G(NaN,NaN,NaN,0):null}function ai(e){return new G(e>>16&255,e>>8&255,e&255,1)}function ce(e,t,n,i){return i<=0&&(e=t=n=NaN),new G(e,t,n,i)}function eo(e){return e instanceof Ht||(e=ut(e)),e?(e=e.rgb(),new G(e.r,e.g,e.b,e.opacity)):new G}function je(e,t,n,i){return arguments.length===1?eo(e):new G(e,t,n,i??1)}function G(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}qe(G,je,ii(Ht,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new G(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vt:Math.pow(Vt,e),new G(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new G(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:ci,formatHex:ci,formatHex8:no,formatRgb:hi,toString:hi}));function ci(){return`#${At(this.r)}${At(this.g)}${At(this.b)}`}function no(){return`#${At(this.r)}${At(this.g)}${At(this.b)}${At((isNaN(this.opacity)?1:this.opacity)*255)}`}function hi(){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 li(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new et(e,t,n,i)}function ui(e){if(e instanceof et)return new et(e.h,e.s,e.l,e.opacity);if(e instanceof Ht||(e=ut(e)),!e)return new et;if(e instanceof et)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 et(o,a,c,e.opacity)}function io(e,t,n,i){return arguments.length===1?ui(e):new et(e,t,n,i??1)}function et(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}qe(et,io,ii(Ht,{brighter(e){return e=e==null?ae:Math.pow(ae,e),new et(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vt:Math.pow(Vt,e),new et(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 G(Ze(e>=240?e-240:e+120,r,i),Ze(e,r,i),Ze(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new et(fi(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("}${fi(this.h)}, ${le(this.s)*100}%, ${le(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fi(e){return e=(e||0)%360,e<0?e+360:e}function le(e){return Math.max(0,Math.min(1,e||0))}function Ze(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 Ke=e=>()=>e;function ro(e,t){return function(n){return e+n*t}}function so(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 oo(e){return(e=+e)==1?di:function(t,n){return n-t?so(t,n,e):Ke(isNaN(t)?n:t)}}function di(e,t){var n=t-e;return n?ro(e,n):Ke(isNaN(e)?t:e)}const Wt=function e(t){var n=oo(t);function i(r,s){var o=n((r=je(r)).r,(s=je(s)).r),a=n(r.g,s.g),c=n(r.b,s.b),h=di(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 ao(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 co(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ho(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]=tn(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 lo(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function nt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function uo(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]=tn(e[r],t[r]):i[r]=t[r];return function(s){for(r in n)i[r]=n[r](s);return i}}var Qe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Je=new RegExp(Qe.source,"g");function fo(e){return function(){return e}}function go(e){return function(t){return e(t)+""}}function gi(e,t){var n=Qe.lastIndex=Je.lastIndex=0,i,r,s,o=-1,a=[],c=[];for(e=e+"",t=t+"";(i=Qe.exec(e))&&(r=Je.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:nt(i,r)})),n=Je.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?go(c[0].x):fo(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 tn(e,t){var n=typeof t,i;return t==null||n==="boolean"?Ke(t):(n==="number"?nt:n==="string"?(i=ut(t))?(t=i,Wt):gi:t instanceof ut?Wt:t instanceof Date?lo:co(t)?ao:Array.isArray(t)?ho:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?uo:nt)(e,t)}function po(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var pi=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mi(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)*pi,skewX:Math.atan(c)*pi,scaleX:o,scaleY:a}}var ue;function mo(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?en:mi(t.a,t.b,t.c,t.d,t.e,t.f)}function yo(e){return e==null||(ue||(ue=document.createElementNS("http://www.w3.org/2000/svg","g")),ue.setAttribute("transform",e),!(e=ue.transform.baseVal.consolidate()))?en:(e=e.matrix,mi(e.a,e.b,e.c,e.d,e.e,e.f))}function yi(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:nt(h,u)},{i:p-2,x:nt(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:nt(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:nt(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:nt(h,u)},{i:p-2,x:nt(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 _o=yi(mo,"px, ","px)","deg)"),vo=yi(yo,", ",")",")"),xo=1e-12;function _i(e){return((e=Math.exp(e))+1/e)/2}function wo(e){return((e=Math.exp(e))-1/e)/2}function bo(e){return((e=Math.exp(2*e))-1)/(e+1)}const To=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<xo)m=Math.log(f/h)/t,y=function(T){return[a+T*d,c+T*g,h*Math.exp(t*T*m)]};else{var v=Math.sqrt(p),x=(f*f-h*h+i*p)/(2*h*n*v),M=(f*f-h*h-i*p)/(2*f*n*v),b=Math.log(Math.sqrt(x*x+1)-x),S=Math.log(Math.sqrt(M*M+1)-M);m=(S-b)/t,y=function(T){var L=T*m,E=_i(b),D=h/(n*v)*(E*bo(t*L+b)-wo(b));return[a+D*d,c+D*g,h*E/_i(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 Mo(e){return function(){return e}}function Ao(e){return+e}var vi=[0,1];function Ft(e){return e}function nn(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Mo(isNaN(t)?NaN:.5)}function Co(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=nn(r,i),s=n(o,s)):(i=nn(i,r),s=n(s,o)),function(a){return s(i(a))}}function Lo(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]=nn(e[o],e[o+1]),s[o]=n(t[o],t[o+1]);return function(a){var c=Ns(e,a,1,i)-1;return s[c](r[c](a))}}function ko(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Eo(){var e=vi,t=vi,n=tn,i,r,s,o=Ft,a,c,h;function l(){var f=Math.min(e.length,t.length);return o!==Ft&&(o=Co(e[0],e[f-1])),a=f>2?Lo: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),nt)))(f)))},u.domain=function(f){return arguments.length?(e=Array.from(f,Ao),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=po,l()},u.clamp=function(f){return arguments.length?(o=f?!0:Ft,l()):o!==Ft},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 Fo(){return Eo()(Ft,Ft)}function Ro(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 Rt(e){return e=fe(Math.abs(e)),e?e[1]:NaN}function Oo(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 Do(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var zo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function de(e){if(!(t=zo.exec(e)))throw new Error("invalid format: "+e);var t;return new rn({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=rn.prototype;function rn(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+""}rn.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 No(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 xi;function $o(e,t){var n=fe(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(xi=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 wi(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 bi={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ro,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)=>wi(e*100,t),r:wi,s:$o,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Ti(e){return e}var Si=Array.prototype.map,Mi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Bo(e){var t=e.grouping===void 0||e.thousands===void 0?Ti:Oo(Si.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:Do(Si.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,v=u.comma,x=u.precision,M=u.trim,b=u.type;b==="n"?(v=!0,b="g"):bi[b]||(x===void 0&&(x=12),M=!0,b="g"),(y||f==="0"&&d==="=")&&(y=!0,f="0",d="=");var S=p==="$"?n:p==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",T=p==="$"?i:/[%p]/.test(b)?o:"",L=bi[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 D(P){var z=S,I=T,_,A,w;if(b==="c")I=L(P)+I,P="";else{P=+P;var k=P<0||1/P<0;if(P=isNaN(P)?c:L(Math.abs(P),x),M&&(P=No(P)),k&&+P==0&&g!=="+"&&(k=!1),z=(k?g==="("?g:a:g==="-"||g==="("?"":g)+z,I=(b==="s"?Mi[8+xi/3]:"")+I+(k&&g==="("?")":""),E){for(_=-1,A=P.length;++_<A;)if(w=P.charCodeAt(_),48>w||w>57){I=(w===46?r+P.slice(_+1):P.slice(_))+I,P=P.slice(0,_);break}}}v&&!y&&(P=t(P,1/0));var R=z.length+P.length+I.length,O=R<m?new Array(m-R+1).join(f):"";switch(v&&y&&(P=t(O+P,O.length?m-I.length:1/0),O=""),d){case"<":P=z+P+I+O;break;case"=":P=z+O+P+I;break;case"^":P=O.slice(0,R=O.length>>1)+z+P+I+O.slice(R);break;default:P=O+z+P+I;break}return s(P)}return D.toString=function(){return u+""},D}function l(u,f){var d=h((u=de(u),u.type="f",u)),g=Math.max(-8,Math.min(8,Math.floor(Rt(f)/3)))*3,p=Math.pow(10,-g),y=Mi[8+g/3];return function(m){return d(p*m)+y}}return{format:h,formatPrefix:l}}var ge,Ai,Ci;Io({thousands:",",grouping:[3],currency:["$",""]});function Io(e){return ge=Bo(e),Ai=ge.format,Ci=ge.formatPrefix,ge}function Ho(e){return Math.max(0,-Rt(Math.abs(e)))}function Vo(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Rt(t)/3)))*3-Rt(Math.abs(e)))}function Uo(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Rt(t)-Rt(e))+1}function Wo(e,t,n,i){var r=Ys(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=Vo(r,o))&&(i.precision=s),Ci(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=Uo(r,Math.max(Math.abs(e),Math.abs(t))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=Ho(r))&&(i.precision=s-(i.type==="%")*2);break}}return Ai(i)}function Yo(e){var t=e.domain;return e.ticks=function(n){var i=t();return Ws(i[0],i[i.length-1],n??10)},e.tickFormat=function(n,i){var r=t();return Wo(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=Ye(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 Ct(){var e=Fo();return e.copy=function(){return ko(e,Ct())},ti.apply(e,arguments),Yo(e)}class Pi{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=Ct().domain([0,1]).range([0,1]),this._scaleY=Ct().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()}}var Go=Math.PI/180;function mt(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e<t?t:e>n?n:e}function Xo(e){return e*Go}function Li(e){var t=new Array(e),n=1/(e-1);t[0]=0;for(var i=1;i<e-1;i++)t[i]=i*n;return t[e-1]=1,t}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 Gt(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 Pt(e,t,n){n===void 0&&(n=e);for(var i=0;i<e.length;i++)n[i]=e[i]*t;return n}function qo(e){for(var t=0,n=0;n<e.length;n++)t+=Math.pow(e[n],2);return t}function Xt(e){var t=qo(e);return t===0?t:Math.sqrt(t)}function ki(e,t){t===void 0&&(t=e);var n=Xt(e);return n===0?jo(0,t):Pt(e,1/n,t)}function jo(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 Ko(e,t){for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}function Qo(e,t,n,i){i===void 0&&(i=e);for(var r=mt(n,0,1),s=1-r,o=0;o<e.length;o++)i[o]=e[o]*s+t[o]*r;return i}function Jo(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 Ei(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 sn=180/Math.PI,ta=Math.PI/180;function on(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 Fi(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 $=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:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this[1]},set:function(t){this[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"magnitude",{get:function(){return Xt(this)},set:function(t){var n=Xt(this);Pt(this,t/n,this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mutable",{get:function(){return this.isMutating=!0,this},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"immutable",{get:function(){return this.isMutating=!1,this},enumerable:!0,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?Yt(this,[t,n]):Yt(this.clone(),[t,n]):this.isMutating?Yt(this,t):Yt(this.clone(),t)},e.add=function(t,n){var i=new e(t);return Yt(i,n)},e.prototype.sub=function(t,n){return n===void 0&&(n=0),typeof t=="number"?this.isMutating?Gt(this,[t,n]):Gt(this.clone(),[t,n]):this.isMutating?Gt(this,t):Gt(this.clone(),t)},e.sub=function(t,n){var i=new e(t);return Gt(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 Pt(i,1/n)},e.multiply=function(t,n){var i=new e(t);return Pt(i,n)},e.prototype.scale=function(t){return Pt(this,t,this.isMutating?this:e.zero)},e.prototype.rescale=function(t){var n=Xt(this);return n<=0?this.isMutating?this:e.zero:Pt(this,t/n,this.isMutating?this:e.zero)},e.prototype.clampMagnitude=function(t){var n=Xt(this);return n>t?Pt(this,t/n,this.isMutating?this:e.zero):this.isMutating?this:this.clone()},e.prototype.rotate=function(t){return on(this,t,this.isMutating?this:e.zero)},e.prototype.rotateDeg=function(t){return on(this,t*ta,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 ki(this)},e.prototype.normalized=function(){return ki(this,e.zero)},e.distance=function(t,n){return Zo(t,n)},e.dot=function(t,n){return Ko(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 Fi(t)},e.angleRightDeg=function(t){return Fi(t)*sn},e.angle=function(t,n){return Math.abs(qt(t,n))},e.angleDeg=function(t,n){return Math.abs(qt(t,n))*sn},e.signedAngle=function(t,n){return qt(t,n)},e.signedAngleDeg=function(t,n){return qt(t,n)*sn},e.lerp=function(t,n,i){var r=new e(t);return Qo(r,n,i)},e.lerpRot=function(t,n,i){return function(r,s,o,a){return a===void 0&&(a=r),on(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),Ei(t,n)},e.prototype.isZeroVector=function(t){return t===void 0&&(t=0),Ei(this,t)},e.prototype.toArray=function(){return[this[0],this[1]]},e.prototype.modify=function(t){return Jo(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:!0,configurable:!0}),Object.defineProperty(e,"one",{get:function(){return new e(1,1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"positiveInfinity",{get:function(){return new e(1/0,1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"negativeInfinity",{get:function(){return new e(-1/0,-1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"up",{get:function(){return new e(0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"right",{get:function(){return new e(1,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"down",{get:function(){return new e(0,-1)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"left",{get:function(){return new e(-1,0)},enumerable:!0,configurable:!0}),e}();/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var an=function(e,t){return an=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])},an(e,t)};function cn(e,t){function n(){this.constructor=e}an(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var hn=function(){return hn=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},hn.apply(this,arguments)};function Ri(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]:Ri(r,s),o=e<a-1?t[e+2]:Ri(s,r)}return[i,r,s,o]}function ea(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 na(e,t){for(var n=0;n<e.length;n++)e[n]=t;return e}function ia(e,t){for(var n=0;n<e.length;n++)e[n]=t(e[n],n);return e}function ra(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 pe(e,t){t=t||new Array(e.length);for(var n=0;n<e.length;n++)t[n]=e[n];return t}function tt(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 it=Math.pow(2,-42);function Oi(e){var t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}function Di(e,t,n){if(Math.abs(e)<it)return Math.abs(t)<it?[]:[-n/t];var i=t*t-4*e*n;return Math.abs(i)<it?[-t/(2*e)]:i>0?[(-t+Math.sqrt(i))/(2*e),(-t-Math.sqrt(i))/(2*e)]:[]}function sa(e,t,n,i){if(Math.abs(e)<it)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)<it)r=[Oi(-o)];else if(Math.abs(o)<it)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)<it)r=[-1.5*o/s,3*o/s];else if(a>0)r=[(c=Oi(-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 oa(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 me(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 zi(e,t){for(var n=0,i=0;i<e.length;i++)n+=(e[i]-t[i])*(e[i]-t[i]);return n}function Ot(e){for(var t=0,n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function ye(e,t){var n=zi(e,t);return n===0?0:Math.sqrt(n)}function yt(e,t){var n=t?pe(e,t):e,i=ra(n,function(s,o){return s+Math.pow(o,2)}),r=Math.sqrt(i);return r===0?na(n,0):ia(n,function(s){return s/r})}function aa(e,t){if(e.length>2)throw Error("Only supported for 2d vectors");var n=t?pe(e,t):e,i=-n[1];return n[1]=n[0],n[0]=i,n}function ca(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(zi(c,h),.5*r)},o=s(t,e),a=s(n,t)+o;return[0,o,a,s(i,n)+a]}function ha(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?ca(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],v=a[2],x=a[3];m-v!=0&&(y-m!=0&&y-v!=0&&(l=(1-s)*(v-m)*((f-d)/(y-m)-(f-g)/(y-v)+(d-g)/(m-v))),m-x!=0&&v-x!=0&&(u=(1-s)*(v-m)*((d-g)/(m-v)-(d-p)/(m-x)+(g-p)/(v-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,S=l,T=d;c[h]=[M,b,S,T]}return c}function Dt(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 la(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]:sa(n,i,r,s).filter(function(o){return o>-it&&o<=1+it}).map(function(o){return tt(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 Ni=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=ea(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=ha(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}(),ua=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 cn(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(Dt,0),s=0;i.push(0);for(var o=1;o<=this._subDivisions;o++)s+=ye(n=this.evaluateForT(Dt,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+ye(this.evaluateForT(Dt,h),this.evaluateForT(Dt,n)))/s},t}(Ni),$i=[[[-.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],[.1603586