@joint/core 4.0.4 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/dist/geometry.js +4962 -6132
- package/dist/geometry.min.js +2 -2
- package/dist/joint.d.ts +328 -50
- package/dist/joint.js +34067 -37565
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +34067 -37565
- package/dist/joint.nowrap.min.js +2 -2
- package/dist/vectorizer.js +7288 -8907
- package/dist/vectorizer.min.js +2 -2
- package/dist/version.mjs +1 -1
- package/package.json +10 -15
- package/src/{linkTools → cellTools}/Button.mjs +8 -6
- package/src/{elementTools → cellTools}/Control.mjs +3 -3
- package/src/{linkTools → cellTools}/HoverConnect.mjs +1 -1
- package/src/dia/Cell.mjs +60 -33
- package/src/dia/CellView.mjs +75 -8
- package/src/dia/ElementView.mjs +13 -8
- package/src/dia/Graph.mjs +148 -40
- package/src/dia/HighlighterView.mjs +8 -4
- package/src/dia/LinkView.mjs +42 -3
- package/src/dia/Paper.mjs +84 -0
- package/src/dia/ToolView.mjs +29 -4
- package/src/dia/ToolsView.mjs +25 -10
- package/src/dia/attributes/connection.mjs +5 -0
- package/src/dia/attributes/defs.mjs +3 -0
- package/src/dia/attributes/eval.mjs +3 -3
- package/src/dia/attributes/index.mjs +3 -0
- package/src/dia/attributes/shape.mjs +4 -0
- package/src/dia/attributes/text.mjs +15 -5
- package/src/dia/ports.mjs +4 -0
- package/src/elementTools/HoverConnect.mjs +5 -5
- package/src/elementTools/index.mjs +5 -4
- package/src/g/rect.mjs +13 -5
- package/src/layout/ports/port.mjs +4 -5
- package/src/linkTools/Anchor.mjs +1 -1
- package/src/linkTools/Arrowhead.mjs +2 -1
- package/src/linkTools/RotateLabel.mjs +110 -0
- package/src/linkTools/Segments.mjs +1 -1
- package/src/linkTools/Vertices.mjs +41 -4
- package/src/linkTools/index.mjs +7 -4
- package/src/mvc/View.mjs +0 -1
- package/src/mvc/ViewBase.mjs +2 -1
- package/src/routers/rightAngle.mjs +538 -140
- package/src/shapes/standard.mjs +8 -1
- package/src/{dia/attributes → util}/calc.mjs +24 -12
- package/src/util/index.mjs +1 -0
- package/src/util/util.mjs +39 -0
- package/src/util/utilHelpers.mjs +2 -1
- package/types/geometry.d.ts +6 -1
- package/types/joint.d.ts +321 -48
- /package/src/{linkTools → cellTools}/Boundary.mjs +0 -0
- /package/src/{linkTools → cellTools}/Connect.mjs +0 -0
- /package/src/{linkTools → cellTools}/helpers.mjs +0 -0
package/dist/vectorizer.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! JointJS v4.0
|
|
1
|
+
/*! JointJS v4.1.0 (2024-11-27) - JavaScript diagramming library
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
5
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
6
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
7
7
|
*/
|
|
8
|
-
if(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).V=n()}(this,function(){"use strict";var e=Math.round,r=Math.floor,i=Math.PI,h=function(t){return t%360+(t<0?360:0)},s=function(t,n){return n*e(t/n)},c=function(t){return 180*t/i%360},l=function(t,n){return(t=(n=n||!1)?t:t%360)*i/180},o=function(t,n){if(void 0===n)n=void 0===t?1:t,t=0;else if(n<t){var e=t;t=n,n=e}return r(Math.random()*(n-t+1)+t)},f=Math.cos,d=Math.sin,g=Math.atan2,n=function(t,n){var e=l(t.y),r=l(n.y),i=t.x,s=n.x,o=l(s-i),a=d(o)*f(r),h=f(e)*d(r)-d(e)*f(r)*f(o),u=c(g(a,h))-22.5;return u<0&&(u+=360),["NE","E","SE","S","SW","W","NW","N"][u=parseInt(u/45)]},a=function(t,n){var e=t.x,r=t.y;return(e-=n.x)*e+(r-=n.y)*r},u=function(t,n){return Math.sqrt(a(t,n))},v={Point:1,Line:2,Ellipse:3,Rect:4,Polyline:5,Polygon:6,Curve:7,Path:8},p=Math.abs,m=Math.cos,y=Math.sin,x=Math.sqrt,w=Math.min,b=Math.max,S=Math.atan2,P=Math.round,A=Math.pow,T=Math.PI,L=function(t,n){if(!(this instanceof L))return new L(t,n);if("string"==typeof t){var e=t.split(-1===t.indexOf("@")?" ":"@");t=parseFloat(e[0]),n=parseFloat(e[1])}else Object(t)===t&&(n=t.y,t=t.x);this.x=void 0===t?0:t,this.y=void 0===n?0:n};L.fromPolar=function(t,n,e){e=new L(e);var r=p(t*m(n)),i=p(t*y(n)),s=h(c(n));return s<90?i=-i:s<180?(r=-r,i=-i):s<270&&(r=-r),new L(e.x+r,e.y+i)},L.random=function(t,n,e,r){return new L(o(t,n),o(e,r))},L.prototype={type:v.Point,chooseClosest:function(t){var n=t.length;if(1===n)return new L(t[0]);for(var e=null,r=1/0,i=0;i<n;i++){var s=new L(t[i]),o=this.squaredDistance(s);o<r&&(e=s,r=o)}return e},adhereToRect:function(t){return t.containsPoint(this)||(this.x=w(b(this.x,t.x),t.x+t.width),this.y=w(b(this.y,t.y),t.y+t.height)),this},angleBetween:function(t,n){var e=this.equals(t)||this.equals(n)?NaN:this.theta(n)-this.theta(t);return e<0&&(e+=360),e},bearing:function(t){return n(this,t)},changeInAngle:function(t,n,e){return this.clone().offset(-t,-n).theta(e)-this.theta(e)},clone:function(){return new L(this)},cross:function(t,n){return t&&n?(n.x-this.x)*(t.y-this.y)-(n.y-this.y)*(t.x-this.x):NaN},difference:function(t,n){return Object(t)===t&&(n=t.y,t=t.x),new L(this.x-(t||0),this.y-(n||0))},distance:function(t){return u(this,t)},dot:function(t){return t?this.x*t.x+this.y*t.y:NaN},equals:function(t){return!!t&&this.x===t.x&&this.y===t.y},lerp:function(t,n){var e=this.x,r=this.y;return new L((1-n)*e+n*t.x,(1-n)*r+n*t.y)},magnitude:function(){return x(this.x*this.x+this.y*this.y)||.01},manhattanDistance:function(t){return p(t.x-this.x)+p(t.y-this.y)},move:function(t,n){var e=l(new L(t).theta(this));return this.offset(m(e)*n,-y(e)*n)},normalize:function(t){var n=(t||1)/this.magnitude();return this.scale(n,n)},offset:function(t,n){return Object(t)===t&&(n=t.y,t=t.x),this.x+=t||0,this.y+=n||0,this},reflection:function(t){return new L(t).move(this,this.distance(t))},rotate:function(t,n){if(0===n)return this;t=t||new L(0,0),n=l(h(-n));var e=m(n),r=y(n),i=e*(this.x-t.x)-r*(this.y-t.y)+t.x,s=r*(this.x-t.x)+e*(this.y-t.y)+t.y;return this.x=i,this.y=s,this},round:function(t){var n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=A(10,t)}return this.x=P(this.x*n)/n,this.y=P(this.y*n)/n,this},scale:function(t,n,e){return e=e&&new L(e)||new L(0,0),this.x=e.x+t*(this.x-e.x),this.y=e.y+n*(this.y-e.y),this},snapToGrid:function(t,n){return this.x=s(this.x,t),this.y=s(this.y,n||t),this},squaredDistance:function(t){return a(this,t)},theta:function(t){var n=-((t=new L(t)).y-this.y),e=t.x-this.x,r=S(n,e);return r<0&&(r=2*T+r),180*r/T},toJSON:function(){return{x:this.x,y:this.y}},toPolar:function(t){t=t&&new L(t)||new L(0,0);var n=this.x,e=this.y;return this.x=x((n-t.x)*(n-t.x)+(e-t.y)*(e-t.y)),this.y=l(t.theta(new L(n,e))),this},toString:function(){return this.x+"@"+this.y},serialize:function(){return this.x+","+this.y},update:function(t,n){return Object(t)===t&&(n=t.y,t=t.x),this.x=t||0,this.y=n||0,this},vectorAngle:function(t){return new L(0,0).angleBetween(this,t)}},L.prototype.translate=L.prototype.offset;var t=L,E=Math.max,C=Math.min,N=function(t,n){return this instanceof N?t instanceof N?new N(t.start,t.end):(this.start=new L(t),void(this.end=new L(n))):new N(t,n)};N.prototype={type:v.Line,angle:function(){var t=new L(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,t)},bbox:function(){var t=C(this.start.x,this.end.x),n=C(this.start.y,this.end.y),e=E(this.start.x,this.end.x),r=E(this.start.y,this.end.y);return new B(t,n,e-t,r-n)},bearing:function(){return n(this.start,this.end)},clone:function(){return new N(this.start,this.end)},closestPoint:function(t){return this.pointAt(this.closestPointNormalizedLength(t))},closestPointLength:function(t){return this.closestPointNormalizedLength(t)*this.length()},closestPointNormalizedLength:function(t){var n=this.vector().dot(new N(this.start,t).vector()),e=C(1,E(0,n/this.squaredLength()));return e!=e?0:e},closestPointTangent:function(t){return this.tangentAt(this.closestPointNormalizedLength(t))},containsPoint:function(t){var n=this.start,e=this.end;if(0!==n.cross(t,e))return!1;var r=this.length();return!(new N(n,t).length()>r)&&!(new N(t,e).length()>r)},divideAt:function(t){var n=this.pointAt(t);return[new N(this.start,n),new N(n,this.end)]},divideAtLength:function(t){var n=this.pointAtLength(t);return[new N(this.start,n),new N(n,this.end)]},equals:function(t){return!!t&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.end.x===t.end.x&&this.end.y===t.end.y},intersect:function(t,n){if(t&&t.intersectionWithLine){var e=t.intersectionWithLine(this,n);return e&&t instanceof N&&(e=e[0]),e}return null},intersectionWithLine:function(t){var n=new L(this.end.x-this.start.x,this.end.y-this.start.y),e=new L(t.end.x-t.start.x,t.end.y-t.start.y),r=n.x*e.y-n.y*e.x,i=new L(t.start.x-this.start.x,t.start.y-this.start.y),s=i.x*e.y-i.y*e.x,o=i.x*n.y-i.y*n.x;if(0===r||s*r<0||o*r<0)return null;if(0<r){if(r<s||r<o)return null}else if(s<r||o<r)return null;return[new L(this.start.x+s*n.x/r,this.start.y+s*n.y/r)]},isDifferentiable:function(){return!this.start.equals(this.end)},length:function(){return u(this.start,this.end)},midpoint:function(){return new L((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)},parallel:function(t){var n=this.clone();if(!this.isDifferentiable())return n;var e=n.start,r=n.end,i=e.clone().rotate(r,270),s=r.clone().rotate(e,90);return e.move(s,t),r.move(i,t),n},pointAt:function(t){var n=this.start,e=this.end;return t<=0?n.clone():1<=t?e.clone():n.lerp(e,t)},pointAtLength:function(t){var n=this.start,e=this.end,r=!0;t<0&&(r=!1,t=-t);var i=this.length();return i<=t?r?e.clone():n.clone():this.pointAt((r?t:i-t)/i)},pointOffset:function(t){t=new L(t);var n=this.start,e=this.end;return((e.x-n.x)*(t.y-n.y)-(e.y-n.y)*(t.x-n.x))/this.length()},rotate:function(t,n){return this.start.rotate(t,n),this.end.rotate(t,n),this},round:function(t){return this.start.round(t),this.end.round(t),this},scale:function(t,n,e){return this.start.scale(t,n,e),this.end.scale(t,n,e),this},setLength:function(t){var n=this.length();if(!n)return this;var e=t/n;return this.scale(e,e,this.start)},squaredLength:function(){return a(this.start,this.end)},tangentAt:function(t){if(!this.isDifferentiable())return null;var n=this.start,e=this.end,r=this.pointAt(t),i=new N(n,e);return i.translate(r.x-n.x,r.y-n.y),i},tangentAtLength:function(t){if(!this.isDifferentiable())return null;var n=this.start,e=this.end,r=this.pointAtLength(t),i=new N(n,e);return i.translate(r.x-n.x,r.y-n.y),i},toString:function(){return this.start.toString()+" "+this.end.toString()},serialize:function(){return this.start.serialize()+" "+this.end.serialize()},translate:function(t,n){return this.start.translate(t,n),this.end.translate(t,n),this},vector:function(){return new L(this.end.x-this.start.x,this.end.y-this.start.y)}},N.prototype.intersection=N.prototype.intersect;var I=N,M=Math.sqrt,R=Math.round,O=Math.pow,D=function(t,n,e){return this instanceof D?t instanceof D?new D(new L(t.x,t.y),t.a,t.b):(t=new L(t),this.x=t.x,this.y=t.y,this.a=n,void(this.b=e)):new D(t,n,e)};D.fromRect=function(t){return t=new B(t),new D(t.center(),t.width/2,t.height/2)},D.prototype={type:v.Ellipse,bbox:function(){return new B(this.x-this.a,this.y-this.b,2*this.a,2*this.b)},center:function(){return new L(this.x,this.y)},clone:function(){return new D(this)},containsPoint:function(t){return this.normalizedDistance(t)<=1},equals:function(t){return!!t&&t.x===this.x&&t.y===this.y&&t.a===this.a&&t.b===this.b},inflate:function(t,n){return void 0===t&&(t=0),void 0===n&&(n=t),this.a+=2*t,this.b+=2*n,this},intersectionWithLine:function(t){var n=[],e=t.start,r=t.end,i=this.a,s=this.b,o=t.vector(),a=e.difference(new L(this)),h=new L(o.x/(i*i),o.y/(s*s)),u=new L(a.x/(i*i),a.y/(s*s)),c=o.dot(h),l=o.dot(u),f=l*l-c*(a.dot(u)-1);if(f<0)return null;if(0<f){var d=M(f),g=(-l-d)/c,v=(-l+d)/c;if((g<0||1<g)&&(v<0||1<v))return null;0<=g&&g<=1&&n.push(e.lerp(r,g)),0<=v&&v<=1&&n.push(e.lerp(r,v))}else{var p=-l/c;if(!(0<=p&&p<=1))return null;n.push(e.lerp(r,p))}return n},intersectionWithLineFromCenterToPoint:function(t,n){t=new L(t),n&&t.rotate(new L(this.x,this.y),n);var e,r=t.x-this.x,i=t.y-this.y;if(0===r)return e=this.bbox().pointNearestToPoint(t),n?e.rotate(new L(this.x,this.y),-n):e;var s=i/r,o=s*s,a=this.a*this.a,h=this.b*this.b,u=M(1/(1/a+o/h)),c=s*(u=r<0?-u:u);return e=new L(this.x+u,this.y+c),n?e.rotate(new L(this.x,this.y),-n):e},normalizedDistance:function(t){var n=t.x,e=t.y,r=this.a,i=this.b,s=this.x,o=this.y;return(n-s)*(n-s)/(r*r)+(e-o)*(e-o)/(i*i)},round:function(t){var n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=O(10,t)}return this.x=R(this.x*n)/n,this.y=R(this.y*n)/n,this.a=R(this.a*n)/n,this.b=R(this.b*n)/n,this},tangentTheta:function(t){var n,e,r=t.x,i=t.y,s=this.a,o=this.b,a=this.bbox().center(),h=a.x,u=a.y,c=r>a.x+s/2,l=r<a.x-s/2;return c||l?e=s*s/(r-h)-s*s*(i-u)*((n=r>a.x?i-30:i+30)-u)/(o*o*(r-h))+h:n=o*o/(i-u)-o*o*(r-h)*((e=i>a.y?r+30:r-30)-h)/(s*s*(i-u))+u,new L(e,n).theta(t)},toString:function(){return new L(this.x,this.y).toString()+" "+this.a+" "+this.b}};var F=D,k=Math.abs,q=Math.cos,V=Math.sin,z=Math.min,j=Math.max,G=Math.round,W=Math.pow,B=function(t,n,e,r){if(!(this instanceof B))return new B(t,n,e,r);Object(t)===t&&(n=t.y,e=t.width,r=t.height,t=t.x),this.x=void 0===t?0:t,this.y=void 0===n?0:n,this.width=void 0===e?0:e,this.height=void 0===r?0:r};B.fromEllipse=function(t){return t=new D(t),new B(t.x-t.a,t.y-t.b,2*t.a,2*t.b)},B.fromPointUnion=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];if(0===t.length)return null;var e,r,i,s,o=new L;e=r=1/0,i=s=-1/0;for(var a=0;a<t.length;a++){o.update(t[a]);var h=o.x,u=o.y;h<e&&(e=h),i<h&&(i=h),u<r&&(r=u),s<u&&(s=u)}return new B(e,r,i-e,s-r)},B.fromRectUnion=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];if(0===t.length)return null;var e,r,i,s,o=new B;e=r=1/0,i=s=-1/0;for(var a=0;a<t.length;a++){o.update(t[a]);var h=o.x,u=o.y,c=h+o.width,l=u+o.height;h<e&&(e=h),i<c&&(i=c),u<r&&(r=u),s<l&&(s=l)}return new B(e,r,i-e,s-r)},B.prototype={type:v.Rect,bbox:function(t){return this.clone().rotateAroundCenter(t)},rotateAroundCenter:function(t){if(!t)return this;var n=this.width,e=this.height,r=l(t),i=k(V(r)),s=k(q(r)),o=n*s+e*i,a=n*i+e*s;return this.x+=(n-o)/2,this.y+=(e-a)/2,this.width=o,this.height=a,this},bottomLeft:function(){return new L(this.x,this.y+this.height)},bottomLine:function(){return new N(this.bottomLeft(),this.bottomRight())},bottomMiddle:function(){return new L(this.x+this.width/2,this.y+this.height)},center:function(){return new L(this.x+this.width/2,this.y+this.height/2)},clone:function(){return new B(this)},containsPoint:function(t){return t instanceof L||(t=new L(t)),t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height},containsRect:function(t){var n=new B(this).normalize(),e=new B(t).normalize(),r=n.width,i=n.height,s=e.width,o=e.height;if(!(r&&i&&s&&o))return!1;var a=n.x,h=n.y,u=e.x,c=e.y;return s+=u,r+=a,o+=c,i+=h,a<=u&&s<=r&&h<=c&&o<=i},corner:function(){return new L(this.x+this.width,this.y+this.height)},equals:function(t){var n=new B(this).normalize(),e=new B(t).normalize();return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height},inflate:function(t,n){return void 0===t&&(t=0),void 0===n&&(n=t),this.x-=t,this.y-=n,this.width+=2*t,this.height+=2*n,this},intersect:function(t){var n=this.origin(),e=this.corner(),r=t.origin(),i=t.corner();if(i.x<=n.x||i.y<=n.y||r.x>=e.x||r.y>=e.y)return null;var s=j(n.x,r.x),o=j(n.y,r.y);return new B(s,o,z(e.x,i.x)-s,z(e.y,i.y)-o)},intersectionWithLine:function(t){var n,e,r=[this.topLine(),this.rightLine(),this.bottomLine(),this.leftLine()],i=[],s=[],o=r.length;for(e=0;e<o;e++)null!==(n=t.intersect(r[e]))&&s.indexOf(n.toString())<0&&(i.push(n),s.push(n.toString()));return 0<i.length?i:null},intersectionWithLineFromCenterToPoint:function(t,n){t=new L(t);var e,r=new L(this.x+this.width/2,this.y+this.height/2);n&&t.rotate(r,n);for(var i=[this.topLine(),this.rightLine(),this.bottomLine(),this.leftLine()],s=new N(r,t),o=i.length-1;0<=o;--o){var a=i[o].intersection(s);if(null!==a){e=a;break}}return e&&n&&e.rotate(r,-n),e},leftLine:function(){return new N(this.topLeft(),this.bottomLeft())},leftMiddle:function(){return new L(this.x,this.y+this.height/2)},maxRectScaleToFit:function(t,n){var e,r,i,s,o,a,h,u;t=new B(t),n||(n=t.center());var c=n.x,l=n.y;e=r=i=s=o=a=h=u=1/0;var f=t.topLeft();f.x<c&&(e=(this.x-c)/(f.x-c)),f.y<l&&(o=(this.y-l)/(f.y-l));var d=t.bottomRight();d.x>c&&(r=(this.x+this.width-c)/(d.x-c)),d.y>l&&(a=(this.y+this.height-l)/(d.y-l));var g=t.topRight();g.x>c&&(i=(this.x+this.width-c)/(g.x-c)),g.y<l&&(h=(this.y-l)/(g.y-l));var v=t.bottomLeft();return v.x<c&&(s=(this.x-c)/(v.x-c)),v.y>l&&(u=(this.y+this.height-l)/(v.y-l)),{sx:z(e,r,i,s),sy:z(o,a,h,u)}},maxRectUniformScaleToFit:function(t,n){var e=this.maxRectScaleToFit(t,n);return z(e.sx,e.sy)},moveAndExpand:function(t){return this.x+=t.x||0,this.y+=t.y||0,this.width+=t.width||0,this.height+=t.height||0,this},normalize:function(){var t=this.x,n=this.y,e=this.width,r=this.height;return this.width<0&&(t=this.x+this.width,e=-this.width),this.height<0&&(n=this.y+this.height,r=-this.height),this.x=t,this.y=n,this.width=e,this.height=r,this},offset:function(t,n){return L.prototype.offset.call(this,t,n)},origin:function(){return new L(this.x,this.y)},pointNearestToPoint:function(t){if(t=new L(t),this.containsPoint(t))switch(this.sideNearestToPoint(t)){case"right":return new L(this.x+this.width,t.y);case"left":return new L(this.x,t.y);case"bottom":return new L(t.x,this.y+this.height);case"top":return new L(t.x,this.y)}return t.adhereToRect(this)},rightLine:function(){return new N(this.topRight(),this.bottomRight())},rightMiddle:function(){return new L(this.x+this.width,this.y+this.height/2)},round:function(t){var n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=W(10,t)}return this.x=G(this.x*n)/n,this.y=G(this.y*n)/n,this.width=G(this.width*n)/n,this.height=G(this.height*n)/n,this},scale:function(t,n,e){return e=this.origin().scale(t,n,e),this.x=e.x,this.y=e.y,this.width*=t,this.height*=n,this},sideNearestToPoint:function(t){var n=(t=new L(t)).x-this.x,e=this.x+this.width-t.x,r=t.y-this.y,i=n,s="left";return e<i&&(i=e,s="right"),r<i&&(i=r,s="top"),this.y+this.height-t.y<i&&(s="bottom"),s},snapToGrid:function(t,n){var e=this.origin().snapToGrid(t,n),r=this.corner().snapToGrid(t,n);return this.x=e.x,this.y=e.y,this.width=r.x-e.x,this.height=r.y-e.y,this},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},topLine:function(){return new N(this.topLeft(),this.topRight())},topMiddle:function(){return new L(this.x+this.width/2,this.y)},topRight:function(){return new L(this.x+this.width,this.y)},toString:function(){return this.origin().toString()+" "+this.corner().toString()},union:function(t){return B.fromRectUnion(this,t)},update:function(t,n,e,r){return Object(t)===t&&(n=t.y,e=t.width,r=t.height,t=t.x),this.x=t||0,this.y=n||0,this.width=e||0,this.height=r||0,this}},B.prototype.bottomRight=B.prototype.corner,B.prototype.topLeft=B.prototype.origin,B.prototype.translate=B.prototype.offset;var U=B;function H(t){var n=t.trim();if(""===n)return[];for(var e=[],r=n.split(/\b\s*,\s*|,\s*|\s+/),i=r.length,s=0;s<i;s+=2)e.push({x:+r[s],y:+r[s+1]});return e}function Z(t){var n=t.length;if(0===n)return[];for(var e=[],r=0;r<n;r++){var i=t[r].clone();e.push(i)}return e}function Y(t){var n,e,r,i=Math.abs,s=t.length;if(0===s)return[];for(n=0;n<s;n++)void 0===r?r=t[n]:t[n].y<r.y?r=t[n]:t[n].y===r.y&&t[n].x>r.x&&(r=t[n]);var o=[];for(n=0;n<s;n++){var a=r.theta(t[n]);0===a&&(a=360);var h=[t[n],n,a];o.push(h)}if(o.sort(function(t,n){var e=t[2]-n[2];return 0===e&&(e=n[1]-t[1]),e}),2<o.length){var u=o[o.length-1];o.unshift(u)}for(var c,l,f,d,g,v,p,m={},y=[];0!==o.length;)if(l=(c=o.pop())[0],!m.hasOwnProperty(c[0]+"@@"+c[1]))for(var x=!1;!x;)if(y.length<2)y.push(c),x=!0;else{d=(f=y.pop())[0];var w=(v=(g=y.pop())[0]).cross(d,l);if(w<0)y.push(g),y.push(f),y.push(c),x=!0;else if(0===w){var b=d.angleBetween(v,l);i(b-180)<1e-10?(m[f[0]+"@@"+f[1]]=d,y.push(g)):d.equals(l)||v.equals(d)?(m[f[0]+"@@"+f[1]]=d,y.push(g)):i((b+1)%360-1)<1e-10&&(y.push(g),o.push(f))}else m[f[0]+"@@"+f[1]]=d,y.push(g)}2<y.length&&y.pop();var S=-1;for(e=y.length,n=0;n<e;n++){var P=y[n][1];(void 0===p||P<p)&&(p=P,S=n)}var A=[];if(0<S){var T=y.slice(S),L=y.slice(0,S);A=T.concat(L)}else A=y;var E=[];for(e=A.length,n=0;n<e;n++)E.push(A[n][0]);return E}var X=function(t){return this instanceof X?"string"==typeof t?new X.parse(t):void(this.points=Array.isArray(t)?t.map(L):[]):new X(t)};X.parse=function(t){return new X(H(t))},X.fromRect=function(t){return new X([t.topLeft(),t.topRight(),t.bottomRight(),t.bottomLeft(),t.topLeft()])},X.prototype={type:v.Polyline,bbox:function(){var t=1/0,n=-1/0,e=1/0,r=-1/0,i=this.points,s=i.length;if(0===s)return null;for(var o=0;o<s;o++){var a=i[o],h=a.x,u=a.y;h<t&&(t=h),n<h&&(n=h),u<e&&(e=u),r<u&&(r=u)}return new B(t,e,n-t,r-e)},clone:function(){return new X(Z(this.points))},closestPoint:function(t){var n=this.closestPointLength(t);return this.pointAtLength(n)},closestPointLength:function(t){var n,e=this.lengthPoints(),r=e.length;if(0===r)return 0;if(1===r)return 0;for(var i=1/0,s=0,o=r-1,a=0;a<o;a++){var h=new N(e[a],e[a+1]),u=h.length(),c=h.closestPointNormalizedLength(t),l=h.pointAt(c).squaredDistance(t);l<i&&(i=l,n=s+c*u),s+=u}return n},closestPointNormalizedLength:function(t){var n=this.closestPointLength(t);if(0===n)return 0;var e=this.length();return 0===e?0:n/e},closestPointTangent:function(t){var n=this.closestPointLength(t);return this.tangentAtLength(n)},containsPoint:function(t){var n=this.points,e=n.length;if(0===e)return!1;for(var r=t.x,i=t.y,s=e-1,o=0,a=0,h=new N,u=new N,c=new L;o<e;o++){var l=n[s],f=n[o];if(t.equals(l))return!0;if(h.start=l,h.end=f,h.containsPoint(t))return!0;if(i<=l.y&&i>f.y||i>l.y&&i<=f.y){var d=l.x-r>f.x-r?l.x-r:f.x-r;0<=d&&(c.x=r+d,c.y=i,u.start=t,u.end=c,h.intersect(u)&&a++)}s=o}return a%2==1},close:function(){var t=this.start,n=this.end,e=this.points;return t&&n&&!t.equals(n)&&e.push(t.clone()),this},lengthPoints:function(){return this.points},convexHull:function(){return new X(Y(this.points))},equals:function(t){if(!t)return!1;var n=this.points,e=t.points,r=n.length;if(e.length!==r)return!1;for(var i=0;i<r;i++){var s=n[i],o=t.points[i];if(!s.equals(o))return!1}return!0},intersectionWithLine:function(t){for(var n=new N(t),e=[],r=this.lengthPoints(),i=new N,s=0,o=r.length-1;s<o;s++){i.start=r[s],i.end=r[s+1];var a=n.intersectionWithLine(i);a&&e.push(a[0])}return 0<e.length?e:null},isDifferentiable:function(){var t=this.points,n=t.length;if(0===n)return!1;for(var e=new N,r=n-1,i=0;i<r;i++)if(e.start=t[i],e.end=t[i+1],e.isDifferentiable())return!0;return!1},length:function(){var t=this.lengthPoints(),n=t.length;if(0===n)return 0;for(var e=0,r=n-1,i=0;i<r;i++)e+=t[i].distance(t[i+1]);return e},pointAt:function(t){var n=this.lengthPoints(),e=n.length;if(0===e)return null;if(1===e)return n[0].clone();if(t<=0)return n[0].clone();if(1<=t)return n[e-1].clone();var r=this.length()*t;return this.pointAtLength(r)},pointAtLength:function(t){var n=this.lengthPoints(),e=n.length;if(0===e)return null;if(1===e)return n[0].clone();var r=!0;t<0&&(r=!1,t=-t);for(var i=0,s=e-1,o=0;o<s;o++){var a=r?o:s-1-o,h=n[a],u=n[a+1],c=new N(h,u),l=h.distance(u);if(t<=i+l)return c.pointAtLength((r?1:-1)*(t-i));i+=l}return(r?n[e-1]:n[0]).clone()},round:function(t){for(var n=this.points,e=n.length,r=0;r<e;r++)n[r].round(t);return this},scale:function(t,n,e){for(var r=this.points,i=r.length,s=0;s<i;s++)r[s].scale(t,n,e);return this},simplify:function(t){void 0===t&&(t={});var n=this.points;if(n.length<3)return this;for(var e=t.threshold||1e-10,r=0;n[r+2];){var i=r+1,s=r+2,o=n[r],a=n[i],h=n[s];new N(o,h).closestPoint(a).distance(a)<=e?n.splice(i,1):r+=1}return this},tangentAt:function(t){var n=this.lengthPoints().length;if(0===n)return null;if(1===n)return null;t<0&&(t=0),1<t&&(t=1);var e=this.length()*t;return this.tangentAtLength(e)},tangentAtLength:function(t){var n=this.lengthPoints(),e=n.length;if(0===e)return null;if(1===e)return null;var r,i=!0;t<0&&(i=!1,t=-t);for(var s=0,o=e-1,a=0;a<o;a++){var h=i?a:o-1-a,u=n[h],c=n[h+1],l=new N(u,c),f=u.distance(c);if(l.isDifferentiable()){if(t<=s+f)return l.tangentAtLength((i?1:-1)*(t-s));r=l}s+=f}if(r){var d=i?1:0;return r.tangentAt(d)}return null},toString:function(){return this.points+""},translate:function(t,n){for(var e=this.points,r=e.length,i=0;i<r;i++)e[i].translate(t,n);return this},serialize:function(){var t=this.points,n=t.length;if(0===n)return"";for(var e="",r=0;r<n;r++){var i=t[r];e+=i.x+","+i.y+" "}return e.trim()}},Object.defineProperty(X.prototype,"start",{configurable:!0,enumerable:!0,get:function(){return 0===this.points.length?null:this.points[0]}}),Object.defineProperty(X.prototype,"end",{configurable:!0,enumerable:!0,get:function(){var t=this.points.length;return 0===t?null:this.points[t-1]}});var J=Math.abs,K=Math.sqrt,Q=Math.min,$=Math.max,_=Math.pow,tt=function(t,n,e,r){return this instanceof tt?t instanceof tt?new tt(t.start,t.controlPoint1,t.controlPoint2,t.end):(this.start=new L(t),this.controlPoint1=new L(n),this.controlPoint2=new L(e),void(this.end=new L(r))):new tt(t,n,e,r)};function nt(t){var n,e,r=arguments,i=[];for(e=arguments.length,n=1;n<e;n++)i.push(r[n]);if(!t)throw new Error("Missing a parent object.");var s=Object.create(t);for(e=i.length,n=0;n<e;n++){var o,a,h=i[n];for(a in h)h.hasOwnProperty(a)&&(delete s[a],o=Object.getOwnPropertyDescriptor(h,a),Object.defineProperty(s,a,o))}return s}tt.throughPoints=function(){function h(t){var n=t.length,e=[],r=[],i=2;e[0]=t[0]/i;for(var s=1;s<n;s++)r[s]=1/i,i=(s<n-1?4:3.5)-r[s],e[s]=(t[s]-e[s-1])/i;for(s=1;s<n;s++)e[n-s-1]-=r[n-s]*e[n-s];return e}return function(t){if(!t||Array.isArray(t)&&t.length<2)throw new Error("At least 2 points are required");for(var n=function(t){var n,e=[],r=[],i=t.length-1;if(1==i)return e[0]=new L((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),r[0]=new L(2*e[0].x-t[0].x,2*e[0].y-t[0].y),[e,r];var s=[];for(n=1;n<i-1;n++)s[n]=4*t[n].x+2*t[n+1].x;s[0]=t[0].x+2*t[1].x,s[i-1]=(8*t[i-1].x+t[i].x)/2;var o=h(s);for(n=1;n<i-1;++n)s[n]=4*t[n].y+2*t[n+1].y;s[0]=t[0].y+2*t[1].y,s[i-1]=(8*t[i-1].y+t[i].y)/2;var a=h(s);for(n=0;n<i;n++)e.push(new L(o[n],a[n])),n<i-1?r.push(new L(2*t[n+1].x-o[n+1],2*t[n+1].y-a[n+1])):r.push(new L((t[i].x+o[i-1])/2,(t[i].y+a[i-1])/2));return[e,r]}(t),e=[],r=n[0].length,i=0;i<r;i++){var s=new L(n[0][i].x,n[0][i].y),o=new L(n[1][i].x,n[1][i].y);e.push(new tt(t[i],s,o,t[i+1]))}return e}}(),tt.prototype={type:v.Curve,bbox:function(){for(var t,n,e,r,i,s,o,a,h=this.start,u=this.controlPoint1,c=this.controlPoint2,l=this.end,f=h.x,d=h.y,g=u.x,v=u.y,p=c.x,m=c.y,y=l.x,x=l.y,w=new Array,b=new Array,S=[new Array,new Array],P=0;P<2;++P)if(e=0===P?(n=6*f-12*g+6*p,t=-3*f+9*g-9*p+3*y,3*g-3*f):(n=6*d-12*v+6*m,t=-3*d+9*v-9*m+3*x,3*v-3*d),J(t)<1e-12){if(J(n)<1e-12)continue;0<(r=-e/n)&&r<1&&b.push(r)}else a=K(o=n*n-4*e*t),o<0||(0<(i=(-n+a)/(2*t))&&i<1&&b.push(i),0<(s=(-n-a)/(2*t))&&s<1&&b.push(s));for(var A,T,L,E=b.length,C=E;E--;)T=(A=1-(r=b[E]))*A*A*f+3*A*A*r*g+3*A*r*r*p+r*r*r*y,S[0][E]=T,L=A*A*A*d+3*A*A*r*v+3*A*r*r*m+r*r*r*x,S[1][E]=L,w[E]={X:T,Y:L};b[C]=0,b[C+1]=1,w[C]={X:f,Y:d},w[C+1]={X:y,Y:x},S[0][C]=f,S[1][C]=d,S[0][C+1]=y,S[1][C+1]=x,b.length=C+2,S[0].length=C+2,S[1].length=C+2,w.length=C+2;var N=Q.apply(null,S[0]),I=Q.apply(null,S[1]),M=$.apply(null,S[0]),R=$.apply(null,S[1]);return new B(N,I,M-N,R-I)},clone:function(){return new tt(this.start,this.controlPoint1,this.controlPoint2,this.end)},closestPoint:function(t,n){return this.pointAtT(this.closestPointT(t,n))},closestPointLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions};return this.lengthAtT(this.closestPointT(t,r),r)},closestPointNormalizedLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions},i=this.closestPointLength(t,r);if(!i)return 0;var s=this.length(r);return 0===s?0:i/s},closestPointT:function(t,n){for(var e,r,i,s,o,a,h,u=void 0===(n=n||{}).precision?this.PRECISION:n.precision,c=void 0===n.subdivisions?this.getSubdivisions({precision:u}):n.subdivisions,l=c.length,f=l?1/l:0,d=0;d<l;d++){var g=c[d],v=g.start.distance(t),p=g.end.distance(t),m=v+p;(!h||m<h)&&(r=d*f,i=(d+1)*f,s=v,o=p,a=(e=g).start.distance(g.end),h=m)}for(var y=_(10,-u);;){var x=s?J(s-o)/s:0,w=o?J(s-o)/o:0;if(x<y||w<y||(!s||s<a*y||(!o||o<a*y)))return s<=o?r:i;var b=e.divide(.5);f/=2;var S=b[0].start.distance(t),P=b[0].end.distance(t),A=S+P,T=b[1].start.distance(t),L=b[1].end.distance(t);o=A<=T+L?(e=b[0],i-=f,s=S,P):(e=b[1],r+=f,s=T,L)}},closestPointTangent:function(t,n){return this.tangentAtT(this.closestPointT(t,n))},containsPoint:function(t,n){return this.toPolyline(n).containsPoint(t)},divideAt:function(t,n){if(t<=0)return this.divideAtT(0);if(1<=t)return this.divideAtT(1);var e=this.tAt(t,n);return this.divideAtT(e)},divideAtLength:function(t,n){var e=this.tAtLength(t,n);return this.divideAtT(e)},divideAtT:function(t){var n=this.start,e=this.controlPoint1,r=this.controlPoint2,i=this.end;if(t<=0)return[new tt(n,n,n,n),new tt(n,e,r,i)];if(1<=t)return[new tt(n,e,r,i),new tt(i,i,i,i)];var s=this.getSkeletonPoints(t),o=s.startControlPoint1,a=s.startControlPoint2,h=s.divider,u=s.dividerControlPoint1,c=s.dividerControlPoint2;return[new tt(n,o,a,h),new tt(h,u,c,i)]},endpointDistance:function(){return this.start.distance(this.end)},equals:function(t){return!!t&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.controlPoint1.x===t.controlPoint1.x&&this.controlPoint1.y===t.controlPoint1.y&&this.controlPoint2.x===t.controlPoint2.x&&this.controlPoint2.y===t.controlPoint2.y&&this.end.x===t.end.x&&this.end.y===t.end.y},getSkeletonPoints:function(t){var n=this.start,e=this.controlPoint1,r=this.controlPoint2,i=this.end;if(t<=0)return{startControlPoint1:n.clone(),startControlPoint2:n.clone(),divider:n.clone(),dividerControlPoint1:e.clone(),dividerControlPoint2:r.clone()};if(1<=t)return{startControlPoint1:e.clone(),startControlPoint2:r.clone(),divider:i.clone(),dividerControlPoint1:i.clone(),dividerControlPoint2:i.clone()};var s=new N(n,e).pointAt(t),o=new N(e,r).pointAt(t),a=new N(r,i).pointAt(t),h=new N(s,o).pointAt(t),u=new N(o,a).pointAt(t);return{startControlPoint1:s,startControlPoint2:h,divider:new N(h,u).pointAt(t),dividerControlPoint1:u,dividerControlPoint2:a}},getSubdivisions:function(t){var n=void 0===(t=t||{}).precision?this.PRECISION:t.precision,e=this.start,r=this.controlPoint1,i=this.controlPoint2,s=this.end,o=[new tt(e,r,i,s)];if(0===n)return o;if(!this.isDifferentiable())return o;var a=this.endpointDistance(),h=_(10,-n),u=2;0===r.cross(e,s)&&0===i.cross(e,s)&&(u=2*n);for(var c=0;;){c+=1;for(var l=[],f=o.length,d=0;d<f;d++){var g=o[d].divide(.5);l.push(g[0],g[1])}for(var v=0,p=l.length,m=0;m<p;m++){v+=l[m].endpointDistance()}if(u<=c)if((0!==v?(v-a)/v:0)<h)return l;o=l,a=v}},isDifferentiable:function(){var t=this.start,n=this.controlPoint1,e=this.controlPoint2,r=this.end;return!(t.equals(n)&&n.equals(e)&&e.equals(r))},length:function(t){for(var n=void 0===(t=t||{}).precision?this.PRECISION:t.precision,e=void 0===t.subdivisions?this.getSubdivisions({precision:n}):t.subdivisions,r=0,i=e.length,s=0;s<i;s++){r+=e[s].endpointDistance()}return r},lengthAtT:function(t,n){if(t<=0)return 0;var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision;return this.divide(t)[0].length({precision:e})},pointAt:function(t,n){if(t<=0)return this.start.clone();if(1<=t)return this.end.clone();var e=this.tAt(t,n);return this.pointAtT(e)},pointAtLength:function(t,n){var e=this.tAtLength(t,n);return this.pointAtT(e)},pointAtT:function(t){return t<=0?this.start.clone():1<=t?this.end.clone():this.getSkeletonPoints(t).divider},PRECISION:3,round:function(t){return this.start.round(t),this.controlPoint1.round(t),this.controlPoint2.round(t),this.end.round(t),this},scale:function(t,n,e){return this.start.scale(t,n,e),this.controlPoint1.scale(t,n,e),this.controlPoint2.scale(t,n,e),this.end.scale(t,n,e),this},tangentAt:function(t,n){if(!this.isDifferentiable())return null;t<0?t=0:1<t&&(t=1);var e=this.tAt(t,n);return this.tangentAtT(e)},tangentAtLength:function(t,n){if(!this.isDifferentiable())return null;var e=this.tAtLength(t,n);return this.tangentAtT(e)},tangentAtT:function(t){if(!this.isDifferentiable())return null;t<0?t=0:1<t&&(t=1);var n=this.getSkeletonPoints(t),e=n.startControlPoint2,r=n.dividerControlPoint1,i=n.divider,s=new N(e,r);return s.translate(i.x-e.x,i.y-e.y),s},tAt:function(t,n){if(t<=0)return 0;if(1<=t)return 1;var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions},i=this.length(r)*t;return this.tAtLength(i,r)},tAtLength:function(t,n){var e=!0;t<0&&(e=!1,t=-t);for(var r,i,s,o,a,h=void 0===(n=n||{}).precision?this.PRECISION:n.precision,u=void 0===n.subdivisions?this.getSubdivisions({precision:h}):n.subdivisions,c={precision:h,subdivisions:u},l=0,f=u.length,d=1/f,g=0;g<f;g++){var v=e?g:f-1-g,p=u[g],m=p.endpointDistance();if(t<=l+m){r=p,i=v*d,s=(v+1)*d,o=e?t-l:m+l-t,a=e?m+l-t:t-l;break}l+=m}if(!r)return e?1:0;for(var y=this.length(c),x=_(10,-h);;){var w,b;if((0!==y?o/y:0)<x)return i;if((0!==y?a/y:0)<x)return s;var S=r.divide(.5);d/=2;var P=S[0].endpointDistance(),A=S[1].endpointDistance();b=o<=P?(r=S[0],s-=d,P-(w=o)):(r=S[1],i+=d,A-(w=o-P)),o=w,a=b}},toPoints:function(t){for(var n=void 0===(t=t||{}).precision?this.PRECISION:t.precision,e=void 0===t.subdivisions?this.getSubdivisions({precision:n}):t.subdivisions,r=[e[0].start.clone()],i=e.length,s=0;s<i;s++){var o=e[s];r.push(o.end.clone())}return r},toPolyline:function(t){return new X(this.toPoints(t))},toString:function(){return this.start+" "+this.controlPoint1+" "+this.controlPoint2+" "+this.end},translate:function(t,n){return this.start.translate(t,n),this.controlPoint1.translate(t,n),this.controlPoint2.translate(t,n),this.end.translate(t,n),this}},tt.prototype.divide=tt.prototype.divideAtT;var et=function(t){if(!(this instanceof et))return new et(t);if("string"==typeof t)return new et.parse(t);var n,e;if(this.segments=[],t)if(Array.isArray(t)&&0!==t.length)if(e=(t=t.reduce(function(t,n){return t.concat(n)},[])).length,t[0].isSegment)for(n=0;n<e;n++){var r=t[n];this.appendSegment(r)}else{var i=null;for(n=0;n<e;n++){var s=t[n];if(!(s instanceof N||s instanceof tt))throw new Error("Cannot construct a path segment from the provided object.");0===n&&this.appendSegment(et.createSegment("M",s.start)),i&&!i.end.equals(s.start)&&this.appendSegment(et.createSegment("M",s.start)),s instanceof N?this.appendSegment(et.createSegment("L",s.end)):s instanceof tt&&this.appendSegment(et.createSegment("C",s.controlPoint1,s.controlPoint2,s.end)),i=s}}else if(t.isSegment)this.appendSegment(t);else if(t instanceof N)this.appendSegment(et.createSegment("M",t.start)),this.appendSegment(et.createSegment("L",t.end));else if(t instanceof tt)this.appendSegment(et.createSegment("M",t.start)),this.appendSegment(et.createSegment("C",t.controlPoint1,t.controlPoint2,t.end));else{if(!(t instanceof X))throw new Error("Cannot construct a path from the provided object.");if(!t.points||0===t.points.length)return;for(e=t.points.length,n=0;n<e;n++){var o=t.points[n];0===n?this.appendSegment(et.createSegment("M",o)):this.appendSegment(et.createSegment("L",o))}}else;};function rt(t,n){return n.unshift(null),new(Function.prototype.bind.apply(t,n))}et.parse=function(t){if(!t)return new et;for(var n=new et,e=t.match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g),r=e.length,i=0;i<r;i++){var s=e[i].match(/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g),o=et.createSegment.apply(this,s);n.appendSegment(o)}return n},et.createSegment=function(t){var n=arguments;if(!t)throw new Error("Type must be provided.");var e=et.segmentTypes[t];if(!e)throw new Error(t+" is not a recognized path segment type.");for(var r=[],i=arguments.length,s=1;s<i;s++)r.push(n[s]);return rt(e,r)},et.prototype={type:v.Path,appendSegment:function(t){var n,e=this.segments,r=e.length,i=0!==r?e[r-1]:null;if(Array.isArray(t)){if(!(t=t.reduce(function(t,n){return t.concat(n)},[]))[0].isSegment)throw new Error("Segments required.");for(var s=t.length,o=0;o<s;o++){var a=t[o];n=this.prepareSegment(a,i,null),e.push(n),i=n}}else{if(!t||!t.isSegment)throw new Error("Segment required.");n=this.prepareSegment(t,i,null),e.push(n)}},bbox:function(){var t,n=this.segments,e=n.length;if(0===e)return null;for(var r=0;r<e;r++){var i=n[r];if(i.isVisible){var s=i.bbox();t=t?t.union(s):s}}if(t)return t;var o=n[e-1];return new B(o.end.x,o.end.y,0,0)},clone:function(){for(var t=this.segments,n=t.length,e=new et,r=0;r<n;r++){var i=t[r].clone();e.appendSegment(i)}return e},closestPoint:function(t,n){var e=this.closestPointT(t,n);return e?this.pointAtT(e):null},closestPointLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},i=this.closestPointT(t,r);return i?this.lengthAtT(i,r):0},closestPointNormalizedLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},i=this.closestPointLength(t,r);if(0===i)return 0;var s=this.length(r);return 0===s?0:i/s},closestPointT:function(t,n){var e=this.segments,r=e.length;if(0===r)return null;for(var i,s=void 0===(n=n||{}).precision?this.PRECISION:n.precision,o=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):n.segmentSubdivisions,a=1/0,h=0;h<r;h++){var u=e[h],c=o[h];if(u.isVisible){var l=u.closestPointT(t,{precision:s,subdivisions:c}),f=u.pointAtT(l),d=new N(f,t).squaredLength();d<a&&(i={segmentIndex:h,value:l},a=d)}}return i||{segmentIndex:r-1,value:1}},closestPointTangent:function(t,n){var e=this.segments,r=e.length;if(0===r)return null;for(var i,s=void 0===(n=n||{}).precision?this.PRECISION:n.precision,o=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):n.segmentSubdivisions,a=1/0,h=0;h<r;h++){var u=e[h],c=o[h];if(u.isDifferentiable()){var l=u.closestPointT(t,{precision:s,subdivisions:c}),f=u.pointAtT(l),d=new N(f,t).squaredLength();d<a&&(i=u.tangentAtT(l),a=d)}}return i||null},containsPoint:function(t,n){var e=this.toPolylines(n);if(!e)return!1;for(var r=e.length,i=0,s=0;s<r;s++){e[s].containsPoint(t)&&i++}return i%2==1},divideAt:function(t,n){if(0===this.segments.length)return null;t<0&&(t=0),1<t&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},i=this.length(r)*t;return this.divideAtLength(i,r)},divideAtLength:function(t,n){var e=this.segments.length;if(0===e)return null;var r=!0;t<0&&(r=!1,t=-t);var i,s,o,a,h,u,c,l=void 0===(n=n||{}).precision?this.PRECISION:n.precision,f=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:l}):n.segmentSubdivisions,d=0;for(i=0;i<e;i++){var g=r?i:e-1-i;s=this.getSegment(g);var v=f[g],p=s.length({precision:l,subdivisions:v});if(s.isDifferentiable()&&(h=s,u=g,t<=d+p)){a=g,o=s.divideAtLength((r?1:-1)*(t-d),{precision:l,subdivisions:v});break}d+=p}if(!h)return null;o||(a=u,c=r?1:0,o=h.divideAtT(c));var m=this.clone();m.replaceSegment(a,o);var y=a,x=a+1,w=a+2;o[0].isDifferentiable()||(m.removeSegment(y),x-=1,w-=1);var b=m.getSegment(x).start;m.insertSegment(x,et.createSegment("M",b)),w+=1,o[1].isDifferentiable()||(m.removeSegment(w-1),w-=1);var S=w-y-1;for(i=w;i<m.segments.length;i++){var P=this.getSegment(i-S);if("Z"===(s=m.getSegment(i)).type&&!P.subpathStartSegment.end.equals(s.subpathStartSegment.end)){var A=et.createSegment("L",P.end);m.replaceSegment(i,A)}}return[new et(m.segments.slice(0,x)),new et(m.segments.slice(x))]},equals:function(t){if(!t)return!1;var n=this.segments,e=t.segments,r=n.length;if(e.length!==r)return!1;for(var i=0;i<r;i++){var s=n[i],o=e[i];if(s.type!==o.type||!s.equals(o))return!1}return!0},getSegment:function(t){var n=this.segments,e=n.length;if(0===e)throw new Error("Path has no segments.");if(t<0&&(t=e+t),e<=t||t<0)throw new Error("Index out of range.");return n[t]},getSegmentSubdivisions:function(t){for(var n=this.segments,e=n.length,r=void 0===(t=t||{}).precision?this.PRECISION:t.precision,i=[],s=0;s<e;s++){var o=n[s].getSubdivisions({precision:r});i.push(o)}return i},getSubpaths:function(){for(var t=this.clone().validate().segments,n=t.length,e=[],r=0;r<n;r++){var i=t[r];i.isSubpathStart?e.push(new et(i)):e[e.length-1].appendSegment(i)}return e},insertSegment:function(t,n){var e,r=this.segments,i=r.length;if(t<0&&(t=i+t+1),i<t||t<0)throw new Error("Index out of range.");var s=null,o=null;if(0!==i&&(o=1<=t?(s=r[t-1]).nextSegment:r[0]),Array.isArray(n)){if(!(n=n.reduce(function(t,n){return t.concat(n)},[]))[0].isSegment)throw new Error("Segments required.");for(var a=n.length,h=0;h<a;h++){var u=n[h];e=this.prepareSegment(u,s,o),r.splice(t+h,0,e),s=e}}else{if(!n||!n.isSegment)throw new Error("Segment required.");e=this.prepareSegment(n,s,o),r.splice(t,0,e)}},intersectionWithLine:function(t,n){var e=null,r=this.toPolylines(n);if(!r)return null;for(var i=0,s=r.length;i<s;i++){var o=r[i],a=t.intersect(o);a&&(e||(e=[]),Array.isArray(a)?Array.prototype.push.apply(e,a):e.push(a))}return e},isDifferentiable:function(){for(var t=this.segments,n=t.length,e=0;e<n;e++){if(t[e].isDifferentiable())return!0}return!1},isValid:function(){var t=this.segments;return 0===t.length||"M"===t[0].type},length:function(t){var n=this.segments,e=n.length;if(0===e)return 0;for(var r=void 0===(t=t||{}).precision?this.PRECISION:t.precision,i=void 0===t.segmentSubdivisions?this.getSegmentSubdivisions({precision:r}):t.segmentSubdivisions,s=0,o=0;o<e;o++){var a=n[o],h=i[o];s+=a.length({subdivisions:h})}return s},lengthAtT:function(t,n){var e=this.segments,r=e.length;if(0===r)return 0;var i=t.segmentIndex;if(i<0)return 0;var s=t.value;r<=i?(i=r-1,s=1):s<0?s=0:1<s&&(s=1);for(var o,a=void 0===(n=n||{}).precision?this.PRECISION:n.precision,h=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:a}):n.segmentSubdivisions,u=0,c=0;c<i;c++){var l=e[c];o=h[c],u+=l.length({precisison:a,subdivisions:o})}return l=e[i],o=h[i],u+=l.lengthAtT(s,{precisison:a,subdivisions:o})},pointAt:function(t,n){if(0===this.segments.length)return null;if(t<=0)return this.start.clone();if(1<=t)return this.end.clone();var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},i=this.length(r)*t;return this.pointAtLength(i,r)},pointAtLength:function(t,n){var e=this.segments,r=e.length;if(0===r)return null;if(0===t)return this.start.clone();var i=!0;t<0&&(i=!1,t=-t);for(var s,o=void 0===(n=n||{}).precision?this.PRECISION:n.precision,a=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:o}):n.segmentSubdivisions,h=0,u=0;u<r;u++){var c=i?u:r-1-u,l=e[c],f=a[c],d=l.length({precision:o,subdivisions:f});if(l.isVisible){if(t<=h+d)return l.pointAtLength((i?1:-1)*(t-h),{precision:o,subdivisions:f});s=l}h+=d}return s?i?s.end:s.start:e[r-1].end.clone()},pointAtT:function(t){var n=this.segments,e=n.length;if(0===e)return null;var r=t.segmentIndex;if(r<0)return n[0].pointAtT(0);if(e<=r)return n[e-1].pointAtT(1);var i=t.value;return i<0?i=0:1<i&&(i=1),n[r].pointAtT(i)},PRECISION:3,prepareSegment:function(t,n,e){t.previousSegment=n,t.nextSegment=e,n&&(n.nextSegment=t),e&&(e.previousSegment=t);var r=t;return t.isSubpathStart&&(t.subpathStartSegment=t,r=e),r&&this.updateSubpathStartSegment(r),t},removeSegment:function(t){var n=this.segments,e=n.length;if(0===e)throw new Error("Path has no segments.");if(t<0&&(t=e+t),e<=t||t<0)throw new Error("Index out of range.");var r=n.splice(t,1)[0],i=r.previousSegment,s=r.nextSegment;i&&(i.nextSegment=s),s&&(s.previousSegment=i),r.isSubpathStart&&s&&this.updateSubpathStartSegment(s)},replaceSegment:function(t,n){var e,r=this.segments,i=r.length;if(0===i)throw new Error("Path has no segments.");if(t<0&&(t=i+t),i<=t||t<0)throw new Error("Index out of range.");var s=r[t],o=s.previousSegment,a=s.nextSegment,h=s.isSubpathStart;if(Array.isArray(n)){if(!(n=n.reduce(function(t,n){return t.concat(n)},[]))[0].isSegment)throw new Error("Segments required.");r.splice(t,1);for(var u=n.length,c=0;c<u;c++){var l=n[c];e=this.prepareSegment(l,o,a),r.splice(t+c,0,e),o=e,h&&e.isSubpathStart&&(h=!1)}}else{if(!n||!n.isSegment)throw new Error("Segment required.");e=this.prepareSegment(n,o,a),r.splice(t,1,e),h&&e.isSubpathStart&&(h=!1)}h&&a&&this.updateSubpathStartSegment(a)},round:function(t){for(var n=this.segments,e=n.length,r=0;r<e;r++){n[r].round(t)}return this},scale:function(t,n,e){for(var r=this.segments,i=r.length,s=0;s<i;s++){r[s].scale(t,n,e)}return this},segmentAt:function(t,n){var e=this.segmentIndexAt(t,n);return e?this.getSegment(e):null},segmentAtLength:function(t,n){var e=this.segmentIndexAtLength(t,n);return e?this.getSegment(e):null},segmentIndexAt:function(t,n){if(0===this.segments.length)return null;t<0&&(t=0),1<t&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},i=this.length(r)*t;return this.segmentIndexAtLength(i,r)},segmentIndexAtLength:function(t,n){var e=this.segments,r=e.length;if(0===r)return null;var i=!0;t<0&&(i=!1,t=-t);for(var s=void 0===(n=n||{}).precision?this.PRECISION:n.precision,o=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):n.segmentSubdivisions,a=null,h=0,u=0;u<r;u++){var c=i?u:r-1-u,l=e[c],f=o[c],d=l.length({precision:s,subdivisions:f});if(l.isVisible){if(t<=h+d)return c;a=c}h+=d}return a},serialize:function(){if(!this.isValid())throw new Error("Invalid path segments.");return this.toString()},tangentAt:function(t,n){if(0===this.segments.length)return null;t<0&&(t=0),1<t&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,r={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},i=this.length(r)*t;return this.tangentAtLength(i,r)},tangentAtLength:function(t,n){var e=this.segments,r=e.length;if(0===r)return null;var i=!0;t<0&&(i=!1,t=-t);for(var s,o=void 0===(n=n||{}).precision?this.PRECISION:n.precision,a=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:o}):n.segmentSubdivisions,h=0,u=0;u<r;u++){var c=i?u:r-1-u,l=e[c],f=a[c],d=l.length({precision:o,subdivisions:f});if(l.isDifferentiable()){if(t<=h+d)return l.tangentAtLength((i?1:-1)*(t-h),{precision:o,subdivisions:f});s=l}h+=d}if(s){var g=i?1:0;return s.tangentAtT(g)}return null},tangentAtT:function(t){var n=this.segments,e=n.length;if(0===e)return null;var r=t.segmentIndex;if(r<0)return n[0].tangentAtT(0);if(e<=r)return n[e-1].tangentAtT(1);var i=t.value;return i<0?i=0:1<i&&(i=1),n[r].tangentAtT(i)},toPoints:function(t){var n=this.segments,e=n.length;if(0===e)return null;for(var r=void 0===(t=t||{}).precision?this.PRECISION:t.precision,i=void 0===t.segmentSubdivisions?this.getSegmentSubdivisions({precision:r}):t.segmentSubdivisions,s=[],o=[],a=0;a<e;a++){var h=n[a];if(h.isVisible){var u=i[a];if(0<u.length){var c=u.map(function(t){return t.start});Array.prototype.push.apply(o,c)}else o.push(h.start)}else 0<o.length&&(o.push(n[a-1].end),s.push(o),o=[])}return 0<o.length&&(o.push(this.end),s.push(o)),s},toPolylines:function(t){var n=[],e=this.toPoints(t);if(!e)return null;for(var r=0,i=e.length;r<i;r++)n.push(new X(e[r]));return n},toString:function(){for(var t=this.segments,n=t.length,e="",r=0;r<n;r++){e+=t[r].serialize()+" "}return e.trim()},translate:function(t,n){for(var e=this.segments,r=e.length,i=0;i<r;i++){e[i].translate(t,n)}return this},updateSubpathStartSegment:function(t){for(var n=t.previousSegment;t&&!t.isSubpathStart;)t.subpathStartSegment=n?n.subpathStartSegment:null,t=(n=t).nextSegment},validate:function(){return this.isValid()||this.insertSegment(0,et.createSegment("M",0,0)),this}},Object.defineProperty(et.prototype,"start",{configurable:!0,enumerable:!0,get:function(){var t=this.segments,n=t.length;if(0===n)return null;for(var e=0;e<n;e++){var r=t[e];if(r.isVisible)return r.start}return t[n-1].end}}),Object.defineProperty(et.prototype,"end",{configurable:!0,enumerable:!0,get:function(){var t=this.segments,n=t.length;if(0===n)return null;for(var e=n-1;0<=e;e--){var r=t[e];if(r.isVisible)return r.end}return t[n-1].end}});var it={bbox:function(){throw new Error("Declaration missing for virtual function.")},clone:function(){throw new Error("Declaration missing for virtual function.")},closestPoint:function(){throw new Error("Declaration missing for virtual function.")},closestPointLength:function(){throw new Error("Declaration missing for virtual function.")},closestPointNormalizedLength:function(){throw new Error("Declaration missing for virtual function.")},closestPointT:function(t){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(t);throw new Error("Neither closestPointT() nor closestPointNormalizedLength() function is implemented.")},closestPointTangent:function(){throw new Error("Declaration missing for virtual function.")},divideAt:function(){throw new Error("Declaration missing for virtual function.")},divideAtLength:function(){throw new Error("Declaration missing for virtual function.")},divideAtT:function(t){if(this.divideAt)return this.divideAt(t);throw new Error("Neither divideAtT() nor divideAt() function is implemented.")},equals:function(){throw new Error("Declaration missing for virtual function.")},getSubdivisions:function(){throw new Error("Declaration missing for virtual function.")},isDifferentiable:function(){throw new Error("Declaration missing for virtual function.")},isSegment:!0,isSubpathStart:!1,isVisible:!0,length:function(){throw new Error("Declaration missing for virtual function.")},lengthAtT:function(t){if(t<=0)return 0;var n=this.length();return 1<=t?n:n*t},nextSegment:null,pointAt:function(){throw new Error("Declaration missing for virtual function.")},pointAtLength:function(){throw new Error("Declaration missing for virtual function.")},pointAtT:function(t){if(this.pointAt)return this.pointAt(t);throw new Error("Neither pointAtT() nor pointAt() function is implemented.")},previousSegment:null,round:function(){throw new Error("Declaration missing for virtual function.")},subpathStartSegment:null,scale:function(){throw new Error("Declaration missing for virtual function.")},serialize:function(){throw new Error("Declaration missing for virtual function.")},tangentAt:function(){throw new Error("Declaration missing for virtual function.")},tangentAtLength:function(){throw new Error("Declaration missing for virtual function.")},tangentAtT:function(t){if(this.tangentAt)return this.tangentAt(t);throw new Error("Neither tangentAtT() nor tangentAt() function is implemented.")},toString:function(){throw new Error("Declaration missing for virtual function.")},translate:function(){throw new Error("Declaration missing for virtual function.")}};Object.defineProperty(it,"end",{configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(it,"start",{configurable:!0,enumerable:!0,get:function(){if(!this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path; OR segment has not yet been added to a path.)");return this.previousSegment.end}}),Object.defineProperty(it,"type",{configurable:!0,enumerable:!0,get:function(){throw new Error("Bad segment declaration. No type specified.")}});var st=function(){for(var t,n,e=arguments,r=[],i=arguments.length,s=0;s<i;s++)r.push(e[s]);if(!(this instanceof st))return rt(st,r);if(0===i)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates (none provided).");if(r[0]instanceof N){if(1===i)return this.end=r[0].end.clone(),this;throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+i+" lines provided).")}if("string"==typeof r[0]||"number"==typeof r[0]){if(2===i)return this.end=new L(+r[0],+r[1]),this;if(i<2)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+i+" coordinates provided).");var o;for(t=[],s=0;s<i;s+=2)o=r.slice(s,s+2),t.push(rt(st,o));return t}if(1===i)return this.end=new L(r[0]),this;for(t=[],s=0;s<i;s+=1)n=r[s],t.push(new st(n));return t},ot={clone:function(){return new st(this.end)},divideAt:function(t){var n=new N(this.start,this.end).divideAt(t);return[new st(n[0]),new st(n[1])]},divideAtLength:function(t){var n=new N(this.start,this.end).divideAtLength(t);return[new st(n[0]),new st(n[1])]},getSubdivisions:function(){return[]},isDifferentiable:function(){return!!this.previousSegment&&!this.start.equals(this.end)},round:function(t){return this.end.round(t),this},scale:function(t,n,e){return this.end.scale(t,n,e),this},serialize:function(){var t=this.end;return this.type+" "+t.x+" "+t.y},toString:function(){return this.type+" "+this.start+" "+this.end},translate:function(t,n){return this.end.translate(t,n),this}};Object.defineProperty(ot,"type",{configurable:!0,enumerable:!0,value:"L"}),st.prototype=nt(it,N.prototype,ot);var at=function(){for(var t,n,e=arguments,r=[],i=arguments.length,s=0;s<i;s++)r.push(e[s]);if(!(this instanceof at))return rt(at,r);if(0===i)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates (none provided).");if(r[0]instanceof tt){if(1===i)return this.controlPoint1=r[0].controlPoint1.clone(),this.controlPoint2=r[0].controlPoint2.clone(),this.end=r[0].end.clone(),this;throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+i+" curves provided).")}if("string"==typeof r[0]||"number"==typeof r[0]){if(6===i)return this.controlPoint1=new L(+r[0],+r[1]),this.controlPoint2=new L(+r[2],+r[3]),this.end=new L(+r[4],+r[5]),this;if(i<6)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+i+" coordinates provided).");var o;for(t=[],s=0;s<i;s+=6)o=r.slice(s,s+6),t.push(rt(at,o));return t}if(3===i)return this.controlPoint1=new L(r[0]),this.controlPoint2=new L(r[1]),this.end=new L(r[2]),this;if(i<3)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+i+" points provided).");for(t=[],s=0;s<i;s+=3)n=r.slice(s,s+3),t.push(rt(at,n));return t},ht={clone:function(){return new at(this.controlPoint1,this.controlPoint2,this.end)},divideAt:function(t,n){var e=new tt(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAt(t,n);return[new at(e[0]),new at(e[1])]},divideAtLength:function(t,n){var e=new tt(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAtLength(t,n);return[new at(e[0]),new at(e[1])]},divideAtT:function(t){var n=new tt(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAtT(t);return[new at(n[0]),new at(n[1])]},isDifferentiable:function(){if(!this.previousSegment)return!1;var t=this.start,n=this.controlPoint1,e=this.controlPoint2,r=this.end;return!(t.equals(n)&&n.equals(e)&&e.equals(r))},round:function(t){return this.controlPoint1.round(t),this.controlPoint2.round(t),this.end.round(t),this},scale:function(t,n,e){return this.controlPoint1.scale(t,n,e),this.controlPoint2.scale(t,n,e),this.end.scale(t,n,e),this},serialize:function(){var t=this.controlPoint1,n=this.controlPoint2,e=this.end;return this.type+" "+t.x+" "+t.y+" "+n.x+" "+n.y+" "+e.x+" "+e.y},toString:function(){return this.type+" "+this.start+" "+this.controlPoint1+" "+this.controlPoint2+" "+this.end},translate:function(t,n){return this.controlPoint1.translate(t,n),this.controlPoint2.translate(t,n),this.end.translate(t,n),this}};Object.defineProperty(ht,"type",{configurable:!0,enumerable:!0,value:"C"}),at.prototype=nt(it,tt.prototype,ht);var ut=function(){for(var t,n,e=arguments,r=[],i=arguments.length,s=0;s<i;s++)r.push(e[s]);if(!(this instanceof ut))return rt(ut,r);if(0===i)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates (none provided).");if(r[0]instanceof N){if(1===i)return this.end=r[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+i+" lines provided).")}if(r[0]instanceof tt){if(1===i)return this.end=r[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+i+" curves provided).")}if("string"==typeof r[0]||"number"==typeof r[0]){if(2===i)return this.end=new L(+r[0],+r[1]),this;if(i<2)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+i+" coordinates provided).");var o;for(t=[],s=0;s<i;s+=2)o=r.slice(s,s+2),0===s?t.push(rt(ut,o)):t.push(rt(st,o));return t}if(1===i)return this.end=new L(r[0]),this;for(t=[],s=0;s<i;s+=1)n=r[s],0===s?t.push(new ut(n)):t.push(new st(n));return t},ct={bbox:function(){return null},clone:function(){return new ut(this.end)},closestPoint:function(){return this.end.clone()},closestPointNormalizedLength:function(){return 0},closestPointLength:function(){return 0},closestPointT:function(){return 1},closestPointTangent:function(){return null},divideAt:function(){return[this.clone(),this.clone()]},divideAtLength:function(){return[this.clone(),this.clone()]},equals:function(t){return this.end.equals(t.end)},getSubdivisions:function(){return[]},isDifferentiable:function(){return!1},isSubpathStart:!0,isVisible:!1,length:function(){return 0},lengthAtT:function(){return 0},pointAt:function(){return this.end.clone()},pointAtLength:function(){return this.end.clone()},pointAtT:function(){return this.end.clone()},round:function(t){return this.end.round(t),this},scale:function(t,n,e){return this.end.scale(t,n,e),this},serialize:function(){var t=this.end;return this.type+" "+t.x+" "+t.y},tangentAt:function(){return null},tangentAtLength:function(){return null},tangentAtT:function(){return null},toString:function(){return this.type+" "+this.end},translate:function(t,n){return this.end.translate(t,n),this}};Object.defineProperty(ct,"start",{configurable:!0,enumerable:!0,get:function(){throw new Error("Illegal access. Moveto segments should not need a start property.")}}),Object.defineProperty(ct,"type",{configurable:!0,enumerable:!0,value:"M"}),ut.prototype=nt(it,ct);var lt=function(){for(var t=arguments,n=[],e=arguments.length,r=0;r<e;r++)n.push(t[r]);if(!(this instanceof lt))return rt(lt,n);if(0<e)throw new Error("Closepath constructor expects no arguments.");return this},ft={clone:function(){return new lt},divideAt:function(t){var n=new N(this.start,this.end).divideAt(t);return[n[1].isDifferentiable()?new st(n[0]):this.clone(),new st(n[1])]},divideAtLength:function(t){var n=new N(this.start,this.end).divideAtLength(t);return[n[1].isDifferentiable()?new st(n[0]):this.clone(),new st(n[1])]},getSubdivisions:function(){return[]},isDifferentiable:function(){return!(!this.previousSegment||!this.subpathStartSegment)&&!this.start.equals(this.end)},round:function(){return this},scale:function(){return this},serialize:function(){return this.type},toString:function(){return this.type+" "+this.start+" "+this.end},translate:function(){return this}};Object.defineProperty(ft,"end",{configurable:!0,enumerable:!0,get:function(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. Moveto); OR segment has not yet been added to a path.)");return this.subpathStartSegment.end}}),Object.defineProperty(ft,"type",{configurable:!0,enumerable:!0,value:"Z"}),lt.prototype=nt(it,N.prototype,ft);var dt=et.segmentTypes={L:st,C:at,M:ut,Z:lt,z:lt};et.regexSupportedData=new RegExp("^[\\s\\d"+Object.keys(dt).join("")+",.]*$"),et.isDataSupported=function(t){return"string"==typeof t&&this.regexSupportedData.test(t)};var gt={curveThroughPoints:function(t){return console.warn("deprecated"),new et(tt.throughPoints(t)).serialize()},getCurveControlPoints:function(t){console.warn("deprecated");var n,e=[],r=[],i=t.length-1;if(1==i)return e[0]=new L((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),r[0]=new L(2*e[0].x-t[0].x,2*e[0].y-t[0].y),[e,r];var s=[];for(n=1;n<i-1;n++)s[n]=4*t[n].x+2*t[n+1].x;s[0]=t[0].x+2*t[1].x,s[i-1]=(8*t[i-1].x+t[i].x)/2;var o=this.getFirstControlPoints(s);for(n=1;n<i-1;++n)s[n]=4*t[n].y+2*t[n+1].y;s[0]=t[0].y+2*t[1].y,s[i-1]=(8*t[i-1].y+t[i].y)/2;var a=this.getFirstControlPoints(s);for(n=0;n<i;n++)e.push(new L(o[n],a[n])),n<i-1?r.push(new L(2*t[n+1].x-o[n+1],2*t[n+1].y-a[n+1])):r.push(new L((t[i].x+o[i-1])/2,(t[i].y+a[i-1])/2));return[e,r]},getCurveDivider:function(t,n,e,r){console.warn("deprecated");var i=new tt(t,n,e,r);return function(t){var n=i.divide(t);return[{p0:n[0].start,p1:n[0].controlPoint1,p2:n[0].controlPoint2,p3:n[0].end},{p0:n[1].start,p1:n[1].controlPoint1,p2:n[1].controlPoint2,p3:n[1].end}]}},getFirstControlPoints:function(t){console.warn("deprecated");var n=t.length,e=[],r=[],i=2;e[0]=t[0]/i;for(var s=1;s<n;s++)r[s]=1/i,i=(s<n-1?4:3.5)-r[s],e[s]=(t[s]-e[s-1])/i;for(s=1;s<n;s++)e[n-s-1]-=r[n-s]*e[n-s];return e},getInversionSolver:function(t,n,e,r){console.warn("deprecated");var i=new tt(t,n,e,r);return function(t){return i.closestPointT(t)}}},vt=function(t){return this instanceof vt?"string"==typeof t?new vt.parse(t):void(this.points=Array.isArray(t)?t.map(L):[]):new vt(t)};function pt(t,n){var e=t.start.x,r=t.start.y,i=t.end.x,s=t.end.y,o=n.start.x,a=n.start.y,h=i-e,u=s-r,c=n.end.x-o,l=n.end.y-a,f=e-o,d=r-a,g=h*l-c*u,v=(h*d-u*f)/g,p=(c*d-l*f)/g;return 0<=v&&v<=1&&0<=p&&p<=1}function mt(t,n){var e=t.a,r=t.b,i=t.x,s=t.y,o=n.start.x-i,a=n.end.x-i,h=n.start.y-s,u=e*e,c=r*r,l=a-o,f=n.end.y-s-h,d=l*l/u+f*f/c,g=2*o*l/u+2*h*f/c,v=g*g-4*d*(o*o/u+h*h/c-1);if(0===v){var p=-g/2/d;return 0<=p&&p<=1}if(0<v){var m=Math.sqrt(v),y=(-g+m)/2/d,x=(-g-m)/2/d;return 0<=y&&y<=1||0<=x&&x<=1}return!1}function yt(t,n){return function(t,n,e,r){var i=Math.cos,s=Math.sin,o=s(n),a=i(n),h=s(r),u=i(r),c=o*o,l=a*a,f=o*a,d=h*h,g=u*u,v=h*u,p=t.a*t.a,m=t.b*t.b,y=e.a*e.a,x=e.b*e.b,w=p*c+m*l,b=y*d+x*g,S=p*l+m*c,P=y*g+x*d,A=2*(m-p)*f,T=2*(x-y)*v,L=-2*w*t.x-A*t.y,E=-2*b*e.x-T*e.y,C=-A*t.x-2*S*t.y,N=-T*e.x-2*P*e.y,I=w*t.x*t.x+S*t.y*t.y+A*t.x*t.y-p*m,M=b*e.x*e.x+P*e.y*e.y+T*e.x*e.y-y*x;T/=2,E/=2,N/=2;var R=Ut([[w,A/=2,L/=2],[A,S,C/=2],[L,C,I]]),O=Ut([[b,T,E],[T,P,N],[E,N,M]]),D=.33333333*(Ut([[b,A,L],[T,S,C],[E,C,I]])+Ut([[w,T,L],[A,P,C],[L,N,I]])+Ut([[w,A,E],[A,S,N],[L,C,M]])),F=.33333333*(Ut([[w,T,E],[A,P,N],[L,N,M]])+Ut([[b,A,E],[T,S,N],[E,C,M]])+Ut([[b,T,L],[T,P,C],[E,N,I]])),k=Bt([[R,D],[D,F]]),q=Bt([[R,F],[D,O]]),V=Bt([[D,F],[F,O]]);if(0<Bt([[2*k,q],[q,2*V]])&&(0<F||0<D))return!1;return!0}(t,0,n,0)}function xt(t,n){var e=n.start,r=n.end,i=t.x,s=t.y,o=t.width,a=t.height;return!(e.x>i+o&&r.x>i+o||e.x<i&&r.x<i||e.y>s+a&&r.y>s+a||e.y<s&&r.y<s)&&(!(!t.containsPoint(n.start)&&!t.containsPoint(n.end))||(pt(t.topLine(),n)||pt(t.rightLine(),n)||pt(t.bottomLine(),n)||pt(t.leftLine(),n)))}function wt(t,n){return!!bt(t,B.fromEllipse(n))&&Et(vt.fromRect(t),n)}function bt(t,n){return t.x<n.x+n.width&&t.x+t.width>n.x&&t.y<n.y+n.height&&t.y+t.height>n.y}function St(t,n){return qt(t,n,{interior:!1})}function Pt(t,n){return Vt(t,n,{interior:!1})}function At(t,n){return zt(t,n,{interior:!1})}function Tt(t,n){return Gt(t,n,{interior:!1})}function Lt(t,n){return qt(t,n,{interior:!0})}function Et(t,n){return Vt(t,n,{interior:!0})}function Ct(t,n){return zt(t,n,{interior:!0})}function Nt(t,n){return Gt(t,n,{interior:!0})}function It(t,n){return Wt(t,n,{interior:!0})}function Mt(t,e,r){return t.getSubpaths().some(function(t){var n=t.toPolylines(r)[0];return"Z"===t.getSegment(-1).type?Lt(n,e):St(n,e)})}function Rt(t,e,r){return t.getSubpaths().some(function(t){var n=t.toPolylines(r)[0];return"Z"===t.getSegment(-1).type?Et(n,e):Pt(n,e)})}function Ot(t,n,e){return Ft(t,vt.fromRect(n),e)}function Dt(t,n,e){return jt(t,n,e,{interior:!1})}function Ft(t,n,e){return jt(t,n,e,{interior:!0})}function kt(t,e,r,i){return t.getSubpaths().some(function(t){var n=t.toPolylines(r)[0];return"Z"===t.getSegment(-1).type?Ft(e,n,i):Dt(e,n,i)})}function qt(t,n,e){void 0===e&&(e={});var r,i=e.interior;if(void 0===i&&(i=!1),i){if(t.containsPoint(n.start))return!0;var s=t.start,o=t.end,a=t.points;r=o.equals(s)?a:a.concat([s])}else r=t.points;for(var h=r.length,u=new N,c=0;c<h-1;c++)if(u.start=r[c],u.end=r[c+1],pt(n,u))return!0;return!1}function Vt(t,n,e){void 0===e&&(e={});var r,i=t.start,s=t.end,o=t.points;if(n.containsPoint(i))return!0;var a=e.interior;if(void 0===a&&(a=!1),a){if(t.containsPoint(n.center()))return!0;r=s.equals(i)?o:o.concat([i])}else r=o;for(var h=r.length,u=new N,c=0;c<h-1;c++)if(u.start=r[c],u.end=r[c+1],mt(n,u))return!0;return!1}function zt(t,n,e){return Wt(t,vt.fromRect(n),e)}function jt(t,e,r,i){return t.getSubpaths().some(function(t){var n=t.toPolylines(r)[0];return"Z"===t.getSegment(-1).type?Wt(e,n,i):Gt(e,n,i)})}function Gt(t,n,e){void 0===e&&(e={});var r,i=e.interior;if(void 0===i&&(i=!1),i){var s=n.start;if(t.containsPoint(s))return!0;r=t.clone().close()}else r=t;for(var o=n.points,a=o.length,h=new N,u=0;u<a-1;u++)if(h.start=o[u],h.end=o[u+1],St(r,h))return!0;return!1}function Wt(t,n,e){return n.containsPoint(t.start)||Gt(t,n.clone().close(),e)}function Bt(t){return t[0][0]*t[1][1]-t[0][1]*t[1][0]}function Ut(t){return t[0][0]*t[1][1]*t[2][2]-t[0][0]*t[1][2]*t[2][1]-t[0][1]*t[1][0]*t[2][2]+t[0][1]*t[1][2]*t[2][0]+t[0][2]*t[1][0]*t[2][1]-t[0][2]*t[1][1]*t[2][0]}vt.parse=function(t){return new vt(H(t))},vt.fromRect=function(t){return new vt([t.topLeft(),t.topRight(),t.bottomRight(),t.bottomLeft()])},vt.prototype=nt(X.prototype,{type:v.Polygon,clone:function(){return new vt(Z(this.points))},convexHull:function(){return new vt(Y(this.points))},lengthPoints:function(){var t=this.start,n=this.end,e=this.points;return e.length<=1||t.equals(n)?e:e.concat([t.clone()])}});var Ht={intersection:{exists:function t(n,e,r,i){switch(n.type){case v.Line:switch(e.type){case v.Line:return pt(n,e)}break;case v.Ellipse:switch(e.type){case v.Line:return mt(n,e);case v.Ellipse:return yt(n,e)}break;case v.Rect:switch(e.type){case v.Line:return xt(n,e);case v.Ellipse:return wt(n,e);case v.Rect:return bt(n,e)}break;case v.Polyline:switch(e.type){case v.Line:return St(n,e);case v.Ellipse:return Pt(n,e);case v.Rect:return At(n,e);case v.Polyline:return Tt(n,e)}break;case v.Polygon:switch(e.type){case v.Line:return Lt(n,e);case v.Ellipse:return Et(n,e);case v.Rect:return Ct(n,e);case v.Polyline:return Nt(n,e);case v.Polygon:return It(n,e)}break;case v.Path:switch(e.type){case v.Line:return Mt(n,e,r);case v.Ellipse:return Rt(n,e,r);case v.Rect:return Ot(n,e,r);case v.Polyline:return Dt(n,e,r);case v.Polygon:return Ft(n,e,r);case v.Path:return kt(n,e,r,i)}}switch(e.type){case v.Ellipse:case v.Rect:case v.Polyline:case v.Polygon:case v.Path:return t(e,n,i,r);default:throw Error("The intersection for "+n+" and "+e+" could not be found.")}},lineWithLine:pt,ellipseWithLine:mt,ellipseWithEllipse:yt,rectWithLine:xt,rectWithEllipse:wt,rectWithRect:bt,polylineWithLine:St,polylineWithEllipse:Pt,polylineWithRect:At,polylineWithPolyline:Tt,polygonWithLine:Lt,polygonWithEllipse:Et,polygonWithRect:Ct,polygonWithPolyline:Nt,polygonWithPolygon:It,pathWithLine:Mt,pathWithEllipse:Rt,pathWithRect:Ot,pathWithPolyline:Dt,pathWithPolygon:Ft,pathWithPath:kt},scale:{linear:function(t,n,e){var r=t[1]-t[0],i=n[1]-n[0];return(e-t[0])/r*i+n[0]||0}},normalizeAngle:h,snapToGrid:s,toDeg:c,toRad:l,random:o,bezier:gt,Curve:tt,Ellipse:D,ellipse:F,Line:N,line:I,Path:et,Point:L,point:t,Polyline:X,Polygon:vt,Rect:B,rect:U,types:v};return function(){if(!("object"==typeof window&&!!window.SVGAngle))return function(){throw new Error("SVG is required to use Vectorizer.")};var F={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},t=Math,v=t.PI,s=t.atan2,o=t.sqrt,l=t.min,f=t.max,p=t.cos,m=t.sin,k=function(t,n,e){if(!(this instanceof k))return k.apply(Object.create(k.prototype),arguments);if(t){if(k.isV(t)&&(t=t.node),n=n||{},k.isString(t)){if("svg"===(t=t.trim()).toLowerCase())t=k.createSvgDocument();else if("<"===t[0]){var r=k.createSvgDocument(t);if(1<r.childNodes.length){var i,s,o=[];for(i=0,s=r.childNodes.length;i<s;i++){var a=r.childNodes[i];o.push(new k(document.importNode(a,!0)))}return o}t=document.importNode(r.firstChild,!0)}else t=document.createElementNS(F.svg,t);k.ensureId(t)}return this.node=t,this.setAttributes(n),e&&this.append(e),this}},n=k.prototype;function q(t,n,e){e||(e={});for(var r=e.includeAnnotationIndices,i=e.eol,s=e.lineHeight,o=e.baseSize,a=0,h={},u=n.length-1,c=0;c<=u;c++){var l=n[c],f=null;if(k.isObject(l)){var d=l.attrs,g=k("tspan",d),v=g.node,p=l.t;i&&c===u&&(p+=i),v.textContent=p;var m=d.class;m&&g.addClass(m),r&&g.attr("annotations",l.annotations),f=parseFloat(d["font-size"]),isFinite(f)||(f=o),f&&a<f&&(a=f)}else i&&c===u&&(l+=i),v=document.createTextNode(l||" "),o&&a<o&&(a=o);t.appendChild(v)}return a&&(h.maxFontSize=a),s?h.lineHeight=s:a&&(h.lineHeight=1.2*a),h}Object.defineProperty(n,"id",{enumerable:!0,get:function(){return this.node.id},set:function(t){this.node.id=t}}),n.getTransformToElement=function(t){var n=this.node;if(k.isSVGGraphicsElement(t)&&k.isSVGGraphicsElement(n)){var e=k.toNode(t).getScreenCTM(),r=n.getScreenCTM();if(e&&r)return e.inverse().multiply(r)}return k.createSVGMatrix()},n.transform=function(t,n){var e=this.node;if(k.isUndefined(t))return k.transformStringToMatrix(this.attr("transform"));if(n&&n.absolute)return this.attr("transform",k.matrixToTransformString(t));var r=k.createSVGTransform(t);return e.transform.baseVal.appendItem(r),this},n.translate=function(t,n,e){e=e||{},n=n||0;var r=this.attr("transform")||"",i=k.parseTransformString(r);if(r=i.value,k.isUndefined(t))return i.translate;r=r.replace(/translate\([^)]*\)/g,"").trim();var s="translate("+(e.absolute?t:i.translate.tx+t)+","+(e.absolute?n:i.translate.ty+n)+")";return this.attr("transform",(s+" "+r).trim()),this},n.rotate=function(t,n,e,r){r=r||{};var i=this.attr("transform")||"",s=k.parseTransformString(i);if(i=s.value,k.isUndefined(t))return s.rotate;i=i.replace(/rotate\([^)]*\)/g,"").trim(),t%=360;var o="rotate("+(r.absolute?t:s.rotate.angle+t)+(void 0!==n&&void 0!==e?","+n+","+e:"")+")";return this.attr("transform",(i+" "+o).trim()),this},n.scale=function(t,n){n=k.isUndefined(n)?t:n;var e=this.attr("transform")||"",r=k.parseTransformString(e);if(e=r.value,k.isUndefined(t))return r.scale;e=e.replace(/scale\([^)]*\)/g,"").trim();var i="scale("+t+","+n+")";return this.attr("transform",(e+" "+i).trim()),this},n.bbox=function(t,n){var e,r=this.node,i=r.ownerSVGElement;if(!i)return new B(0,0,0,0);try{e=r.getBBox()}catch(t){e={x:r.clientLeft,y:r.clientTop,width:r.clientWidth,height:r.clientHeight}}if(t)return new B(e);var s=this.getTransformToElement(n||i);return k.transformRect(e,s)},n.getBBox=function(t){var n,e={},r=this.node;if(!r.ownerSVGElement||!k.isSVGGraphicsElement(r))return new B(0,0,0,0);if(t&&(t.target&&(e.target=k.toNode(t.target)),t.recursive&&(e.recursive=t.recursive)),e.recursive){var i=this.children(),s=i.length;if(0===s)return this.getBBox({target:e.target,recursive:!1});e.target||(e.target=this);for(var o=0;o<s;o++){var a,h=i[o];a=0===h.children().length?h.getBBox({target:e.target,recursive:!1}):h.getBBox({target:e.target,recursive:!0}),n=n?n.union(a):a}return n}try{n=r.getBBox()}catch(t){n={x:r.clientLeft,y:r.clientTop,width:r.clientWidth,height:r.clientHeight}}if(e.target){var u=this.getTransformToElement(e.target);return k.transformRect(n,u)}return new B(n)};var V=/em$/;function z(t,n){var e=parseFloat(t);return V.test(t)?e*n:e}n.text=function(t,n){if(t&&"string"!=typeof t)throw new Error("Vectorizer: text() expects the first argument to be a string.");t=k.sanitizeText(t),n||(n={});var e=n.displayEmpty,r=n.eol,i=n.textPath,s=n.textVerticalAnchor,o="middle"===s||"bottom"===s||"top"===s,a=n.x;void 0===a&&(a=this.attr("x")||0);var h=n.includeAnnotationIndices,u=n.annotations;u&&!k.isArray(u)&&(u=[u]);var c=n.lineHeight,l="auto"===c,f=l?"1.5em":c||"1em";this.empty(),this.attr({"xml:space":"preserve",display:t||e?null:"none"});var d=parseFloat(this.attr("font-size"));d||(d=16,(o||u)&&this.attr("font-size",d));var g,v=document;g=i?("string"==typeof i&&(i={d:i}),function(t,n){t||(t={});var e=k("textPath"),r=t.d;if(r&&void 0===t["xlink:href"]){var i=k("path").attr("d",r).appendTo(n.defs());e.attr("xlink:href","#"+i.id)}return k.isObject(t)&&e.attr(t),e.node}(i,this)):v.createDocumentFragment();for(var p,m=0,y=t.split("\n"),x=[],w=0,b=y.length-1;w<=b;w++){var S,P=f,A="v-line",T=v.createElementNS(F.svg,"tspan"),L=y[w];if(L)if(u){var E=k.annotateString(L,u,{offset:-m,includeAnnotationIndices:h}),C=(S=q(T,E,{includeAnnotationIndices:h,eol:w!==b&&r,lineHeight:l?null:f,baseSize:d})).lineHeight;C&&l&&0!==w&&(P=C),0===w&&(p=.8*S.maxFontSize)}else r&&w!==b&&(L+=r),T.textContent=L;else{T.textContent="-",A+=" v-empty-line";var N=T.style;if(N.fillOpacity=0,N.strokeOpacity=0,u){S={};for(var I=d,M=(E=k.findAnnotationsAtIndex(u,m)).length;0<M;M--){var R=E[M-1].attrs;if(R&&"font-size"in R){var O=parseFloat(R["font-size"]);if(isFinite(O)){I=O;break}}}l&&(0<w?P=1.2*I:p=.8*I),T.setAttribute("font-size",I),S.maxFontSize=I}}S&&x.push(S),0<w&&T.setAttribute("dy",P),(0<w||i)&&T.setAttribute("x",a),T.className.baseVal=A,g.appendChild(T),m+=L.length+1}if(o)if(u)P=function(t,n,e,r){if(!Array.isArray(n))return 0;var i=n.length;if(!i)return 0;for(var s=n[0],o=z(s.maxFontSize,e)||e,a=0,h=z(r,e),u=1;u<i;u++)a+=z((s=n[u]).lineHeight,e)||h;var c,l=z(s.maxFontSize,e)||e;switch(t){case"middle":c=o/2-.15*l-a/2;break;case"bottom":c=-.25*l-a;break;default:case"top":c=.8*o}return c}(s,x,d,f);else if("top"===s)P="0.8em";else{var D;switch(0<b?(D=parseFloat(f)||1,D*=b,V.test(f)||(D/=d)):D=0,s){case"middle":P=.3-D/2+"em";break;case"bottom":P=-D-.3+"em"}}else 0===s?P="0em":s?P=s:(P=0,null===this.attr("y")&&this.attr("y",p||"0.8em"));return g.firstChild.setAttribute("dy",P),this.append(g),this},n.removeAttr=function(t){var n=a[t],e=k.qualifyAttr(n),r=e.ns,i=e.local,s=this.node;return r?s.hasAttributeNS(r,i)&&s.removeAttributeNS(r,i):s.hasAttribute(n)&&s.removeAttribute(n),this},n.attr=function(t,n){if(k.isUndefined(t)){for(var e=this.node.attributes,r={},i=0;i<e.length;i++)r[e[i].name]=e[i].value;return r}if(k.isString(t)&&k.isUndefined(n))return this.node.getAttribute(a[t]);if("object"==typeof t)for(var s in t)t.hasOwnProperty(s)&&this.setAttribute(s,t[s]);else this.setAttribute(t,n);return this},n.normalizePath=function(){return"PATH"===this.tagName()&&this.attr("d",k.normalizePathData(this.attr("d"))),this},n.remove=function(){return this.node.parentNode&&this.node.parentNode.removeChild(this.node),this},n.empty=function(){for(;this.node.firstChild;)this.node.removeChild(this.node.firstChild);return this},n.setAttributes=function(t){for(var n in t)t.hasOwnProperty(n)&&this.setAttribute(n,t[n]);return this},n.append=function(t){k.isArray(t)||(t=[t]);for(var n=0,e=t.length;n<e;n++)this.node.appendChild(k.toNode(t[n]));return this},n.prepend=function(t){var n=this.node.firstChild;return n?k(n).before(t):this.append(t)},n.before=function(t){var n=this.node,e=n.parentNode;if(e){k.isArray(t)||(t=[t]);for(var r=0,i=t.length;r<i;r++)e.insertBefore(k.toNode(t[r]),n)}return this},n.appendTo=function(t){return k.toNode(t).appendChild(this.node),this},n.svg=function(){return this.node instanceof window.SVGSVGElement?this:k(this.node.ownerSVGElement)},n.tagName=function(){return this.node.tagName.toUpperCase()},n.defs=function(){var t=this.svg()||this,n=t.node.getElementsByTagName("defs")[0];return n?k(n):k("defs").appendTo(t)},n.clone=function(){var t=k(this.node.cloneNode(!0));return t.node.id=k.uniqueId(),t},n.findOne=function(t){var n=this.node.querySelector(t);return n?k(n):void 0},n.find=function(t){var n=[],e=this.node.querySelectorAll(t);if(e)for(var r=0;r<e.length;r++)n.push(k(e[r]));return n},n.children=function(){for(var t=this.node.childNodes,n=[],e=0;e<t.length;e++){1===t[e].nodeType&&n.push(k(t[e]))}return n},n.parent=function(){return k(this.node.parentNode)||null},n.index=function(){for(var t=0,n=this.node.previousSibling;n;)1===n.nodeType&&t++,n=n.previousSibling;return t},n.findParentByClass=function(t,n){for(var e=this.node.ownerSVGElement,r=this.node.parentNode;r&&r!==n&&r!==e;){var i=k(r);if(i.hasClass(t))return i;r=r.parentNode}return null},n.contains=function(t){var n=this.node,e=k.toNode(t),r=e&&e.parentNode;return n===r||!!(r&&1===r.nodeType&&16&n.compareDocumentPosition(r))},n.toLocalPoint=function(t,n){var e=this.svg().node,r=e.createSVGPoint();r.x=t,r.y=n;try{var i=r.matrixTransform(e.getScreenCTM().inverse()),s=this.getTransformToElement(e).inverse()}catch(t){return r}return i.matrixTransform(s)},n.translateCenterToPoint=function(t){var n=this.getBBox({target:this.svg()}).center();return this.translate(t.x-n.x,t.y-n.y),this},n.translateAndAutoOrient=function(t,n,e){t=new L(t),n=new L(n),e||(e=this.svg());var r=this.scale();this.attr("transform","");var i=this.getBBox({target:e}).scale(r.sx,r.sy),s=k.createSVGTransform();s.setTranslate(-i.x-i.width/2,-i.y-i.height/2);var o=k.createSVGTransform(),a=t.angleBetween(n,t.clone().offset(1,0));a&&o.setRotate(a,0,0);var h=k.createSVGTransform(),u=t.clone().move(n,i.width/2);h.setTranslate(2*t.x-u.x,2*t.y-u.y);var c=this.getTransformToElement(e),l=k.createSVGTransform();return l.setMatrix(h.matrix.multiply(o.matrix.multiply(s.matrix.multiply(c.scale(r.sx,r.sy))))),this.attr("transform",k.matrixToTransformString(l.matrix)),this},n.animateAlongPath=function(t,n){n=k.toNode(n);var e=k.ensureId(n),r=k("animateMotion",t),i=k("mpath",{"xlink:href":"#"+e});r.append(i),this.append(r);try{r.node.beginElement()}catch(t){if("fake"===document.documentElement.getAttribute("smiling")){var s=r.node;s.animators=[];var o=s.getAttribute("id");o&&(id2anim[o]=s);for(var a=getTargets(s),h=0,u=a.length;h<u;h++){var c=a[h],l=new Animator(s,c,h);animators.push(l),(s.animators[h]=l).register()}}}return this};var e=/[^\x20\t\r\n\f]+/g;function i(t){return k.isString(t)&&t.trim().match(e)||[]}n.hasClass=function(t){return!!k.isString(t)&&this.node.classList.contains(t.trim())},n.addClass=function(t){var n;return(n=this.node.classList).add.apply(n,i(t)),this},n.removeClass=function(t){var n;return(n=this.node.classList).remove.apply(n,i(t)),this},n.toggleClass=function(t,n){for(var e=i(t),r=0;r<e.length;r++)this.node.classList.toggle(e[r],n);return this},n.sample=function(t){t=t||1;for(var n,e=this.node,r=e.getTotalLength(),i=[],s=0;s<r;)n=e.getPointAtLength(s),i.push({x:n.x,y:n.y,distance:s}),s+=t;return i},n.convertToPath=function(){var t=k("path");t.attr(this.attr());var n=this.convertToPathData();return n&&t.attr("d",n),t},n.convertToPathData=function(){var t=this.tagName();switch(t){case"PATH":return this.attr("d");case"LINE":return k.convertLineToPathData(this.node);case"POLYGON":return k.convertPolygonToPathData(this.node);case"POLYLINE":return k.convertPolylineToPathData(this.node);case"ELLIPSE":return k.convertEllipseToPathData(this.node);case"CIRCLE":return k.convertCircleToPathData(this.node);case"RECT":return k.convertRectToPathData(this.node)}throw new Error(t+" cannot be converted to PATH.")},k.prototype.toGeometryShape=function(){var t,n,e,r,i,s,o,a,h,u,c,l,f,d,g;switch(this.tagName()){case"RECT":return t=parseFloat(this.attr("x"))||0,n=parseFloat(this.attr("y"))||0,e=parseFloat(this.attr("width"))||0,r=parseFloat(this.attr("height"))||0,new B(t,n,e,r);case"CIRCLE":return i=parseFloat(this.attr("cx"))||0,s=parseFloat(this.attr("cy"))||0,o=parseFloat(this.attr("r"))||0,new D({x:i,y:s},o,o);case"ELLIPSE":return i=parseFloat(this.attr("cx"))||0,s=parseFloat(this.attr("cy"))||0,a=parseFloat(this.attr("rx"))||0,h=parseFloat(this.attr("ry"))||0,new D({x:i,y:s},a,h);case"POLYLINE":return u=k.getPointsFromSvgNode(this),new X(u);case"POLYGON":return 1<(u=k.getPointsFromSvgNode(this)).length&&u.push(u[0]),new X(u);case"PATH":return c=this.attr("d"),et.isDataSupported(c)||(c=k.normalizePathData(c)),new et(c);case"LINE":return l=parseFloat(this.attr("x1"))||0,d=parseFloat(this.attr("y1"))||0,f=parseFloat(this.attr("x2"))||0,g=parseFloat(this.attr("y2"))||0,new N({x:l,y:d},{x:f,y:g})}return this.getBBox()},n.findIntersection=function(t,n){var e=this.svg().node;n=n||e;var r=this.getBBox({target:n}),i=r.center();if(r.intersectionWithLineFromCenterToPoint(t)){var s,o=this.tagName();if("RECT"===o){var a=new B(parseFloat(this.attr("x")||0),parseFloat(this.attr("y")||0),parseFloat(this.attr("width")),parseFloat(this.attr("height"))),h=this.getTransformToElement(n),u=k.decomposeMatrix(h),c=e.createSVGTransform();c.setRotate(-u.rotation,i.x,i.y);var l=k.transformRect(a,c.matrix.multiply(h));s=new B(l).intersectionWithLineFromCenterToPoint(t,u.rotation)}else if("PATH"===o||"POLYGON"===o||"POLYLINE"===o||"CIRCLE"===o||"ELLIPSE"===o){var f,d,g,v,p,m=("PATH"===o?this:this.convertToPath()).sample(),y=1/0,x=[];for(f=0;f<m.length;f++)d=m[f],g=(g=k.createSVGPoint(d.x,d.y)).matrixTransform(this.getTransformToElement(n)),(p=(d=new L(g)).distance(i)+(v=1.1*d.distance(t)))<y?(y=p,x=[{sample:d,refDistance:v}]):p<y+1&&x.push({sample:d,refDistance:v});x.sort(function(t,n){return t.refDistance-n.refDistance}),x[0]&&(s=x[0].sample)}return s}},n.setAttribute=function(t,n){var e=this.node;if(null===n)return this.removeAttr(t),this;var r=a[t],i=k.qualifyAttr(r).ns;return i?e.setAttributeNS(i,r,n):"id"===r?e.id=n:e.setAttribute(r,n),this},k.createSvgDocument=function(t){if(t){var n='<svg xmlns="'+F.svg+'" xmlns:xlink="'+F.xlink+'" version="1.1">'+t+"</svg>";return k.parseXML(n,{async:!1}).documentElement}var e=document.createElementNS(F.svg,"svg");return e.setAttributeNS(F.xmlns,"xmlns:xlink",F.xlink),e.setAttribute("version","1.1"),e},k.createSVGStyle=function(t){return k("style",{type:"text/css"},[k.createCDATASection(t)]).node},k.createCDATASection=function(t){return void 0===t&&(t=""),document.implementation.createDocument(null,"xml",null).createCDATASection(t)},k.idCounter=0,k.uniqueId=function(){return"v-"+ ++k.idCounter},k.toNode=function(t){return k.isV(t)?t.node:t.nodeName&&t||t[0]},k.ensureId=function(t){return(t=k.toNode(t)).id||(t.id=k.uniqueId())},k.sanitizeText=function(t){return(t||"").replace(/ /g,"\xa0")},k.isUndefined=function(t){return void 0===t},k.isString=function(t){return"string"==typeof t},k.isObject=function(t){return t&&"object"==typeof t},k.isArray=Array.isArray,k.parseXML=function(t,n){var e;n=n||{};try{var r=new DOMParser;k.isUndefined(n.async)||(r.async=n.async),e=r.parseFromString(t,"text/xml")}catch(t){e=void 0}if(!e||e.getElementsByTagName("parsererror").length)throw new Error("Invalid XML: "+t);return e};var r=Object.create(null);["baseFrequency","baseProfile","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].forEach(function(t){return r[t]=t}),r.xlinkShow="xlink:show",r.xlinkRole="xlink:role",r.xlinkActuate="xlink:actuate",r.xlinkHref="xlink:href",r.xlinkType="xlink:type",r.xlinkTitle="xlink:title",r.xmlBase="xml:base",r.xmlLang="xml:lang",r.xmlSpace="xml:space";var a=new Proxy(r,{get:function(t,n){return k.supportCamelCaseAttributes?n in t?t[n]:t[n]=n.replace(/[A-Z]/g,"-$&").toLowerCase():n}});Object.defineProperty(k,"attributeNames",{enumerable:!0,value:a,writable:!1}),Object.defineProperty(k,"supportCamelCaseAttributes",{enumerable:!0,value:!0,writable:!0}),k.qualifyAttr=function(t){if(-1===t.indexOf(":"))return{ns:null,local:t};var n=t.split(":");return{ns:F[n[0]],local:n[1]}},k.transformSeparatorRegex=/[ ,]+/,k.transformRegex=/\b\w+\([^()]+\)/g,k.transformFunctionRegex=/\b(\w+)\(([^()]+)\)/,k.transformTranslateRegex=/\btranslate\(([^()]+)\)/,k.transformRotateRegex=/\brotate\(([^()]+)\)/,k.transformScaleRegex=/\bscale\(([^()]+)\)/,k.transformStringToMatrix=function(t){var n=k.createSVGMatrix(),e=t&&t.match(k.transformRegex);if(!e)return n;for(var r=e.length,i=0;i<r;i++){var s=e[i].match(k.transformFunctionRegex);if(s){var o=void 0,a=void 0,h=void 0,u=void 0,c=void 0,l=k.createSVGMatrix(),f=s[1].toLowerCase(),d=s[2].split(k.transformSeparatorRegex);switch(f){case"scale":o=parseFloat(d[0]),a=void 0===d[1]?o:parseFloat(d[1]),l=l.scaleNonUniform(o,a);break;case"translate":h=parseFloat(d[0]),u=parseFloat(d[1]),l=l.translate(h,u);break;case"rotate":c=parseFloat(d[0]),h=parseFloat(d[1])||0,u=parseFloat(d[2])||0,l=0!==h||0!==u?l.translate(h,u).rotate(c).translate(-h,-u):l.rotate(c);break;case"skewx":c=parseFloat(d[0]),l=l.skewX(c);break;case"skewy":c=parseFloat(d[0]),l=l.skewY(c);break;case"matrix":l.a=parseFloat(d[0]),l.b=parseFloat(d[1]),l.c=parseFloat(d[2]),l.d=parseFloat(d[3]),l.e=parseFloat(d[4]),l.f=parseFloat(d[5]);break;default:continue}n=n.multiply(l)}}return n},k.matrixToTransformString=function(t){return t||(t=!0),"matrix("+(void 0!==t.a?t.a:1)+","+(void 0!==t.b?t.b:0)+","+(void 0!==t.c?t.c:0)+","+(void 0!==t.d?t.d:1)+","+(void 0!==t.e?t.e:0)+","+(void 0!==t.f?t.f:0)+")"},k.parseTransformString=function(t){var n,e,r;if(t){var i=k.transformSeparatorRegex;if(0<=t.trim().indexOf("matrix")){var s=k.transformStringToMatrix(t),o=k.decomposeMatrix(s);n=[o.translateX,o.translateY],r=[o.scaleX,o.scaleY],e=[o.rotation];var a=[];0===n[0]&&0===n[1]||a.push("translate("+n+")"),1===r[0]&&1===r[1]||a.push("scale("+r+")"),0!==e[0]&&a.push("rotate("+e+")"),t=a.join(" ")}else{var h=t.match(k.transformTranslateRegex);h&&(n=h[1].split(i));var u=t.match(k.transformRotateRegex);u&&(e=u[1].split(i));var c=t.match(k.transformScaleRegex);c&&(r=c[1].split(i))}}var l=r&&r[0]?parseFloat(r[0]):1;return{value:t,translate:{tx:n&&n[0]?parseInt(n[0],10):0,ty:n&&n[1]?parseInt(n[1],10):0},rotate:{angle:e&&e[0]?parseInt(e[0],10):0,cx:e&&e[1]?parseInt(e[1],10):void 0,cy:e&&e[2]?parseInt(e[2],10):void 0},scale:{sx:l,sy:r&&r[1]?parseFloat(r[1]):l}}},k.deltaTransformPoint=function(t,n){return{x:n.x*t.a+n.y*t.c+0,y:n.x*t.b+n.y*t.d+0}},k.decomposeMatrix=function(t){var n=k.deltaTransformPoint(t,{x:0,y:1}),e=k.deltaTransformPoint(t,{x:1,y:0}),r=180/v*s(n.y,n.x)-90,i=180/v*s(e.y,e.x);return{translateX:t.e,translateY:t.f,scaleX:o(t.a*t.a+t.b*t.b),scaleY:o(t.c*t.c+t.d*t.d),skewX:r,skewY:i,rotation:r}},k.matrixToScale=function(t){var n,e,r,i;return t?(n=k.isUndefined(t.a)?1:t.a,i=k.isUndefined(t.d)?1:t.d,e=t.b,r=t.c):n=i=1,{sx:e?o(n*n+e*e):n,sy:r?o(r*r+i*i):i}},k.matrixToRotate=function(t){var n={x:0,y:1};return t&&(n=k.deltaTransformPoint(t,n)),{angle:h(c(s(n.y,n.x))-90)}},k.matrixToTranslate=function(t){return{tx:t&&t.e||0,ty:t&&t.f||0}},k.isV=function(t){return t instanceof k},k.isVElement=k.isV,k.isSVGGraphicsElement=function(t){return!!t&&((t=k.toNode(t))instanceof SVGElement&&"function"==typeof t.getScreenCTM)};var d=k("svg").node;return k.createSVGMatrix=function(t){var n=d.createSVGMatrix();for(var e in t)n[e]=t[e];return n},k.createSVGTransform=function(t){return k.isUndefined(t)?d.createSVGTransform():(t instanceof SVGMatrix||(t=k.createSVGMatrix(t)),d.createSVGTransformFromMatrix(t))},k.createSVGPoint=function(t,n){var e=d.createSVGPoint();return e.x=t,e.y=n,e},k.transformRect=function(t,n){var e=d.createSVGPoint();e.x=t.x,e.y=t.y;var r=e.matrixTransform(n);e.x=t.x+t.width,e.y=t.y;var i=e.matrixTransform(n);e.x=t.x+t.width,e.y=t.y+t.height;var s=e.matrixTransform(n);e.x=t.x,e.y=t.y+t.height;var o=e.matrixTransform(n),a=l(r.x,i.x,s.x,o.x),h=f(r.x,i.x,s.x,o.x),u=l(r.y,i.y,s.y,o.y),c=f(r.y,i.y,s.y,o.y);return new B(a,u,h-a,c-u)},k.transformPoint=function(t,n){return new L(k.createSVGPoint(t.x,t.y).matrixTransform(n))},k.transformLine=function(t,n){return new N(k.transformPoint(t.start,n),k.transformPoint(t.end,n))},k.transformPolyline=function(t,n){var e=t instanceof X?t.points:t;k.isArray(e)||(e=[]);for(var r=[],i=0,s=e.length;i<s;i++)r[i]=k.transformPoint(e[i],n);return new X(r)},k.styleToObject=function(t){for(var n={},e=t.split(";"),r=0;r<e.length;r++){var i=e[r].split("=");n[i[0].trim()]=i[1].trim()}return n},k.createSlicePathData=function(t,n,e,r){var i=2*v-1e-6,s=t,o=n,a=e,h=r,u=(h<a&&(u=a,a=h,h=u),h-a),c=u<v?"0":"1",l=p(a),f=m(a),d=p(h),g=m(h);return i<=u?s?"M0,"+o+"A"+o+","+o+" 0 1,1 0,"+-o+"A"+o+","+o+" 0 1,1 0,"+o+"M0,"+s+"A"+s+","+s+" 0 1,0 0,"+-s+"A"+s+","+s+" 0 1,0 0,"+s+"Z":"M0,"+o+"A"+o+","+o+" 0 1,1 0,"+-o+"A"+o+","+o+" 0 1,1 0,"+o+"Z":s?"M"+o*l+","+o*f+"A"+o+","+o+" 0 "+c+",1 "+o*d+","+o*g+"L"+s*d+","+s*g+"A"+s+","+s+" 0 "+c+",0 "+s*l+","+s*f+"Z":"M"+o*l+","+o*f+"A"+o+","+o+" 0 "+c+",1 "+o*d+","+o*g+"L0,0Z"},k.mergeAttrs=function(t,n){for(var e in n)"class"===e?t[e]=t[e]?t[e]+" "+n[e]:n[e]:"style"===e?k.isObject(t[e])&&k.isObject(n[e])?t[e]=k.mergeAttrs(t[e],n[e]):k.isObject(t[e])?t[e]=k.mergeAttrs(t[e],k.styleToObject(n[e])):k.isObject(n[e])?t[e]=k.mergeAttrs(k.styleToObject(t[e]),n[e]):t[e]=k.mergeAttrs(k.styleToObject(t[e]),k.styleToObject(n[e])):t[e]=n[e];return t},k.annotateString=function(t,n,e){n=n||[];for(var r,i,s,o=(e=e||{}).offset||0,a=[],h=[],u=0;u<t.length;u++){i=h[u]=t[u];for(var c=0;c<n.length;c++){var l=n[c],f=l.start+o,d=l.end+o;f<=u&&u<d&&(k.isObject(i)?i.attrs=k.mergeAttrs(k.mergeAttrs({},i.attrs),l.attrs):i=h[u]={t:t[u],attrs:l.attrs},e.includeAnnotationIndices&&(i.annotations||(i.annotations=[])).push(c))}(s=h[u-1])?k.isObject(i)&&k.isObject(s)?JSON.stringify(i.attrs)===JSON.stringify(s.attrs)?r.t+=i.t:(a.push(r),r=i):r=k.isObject(i)?(a.push(r),i):k.isObject(s)?(a.push(r),i):(r||"")+i:r=i}return r&&a.push(r),a},k.findAnnotationsAtIndex=function(t,n){var e=[];return t&&t.forEach(function(t){t.start<n&&n<=t.end&&e.push(t)}),e},k.findAnnotationsBetweenIndexes=function(t,n,e){var r=[];return t&&t.forEach(function(t){(n>=t.start&&n<t.end||e>t.start&&e<=t.end||t.start>=n&&t.end<e)&&r.push(t)}),r},k.shiftAnnotations=function(t,n,e){return t&&t.forEach(function(t){t.start<n&&t.end>=n?t.end+=e:t.start>=n&&(t.start+=e,t.end+=e)}),t},k.convertLineToPathData=function(t){return["M",(t=k(t)).attr("x1"),t.attr("y1"),"L",t.attr("x2"),t.attr("y2")].join(" ")},k.convertPolygonToPathData=function(t){var n=k.getPointsFromSvgNode(t);return 0===n.length?null:k.svgPointsToPath(n)+" Z"},k.convertPolylineToPathData=function(t){var n=k.getPointsFromSvgNode(t);return 0===n.length?null:k.svgPointsToPath(n)},k.svgPointsToPath=function(t){for(var n=0,e=t.length;n<e;n++)t[n]=t[n].x+" "+t[n].y;return"M "+t.join(" L")},k.getPointsFromSvgNode=function(t){var n=[],e=(t=k.toNode(t)).points;if(e)for(var r=0,i=e.numberOfItems;r<i;r++)n.push(e.getItem(r));return n},k.KAPPA=.551784,k.convertCircleToPathData=function(t){t=k(t);var n=parseFloat(t.attr("cx"))||0,e=parseFloat(t.attr("cy"))||0,r=parseFloat(t.attr("r")),i=r*k.KAPPA;return["M",n,e-r,"C",n+i,e-r,n+r,e-i,n+r,e,"C",n+r,e+i,n+i,e+r,n,e+r,"C",n-i,e+r,n-r,e+i,n-r,e,"C",n-r,e-i,n-i,e-r,n,e-r,"Z"].join(" ")},k.convertEllipseToPathData=function(t){t=k(t);var n=parseFloat(t.attr("cx"))||0,e=parseFloat(t.attr("cy"))||0,r=parseFloat(t.attr("rx")),i=parseFloat(t.attr("ry"))||r,s=r*k.KAPPA,o=i*k.KAPPA;return["M",n,e-i,"C",n+s,e-i,n+r,e-o,n+r,e,"C",n+r,e+o,n+s,e+i,n,e+i,"C",n-s,e+i,n-r,e+o,n-r,e,"C",n-r,e-o,n-s,e-i,n,e-i,"Z"].join(" ")},k.convertRectToPathData=function(t){return t=k(t),k.rectToPath({x:parseFloat(t.attr("x"))||0,y:parseFloat(t.attr("y"))||0,width:parseFloat(t.attr("width"))||0,height:parseFloat(t.attr("height"))||0,rx:parseFloat(t.attr("rx"))||0,ry:parseFloat(t.attr("ry"))||0})},k.rectToPath=function(t){var n=t.x,e=t.y,r=t.width,i=t.height,s=l(t.rx||t["top-rx"]||0,r/2),o=l(t.rx||t["bottom-rx"]||0,r/2),a=l(t.ry||t["top-ry"]||0,i/2),h=l(t.ry||t["bottom-ry"]||0,i/2);return(s||o||a||h?["M",n,e+a,"v",i-a-h,"a",o,h,0,0,0,o,h,"h",r-2*o,"a",o,h,0,0,0,o,-h,"v",-(i-h-a),"a",s,a,0,0,0,-s,-a,"h",-(r-2*s),"a",s,a,0,0,0,-s,a,"Z"]:["M",n,e,"H",n+r,"V",e+i,"H",n,"V",e,"Z"]).join(" ")},k.normalizePathData=function(){var t="\t\n\v\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029",v=new RegExp("([a-z])["+t+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+t+"]*,?["+t+"]*)+)","ig"),p=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+t+"]*,?["+t+"]*","ig"),n=Math,B=n.PI,U=n.sin,H=n.cos,Z=n.tan,Y=n.asin,X=n.sqrt,J=n.abs;function f(t,n,e,r,i,s){return[1/3*t+2/3*e,1/3*n+2/3*r,1/3*i+2/3*e,1/3*s+2/3*r,i,s]}function K(t,n,e){return{x:t*H(e)-n*U(e),y:t*U(e)+n*H(e)}}function d(t){if(Array.isArray(t)&&Array.isArray(t&&t[0])||(t=function(t){if(!t)return null;var s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(t).replace(v,function(t,n,e){var r=[],i=n.toLowerCase();for(e.replace(p,function(t,n){n&&r.push(+n)}),"m"===i&&2<r.length&&(o.push([n].concat(r.splice(0,2))),i="l",n="m"===n?"l":"L");r.length>=s[i]&&(o.push([n].concat(r.splice(0,s[i]))),s[i]););}),o}(t)),!t||!t.length)return[["M",0,0]];for(var n,e=[],r=0,i=0,s=0,o=0,a=t.length,h=0;h<a;h++){var u=[];e.push(u);var c,l,f=t[h];if((n=f[0])!=n.toUpperCase())switch(u[0]=n.toUpperCase(),u[0]){case"A":u[1]=f[1],u[2]=f[2],u[3]=f[3],u[4]=f[4],u[5]=f[5],u[6]=+f[6]+r,u[7]=+f[7]+i;break;case"V":u[1]=+f[1]+i;break;case"H":u[1]=+f[1]+r;break;case"M":for(s=+f[1]+r,o=+f[2]+i,c=f.length,l=1;l<c;l++)u[l]=+f[l]+(l%2?r:i);break;default:for(c=f.length,l=1;l<c;l++)u[l]=+f[l]+(l%2?r:i)}else for(var d=f.length,g=0;g<d;g++)u[g]=f[g];switch(u[0]){case"Z":r=+s,i=+o;break;case"H":r=u[1];break;case"V":i=u[1];break;case"M":s=u[u.length-2],o=u[u.length-1],r=u[u.length-2],i=u[u.length-1];break;default:r=u[u.length-2],i=u[u.length-1]}}return e}function e(t){var r=d(t),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function e(t,n,e){var r,i;if(!t)return["C",n.x,n.y,n.x,n.y,n.x,n.y];switch(t[0]in{T:1,Q:1}||(n.qx=null,n.qy=null),t[0]){case"M":n.X=t[1],n.Y=t[2];break;case"A":t=0===parseFloat(t[1])||0===parseFloat(t[2])?["L",t[6],t[7]]:["C"].concat(function t(n,e,r,i,s,o,a,h,u,c){var l,f=120*B/180,d=B/180*(+s||0),g=[];if(c)P=c[0],A=c[1],b=c[2],S=c[3];else{n=(l=K(n,e,-d)).x,e=l.y;var v=(n-(h=(l=K(h,u,-d)).x))/2,p=(e-(u=l.y))/2,m=v*v/(r*r)+p*p/(i*i);1<m&&(r*=m=X(m),i*=m);var y=r*r,x=i*i,w=(o==a?-1:1)*X(J((y*x-y*p*p-x*v*v)/(y*p*p+x*v*v)));if(!Number.isFinite(w))return[n,e,h,u,h,u];var b=w*r*p/i+(n+h)/2,S=w*-i*v/r+(e+u)/2,P=Y(((e-S)/i).toFixed(9)),A=Y(((u-S)/i).toFixed(9));(P=n<b?B-P:P)<0&&(P=2*B+P),(A=h<b?B-A:A)<0&&(A=2*B+A),a&&A<P&&(P-=2*B),!a&&P<A&&(A-=2*B)}var T=A-P;if(J(T)>f){var L=A,E=h,C=u;g=t(h=b+r*H(A=P+f*(a&&P<A?1:-1)),u=S+i*U(A),r,i,s,0,a,E,C,[A,L,b,S])}T=A-P;var N=H(P),I=U(P),M=H(A),R=U(A),O=Z(T/4),D=4/3*(r*O),F=4/3*(i*O),k=[n,e],q=[n+D*I,e-F*N],V=[h+D*R,u-F*M],z=[h,u];if(q[0]=2*k[0]-q[0],q[1]=2*k[1]-q[1],c)return[q,V,z].concat(g);for(var j=[],G=(g=[q,V,z].concat(g).join().split(",")).length,W=0;W<G;W++)j[W]=W%2?K(g[W-1],g[W],d).y:K(g[W],g[W+1],d).x;return j}.apply(0,[n.x,n.y].concat(t.slice(1))));break;case"S":i="C"===e||"S"===e?(r=2*n.x-n.bx,2*n.y-n.by):(r=n.x,n.y),t=["C",r,i].concat(t.slice(1));break;case"T":"Q"===e||"T"===e?(n.qx=2*n.x-n.qx,n.qy=2*n.y-n.qy):(n.qx=n.x,n.qy=n.y),t=["C"].concat(f(n.x,n.y,n.qx,n.qy,t[1],t[2]));break;case"Q":n.qx=t[1],n.qy=t[2],t=["C"].concat(f(n.x,n.y,t[1],t[2],t[3],t[4]));break;case"H":t=["L"].concat(t[1],n.y);break;case"V":t=["L"].concat(n.x,t[1])}return t}function i(t,n){if(7<t[n].length){t[n].shift();for(var e=t[n];e.length;)s[n]="A",t.splice(n++,0,["C"].concat(e.splice(0,6)));t.splice(n,1),h=r.length}}for(var s=[],o="",a="",h=r.length,u=0;u<h;u++){r[u]&&(o=r[u][0]),"C"!==o&&(s[u]=o,0<u&&(a=s[u-1])),r[u]=e(r[u],n,a),"A"!==s[u]&&"C"===o&&(s[u]="C"),i(r,u);var c=r[u],l=c.length;n.x=c[l-2],n.y=c[l-1],n.bx=parseFloat(c[l-4])||n.x,n.by=parseFloat(c[l-3])||n.y}return r[0][0]&&"M"===r[0][0]||r.unshift(["M",0,0]),r}return function(t){return e(t).join(",").split(",").join(" ")}}(),k.namespace=F,k.g=Ht,k}()}),"undefined"!=typeof V)var g=V.g,Vectorizer=V;
|
|
8
|
+
var g,Vectorizer;((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).V=e()})(this,function(){let{round:q,floor:V,PI:z}=Math;function r(t){return t%360+(t<0?360:0)}function j(t,e){return e*q(t/e)}function s(t){return 180*t/z%360}function o(t,e){return(t=(e=e||!1)?t:t%360)*z/180}function G(t,e){var n;return void 0===e?(e=void 0===t?1:t,t=0):e<t&&(n=t,t=e,e=n),V(Math.random()*(e-t+1)+t)}function e(t,e){var n=o(t.y),i=o(e.y),t=t.x,e=e.x,e=o(e-t),t=U(e)*a(i),n=a(n)*U(i)-U(n)*a(i)*a(e);return(i=s(H(t,n))-22.5)<0&&(i+=360),["NE","E","SE","S","SW","W","NW","N"][i=parseInt(i/45)]}function W(t,e){var n=t.x,t=t.y;return(n-=e.x)*n+(t-=e.y)*t}function B(t,e){return Math.sqrt(W(t,e))}function p(t,e){if(!(this instanceof p))return new p(t,e);var n;"string"==typeof t?(n=t.split(-1===t.indexOf("@")?" ":"@"),t=parseFloat(n[0]),e=parseFloat(n[1])):Object(t)===t&&(e=t.y,t=t.x),this.x=void 0===t?0:t,this.y=void 0===e?0:e}let{cos:a,sin:U,atan2:H}=Math,h={Point:1,Line:2,Ellipse:3,Rect:4,Polyline:5,Polygon:6,Curve:7,Path:8},{abs:u,cos:Z,sin:Y,sqrt:X,min:$,max:J,atan2:K,round:Q,pow:_,PI:tt}=Math;p.fromPolar=function(t,e,n){n=new p(n);var i=u(t*Z(e)),t=u(t*Y(e)),e=r(s(e));return e<90?t=-t:e<180?(i=-i,t=-t):e<270&&(i=-i),new p(n.x+i,n.y+t)},p.random=function(t,e,n,i){return new p(G(t,e),G(n,i))},p.prototype={type:h.Point,chooseClosest:function(t){var e=t.length;if(1===e)return new p(t[0]);for(var n=null,i=1/0,r=0;r<e;r++){var s=new p(t[r]),o=this.squaredDistance(s);o<i&&(n=s,i=o)}return n},adhereToRect:function(t){return t.containsPoint(this)||(this.x=$(J(this.x,t.x),t.x+t.width),this.y=$(J(this.y,t.y),t.y+t.height)),this},angleBetween:function(t,e){e=this.equals(t)||this.equals(e)?NaN:this.theta(e)-this.theta(t);return e<0&&(e+=360),e},bearing:function(t){return e(this,t)},changeInAngle:function(t,e,n){return this.clone().offset(-t,-e).theta(n)-this.theta(n)},clone:function(){return new p(this)},cross:function(t,e){return t&&e?(e.x-this.x)*(t.y-this.y)-(e.y-this.y)*(t.x-this.x):NaN},difference:function(t,e){return Object(t)===t&&(e=t.y,t=t.x),new p(this.x-(t||0),this.y-(e||0))},distance:function(t){return B(this,t)},dot:function(t){return t?this.x*t.x+this.y*t.y:NaN},equals:function(t){return!!t&&this.x===t.x&&this.y===t.y},lerp:function(t,e){var n=this.x,i=this.y;return new p((1-e)*n+e*t.x,(1-e)*i+e*t.y)},magnitude:function(){return X(this.x*this.x+this.y*this.y)||.01},manhattanDistance:function(t){return u(t.x-this.x)+u(t.y-this.y)},move:function(t,e){t=o(new p(t).theta(this));return this.offset(Z(t)*e,-Y(t)*e)},normalize:function(t){t=(t||1)/this.magnitude();return this.scale(t,t)},offset:function(t,e){return Object(t)===t&&(e=t.y,t=t.x),this.x+=t||0,this.y+=e||0,this},reflection:function(t){return new p(t).move(this,this.distance(t))},rotate:function(t,e){var n,i;return 0!==e&&(t=t||new p(0,0),e=o(r(-e)),n=Z(e),e=Y(e),i=n*(this.x-t.x)-e*(this.y-t.y)+t.x,e=e*(this.x-t.x)+n*(this.y-t.y)+t.y,this.x=i,this.y=e),this},round:function(t){let e=1;if(t)switch(t){case 1:e=10;break;case 2:e=100;break;case 3:e=1e3;break;default:e=_(10,t)}return this.x=Q(this.x*e)/e,this.y=Q(this.y*e)/e,this},scale:function(t,e,n){return n=n&&new p(n)||new p(0,0),this.x=n.x+t*(this.x-n.x),this.y=n.y+e*(this.y-n.y),this},snapToGrid:function(t,e){return this.x=j(this.x,t),this.y=j(this.y,e||t),this},squaredDistance:function(t){return W(this,t)},theta:function(t){var e=-((t=new p(t)).y-this.y),t=t.x-this.x,e=K(e,t);return 180*(e=e<0?2*tt+e:e)/tt},toJSON:function(){return{x:this.x,y:this.y}},toPolar:function(t){t=t&&new p(t)||new p(0,0);var e=this.x,n=this.y;return this.x=X((e-t.x)*(e-t.x)+(n-t.y)*(n-t.y)),this.y=o(t.theta(new p(e,n))),this},toString:function(){return this.x+"@"+this.y},serialize:function(){return this.x+","+this.y},update:function(t,e){return Object(t)===t&&(e=t.y,t=t.x),this.x=t||0,this.y=e||0,this},vectorAngle:function(t){return new p(0,0).angleBetween(this,t)}},p.prototype.translate=p.prototype.offset;var et=p;let{max:nt,min:it}=Math,d=function(t,e){return this instanceof d?t instanceof d?new d(t.start,t.end):(this.start=new p(t),void(this.end=new p(e))):new d(t,e)};d.prototype={type:h.Line,angle:function(){var t=new p(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,t)},bbox:function(){var t=it(this.start.x,this.end.x),e=it(this.start.y,this.end.y),n=nt(this.start.x,this.end.x),i=nt(this.start.y,this.end.y);return new A(t,e,n-t,i-e)},bearing:function(){return e(this.start,this.end)},clone:function(){return new d(this.start,this.end)},closestPoint:function(t){return this.pointAt(this.closestPointNormalizedLength(t))},closestPointLength:function(t){return this.closestPointNormalizedLength(t)*this.length()},closestPointNormalizedLength:function(t){t=this.vector().dot(new d(this.start,t).vector()),t=it(1,nt(0,t/this.squaredLength()));return t!=t?0:t},closestPointTangent:function(t){return this.tangentAt(this.closestPointNormalizedLength(t))},containsPoint:function(t){var e,n=this.start,i=this.end;return 0===n.cross(t,i)&&(e=this.length(),!(new d(n,t).length()>e||new d(t,i).length()>e))},divideAt:function(t){t=this.pointAt(t);return[new d(this.start,t),new d(t,this.end)]},divideAtLength:function(t){t=this.pointAtLength(t);return[new d(this.start,t),new d(t,this.end)]},equals:function(t){return!!t&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.end.x===t.end.x&&this.end.y===t.end.y},intersect:function(t,e){return t&&t.intersectionWithLine?(e=t.intersectionWithLine(this,e))&&t instanceof d?e[0]:e:null},intersectionWithLine:function(t){var e=new p(this.end.x-this.start.x,this.end.y-this.start.y),n=new p(t.end.x-t.start.x,t.end.y-t.start.y),i=e.x*n.y-e.y*n.x,t=new p(t.start.x-this.start.x,t.start.y-this.start.y),n=t.x*n.y-t.y*n.x,t=t.x*e.y-t.y*e.x;if(0==i||n*i<0||t*i<0)return null;if(0<i){if(i<n||i<t)return null}else if(n<i||t<i)return null;return[new p(this.start.x+n*e.x/i,this.start.y+n*e.y/i)]},isDifferentiable:function(){return!this.start.equals(this.end)},length:function(){return B(this.start,this.end)},midpoint:function(){return new p((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)},parallel:function(t){var e,n,i,r,s=this.clone();return this.isDifferentiable()&&({start:e,end:n}=s,i=e.clone().rotate(n,270),r=n.clone().rotate(e,90),e.move(r,t),n.move(i,t)),s},pointAt:function(t){var e=this.start,n=this.end;return t<=0?e.clone():1<=t?n.clone():e.lerp(n,t)},pointAtLength:function(t){var e=this.start,n=this.end,i=!0,r=(t<0&&(i=!1,t=-t),this.length());return r<=t?(i?n:e).clone():this.pointAt((i?t:r-t)/r)},pointOffset:function(t){t=new p(t);var e=this.start,n=this.end;return((n.x-e.x)*(t.y-e.y)-(n.y-e.y)*(t.x-e.x))/this.length()},rotate:function(t,e){return this.start.rotate(t,e),this.end.rotate(t,e),this},round:function(t){return this.start.round(t),this.end.round(t),this},scale:function(t,e,n){return this.start.scale(t,e,n),this.end.scale(t,e,n),this},setLength:function(t){var e=this.length();return e?this.scale(t=t/e,t,this.start):this},squaredLength:function(){return W(this.start,this.end)},tangentAt:function(t){var e,n;return this.isDifferentiable()?(e=this.start,n=this.end,t=this.pointAt(t),(n=new d(e,n)).translate(t.x-e.x,t.y-e.y),n):null},tangentAtLength:function(t){var e,n;return this.isDifferentiable()?(e=this.start,n=this.end,t=this.pointAtLength(t),(n=new d(e,n)).translate(t.x-e.x,t.y-e.y),n):null},toString:function(){return this.start.toString()+" "+this.end.toString()},serialize:function(){return this.start.serialize()+" "+this.end.serialize()},translate:function(t,e){return this.start.translate(t,e),this.end.translate(t,e),this},vector:function(){return new p(this.end.x-this.start.x,this.end.y-this.start.y)}},d.prototype.intersection=d.prototype.intersect;var rt=d;function c(t,e,n){return this instanceof c?t instanceof c?new c(new p(t.x,t.y),t.a,t.b):(t=new p(t),this.x=t.x,this.y=t.y,this.a=e,void(this.b=n)):new c(t,e,n)}let{sqrt:st,round:n,pow:ot}=Math;c.fromRect=function(t){return t=new A(t),new c(t.center(),t.width/2,t.height/2)},c.prototype={type:h.Ellipse,bbox:function(){return new A(this.x-this.a,this.y-this.b,2*this.a,2*this.b)},center:function(){return new p(this.x,this.y)},clone:function(){return new c(this)},containsPoint:function(t){return this.normalizedDistance(t)<=1},equals:function(t){return!!t&&t.x===this.x&&t.y===this.y&&t.a===this.a&&t.b===this.b},inflate:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.a+=2*t,this.b+=2*e,this},intersectionWithLine:function(t){var e=[],n=t.start,i=t.end,r=this.a,s=this.b,t=t.vector(),o=n.difference(new p(this)),a=new p(t.x/(r*r),t.y/(s*s)),r=new p(o.x/(r*r),o.y/(s*s)),s=t.dot(a),a=t.dot(r),t=a*a-s*(o.dot(r)-1);if(t<0)return null;if(0<t){o=st(t),r=(-a-o)/s,t=(-a+o)/s;if((r<0||1<r)&&(t<0||1<t))return null;0<=r&&r<=1&&e.push(n.lerp(i,r)),0<=t&&t<=1&&e.push(n.lerp(i,t))}else{o=-a/s;if(!(0<=o&&o<=1))return null;e.push(n.lerp(i,o))}return e},intersectionWithLineFromCenterToPoint:function(t,e){t=new p(t),e&&t.rotate(new p(this.x,this.y),e);var n,i,r,s=t.x-this.x,o=t.y-this.y;return r=0==s?this.bbox().pointNearestToPoint(t):(o=(t=o/s)*t,i=this.a*this.a,n=this.b*this.b,i=st(1/(1/i+o/n)),o=t*(i=s<0?-i:i),new p(this.x+i,this.y+o)),e?r.rotate(new p(this.x,this.y),-e):r},normalizedDistance:function(t){var e=t.x,t=t.y,n=this.a,i=this.b,r=this.x,s=this.y;return(e-r)*(e-r)/(n*n)+(t-s)*(t-s)/(i*i)},round:function(t){let e=1;if(t)switch(t){case 1:e=10;break;case 2:e=100;break;case 3:e=1e3;break;default:e=ot(10,t)}return this.x=n(this.x*e)/e,this.y=n(this.y*e)/e,this.a=n(this.a*e)/e,this.b=n(this.b*e)/e,this},tangentTheta:function(t){var e,n,i=t.x,r=t.y,s=this.a,o=this.b,a=this.bbox().center(),h=a.x,u=a.y;return a.x+s/2<i||i<a.x-s/2?n=s*s/(i-h)-s*s*(r-u)*((e=i>a.x?r-30:r+30)-u)/(o*o*(i-h))+h:e=o*o/(r-u)-o*o*(i-h)*((n=r>a.y?i+30:i-30)-h)/(s*s*(r-u))+u,new p(n,e).theta(t)},toString:function(){return new p(this.x,this.y).toString()+" "+this.a+" "+this.b}};var at=c;let{abs:ht,cos:ut,sin:ct,min:f,max:lt,round:i,pow:ft}=Math,A=function(t,e,n,i){if(!(this instanceof A))return new A(t,e,n,i);Object(t)===t&&(e=t.y,n=t.width,i=t.height,t=t.x),this.x=void 0===t?0:t,this.y=void 0===e?0:e,this.width=void 0===n?0:n,this.height=void 0===i?0:i};A.fromEllipse=function(t){return t=new c(t),new A(t.x-t.a,t.y-t.b,2*t.a,2*t.b)},A.fromPointUnion=function(){if(0===arguments.length)return null;var e=new p;let n,i,r,s;n=i=1/0,r=s=-1/0;for(let t=0;t<arguments.length;t++){e.update(t<0||arguments.length<=t?void 0:arguments[t]);var o=e.x,a=e.y;o<n&&(n=o),o>r&&(r=o),a<i&&(i=a),a>s&&(s=a)}return new A(n,i,r-n,s-i)},A.fromRectUnion=function(){if(0===arguments.length)return null;var e=new A;let n,i,r,s;n=i=1/0,r=s=-1/0;for(let t=0;t<arguments.length;t++){e.update(t<0||arguments.length<=t?void 0:arguments[t]);var o=e.x,a=e.y,h=o+e.width,u=a+e.height;o<n&&(n=o),h>r&&(r=h),a<i&&(i=a),u>s&&(s=u)}return new A(n,i,r-n,s-i)},A.prototype={type:h.Rect,bbox:function(t){return this.clone().rotateAroundCenter(t)},rotateAroundCenter:function(t){var e,n,i,r;return t&&({width:i,height:e}=this,t=o(t),r=i*(n=ht(ct(t)))+e*(t=ht(ut(t))),this.x+=(i-(i=i*t+e*n))/2,this.y+=(e-r)/2,this.width=i,this.height=r),this},bottomLeft:function(){return new p(this.x,this.y+this.height)},bottomLine:function(){return new d(this.bottomLeft(),this.bottomRight())},bottomMiddle:function(){return new p(this.x+this.width/2,this.y+this.height)},center:function(){return new p(this.x+this.width/2,this.y+this.height/2)},clone:function(){return new A(this)},containsPoint:function(t,e){let n,i;return t&&"string"!=typeof t?{x:n=0,y:i=0}=t:{x:n,y:i}=new p(t),e&&e.strict?n>this.x&&n<this.x+this.width&&i>this.y&&i<this.y+this.height:n>=this.x&&n<=this.x+this.width&&i>=this.y&&i<=this.y+this.height},containsRect:function(t){var e,n,i=new A(this).normalize(),t=new A(t).normalize(),r=i.width,s=i.height,o=t.width,a=t.height;return!!(r&&s&&o&&a)&&(e=i.x,i=i.y,o+=n=t.x,r+=e,a+=t=t.y,s+=i,e<=n)&&o<=r&&i<=t&&a<=s},corner:function(){return new p(this.x+this.width,this.y+this.height)},equals:function(t){var e=new A(this).normalize(),t=new A(t).normalize();return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height},inflate:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},intersect:function(t){var e,n=this.origin(),i=this.corner(),r=t.origin(),t=t.corner();return t.x<=n.x||t.y<=n.y||r.x>=i.x||r.y>=i.y?null:(e=lt(n.x,r.x),n=lt(n.y,r.y),new A(e,n,f(i.x,t.x)-e,f(i.y,t.y)-n))},intersectionWithLine:function(t){for(var e,n=[this.topLine(),this.rightLine(),this.bottomLine(),this.leftLine()],i=[],r=[],s=n.length,o=0;o<s;o++)null!==(e=t.intersect(n[o]))&&r.indexOf(e.toString())<0&&(i.push(e),r.push(e.toString()));return 0<i.length?i:null},intersectionWithLineFromCenterToPoint:function(t,e){t=new p(t);for(var n,i=new p(this.x+this.width/2,this.y+this.height/2),r=(e&&t.rotate(i,e),[this.topLine(),this.rightLine(),this.bottomLine(),this.leftLine()]),s=new d(i,t),o=r.length-1;0<=o;--o){var a=r[o].intersection(s);if(null!==a){n=a;break}}return n&&e&&n.rotate(i,-e),n},leftLine:function(){return new d(this.topLeft(),this.bottomLeft())},leftMiddle:function(){return new p(this.x,this.y+this.height/2)},maxRectScaleToFit:function(t,e){t=new A(t);var n,i,r,s,o,a,h,u=(e=e||t.center()).x,e=e.y,c=n=i=r=s=o=a=h=1/0,l=t.topLeft(),l=(l.x<u&&(c=(this.x-u)/(l.x-u)),l.y<e&&(s=(this.y-e)/(l.y-e)),t.bottomRight()),l=(l.x>u&&(n=(this.x+this.width-u)/(l.x-u)),e<l.y&&(o=(this.y+this.height-e)/(l.y-e)),t.topRight()),l=(l.x>u&&(i=(this.x+this.width-u)/(l.x-u)),l.y<e&&(a=(this.y-e)/(l.y-e)),t.bottomLeft());return l.x<u&&(r=(this.x-u)/(l.x-u)),e<l.y&&(h=(this.y+this.height-e)/(l.y-e)),{sx:f(c,n,i,r),sy:f(s,o,a,h)}},maxRectUniformScaleToFit:function(t,e){t=this.maxRectScaleToFit(t,e);return f(t.sx,t.sy)},moveAndExpand:function(t){return this.x+=t.x||0,this.y+=t.y||0,this.width+=t.width||0,this.height+=t.height||0,this},normalize:function(){var t=this.x,e=this.y,n=this.width,i=this.height;return this.width<0&&(t=this.x+this.width,n=-this.width),this.height<0&&(e=this.y+this.height,i=-this.height),this.x=t,this.y=e,this.width=n,this.height=i,this},offset:function(t,e){return p.prototype.offset.call(this,t,e)},origin:function(){return new p(this.x,this.y)},pointNearestToPoint:function(t){if(t=new p(t),this.containsPoint(t))switch(this.sideNearestToPoint(t)){case"right":return new p(this.x+this.width,t.y);case"left":return new p(this.x,t.y);case"bottom":return new p(t.x,this.y+this.height);case"top":return new p(t.x,this.y)}return t.adhereToRect(this)},rightLine:function(){return new d(this.topRight(),this.bottomRight())},rightMiddle:function(){return new p(this.x+this.width,this.y+this.height/2)},round:function(t){let e=1;if(t)switch(t){case 1:e=10;break;case 2:e=100;break;case 3:e=1e3;break;default:e=ft(10,t)}return this.x=i(this.x*e)/e,this.y=i(this.y*e)/e,this.width=i(this.width*e)/e,this.height=i(this.height*e)/e,this},scale:function(t,e,n){return n=this.origin().scale(t,e,n),this.x=n.x,this.y=n.y,this.width*=t,this.height*=e,this},sideNearestToPoint:function(t){var e=(t=new p(t)).x-this.x,n=this.x+this.width-t.x,i=t.y-this.y,r="left";return n<e&&(e=n,r="right"),i<e&&(e=i,r="top"),r=this.y+this.height-t.y<e?"bottom":r},snapToGrid:function(t,e){var n=this.origin().snapToGrid(t,e),t=this.corner().snapToGrid(t,e);return this.x=n.x,this.y=n.y,this.width=t.x-n.x,this.height=t.y-n.y,this},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},topLine:function(){return new d(this.topLeft(),this.topRight())},topMiddle:function(){return new p(this.x+this.width/2,this.y)},topRight:function(){return new p(this.x+this.width,this.y)},toString:function(){return this.origin().toString()+" "+this.corner().toString()},union:function(t){return A.fromRectUnion(this,t)},update:function(t,e,n,i){return Object(t)===t&&(e=t.y,n=t.width,i=t.height,t=t.x),this.x=t||0,this.y=e||0,this.width=n||0,this.height=i||0,this}},A.prototype.bottomRight=A.prototype.corner,A.prototype.topLeft=A.prototype.origin,A.prototype.translate=A.prototype.offset;var dt=A;function gt(t){t=t.trim();if(""===t)return[];var e=[],n=t.split(/\b\s*,\s*|,\s*|\s+/),i=n.length;for(let t=0;t<i;t+=2)e.push({x:+n[t],y:+n[t+1]});return e}function pt(e){var n=e.length;if(0===n)return[];var i=[];for(let t=0;t<n;t++){var r=e[t].clone();i.push(r)}return i}function vt(t){var e,n=Math.abs,i=t.length;if(0===i)return[];for(s=0;s<i;s++)(void 0===e||t[s].y<e.y||t[s].y===e.y&&t[s].x>e.x)&&(e=t[s]);for(var r=[],s=0;s<i;s++){var o=e.theta(t[s]),o=(0===o&&(o=360),[t[s],s,o]);r.push(o)}r.sort(function(t,e){var n=t[2]-e[2];return n=0===n?e[1]-t[1]:n}),2<r.length&&r.unshift(r[r.length-1]);for(var a,h,u,c={},l=[];0!==r.length;)if(h=(a=r.pop())[0],!c.hasOwnProperty(a[0]+"@@"+a[1]))for(var f,d,g,p,v,m=!1;!m;)l.length<2?(l.push(a),m=!0):(d=(f=l.pop())[0],(v=(p=(g=l.pop())[0]).cross(d,h))<0?(l.push(g),l.push(f),l.push(a),m=!0):0!==v||n((v=d.angleBetween(p,h))-180)<1e-10||d.equals(h)||p.equals(d)?(c[f[0]+"@@"+f[1]]=d,l.push(g)):n((v+1)%360-1)<1e-10&&(l.push(g),r.push(f)));2<l.length&&l.pop();var y=-1,x=l.length;for(s=0;s<x;s++){var w=l[s][1];(void 0===u||w<u)&&(u=w,y=s)}var b,S,P=[],A=[];for(x=(P=0<y?(b=l.slice(y),S=l.slice(0,y),b.concat(S)):l).length,s=0;s<x;s++)A.push(P[s][0]);return A}function l(t){return this instanceof l?"string"==typeof t?new l.parse(t):void(this.points=Array.isArray(t)?t.map(p):[]):new l(t)}function m(t,e,n,i){return this instanceof m?t instanceof m?new m(t.start,t.controlPoint1,t.controlPoint2,t.end):(this.start=new p(t),this.controlPoint1=new p(e),this.controlPoint2=new p(n),void(this.end=new p(i))):new m(t,e,n,i)}l.parse=function(t){return new l(gt(t))},l.fromRect=function(t){return new l([t.topLeft(),t.topRight(),t.bottomRight(),t.bottomLeft(),t.topLeft()])},l.prototype={type:h.Polyline,bbox:function(){var t=1/0,e=-1/0,n=1/0,i=-1/0,r=this.points,s=r.length;if(0===s)return null;for(var o=0;o<s;o++){var a=r[o],h=a.x,a=a.y;h<t&&(t=h),e<h&&(e=h),a<n&&(n=a),i<a&&(i=a)}return new A(t,n,e-t,i-n)},clone:function(){return new l(pt(this.points))},closestPoint:function(t){t=this.closestPointLength(t);return this.pointAtLength(t)},closestPointLength:function(t){var e,n=this.lengthPoints(),i=n.length;if(0===i)return 0;if(1===i)return 0;for(var r=1/0,s=0,o=i-1,a=0;a<o;a++){var h=new d(n[a],n[a+1]),u=h.length(),c=h.closestPointNormalizedLength(t),h=h.pointAt(c).squaredDistance(t);h<r&&(r=h,e=s+c*u),s+=u}return e},closestPointNormalizedLength:function(t){var e,t=this.closestPointLength(t);return 0===t||0===(e=this.length())?0:t/e},closestPointTangent:function(t){t=this.closestPointLength(t);return this.tangentAtLength(t)},containsPoint:function(t){var e=this.points,n=e.length;if(0===n)return!1;for(var i=t.x,r=t.y,s=n-1,o=0,a=0,h=new d,u=new d,c=new p;o<n;o++){var l=e[s],f=e[o];if(t.equals(l))return!0;if(h.start=l,h.end=f,h.containsPoint(t))return!0;(r<=l.y&&r>f.y||r>l.y&&r<=f.y)&&0<=(l=l.x-i>f.x-i?l.x-i:f.x-i)&&(c.x=i+l,c.y=r,u.start=t,u.end=c,h.intersect(u))&&a++,s=o}return a%2==1},close:function(){var{start:t,end:e,points:n}=this;return t&&e&&!t.equals(e)&&n.push(t.clone()),this},lengthPoints:function(){return this.points},convexHull:function(){return new l(vt(this.points))},equals:function(t){if(!t)return!1;var e=this.points,n=t.points,i=e.length;if(n.length!==i)return!1;for(var r=0;r<i;r++){var s=e[r],o=t.points[r];if(!s.equals(o))return!1}return!0},intersectionWithLine:function(t){for(var e=new d(t),n=[],i=this.lengthPoints(),r=new d,s=0,o=i.length-1;s<o;s++){r.start=i[s],r.end=i[s+1];var a=e.intersectionWithLine(r);a&&n.push(a[0])}return 0<n.length?n:null},isDifferentiable:function(){var t=this.points,e=t.length;if(0!==e)for(var n=new d,i=e-1,r=0;r<i;r++)if(n.start=t[r],n.end=t[r+1],n.isDifferentiable())return!0;return!1},length:function(){var t=this.lengthPoints(),e=t.length;if(0===e)return 0;for(var n=0,i=e-1,r=0;r<i;r++)n+=t[r].distance(t[r+1]);return n},pointAt:function(t){var e=this.lengthPoints(),n=e.length;return 0===n?null:1===n||t<=0?e[0].clone():1<=t?e[n-1].clone():(e=this.length(),this.pointAtLength(e*t))},pointAtLength:function(t){var e=this.lengthPoints(),n=e.length;if(0===n)return null;if(1===n)return e[0].clone();for(var i=!0,r=(t<0&&(i=!1,t=-t),0),s=n-1,o=0;o<s;o++){var a=i?o:s-1-o,h=e[a],a=e[a+1],u=new d(h,a),h=h.distance(a);if(t<=r+h)return u.pointAtLength((i?1:-1)*(t-r));r+=h}return(i?e[n-1]:e[0]).clone()},round:function(t){for(var e=this.points,n=e.length,i=0;i<n;i++)e[i].round(t);return this},scale:function(t,e,n){for(var i=this.points,r=i.length,s=0;s<r;s++)i[s].scale(t,e,n);return this},simplify:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=this.points;if(!(n.length<3)){var i=e.threshold||1e-10;let t=0;for(;n[t+2];){var r=t,s=t+1,o=t+2,r=n[r],a=n[s],o=n[o];new d(r,o).closestPoint(a).distance(a)<=i?n.splice(s,1):t+=1}}return this},tangentAt:function(t){var e=this.lengthPoints().length;if(0===e)return null;if(1===e)return null;1<(t=t<0?0:t)&&(t=1);e=this.length();return this.tangentAtLength(e*t)},tangentAtLength:function(t){var e=this.lengthPoints(),n=e.length;if(0===n)return null;if(1===n)return null;for(var i,r=!0,s=(t<0&&(r=!1,t=-t),0),o=n-1,a=0;a<o;a++){var h=r?a:o-1-a,u=e[h],h=e[h+1],c=new d(u,h),u=u.distance(h);if(c.isDifferentiable()){if(t<=s+u)return c.tangentAtLength((r?1:-1)*(t-s));i=c}s+=u}return i?i.tangentAt(r?1:0):null},toString:function(){return this.points+""},translate:function(t,e){for(var n=this.points,i=n.length,r=0;r<i;r++)n[r].translate(t,e);return this},serialize:function(){var t=this.points,e=t.length;if(0===e)return"";for(var n="",i=0;i<e;i++){var r=t[i];n+=r.x+","+r.y+" "}return n.trim()}},Object.defineProperty(l.prototype,"start",{configurable:!0,enumerable:!0,get:function(){return 0===this.points.length?null:this.points[0]}}),Object.defineProperty(l.prototype,"end",{configurable:!0,enumerable:!0,get:function(){var t=this.points.length;return 0===t?null:this.points[t-1]}});let{abs:T,sqrt:mt,min:yt,max:xt,pow:wt}=Math;function bt(t){var e=t.length,n=[],i=[],r=2;n[0]=t[0]/r;for(var s=1;s<e;s++)i[s]=1/r,n[s]=(t[s]-n[s-1])/(r=(s<e-1?4:3.5)-i[s]);for(s=1;s<e;s++)n[e-s-1]-=i[e-s]*n[e-s];return n}function t(t){for(var e=[],n=arguments.length,i=1;i<n;i++)e.push(arguments[i]);if(!t)throw new Error("Missing a parent object.");var r=Object.create(t);for(n=e.length,i=0;i<n;i++){var s,o,a=e[i];for(o in a)a.hasOwnProperty(o)&&(delete r[o],s=Object.getOwnPropertyDescriptor(a,o),Object.defineProperty(r,o,s))}return r}m.throughPoints=function(t){if(!t||Array.isArray(t)&&t.length<2)throw new Error("At least 2 points are required");for(var e=(t=>{var e=[],n=[],i=t.length-1;if(1==i)e[0]=new p((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),n[0]=new p(2*e[0].x-t[0].x,2*e[0].y-t[0].y);else{for(var r=[],s=1;s<i-1;s++)r[s]=4*t[s].x+2*t[s+1].x;r[0]=t[0].x+2*t[1].x,r[i-1]=(8*t[i-1].x+t[i].x)/2;var o=bt(r);for(s=1;s<i-1;++s)r[s]=4*t[s].y+2*t[s+1].y;r[0]=t[0].y+2*t[1].y,r[i-1]=(8*t[i-1].y+t[i].y)/2;var a=bt(r);for(s=0;s<i;s++)e.push(new p(o[s],a[s])),n.push(s<i-1?new p(2*t[s+1].x-o[s+1],2*t[s+1].y-a[s+1]):new p((t[i].x+o[i-1])/2,(t[i].y+a[i-1])/2))}return[e,n]})(t),n=[],i=e[0].length,r=0;r<i;r++){var s=new p(e[0][r].x,e[0][r].y),o=new p(e[1][r].x,e[1][r].y);n.push(new m(t[r],s,o,t[r+1]))}return n},m.prototype={type:h.Curve,bbox:function(){for(var t,e,n,i,r,s=this.start,o=this.controlPoint1,a=this.controlPoint2,h=this.end,u=s.x,c=s.y,l=o.x,f=o.y,d=a.x,g=a.y,p=h.x,v=h.y,m=new Array,y=new Array,x=[new Array,new Array],w=0;w<2;++w)i=0===w?(e=6*u-12*l+6*d,t=-3*u+9*l-9*d+3*p,3*l-3*u):(e=6*c-12*f+6*g,t=-3*c+9*f-9*g+3*v,3*f-3*c),T(t)<1e-12?T(e)<1e-12||0<(n=-i/e)&&n<1&&y.push(n):(i=e*e-4*i*t,r=mt(i),i<0||(0<(i=(-e+r)/(2*t))&&i<1&&y.push(i),0<(i=(-e-r)/(2*t))&&i<1&&y.push(i)));for(var b,S,P=y.length,s=P;P--;)n=y[P],x[0][P]=b=(S=1-n)*S*S*u+3*S*S*n*l+3*S*n*n*d+n*n*n*p,x[1][P]=S=S*S*S*c+3*S*S*n*f+3*S*n*n*g+n*n*n*v,m[P]={X:b,Y:S};y[s]=0,y[s+1]=1,m[s]={X:u,Y:c},m[s+1]={X:p,Y:v},x[0][s]=u,x[1][s]=c,x[0][s+1]=p,x[1][s+1]=v,y.length=s+2,x[0].length=s+2,x[1].length=s+2,m.length=s+2;o=yt.apply(null,x[0]),a=yt.apply(null,x[1]),h=xt.apply(null,x[0]),s=xt.apply(null,x[1]);return new A(o,a,h-o,s-a)},clone:function(){return new m(this.start,this.controlPoint1,this.controlPoint2,this.end)},closestPoint:function(t,e){return this.pointAtT(this.closestPointT(t,e))},closestPointLength:function(t,e){var n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,n={precision:n,subdivisions:void 0===e.subdivisions?this.getSubdivisions({precision:n}):e.subdivisions};return this.lengthAtT(this.closestPointT(t,n),n)},closestPointNormalizedLength:function(t,e){var n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,n={precision:n,subdivisions:void 0===e.subdivisions?this.getSubdivisions({precision:n}):e.subdivisions},e=this.closestPointLength(t,n);return!e||0===(t=this.length(n))?0:e/t},closestPointT:function(t,e){for(var n,i,r,s,o,a,h=void 0===(e=e||{}).precision?this.PRECISION:e.precision,u=void 0===e.subdivisions?this.getSubdivisions({precision:h}):e.subdivisions,c=u.length,l=c?1/c:0,f=0;f<c;f++){var d=u[f],g=d.start.distance(t),p=d.end.distance(t),v=g+p;(!a||v<a)&&(i=f*l,r=(f+1)*l,s=g,A=p,o=(n=d).start.distance(d.end),a=v)}for(var m=wt(10,-h);;){var y=s?T(s-A)/s:0,x=A?T(s-A)/A:0;if(y<m||x<m||(!s||s<o*m||(!A||A<o*m)))return s<=A?i:r;var y=n.divide(.5),x=(l/=2,y[0].start.distance(t)),w=y[0].end.distance(t),b=x+w,S=y[1].start.distance(t),P=y[1].end.distance(t),A=b<=S+P?(n=y[0],r-=l,s=x,w):(n=y[1],i+=l,s=S,P)}},closestPointTangent:function(t,e){return this.tangentAtT(this.closestPointT(t,e))},containsPoint:function(t,e){return this.toPolyline(e).containsPoint(t)},divideAt:function(t,e){return t<=0?this.divideAtT(0):1<=t?this.divideAtT(1):(t=this.tAt(t,e),this.divideAtT(t))},divideAtLength:function(t,e){t=this.tAtLength(t,e);return this.divideAtT(t)},divideAtT:function(t){var e,n,i=this.start,r=this.controlPoint1,s=this.controlPoint2,o=this.end;return t<=0?[new m(i,i,i,i),new m(i,r,s,o)]:1<=t?[new m(i,r,s,o),new m(o,o,o,o)]:(s=(r=this.getSkeletonPoints(t)).startControlPoint1,t=r.startControlPoint2,e=r.divider,n=r.dividerControlPoint1,r=r.dividerControlPoint2,[new m(i,s,t,e),new m(e,n,r,o)])},endpointDistance:function(){return this.start.distance(this.end)},equals:function(t){return!!t&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.controlPoint1.x===t.controlPoint1.x&&this.controlPoint1.y===t.controlPoint1.y&&this.controlPoint2.x===t.controlPoint2.x&&this.controlPoint2.y===t.controlPoint2.y&&this.end.x===t.end.x&&this.end.y===t.end.y},getSkeletonPoints:function(t){var e=this.start,n=this.controlPoint1,i=this.controlPoint2,r=this.end;return t<=0?{startControlPoint1:e.clone(),startControlPoint2:e.clone(),divider:e.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:i.clone()}:1<=t?{startControlPoint1:n.clone(),startControlPoint2:i.clone(),divider:r.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:r.clone()}:(e=new d(e,n).pointAt(t),n=new d(n,i).pointAt(t),i=new d(i,r).pointAt(t),r=new d(e,n).pointAt(t),n=new d(n,i).pointAt(t),{startControlPoint1:e,startControlPoint2:r,divider:new d(r,n).pointAt(t),dividerControlPoint1:n,dividerControlPoint2:i})},getSubdivisions:function(t){var t=void 0===(t=t||{}).precision?this.PRECISION:t.precision,e=this.start,n=this.controlPoint1,i=this.controlPoint2,r=this.end,s=[new m(e,n,i,r)];if(0===t)return s;if(!this.isDifferentiable())return s;for(var o=this.endpointDistance(),a=wt(10,-t),h=2,u=(0===n.cross(e,r)&&0===i.cross(e,r)&&(h=2*t),0);;){u+=1;for(var c=[],l=s.length,f=0;f<l;f++){var d=s[f].divide(.5);c.push(d[0],d[1])}for(var g=0,p=c.length,v=0;v<p;v++)g+=c[v].endpointDistance();if(h<=u)if((0!==g?(g-o)/g:0)<a)return c;s=c,o=g}},isDifferentiable:function(){var t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(i))},length:function(t){for(var e=void 0===(t=t||{}).precision?this.PRECISION:t.precision,n=void 0===t.subdivisions?this.getSubdivisions({precision:e}):t.subdivisions,i=0,r=n.length,s=0;s<r;s++)i+=n[s].endpointDistance();return i},lengthAtT:function(t,e){return t<=0?0:(e=void 0===(e=e||{}).precision?this.PRECISION:e.precision,this.divide(t)[0].length({precision:e}))},pointAt:function(t,e){return t<=0?this.start.clone():1<=t?this.end.clone():(t=this.tAt(t,e),this.pointAtT(t))},pointAtLength:function(t,e){t=this.tAtLength(t,e);return this.pointAtT(t)},pointAtT:function(t){return t<=0?this.start.clone():1<=t?this.end.clone():this.getSkeletonPoints(t).divider},PRECISION:3,round:function(t){return this.start.round(t),this.controlPoint1.round(t),this.controlPoint2.round(t),this.end.round(t),this},scale:function(t,e,n){return this.start.scale(t,e,n),this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this},tangentAt:function(t,e){if(!this.isDifferentiable())return null;t<0?t=0:1<t&&(t=1);t=this.tAt(t,e);return this.tangentAtT(t)},tangentAtLength:function(t,e){return this.isDifferentiable()?(t=this.tAtLength(t,e),this.tangentAtT(t)):null},tangentAtT:function(t){if(!this.isDifferentiable())return null;t<0?t=0:1<t&&(t=1);var t=this.getSkeletonPoints(t),e=t.startControlPoint2,n=t.dividerControlPoint1,t=t.divider,n=new d(e,n);return n.translate(t.x-e.x,t.y-e.y),n},tAt:function(t,e){var n;return t<=0?0:1<=t?1:(n={precision:n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,subdivisions:void 0===e.subdivisions?this.getSubdivisions({precision:n}):e.subdivisions},e=this.length(n),this.tAtLength(e*t,n))},tAtLength:function(t,e){for(var n,i,r,s=!0,o=(t<0&&(s=!1,t=-t),void 0===(e=e||{}).precision?this.PRECISION:e.precision),a=void 0===e.subdivisions?this.getSubdivisions({precision:o}):e.subdivisions,e={precision:o,subdivisions:a},h=0,u=a.length,c=1/u,l=0;l<u;l++){var f=s?l:u-1-l,d=a[l],g=d.endpointDistance();if(t<=h+g){n=d,i=f*c,r=(f+1)*c,b=s?t-h:g+h-t,S=s?g+h-t:t-h;break}h+=g}if(!n)return s?1:0;for(var p=this.length(e),v=wt(10,-o);;){var m,y=0!==p?b/p:0;if(y<v)return i;if((0!==p?S/p:0)<v)return r;var y=n.divide(.5),x=(c/=2,y[0].endpointDistance()),w=y[1].endpointDistance(),y=b<=x?(n=y[0],r-=c,x-(m=b)):(n=y[1],i+=c,w-(m=b-x)),b=m,S=y}},toPoints:function(t){for(var e=void 0===(t=t||{}).precision?this.PRECISION:t.precision,n=void 0===t.subdivisions?this.getSubdivisions({precision:e}):t.subdivisions,i=[n[0].start.clone()],r=n.length,s=0;s<r;s++){var o=n[s];i.push(o.end.clone())}return i},toPolyline:function(t){return new l(this.toPoints(t))},toString:function(){return this.start+" "+this.controlPoint1+" "+this.controlPoint2+" "+this.end},translate:function(t,e){return this.start.translate(t,e),this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e),this}},m.prototype.divide=m.prototype.divideAtT;function S(t){if(!(this instanceof S))return new S(t);if("string"==typeof t)return new S.parse(t);var e;if(this.segments=[],t)if(Array.isArray(t)&&0!==t.length)if(e=(t=t.reduce(function(t,e){return t.concat(e)},[])).length,t[0].isSegment)for(r=0;r<e;r++){var n=t[r];this.appendSegment(n)}else for(var i=null,r=0;r<e;r++){var s=t[r];if(!(s instanceof d||s instanceof m))throw new Error("Cannot construct a path segment from the provided object.");0===r&&this.appendSegment(S.createSegment("M",s.start)),i&&!i.end.equals(s.start)&&this.appendSegment(S.createSegment("M",s.start)),s instanceof d?this.appendSegment(S.createSegment("L",s.end)):s instanceof m&&this.appendSegment(S.createSegment("C",s.controlPoint1,s.controlPoint2,s.end)),i=s}else if(t.isSegment)this.appendSegment(t);else if(t instanceof d)this.appendSegment(S.createSegment("M",t.start)),this.appendSegment(S.createSegment("L",t.end));else if(t instanceof m)this.appendSegment(S.createSegment("M",t.start)),this.appendSegment(S.createSegment("C",t.controlPoint1,t.controlPoint2,t.end));else{if(!(t instanceof l))throw new Error("Cannot construct a path from the provided object.");if(t.points&&0!==t.points.length)for(e=t.points.length,r=0;r<e;r++){var o=t.points[r];0===r?this.appendSegment(S.createSegment("M",o)):this.appendSegment(S.createSegment("L",o))}}}function g(t,e){return e.unshift(null),new(Function.prototype.bind.apply(t,e))}S.parse=function(t){if(!t)return new S;for(var e=new S,n=t.match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g),i=n.length,r=0;r<i;r++){var s=n[r].match(/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g),s=S.createSegment.apply(this,s);e.appendSegment(s)}return e},S.createSegment=function(t){if(!t)throw new Error("Type must be provided.");var e=S.segmentTypes[t];if(!e)throw new Error(t+" is not a recognized path segment type.");for(var n=[],i=arguments.length,r=1;r<i;r++)n.push(arguments[r]);return g(e,n)},S.prototype={type:h.Path,appendSegment:function(t){var e=this.segments,n=e.length,i=0!==n?e[n-1]:null;if(Array.isArray(t)){if(!(t=t.reduce(function(t,e){return t.concat(e)},[]))[0].isSegment)throw new Error("Segments required.");for(var r=t.length,s=0;s<r;s++){var o=t[s],a=this.prepareSegment(o,i,null);e.push(a),i=a}}else{if(!t||!t.isSegment)throw new Error("Segment required.");a=this.prepareSegment(t,i,null),e.push(a)}},bbox:function(){var t=this.segments,e=t.length;if(0===e)return null;for(var n,i=0;i<e;i++){var r,s=t[i];s.isVisible&&(s=s.bbox(),r=r?r.union(s):s)}return r||(n=t[e-1],new A(n.end.x,n.end.y,0,0))},clone:function(){for(var t=this.segments,e=t.length,n=new S,i=0;i<e;i++){var r=t[i].clone();n.appendSegment(r)}return n},closestPoint:function(t,e){t=this.closestPointT(t,e);return t?this.pointAtT(t):null},closestPointLength:function(t,e){var n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,n={precision:n,segmentSubdivisions:void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:n}):e.segmentSubdivisions},e=this.closestPointT(t,n);return e?this.lengthAtT(e,n):0},closestPointNormalizedLength:function(t,e){var n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,n={precision:n,segmentSubdivisions:void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:n}):e.segmentSubdivisions},e=this.closestPointLength(t,n);return 0===e||0===(t=this.length(n))?0:e/t},closestPointT:function(t,e){var n=this.segments,i=n.length;if(0===i)return null;for(var r,s=void 0===(e=e||{}).precision?this.PRECISION:e.precision,o=void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):e.segmentSubdivisions,a=1/0,h=0;h<i;h++){var u=n[h],c=o[h];u.isVisible&&(c=u.closestPointT(t,{precision:s,subdivisions:c}),u=u.pointAtT(c),(u=new d(u,t).squaredLength())<a)&&(r={segmentIndex:h,value:c},a=u)}return r||{segmentIndex:i-1,value:1}},closestPointTangent:function(t,e){var n=this.segments,i=n.length;if(0===i)return null;for(var r,s=void 0===(e=e||{}).precision?this.PRECISION:e.precision,o=void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):e.segmentSubdivisions,a=1/0,h=0;h<i;h++){var u,c=n[h],l=o[h];c.isDifferentiable()&&(l=c.closestPointT(t,{precision:s,subdivisions:l}),u=c.pointAtT(l),(u=new d(u,t).squaredLength())<a)&&(r=c.tangentAtT(l),a=u)}return r||null},containsPoint:function(t,e){var n=this.toPolylines(e);if(!n)return!1;for(var i=n.length,r=0,s=0;s<i;s++)n[s].containsPoint(t)&&r++;return r%2==1},divideAt:function(t,e){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,n={precision:n,segmentSubdivisions:void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:n}):e.segmentSubdivisions},e=this.length(n);return this.divideAtLength(e*t,n)},divideAtLength:function(t,e){var n=this.segments.length;if(0===n)return null;for(var i,r,s,o,a=!0,h=(t<0&&(a=!1,t=-t),void 0===(e=e||{}).precision?this.PRECISION:e.precision),u=void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:h}):e.segmentSubdivisions,c=0,l=0;l<n;l++){var f=a?l:n-1-l,d=this.getSegment(f),g=u[f],p=d.length({precision:h,subdivisions:g});if(d.isDifferentiable()&&(s=d,o=f,t<=c+p)){r=f,i=d.divideAtLength((a?1:-1)*(t-c),{precision:h,subdivisions:g});break}c+=p}if(!s)return null;i||(r=o,i=s.divideAtT(a?1:0));var v=this.clone(),e=(v.replaceSegment(r,i),r),m=r+1,y=r+2,x=(i[0].isDifferentiable()||(v.removeSegment(e),--m,--y),v.getSegment(m).start),w=(v.insertSegment(m,S.createSegment("M",x)),y+=1,i[1].isDifferentiable()||(v.removeSegment(y-1),--y),y-e-1);for(l=y;l<v.segments.length;l++){var b=this.getSegment(l-w);"Z"!==(d=v.getSegment(l)).type||b.subpathStartSegment.end.equals(d.subpathStartSegment.end)||(b=S.createSegment("L",b.end),v.replaceSegment(l,b))}return[new S(v.segments.slice(0,m)),new S(v.segments.slice(m))]},equals:function(t){if(!t)return!1;var e=this.segments,n=t.segments,i=e.length;if(n.length!==i)return!1;for(var r=0;r<i;r++){var s=e[r],o=n[r];if(s.type!==o.type||!s.equals(o))return!1}return!0},getSegment:function(t){var e=this.segments,n=e.length;if(0===n)throw new Error("Path has no segments.");if(n<=(t=t<0?n+t:t)||t<0)throw new Error("Index out of range.");return e[t]},getSegmentSubdivisions:function(t){for(var e=this.segments,n=e.length,i=void 0===(t=t||{}).precision?this.PRECISION:t.precision,r=[],s=0;s<n;s++){var o=e[s].getSubdivisions({precision:i});r.push(o)}return r},getSubpaths:function(){var e=this.clone().validate().segments,n=e.length,i=[];for(let t=0;t<n;t++){var r=e[t];r.isSubpathStart?i.push(new S(r)):i[i.length-1].appendSegment(r)}return i},insertSegment:function(t,e){var n=this.segments,i=n.length;if(i<(t=t<0?i+t+1:t)||t<0)throw new Error("Index out of range.");var r=null,s=null;if(0!==i&&(s=1<=t?(r=n[t-1]).nextSegment:n[0]),Array.isArray(e)){if(!(e=e.reduce(function(t,e){return t.concat(e)},[]))[0].isSegment)throw new Error("Segments required.");for(var o=e.length,a=0;a<o;a++){var h=e[a],u=this.prepareSegment(h,r,s);n.splice(t+a,0,u),r=u}}else{if(!e||!e.isSegment)throw new Error("Segment required.");u=this.prepareSegment(e,r,s),n.splice(t,0,u)}},intersectionWithLine:function(t,e){var n=null,i=this.toPolylines(e);if(!i)return null;for(var r=0,s=i.length;r<s;r++){var o=i[r],o=t.intersect(o);o&&(n=n||[],Array.isArray(o)?Array.prototype.push.apply(n,o):n.push(o))}return n},isDifferentiable:function(){for(var t=this.segments,e=t.length,n=0;n<e;n++)if(t[n].isDifferentiable())return!0;return!1},isValid:function(){var t=this.segments;return 0===t.length||"M"===t[0].type},length:function(t){var e=this.segments,n=e.length;if(0===n)return 0;for(var i=void 0===(t=t||{}).precision?this.PRECISION:t.precision,r=void 0===t.segmentSubdivisions?this.getSegmentSubdivisions({precision:i}):t.segmentSubdivisions,s=0,o=0;o<n;o++){var a=e[o],h=r[o];s+=a.length({subdivisions:h})}return s},lengthAtT:function(t,e){var n=this.segments,i=n.length;if(0===i)return 0;var r=t.segmentIndex;if(r<0)return 0;for(var t=t.value,s=(i<=r?(r=i-1,t=1):t<0?t=0:1<t&&(t=1),void 0===(e=e||{}).precision?this.PRECISION:e.precision),o=void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):e.segmentSubdivisions,a=0,h=0;h<r;h++){var u=n[h],c=o[h];a+=u.length({precisison:s,subdivisions:c})}return c=o[r],a+=(u=n[r]).lengthAtT(t,{precisison:s,subdivisions:c})},pointAt:function(t,e){var n;return 0===this.segments.length?null:t<=0?this.start.clone():1<=t?this.end.clone():(n={precision:n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,segmentSubdivisions:void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:n}):e.segmentSubdivisions},e=this.length(n),this.pointAtLength(e*t,n))},pointAtLength:function(t,e){var n=this.segments,i=n.length;if(0===i)return null;if(0===t)return this.start.clone();for(var r,s=!0,o=(t<0&&(s=!1,t=-t),void 0===(e=e||{}).precision?this.PRECISION:e.precision),a=void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:o}):e.segmentSubdivisions,h=0,u=0;u<i;u++){var c=s?u:i-1-u,l=n[c],c=a[c],f=l.length({precision:o,subdivisions:c});if(l.isVisible){if(t<=h+f)return l.pointAtLength((s?1:-1)*(t-h),{precision:o,subdivisions:c});r=l}h+=f}return r?s?r.end:r.start:n[i-1].end.clone()},pointAtT:function(t){var e,n=this.segments,i=n.length;return 0===i?null:(e=t.segmentIndex)<0?n[0].pointAtT(0):i<=e?n[i-1].pointAtT(1):((i=t.value)<0?i=0:1<i&&(i=1),n[e].pointAtT(i))},PRECISION:3,prepareSegment:function(t,e,n){t.previousSegment=e,t.nextSegment=n,e&&(e.nextSegment=t),n&&(n.previousSegment=t);e=t;return t.isSubpathStart&&(t.subpathStartSegment=t,e=n),e&&this.updateSubpathStartSegment(e),t},removeSegment:function(t){var e=this.segments,n=e.length;if(0===n)throw new Error("Path has no segments.");if(n<=(t=t<0?n+t:t)||t<0)throw new Error("Index out of range.");n=e.splice(t,1)[0],e=n.previousSegment,t=n.nextSegment;e&&(e.nextSegment=t),t&&(t.previousSegment=e),n.isSubpathStart&&t&&this.updateSubpathStartSegment(t)},replaceSegment:function(t,e){var n=this.segments,i=n.length;if(0===i)throw new Error("Path has no segments.");if(i<=(t=t<0?i+t:t)||t<0)throw new Error("Index out of range.");var i=n[t],r=i.previousSegment,s=i.nextSegment,o=i.isSubpathStart;if(Array.isArray(e)){if(!(e=e.reduce(function(t,e){return t.concat(e)},[]))[0].isSegment)throw new Error("Segments required.");n.splice(t,1);for(var a=e.length,h=0;h<a;h++){var u=e[h],c=this.prepareSegment(u,r,s);n.splice(t+h,0,c),r=c,o&&c.isSubpathStart&&(o=!1)}}else{if(!e||!e.isSegment)throw new Error("Segment required.");c=this.prepareSegment(e,r,s),n.splice(t,1,c),o&&c.isSubpathStart&&(o=!1)}o&&s&&this.updateSubpathStartSegment(s)},round:function(t){for(var e=this.segments,n=e.length,i=0;i<n;i++)e[i].round(t);return this},scale:function(t,e,n){for(var i=this.segments,r=i.length,s=0;s<r;s++)i[s].scale(t,e,n);return this},segmentAt:function(t,e){t=this.segmentIndexAt(t,e);return t?this.getSegment(t):null},segmentAtLength:function(t,e){t=this.segmentIndexAtLength(t,e);return t?this.getSegment(t):null},segmentIndexAt:function(t,e){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,n={precision:n,segmentSubdivisions:void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:n}):e.segmentSubdivisions},e=this.length(n);return this.segmentIndexAtLength(e*t,n)},segmentIndexAtLength:function(t,e){var n=this.segments,i=n.length;if(0===i)return null;for(var r=!0,s=(t<0&&(r=!1,t=-t),void 0===(e=e||{}).precision?this.PRECISION:e.precision),o=void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):e.segmentSubdivisions,a=null,h=0,u=0;u<i;u++){var c=r?u:i-1-u,l=n[c],f=o[c],f=l.length({precision:s,subdivisions:f});if(l.isVisible){if(t<=h+f)return c;a=c}h+=f}return a},serialize:function(){if(this.isValid())return this.toString();throw new Error("Invalid path segments.")},tangentAt:function(t,e){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var n=void 0===(e=e||{}).precision?this.PRECISION:e.precision,n={precision:n,segmentSubdivisions:void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:n}):e.segmentSubdivisions},e=this.length(n);return this.tangentAtLength(e*t,n)},tangentAtLength:function(t,e){var n=this.segments,i=n.length;if(0===i)return null;for(var r,s=!0,o=(t<0&&(s=!1,t=-t),void 0===(e=e||{}).precision?this.PRECISION:e.precision),a=void 0===e.segmentSubdivisions?this.getSegmentSubdivisions({precision:o}):e.segmentSubdivisions,h=0,u=0;u<i;u++){var c=s?u:i-1-u,l=n[c],c=a[c],f=l.length({precision:o,subdivisions:c});if(l.isDifferentiable()){if(t<=h+f)return l.tangentAtLength((s?1:-1)*(t-h),{precision:o,subdivisions:c});r=l}h+=f}return r?r.tangentAtT(s?1:0):null},tangentAtT:function(t){var e,n=this.segments,i=n.length;return 0===i?null:(e=t.segmentIndex)<0?n[0].tangentAtT(0):i<=e?n[i-1].tangentAtT(1):((i=t.value)<0?i=0:1<i&&(i=1),n[e].tangentAtT(i))},toPoints:function(t){var e=this.segments,n=e.length;if(0===n)return null;for(var i=void 0===(t=t||{}).precision?this.PRECISION:t.precision,r=void 0===t.segmentSubdivisions?this.getSegmentSubdivisions({precision:i}):t.segmentSubdivisions,s=[],o=[],a=0;a<n;a++){var h,u=e[a];u.isVisible?0<(h=r[a]).length?(h=h.map(function(t){return t.start}),Array.prototype.push.apply(o,h)):o.push(u.start):0<o.length&&(o.push(e[a-1].end),s.push(o),o=[])}return 0<o.length&&(o.push(this.end),s.push(o)),s},toPolylines:function(t){var e=[],n=this.toPoints(t);if(!n)return null;for(var i=0,r=n.length;i<r;i++)e.push(new l(n[i]));return e},toString:function(){for(var t=this.segments,e=t.length,n="",i=0;i<e;i++)n+=t[i].serialize()+" ";return n.trim()},translate:function(t,e){for(var n=this.segments,i=n.length,r=0;r<i;r++)n[r].translate(t,e);return this},updateSubpathStartSegment:function(t){for(var e=t.previousSegment;t&&!t.isSubpathStart;)t.subpathStartSegment=e?e.subpathStartSegment:null,t=(e=t).nextSegment},validate:function(){return this.isValid()||this.insertSegment(0,S.createSegment("M",0,0)),this}},Object.defineProperty(S.prototype,"start",{configurable:!0,enumerable:!0,get:function(){var t=this.segments,e=t.length;if(0===e)return null;for(var n=0;n<e;n++){var i=t[n];if(i.isVisible)return i.start}return t[e-1].end}}),Object.defineProperty(S.prototype,"end",{configurable:!0,enumerable:!0,get:function(){var t=this.segments,e=t.length;if(0===e)return null;for(var n=e-1;0<=n;n--){var i=t[n];if(i.isVisible)return i.end}return t[e-1].end}});function v(){for(var t=[],e=arguments.length,n=0;n<e;n++)t.push(arguments[n]);if(!(this instanceof v))return g(v,t);if(0===e)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates (none provided).");if(t[0]instanceof d){if(1===e)return this.end=t[0].end.clone(),this;throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+e+" lines provided).")}if("string"==typeof t[0]||"number"==typeof t[0]){if(2===e)return this.end=new p(+t[0],+t[1]),this;if(e<2)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+e+" coordinates provided).");for(var i,r=[],n=0;n<e;n+=2)i=t.slice(n,n+2),r.push(g(v,i))}else{if(1===e)return this.end=new p(t[0]),this;for(r=[],n=0;n<e;n+=1)r.push(new v(t[n]))}return r}function y(){for(var t,e=[],n=arguments.length,i=0;i<n;i++)e.push(arguments[i]);if(!(this instanceof y))return g(y,e);if(0===n)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates (none provided).");if(e[0]instanceof m){if(1===n)return this.controlPoint1=e[0].controlPoint1.clone(),this.controlPoint2=e[0].controlPoint2.clone(),this.end=e[0].end.clone(),this;throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+n+" curves provided).")}if("string"==typeof e[0]||"number"==typeof e[0]){if(6===n)return this.controlPoint1=new p(+e[0],+e[1]),this.controlPoint2=new p(+e[2],+e[3]),this.end=new p(+e[4],+e[5]),this;if(n<6)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+n+" coordinates provided).");for(var r,s=[],i=0;i<n;i+=6)r=e.slice(i,i+6),s.push(g(y,r))}else{if(3===n)return this.controlPoint1=new p(e[0]),this.controlPoint2=new p(e[1]),this.end=new p(e[2]),this;if(n<3)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+n+" points provided).");for(s=[],i=0;i<n;i+=3)t=e.slice(i,i+3),s.push(g(y,t))}return s}function x(){for(var t,e=[],n=arguments.length,i=0;i<n;i++)e.push(arguments[i]);if(!(this instanceof x))return g(x,e);if(0===n)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates (none provided).");if(e[0]instanceof d){if(1===n)return this.end=e[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+n+" lines provided).")}if(e[0]instanceof m){if(1===n)return this.end=e[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+n+" curves provided).")}if("string"==typeof e[0]||"number"==typeof e[0]){if(2===n)return this.end=new p(+e[0],+e[1]),this;if(n<2)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+n+" coordinates provided).");for(var r,s=[],i=0;i<n;i+=2)r=e.slice(i,i+2),0===i?s.push(g(x,r)):s.push(g(v,r))}else{if(1===n)return this.end=new p(e[0]),this;for(s=[],i=0;i<n;i+=1)t=e[i],0===i?s.push(new x(t)):s.push(new v(t))}return s}function w(){for(var t=[],e=arguments.length,n=0;n<e;n++)t.push(arguments[n]);if(!(this instanceof w))return g(w,t);if(0<e)throw new Error("Closepath constructor expects no arguments.");return this}var b={bbox:function(){throw new Error("Declaration missing for virtual function.")},clone:function(){throw new Error("Declaration missing for virtual function.")},closestPoint:function(){throw new Error("Declaration missing for virtual function.")},closestPointLength:function(){throw new Error("Declaration missing for virtual function.")},closestPointNormalizedLength:function(){throw new Error("Declaration missing for virtual function.")},closestPointT:function(t){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(t);throw new Error("Neither closestPointT() nor closestPointNormalizedLength() function is implemented.")},closestPointTangent:function(){throw new Error("Declaration missing for virtual function.")},divideAt:function(){throw new Error("Declaration missing for virtual function.")},divideAtLength:function(){throw new Error("Declaration missing for virtual function.")},divideAtT:function(t){if(this.divideAt)return this.divideAt(t);throw new Error("Neither divideAtT() nor divideAt() function is implemented.")},equals:function(){throw new Error("Declaration missing for virtual function.")},getSubdivisions:function(){throw new Error("Declaration missing for virtual function.")},isDifferentiable:function(){throw new Error("Declaration missing for virtual function.")},isSegment:!0,isSubpathStart:!1,isVisible:!0,length:function(){throw new Error("Declaration missing for virtual function.")},lengthAtT:function(t){var e;return t<=0?0:(e=this.length(),1<=t?e:e*t)},nextSegment:null,pointAt:function(){throw new Error("Declaration missing for virtual function.")},pointAtLength:function(){throw new Error("Declaration missing for virtual function.")},pointAtT:function(t){if(this.pointAt)return this.pointAt(t);throw new Error("Neither pointAtT() nor pointAt() function is implemented.")},previousSegment:null,round:function(){throw new Error("Declaration missing for virtual function.")},subpathStartSegment:null,scale:function(){throw new Error("Declaration missing for virtual function.")},serialize:function(){throw new Error("Declaration missing for virtual function.")},tangentAt:function(){throw new Error("Declaration missing for virtual function.")},tangentAtLength:function(){throw new Error("Declaration missing for virtual function.")},tangentAtT:function(t){if(this.tangentAt)return this.tangentAt(t);throw new Error("Neither tangentAtT() nor tangentAt() function is implemented.")},toString:function(){throw new Error("Declaration missing for virtual function.")},translate:function(){throw new Error("Declaration missing for virtual function.")}},P=(Object.defineProperty(b,"end",{configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(b,"start",{configurable:!0,enumerable:!0,get:function(){if(this.previousSegment)return this.previousSegment.end;throw new Error("Missing previous segment. (This segment cannot be the first segment of a path; OR segment has not yet been added to a path.)")}}),Object.defineProperty(b,"type",{configurable:!0,enumerable:!0,get:function(){throw new Error("Bad segment declaration. No type specified.")}}),{clone:function(){return new v(this.end)},divideAt:function(t){t=new d(this.start,this.end).divideAt(t);return[new v(t[0]),new v(t[1])]},divideAtLength:function(t){t=new d(this.start,this.end).divideAtLength(t);return[new v(t[0]),new v(t[1])]},getSubdivisions:function(){return[]},isDifferentiable:function(){return!!this.previousSegment&&!this.start.equals(this.end)},round:function(t){return this.end.round(t),this},scale:function(t,e,n){return this.end.scale(t,e,n),this},serialize:function(){var t=this.end;return this.type+" "+t.x+" "+t.y},toString:function(){return this.type+" "+this.start+" "+this.end},translate:function(t,e){return this.end.translate(t,e),this}}),P=(Object.defineProperty(P,"type",{configurable:!0,enumerable:!0,value:"L"}),v.prototype=t(b,d.prototype,P),{clone:function(){return new y(this.controlPoint1,this.controlPoint2,this.end)},divideAt:function(t,e){t=new m(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAt(t,e);return[new y(t[0]),new y(t[1])]},divideAtLength:function(t,e){t=new m(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAtLength(t,e);return[new y(t[0]),new y(t[1])]},divideAtT:function(t){t=new m(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAtT(t);return[new y(t[0]),new y(t[1])]},isDifferentiable:function(){var t,e,n,i;return!(!this.previousSegment||(t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end,t.equals(e)&&e.equals(n)&&n.equals(i)))},round:function(t){return this.controlPoint1.round(t),this.controlPoint2.round(t),this.end.round(t),this},scale:function(t,e,n){return this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this},serialize:function(){var t=this.controlPoint1,e=this.controlPoint2,n=this.end;return this.type+" "+t.x+" "+t.y+" "+e.x+" "+e.y+" "+n.x+" "+n.y},toString:function(){return this.type+" "+this.start+" "+this.controlPoint1+" "+this.controlPoint2+" "+this.end},translate:function(t,e){return this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e),this}}),P=(Object.defineProperty(P,"type",{configurable:!0,enumerable:!0,value:"C"}),y.prototype=t(b,m.prototype,P),{bbox:function(){return null},clone:function(){return new x(this.end)},closestPoint:function(){return this.end.clone()},closestPointNormalizedLength:function(){return 0},closestPointLength:function(){return 0},closestPointT:function(){return 1},closestPointTangent:function(){return null},divideAt:function(){return[this.clone(),this.clone()]},divideAtLength:function(){return[this.clone(),this.clone()]},equals:function(t){return this.end.equals(t.end)},getSubdivisions:function(){return[]},isDifferentiable:function(){return!1},isSubpathStart:!0,isVisible:!1,length:function(){return 0},lengthAtT:function(){return 0},pointAt:function(){return this.end.clone()},pointAtLength:function(){return this.end.clone()},pointAtT:function(){return this.end.clone()},round:function(t){return this.end.round(t),this},scale:function(t,e,n){return this.end.scale(t,e,n),this},serialize:function(){var t=this.end;return this.type+" "+t.x+" "+t.y},tangentAt:function(){return null},tangentAtLength:function(){return null},tangentAtT:function(){return null},toString:function(){return this.type+" "+this.end},translate:function(t,e){return this.end.translate(t,e),this}}),P=(Object.defineProperty(P,"start",{configurable:!0,enumerable:!0,get:function(){throw new Error("Illegal access. Moveto segments should not need a start property.")}}),Object.defineProperty(P,"type",{configurable:!0,enumerable:!0,value:"M"}),x.prototype=t(b,P),{clone:function(){return new w},divideAt:function(t){t=new d(this.start,this.end).divideAt(t);return[t[1].isDifferentiable()?new v(t[0]):this.clone(),new v(t[1])]},divideAtLength:function(t){t=new d(this.start,this.end).divideAtLength(t);return[t[1].isDifferentiable()?new v(t[0]):this.clone(),new v(t[1])]},getSubdivisions:function(){return[]},isDifferentiable:function(){return!(!this.previousSegment||!this.subpathStartSegment||this.start.equals(this.end))},round:function(){return this},scale:function(){return this},serialize:function(){return this.type},toString:function(){return this.type+" "+this.start+" "+this.end},translate:function(){return this}}),b=(Object.defineProperty(P,"end",{configurable:!0,enumerable:!0,get:function(){if(this.subpathStartSegment)return this.subpathStartSegment.end;throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. Moveto); OR segment has not yet been added to a path.)")}}),Object.defineProperty(P,"type",{configurable:!0,enumerable:!0,value:"Z"}),w.prototype=t(b,d.prototype,P),S.segmentTypes={L:v,C:y,M:x,Z:w,z:w}),P=(S.regexSupportedData=new RegExp("^[\\s\\d"+Object.keys(b).join("")+",.]*$"),S.isDataSupported=function(t){return"string"==typeof t&&this.regexSupportedData.test(t)},{curveThroughPoints:function(t){return console.warn("deprecated"),new S(m.throughPoints(t)).serialize()},getCurveControlPoints:function(t){console.warn("deprecated");var e=[],n=[],i=t.length-1;if(1==i)e[0]=new p((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),n[0]=new p(2*e[0].x-t[0].x,2*e[0].y-t[0].y);else{for(var r=[],s=1;s<i-1;s++)r[s]=4*t[s].x+2*t[s+1].x;r[0]=t[0].x+2*t[1].x,r[i-1]=(8*t[i-1].x+t[i].x)/2;var o=this.getFirstControlPoints(r);for(s=1;s<i-1;++s)r[s]=4*t[s].y+2*t[s+1].y;r[0]=t[0].y+2*t[1].y,r[i-1]=(8*t[i-1].y+t[i].y)/2;var a=this.getFirstControlPoints(r);for(s=0;s<i;s++)e.push(new p(o[s],a[s])),n.push(s<i-1?new p(2*t[s+1].x-o[s+1],2*t[s+1].y-a[s+1]):new p((t[i].x+o[i-1])/2,(t[i].y+a[i-1])/2))}return[e,n]},getCurveDivider:function(t,e,n,i){console.warn("deprecated");var r=new m(t,e,n,i);return function(t){t=r.divide(t);return[{p0:t[0].start,p1:t[0].controlPoint1,p2:t[0].controlPoint2,p3:t[0].end},{p0:t[1].start,p1:t[1].controlPoint1,p2:t[1].controlPoint2,p3:t[1].end}]}},getFirstControlPoints:function(t){console.warn("deprecated");var e=t.length,n=[],i=[],r=2;n[0]=t[0]/r;for(var s=1;s<e;s++)i[s]=1/r,n[s]=(t[s]-n[s-1])/(r=(s<e-1?4:3.5)-i[s]);for(s=1;s<e;s++)n[e-s-1]-=i[e-s]*n[e-s];return n},getInversionSolver:function(t,e,n,i){console.warn("deprecated");var r=new m(t,e,n,i);return function(t){return r.closestPointT(t)}}});let L=function(t){return this instanceof L?"string"==typeof t?new L.parse(t):void(this.points=Array.isArray(t)?t.map(p):[]):new L(t)};function E(t,e){var n=t.start.x,i=t.start.y,r=t.end.x,t=t.end.y,s=e.start.x,o=e.start.y,r=r-n,t=t-i,a=e.end.x-s,e=e.end.y-o,n=n-s,s=i-o,i=r*e-a*t,o=(r*s-t*n)/i,r=(a*s-e*n)/i;return 0<=o&&o<=1&&0<=r&&r<=1}function St(t,e){var n=t.a,i=t.b,r=t.x,t=t.y,s=e.start.x-r,r=e.end.x-r,o=e.start.y-t,n=n*n,i=i*i,r=r-s,e=e.end.y-t-o,t=r*r/n+e*e/i,r=2*s*r/n+2*o*e/i,e=r*r-4*t*(s*s/n+o*o/i-1);return 0==e?0<=(s=-r/2/t)&&s<=1:0<e&&(o=(-r-(n=Math.sqrt(e)))/2/t,0<=(i=(-r+n)/2/t)&&i<=1||0<=o&&o<=1)}function Pt(C,N){{var I=0,R=0;let{cos:t,sin:e}=Math,n=e(I),i=t(I),r=e(R),s=t(R),o=n*n,a=i*i,h=n*i,u=r*r,c=s*s,l=r*s,f=C.a*C.a,d=C.b*C.b,g=N.a*N.a,p=N.b*N.b,v=f*o+d*a,m=g*u+p*c,y=f*a+d*o,x=g*c+p*u,w=2*(d-f)*h,b=2*(p-g)*l,S=-2*v*C.x-w*C.y,P=-2*m*N.x-b*N.y,A=-w*C.x-2*y*C.y,T=-b*N.x-2*x*N.y,L=v*C.x*C.x+y*C.y*C.y+w*C.x*C.y-f*d,E=m*N.x*N.x+x*N.y*N.y+b*N.x*N.y-g*p;w/=2,b/=2,S/=2,P/=2,A/=2,T/=2;var I=D([[v,w,S],[w,y,A],[S,A,L]]),R=D([[m,b,P],[b,x,T],[P,T,E]]),C=.33333333*(D([[m,w,S],[b,y,A],[P,A,L]])+D([[v,b,S],[w,x,A],[S,T,L]])+D([[v,w,P],[w,y,T],[S,A,E]])),N=.33333333*(D([[v,b,P],[w,x,T],[S,T,E]])+D([[m,w,P],[b,y,T],[P,A,E]])+D([[m,b,S],[b,x,A],[P,T,L]])),O=Yt([[I,C],[C,N]]),I=Yt([[I,N],[C,R]]),R=Yt([[C,N],[N,R]]);return!(0<(O=Yt([[2*O,I],[I,2*R]]))&&(0<N||0<C))}}function At(t,e){var{start:n,end:i}=e,{x:r,y:s,width:o,height:a}=t;return!(n.x>r+o&&i.x>r+o||n.x<r&&i.x<r||n.y>s+a&&i.y>s+a||n.y<s&&i.y<s)&&(!(!t.containsPoint(e.start)&&!t.containsPoint(e.end))||E(t.topLine(),e)||E(t.rightLine(),e)||E(t.bottomLine(),e)||E(t.leftLine(),e))}function Tt(t,e){return!!Lt(t,A.fromEllipse(e))&&Rt(L.fromRect(t),e)}function Lt(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function C(t,e){return Gt(t,e,{interior:!1})}function Et(t,e){return Wt(t,e,{interior:!1})}function Ct(t,e){return Bt(t,e,{interior:!1})}function Nt(t,e){return Ht(t,e,{interior:!1})}function It(t,e){return Gt(t,e,{interior:!0})}function Rt(t,e){return Wt(t,e,{interior:!0})}function Ot(t,e){return Bt(t,e,{interior:!0})}function Dt(t,e){return Ht(t,e,{interior:!0})}function Ft(t,e){return Zt(t,e,{interior:!0})}function kt(t,n,i){return t.getSubpaths().some(t=>{var[e]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?It:C)(e,n)})}function Mt(t,n,i){return t.getSubpaths().some(t=>{var[e]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?Rt:Et)(e,n)})}function qt(t,e,n){return zt(t,L.fromRect(e),n)}function Vt(t,e,n){return Ut(t,e,n,{interior:!1})}function zt(t,e,n){return Ut(t,e,n,{interior:!0})}function jt(t,n,i,r){return t.getSubpaths().some(t=>{var[e]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?zt:Vt)(n,e,r)})}function Gt(t,e,n){var{interior:n=!1}=2<arguments.length&&void 0!==n?n:{};let i;if(n){if(t.containsPoint(e.start))return!0;var{start:n,end:r,points:s}=t;i=r.equals(n)?s:[...s,n]}else i=t.points;var o=i.length,a=new d;for(let t=0;t<o-1;t++)if(a.start=i[t],a.end=i[t+1],E(e,a))return!0;return!1}function Wt(t,e,n){var n=2<arguments.length&&void 0!==n?n:{},{start:i,end:r,points:s}=t;if(e.containsPoint(i))return!0;let o;var{interior:n=!1}=n;if(n){if(t.containsPoint(e.center()))return!0;o=r.equals(i)?s:[...s,i]}else o=s;var a=o.length,h=new d;for(let t=0;t<a-1;t++)if(h.start=o[t],h.end=o[t+1],St(e,h))return!0;return!1}function Bt(t,e,n){return Zt(t,L.fromRect(e),n)}function Ut(t,n,i,r){return t.getSubpaths().some(t=>{var[e]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?Zt:Ht)(n,e,r)})}function Ht(t,e,n){var{interior:n=!1}=2<arguments.length&&void 0!==n?n:{};let i;if(n){n=e.start;if(t.containsPoint(n))return!0;i=t.clone().close()}else i=t;var r=e.points,s=r.length,o=new d;for(let t=0;t<s-1;t++)if(o.start=r[t],o.end=r[t+1],C(i,o))return!0;return!1}function Zt(t,e,n){return e.containsPoint(t.start)||Ht(t,e.clone().close(),n)}function Yt(t){return t[0][0]*t[1][1]-t[0][1]*t[1][0]}function D(t){return t[0][0]*t[1][1]*t[2][2]-t[0][0]*t[1][2]*t[2][1]-t[0][1]*t[1][0]*t[2][2]+t[0][1]*t[1][2]*t[2][0]+t[0][2]*t[1][0]*t[2][1]-t[0][2]*t[1][1]*t[2][0]}L.parse=function(t){return new L(gt(t))},L.fromRect=function(t){return new L([t.topLeft(),t.topRight(),t.bottomRight(),t.bottomLeft()])},L.prototype=t(l.prototype,{type:h.Polygon,clone:function(){return new L(pt(this.points))},convexHull:function(){return new L(vt(this.points))},lengthPoints:function(){var{start:t,end:e,points:n}=this;return n.length<=1||t.equals(e)?n:[...n,t.clone()]}});b={intersection:{exists:function t(e,n,i,r){switch(e.type){case h.Line:if(n.type===h.Line)return E(e,n);break;case h.Ellipse:switch(n.type){case h.Line:return St(e,n);case h.Ellipse:return Pt(e,n)}break;case h.Rect:switch(n.type){case h.Line:return At(e,n);case h.Ellipse:return Tt(e,n);case h.Rect:return Lt(e,n)}break;case h.Polyline:switch(n.type){case h.Line:return C(e,n);case h.Ellipse:return Et(e,n);case h.Rect:return Ct(e,n);case h.Polyline:return Nt(e,n)}break;case h.Polygon:switch(n.type){case h.Line:return It(e,n);case h.Ellipse:return Rt(e,n);case h.Rect:return Ot(e,n);case h.Polyline:return Dt(e,n);case h.Polygon:return Ft(e,n)}break;case h.Path:switch(n.type){case h.Line:return kt(e,n,i);case h.Ellipse:return Mt(e,n,i);case h.Rect:return qt(e,n,i);case h.Polyline:return Vt(e,n,i);case h.Polygon:return zt(e,n,i);case h.Path:return jt(e,n,i,r)}}switch(n.type){case h.Ellipse:case h.Rect:case h.Polyline:case h.Polygon:case h.Path:return t(n,e,r,i);default:throw Error(`The intersection for ${e} and ${n} could not be found.`)}},lineWithLine:E,ellipseWithLine:St,ellipseWithEllipse:Pt,rectWithLine:At,rectWithEllipse:Tt,rectWithRect:Lt,polylineWithLine:C,polylineWithEllipse:Et,polylineWithRect:Ct,polylineWithPolyline:Nt,polygonWithLine:It,polygonWithEllipse:Rt,polygonWithRect:Ot,polygonWithPolyline:Dt,polygonWithPolygon:Ft,pathWithLine:kt,pathWithEllipse:Mt,pathWithRect:qt,pathWithPolyline:Vt,pathWithPolygon:zt,pathWithPath:jt},scale:{linear:function(t,e,n){var i=t[1]-t[0],r=e[1]-e[0];return(n-t[0])/i*r+e[0]||0}},normalizeAngle:r,snapToGrid:j,toDeg:s,toRad:o,random:G,bezier:P,Curve:m,Ellipse:c,ellipse:at,Line:d,line:rt,Path:S,Point:p,point:et,Polyline:l,Polygon:L,Rect:A,rect:dt,types:h};{if(!("object"==typeof window&&!!window.SVGAngle))return function(){throw new Error("SVG is required to use Vectorizer.")};function O(t,e,n){if(!(this instanceof O))return O.apply(Object.create(O.prototype),arguments);if(t){if(O.isV(t)&&(t=t.node),e=e||{},O.isString(t)){if("svg"===(t=t.trim()).toLowerCase())t=O.createSvgDocument();else if("<"===t[0]){var i=O.createSvgDocument(t);if(1<i.childNodes.length){for(var r=[],s=0,o=i.childNodes.length;s<o;s++){var a=i.childNodes[s];r.push(new O(document.importNode(a,!0)))}return r}t=document.importNode(i.firstChild,!0)}else t=document.createElementNS(F.svg,t);O.ensureId(t)}return this.node=t,this.setAttributes(e),n&&this.append(n),this}}var F={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},Xt=(P=Math).PI,$t=P.atan2,Jt=P.sqrt,N=P.min,Kt=P.max,Qt=P.cos,_t=P.sin,P=O.prototype,te=(Object.defineProperty(P,"id",{enumerable:!0,get:function(){return this.node.id},set:function(t){this.node.id=t}}),P.getTransformToElement=function(t){var e=this.node;if(O.isSVGGraphicsElement(t)&&O.isSVGGraphicsElement(e)){t=O.toNode(t).getScreenCTM(),e=e.getScreenCTM();if(t&&e)return t.inverse().multiply(e)}return O.createSVGMatrix()},P.transform=function(t,e){var n=this.node;return O.isUndefined(t)?O.transformStringToMatrix(this.attr("transform")):e&&e.absolute?this.attr("transform",O.matrixToTransformString(t)):(e=O.createSVGTransform(t),n.transform.baseVal.appendItem(e),this)},P.translate=function(t,e,n){n=n||{},e=e||0;var i=this.attr("transform")||"",r=O.parseTransformString(i),i=r.value;if(O.isUndefined(t))return r.translate;i=i.replace(/translate\([^)]*\)/g,"").trim();t=n.absolute?t:r.translate.tx+t,n=n.absolute?e:r.translate.ty+e;return this.attr("transform",("translate("+t+","+n+")"+" "+i).trim()),this},P.rotate=function(t,e,n,i){i=i||{};var r=this.attr("transform")||"",s=O.parseTransformString(r),r=s.value;if(O.isUndefined(t))return s.rotate;r=r.replace(/rotate\([^)]*\)/g,"").trim(),t%=360;i=i.absolute?t:s.rotate.angle+t;return this.attr("transform",(r+" "+("rotate("+i+(void 0!==e&&void 0!==n?","+e+","+n:"")+")")).trim()),this},P.scale=function(t,e){e=O.isUndefined(e)?t:e;var n=this.attr("transform")||"",i=O.parseTransformString(n),n=i.value;return O.isUndefined(t)?i.scale:(n=n.replace(/scale\([^)]*\)/g,"").trim(),this.attr("transform",(n+" "+("scale("+t+","+e+")")).trim()),this)},P.bbox=function(t,e){var n,i=this.node,r=i.ownerSVGElement;if(!r)return new A(0,0,0,0);try{n=i.getBBox()}catch(t){n={x:i.clientLeft,y:i.clientTop,width:i.clientWidth,height:i.clientHeight}}return t?new A(n):(i=this.getTransformToElement(e||r),O.transformRect(n,i))},P.getBBox=function(t){var e={},n=this.node;if(!n.ownerSVGElement||!O.isSVGGraphicsElement(n))return new A(0,0,0,0);if(t&&(t.target&&(e.target=O.toNode(t.target)),t.recursive)&&(e.recursive=t.recursive),e.recursive){var i=this.children(),r=i.length;if(0===r)return this.getBBox({target:e.target,recursive:!1});e.target||(e.target=this);for(var s=0;s<r;s++)var o=i[s],o=0===o.children().length?o.getBBox({target:e.target,recursive:!1}):o.getBBox({target:e.target,recursive:!0}),a=a?a.union(o):o;return a}try{a=n.getBBox()}catch(t){a={x:n.clientLeft,y:n.clientTop,width:n.clientWidth,height:n.clientHeight}}return e.target?(t=this.getTransformToElement(e.target),O.transformRect(a,t)):new A(a)},/em$/);function ee(t,e){var n=parseFloat(t);return te.test(t)?n*e:n}P.text=function(t,e){if(t&&"string"!=typeof t)throw new Error("Vectorizer: text() expects the first argument to be a string.");t=O.sanitizeText(t);for(var n,i,r,s,o=(e=e||{}).displayEmpty,a=e.eol,h=e.textPath,u=e.textVerticalAnchor,c="middle"===u||"bottom"===u||"top"===u,l=e.x,f=(void 0===l&&(l=this.attr("x")||0),e.includeAnnotationIndices),d=e.annotations,e=(d&&!O.isArray(d)&&(d=[d]),e.lineHeight),g="auto"===e,p=g?"1.5em":e||"1em",v=(this.empty(),this.attr({"xml:space":"preserve",display:t||o?null:"none"}),parseFloat(this.attr("font-size"))),m=(!v&&(v=16,c||d)&&this.attr("font-size",v),document),y=h?(e=this,o=(o=h="string"==typeof h?{d:h}:h)||{},n=O("textPath"),(i=o.d)&&void 0===o["xlink:href"]&&(i=O("path").attr("d",i).appendTo(e.defs()),n.attr("xlink:href","#"+i.id)),O.isObject(o)&&n.attr(o),n.node):m.createDocumentFragment(),x=0,w=t.split("\n"),b=[],S=0,P=w.length-1;S<=P;S++){var A,T,L=p,E="v-line",C=m.createElementNS(F.svg,"tspan"),N=w[S];if(N)d?((I=(T=((t,e,n)=>{for(var i=(n=n||{}).includeAnnotationIndices,r=n.eol,s=n.lineHeight,o=n.baseSize,a=0,n={},h=e.length-1,u=0;u<=h;u++){var c,l,f,d,g=e[u],p=null;O.isObject(g)?(c=g.attrs,f=(l=O("tspan",c)).node,d=g.t,r&&u===h&&(d+=r),f.textContent=d,(d=c.class)&&l.addClass(d),i&&l.attr("annotations",g.annotations),p=parseFloat(c["font-size"]),(p=isFinite(p)?p:o)&&a<p&&(a=p)):(r&&u===h&&(g+=r),f=document.createTextNode(g||" "),o&&a<o&&(a=o)),t.appendChild(f)}return a&&(n.maxFontSize=a),s?n.lineHeight=s:a&&(n.lineHeight=1.2*a),n})(C,A=O.annotateString(N,d,{offset:-x,includeAnnotationIndices:f}),{includeAnnotationIndices:f,eol:S!==P&&a,lineHeight:g?null:p,baseSize:v})).lineHeight)&&g&&0!==S&&(L=I),0===S&&(r=.8*T.maxFontSize)):(a&&S!==P&&(N+=a),C.textContent=N);else{C.textContent="-",E+=" v-empty-line";var I=C.style;if(I.fillOpacity=0,I.strokeOpacity=0,d){T={};let e=v;for(let t=(A=O.findAnnotationsAtIndex(d,x)).length;0<t;t--){var R=A[t-1].attrs;if(R&&"font-size"in R){R=parseFloat(R["font-size"]);if(isFinite(R)){e=R;break}}}g&&(0<S?L=1.2*e:r=.8*e),C.setAttribute("font-size",e),T.maxFontSize=e}}T&&b.push(T),0<S&&C.setAttribute("dy",L),(0<S||h)&&C.setAttribute("x",l),C.className.baseVal=E,y.appendChild(C),x+=N.length+1}if(c)if(d)L=((t,e,n,i)=>{if(!Array.isArray(e))return 0;var r=e.length;if(!r)return 0;for(var s=e[0],o=ee(s.maxFontSize,n)||n,a=0,h=ee(i,n),u=1;u<r;u++)a+=ee((s=e[u]).lineHeight,n)||h;var c,l=ee(s.maxFontSize,n)||n;switch(t){case"middle":c=o/2-.15*l-a/2;break;case"bottom":c=-.25*l-a;break;default:c=.8*o}return c})(u,b,v,p);else if("top"===u)L="0.8em";else switch(0<P?(s=parseFloat(p)||1,s*=P,te.test(p)||(s/=v)):s=0,u){case"middle":L=.3-s/2+"em";break;case"bottom":L=-s-.3+"em"}else 0===u?L="0em":u?L=u:(L=0,null===this.attr("y")&&this.attr("y",r||"0.8em"));return y.firstChild.setAttribute("dy",L),this.append(y),this},P.removeAttr=function(t){var t=o[t],{ns:e,local:n}=O.qualifyAttr(t),i=this.node;return e?i.hasAttributeNS(e,n)&&i.removeAttributeNS(e,n):i.hasAttribute(t)&&i.removeAttribute(t),this},P.attr=function(t,e){if(O.isUndefined(t)){for(var n=this.node.attributes,i={},r=0;r<n.length;r++)i[n[r].name]=n[r].value;return i}if(O.isString(t)&&O.isUndefined(e))return this.node.getAttribute(o[t]);if("object"==typeof t)for(var s in t)t.hasOwnProperty(s)&&this.setAttribute(s,t[s]);else this.setAttribute(t,e);return this},P.normalizePath=function(){return"PATH"===this.tagName()&&this.attr("d",O.normalizePathData(this.attr("d"))),this},P.remove=function(){return this.node.parentNode&&this.node.parentNode.removeChild(this.node),this},P.empty=function(){for(;this.node.firstChild;)this.node.removeChild(this.node.firstChild);return this},P.setAttributes=function(t){for(var e in t)t.hasOwnProperty(e)&&this.setAttribute(e,t[e]);return this},P.append=function(t){for(var e=0,n=(t=O.isArray(t)?t:[t]).length;e<n;e++)this.node.appendChild(O.toNode(t[e]));return this},P.prepend=function(t){var e=this.node.firstChild;return e?O(e).before(t):this.append(t)},P.before=function(t){var e=this.node,n=e.parentNode;if(n)for(var i=0,r=(t=O.isArray(t)?t:[t]).length;i<r;i++)n.insertBefore(O.toNode(t[i]),e);return this},P.appendTo=function(t){return O.toNode(t).appendChild(this.node),this},P.svg=function(){return this.node instanceof window.SVGSVGElement?this:O(this.node.ownerSVGElement)},P.tagName=function(){return this.node.tagName.toUpperCase()},P.defs=function(){var t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?O(e):O("defs").appendTo(t)},P.clone=function(){var t=O(this.node.cloneNode(!0));return t.node.id=O.uniqueId(),t},P.findOne=function(t){t=this.node.querySelector(t);return t?O(t):void 0},P.find=function(t){var e=[],n=this.node.querySelectorAll(t);if(n)for(var i=0;i<n.length;i++)e.push(O(n[i]));return e},P.children=function(){for(var t=this.node.childNodes,e=[],n=0;n<t.length;n++)1===t[n].nodeType&&e.push(O(t[n]));return e},P.parent=function(){return O(this.node.parentNode)||null},P.index=function(){for(var t=0,e=this.node.previousSibling;e;)1===e.nodeType&&t++,e=e.previousSibling;return t},P.findParentByClass=function(t,e){for(var n=this.node.ownerSVGElement,i=this.node.parentNode;i&&i!==e&&i!==n;){var r=O(i);if(r.hasClass(t))return r;i=i.parentNode}return null},P.contains=function(t){var e=this.node,t=O.toNode(t),t=t&&t.parentNode;return e===t||!!(t&&1===t.nodeType&&16&e.compareDocumentPosition(t))},P.toLocalPoint=function(t,e){var n=this.svg().node,i=n.createSVGPoint();i.x=t,i.y=e;try{var r=i.matrixTransform(n.getScreenCTM().inverse()),s=this.getTransformToElement(n).inverse()}catch(t){return i}return r.matrixTransform(s)},P.translateCenterToPoint=function(t){var e=this.getBBox({target:this.svg()}).center();return this.translate(t.x-e.x,t.y-e.y),this},P.translateAndAutoOrient=function(t,e,n){t=new p(t),e=new p(e),n=n||this.svg();var i=this.scale(),r=(this.attr("transform",""),this.getBBox({target:n}).scale(i.sx,i.sy)),s=O.createSVGTransform(),o=(s.setTranslate(-r.x-r.width/2,-r.y-r.height/2),O.createSVGTransform()),a=t.angleBetween(e,t.clone().offset(1,0)),a=(a&&o.setRotate(a,0,0),O.createSVGTransform()),e=t.clone().move(e,r.width/2),r=(a.setTranslate(2*t.x-e.x,2*t.y-e.y),this.getTransformToElement(n)),t=O.createSVGTransform();return t.setMatrix(a.matrix.multiply(o.matrix.multiply(s.matrix.multiply(r.scale(i.sx,i.sy))))),this.attr("transform",O.matrixToTransformString(t.matrix)),this},P.animateAlongPath=function(e,n){n=O.toNode(n);n=O.ensureId(n),e=O("animateMotion",e),n=O("mpath",{"xlink:href":"#"+n});e.append(n),this.append(e);try{e.node.beginElement()}catch(t){if("fake"===document.documentElement.getAttribute("smiling"))for(var i=e.node,n=(i.animators=[],i.getAttribute("id")),r=(n&&(id2anim[n]=i),getTargets(i)),s=0,o=r.length;s<o;s++){var a=r[s],a=new Animator(i,a,s);animators.push(a),(i.animators[s]=a).register()}}return this};let e=/[^\x20\t\r\n\f]+/g;function ne(t){return O.isString(t)&&t.trim().match(e)||[]}P.hasClass=function(t){return!!O.isString(t)&&this.node.classList.contains(t.trim())},P.addClass=function(t){return this.node.classList.add(...ne(t)),this},P.removeClass=function(t){return this.node.classList.remove(...ne(t)),this},P.toggleClass=function(t,e){var n=ne(t);for(let t=0;t<n.length;t++)this.node.classList.toggle(n[t],e);return this},P.sample=function(t){t=t||1;for(var e,n=this.node,i=n.getTotalLength(),r=[],s=0;s<i;)e=n.getPointAtLength(s),r.push({x:e.x,y:e.y,distance:s}),s+=t;return r},P.convertToPath=function(){var t=O("path"),e=(t.attr(this.attr()),this.convertToPathData());return e&&t.attr("d",e),t},P.convertToPathData=function(){var t=this.tagName();switch(t){case"PATH":return this.attr("d");case"LINE":return O.convertLineToPathData(this.node);case"POLYGON":return O.convertPolygonToPathData(this.node);case"POLYLINE":return O.convertPolylineToPathData(this.node);case"ELLIPSE":return O.convertEllipseToPathData(this.node);case"CIRCLE":return O.convertCircleToPathData(this.node);case"RECT":return O.convertRectToPathData(this.node)}throw new Error(t+" cannot be converted to PATH.")},O.prototype.toGeometryShape=function(){var t,e,n,i,r,s,o;switch(this.tagName()){case"RECT":return i=parseFloat(this.attr("x"))||0,o=parseFloat(this.attr("y"))||0,t=parseFloat(this.attr("width"))||0,n=parseFloat(this.attr("height"))||0,new A(i,o,t,n);case"CIRCLE":return s=parseFloat(this.attr("cx"))||0,r=parseFloat(this.attr("cy"))||0,i=parseFloat(this.attr("r"))||0,new c({x:s,y:r},i,i);case"ELLIPSE":return s=parseFloat(this.attr("cx"))||0,r=parseFloat(this.attr("cy"))||0,o=parseFloat(this.attr("rx"))||0,t=parseFloat(this.attr("ry"))||0,new c({x:s,y:r},o,t);case"POLYLINE":return e=O.getPointsFromSvgNode(this),new l(e);case"POLYGON":return 1<(e=O.getPointsFromSvgNode(this)).length&&e.push(e[0]),new l(e);case"PATH":return n=this.attr("d"),S.isDataSupported(n)||(n=O.normalizePathData(n)),new S(n);case"LINE":return i=parseFloat(this.attr("x1"))||0,s=parseFloat(this.attr("y1"))||0,r=parseFloat(this.attr("x2"))||0,o=parseFloat(this.attr("y2"))||0,new d({x:i,y:s},{x:r,y:o})}return this.getBBox()},P.findIntersection=function(t,e){var n=this.svg().node,i=this.getBBox({target:e=e||n}),r=i.center();if(i.intersectionWithLineFromCenterToPoint(t)){i=this.tagName();if("RECT"===i)var s=new A(parseFloat(this.attr("x")||0),parseFloat(this.attr("y")||0),parseFloat(this.attr("width")),parseFloat(this.attr("height"))),o=this.getTransformToElement(e),a=O.decomposeMatrix(o),n=n.createSVGTransform(),s=(n.setRotate(-a.rotation,r.x,r.y),O.transformRect(s,n.matrix.multiply(o))),o=new A(s).intersectionWithLineFromCenterToPoint(t,a.rotation);else if("PATH"===i||"POLYGON"===i||"POLYLINE"===i||"CIRCLE"===i||"ELLIPSE"===i){for(var h,u,c,l=("PATH"===i?this:this.convertToPath()).sample(),f=1/0,d=[],g=0;g<l.length;g++)h=l[g],u=(u=O.createSVGPoint(h.x,h.y)).matrixTransform(this.getTransformToElement(e)),(c=(h=new p(u)).distance(r)+(u=1.1*h.distance(t)))<f?(f=c,d=[{sample:h,refDistance:u}]):c<f+1&&d.push({sample:h,refDistance:u});d.sort(function(t,e){return t.refDistance-e.refDistance}),d[0]&&(o=d[0].sample)}return o}},P.setAttribute=function(t,e){var n,i=this.node;return null===e?this.removeAttr(t):(t=o[t],n=O.qualifyAttr(t).ns,n?i.setAttributeNS(n,t,e):"id"===t?i.id=e:i.setAttribute(t,e)),this},O.createSvgDocument=function(t){return t?t=O.parseXML(`<svg xmlns="${F.svg}" xmlns:xlink="${F.xlink}" version="1.1">${t}</svg>`,{async:!1}).documentElement:((t=document.createElementNS(F.svg,"svg")).setAttributeNS(F.xmlns,"xmlns:xlink",F.xlink),t.setAttribute("version","1.1")),t},O.createSVGStyle=function(t){t=O("style",{type:"text/css"},[O.createCDATASection(t)]).node;return t},O.createCDATASection=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return document.implementation.createDocument(null,"xml",null).createCDATASection(t)},O.idCounter=0,O.uniqueId=function(){return"v-"+ ++O.idCounter},O.toNode=function(t){return O.isV(t)?t.node:t.nodeName&&t||t[0]},O.ensureId=function(t){return(t=O.toNode(t)).id||(t.id=O.uniqueId())},O.sanitizeText=function(t){return(t||"").replace(/ /g,"\xa0")},O.isUndefined=function(t){return void 0===t},O.isString=function(t){return"string"==typeof t},O.isObject=function(t){return t&&"object"==typeof t},O.isArray=Array.isArray,O.parseXML=function(t,e){var n;e=e||{};try{var i=new DOMParser;O.isUndefined(e.async)||(i.async=e.async),n=i.parseFromString(t,"text/xml")}catch(t){n=void 0}if(!n||n.getElementsByTagName("parsererror").length)throw new Error("Invalid XML: "+t);return n};let n=Object.create(null),o=(["baseFrequency","baseProfile","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].forEach(t=>n[t]=t),n.xlinkShow="xlink:show",n.xlinkRole="xlink:role",n.xlinkActuate="xlink:actuate",n.xlinkHref="xlink:href",n.xlinkType="xlink:type",n.xlinkTitle="xlink:title",n.xmlBase="xml:base",n.xmlLang="xml:lang",n.xmlSpace="xml:space",new Proxy(n,{get(t,e){return O.supportCamelCaseAttributes?e in t?t[e]:t[e]=e.replace(/[A-Z]/g,"-$&").toLowerCase():e}}));Object.defineProperty(O,"attributeNames",{enumerable:!0,value:o,writable:!1}),Object.defineProperty(O,"supportCamelCaseAttributes",{enumerable:!0,value:!0,writable:!0}),O.qualifyAttr=function(t){var e;return-1!==t.indexOf(":")?(e=t.split(":"),{ns:F[e[0]],local:e[1]}):{ns:null,local:t}},O.transformSeparatorRegex=/[ ,]+/,O.transformRegex=/\b\w+\([^()]+\)/g,O.transformFunctionRegex=/\b(\w+)\(([^()]+)\)/,O.transformTranslateRegex=/\btranslate\(([^()]+)\)/,O.transformRotateRegex=/\brotate\(([^()]+)\)/,O.transformScaleRegex=/\bscale\(([^()]+)\)/,O.transformStringToMatrix=function(t){let o=O.createSVGMatrix();var e=t&&t.match(O.transformRegex);if(e){var n=e.length;for(let t=0;t<n;t++){var a=e[t].match(O.transformFunctionRegex);if(a){let t,e,n,i,r,s=O.createSVGMatrix();var h=a[1].toLowerCase(),u=a[2].split(O.transformSeparatorRegex);switch(h){case"scale":t=parseFloat(u[0]),e=void 0===u[1]?t:parseFloat(u[1]),s=s.scaleNonUniform(t,e);break;case"translate":n=parseFloat(u[0]),i=parseFloat(u[1]),s=s.translate(n,i);break;case"rotate":r=parseFloat(u[0]),n=parseFloat(u[1])||0,i=parseFloat(u[2])||0,s=0!==n||0!==i?s.translate(n,i).rotate(r).translate(-n,-i):s.rotate(r);break;case"skewx":r=parseFloat(u[0]),s=s.skewX(r);break;case"skewy":r=parseFloat(u[0]),s=s.skewY(r);break;case"matrix":s.a=parseFloat(u[0]),s.b=parseFloat(u[1]),s.c=parseFloat(u[2]),s.d=parseFloat(u[3]),s.e=parseFloat(u[4]),s.f=parseFloat(u[5]);break;default:continue}o=o.multiply(s)}}}return o},O.matrixToTransformString=function(t){return"matrix("+(void 0!==(t=t||!0).a?t.a:1)+","+(void 0!==t.b?t.b:0)+","+(void 0!==t.c?t.c:0)+","+(void 0!==t.d?t.d:1)+","+(void 0!==t.e?t.e:0)+","+(void 0!==t.f?t.f:0)+")"},O.parseTransformString=function(t){t&&(e=O.transformSeparatorRegex,0<=t.trim().indexOf("matrix")?(r=O.transformStringToMatrix(t),n=[(r=O.decomposeMatrix(r)).translateX,r.translateY],i=[r.scaleX,r.scaleY],r=[r.rotation],s=[],0===n[0]&&0===n[1]||s.push("translate("+n+")"),1===i[0]&&1===i[1]||s.push("scale("+i+")"),0!==r[0]&&s.push("rotate("+r+")"),t=s.join(" ")):((s=t.match(O.transformTranslateRegex))&&(n=s[1].split(e)),(s=t.match(O.transformRotateRegex))&&(r=s[1].split(e)),(s=t.match(O.transformScaleRegex))&&(i=s[1].split(e))));var e,n,i,r,s=i&&i[0]?parseFloat(i[0]):1;return{value:t,translate:{tx:n&&n[0]?parseInt(n[0],10):0,ty:n&&n[1]?parseInt(n[1],10):0},rotate:{angle:r&&r[0]?parseInt(r[0],10):0,cx:r&&r[1]?parseInt(r[1],10):void 0,cy:r&&r[2]?parseInt(r[2],10):void 0},scale:{sx:s,sy:i&&i[1]?parseFloat(i[1]):s}}},O.deltaTransformPoint=function(t,e){return{x:e.x*t.a+e.y*t.c,y:e.x*t.b+e.y*t.d}},O.decomposeMatrix=function(t){var e=O.deltaTransformPoint(t,{x:0,y:1}),n=O.deltaTransformPoint(t,{x:1,y:0}),e=180/Xt*$t(e.y,e.x)-90,n=180/Xt*$t(n.y,n.x);return{translateX:t.e,translateY:t.f,scaleX:Jt(t.a*t.a+t.b*t.b),scaleY:Jt(t.c*t.c+t.d*t.d),skewX:e,skewY:n,rotation:e}},O.matrixToScale=function(t){var e,n,i,r;return t?(e=O.isUndefined(t.a)?1:t.a,r=O.isUndefined(t.d)?1:t.d,n=t.b,i=t.c):e=r=1,{sx:n?Jt(e*e+n*n):e,sy:i?Jt(i*i+r*r):r}},O.matrixToRotate=function(t){var e={x:0,y:1};return t&&(e=O.deltaTransformPoint(t,e)),{angle:r(s($t(e.y,e.x))-90)}},O.matrixToTranslate=function(t){return{tx:t&&t.e||0,ty:t&&t.f||0}},O.isVElement=O.isV=function(t){return t instanceof O},O.isSVGGraphicsElement=function(t){return!!t&&(t=O.toNode(t))instanceof SVGElement&&"function"==typeof t.getScreenCTM};var ie,re,I,R,k,se,oe,ae,he,M=O("svg").node;function ue(t,e,n,i,r,s){return[1/3*t+2/3*n,1/3*e+2/3*i,1/3*r+2/3*n,1/3*s+2/3*i,r,s]}function ce(t,e,n){return{x:t*k(n)-e*R(n),y:t*R(n)+e*k(n)}}function le(t,e,n,i,r,s,o,a,h,u){var c=120*I/180,l=I/180*(+r||0),f=[];if(u)x=u[0],w=u[1],m=u[2],y=u[3];else{t=(g=ce(t,e,-l)).x,e=g.y;var d=(t-(a=(g=ce(a,h,-l)).x))/2,g=(e-(h=g.y))/2,p=d*d/(n*n)+g*g/(i*i),p=(1<p&&(n*=p=ae(p),i*=p),n*n),v=i*i,s=(s==o?-1:1)*ae(he((p*v-p*g*g-v*d*d)/(p*g*g+v*d*d)));if(!Number.isFinite(s))return[t,e,a,h,a,h];var m=s*n*g/i+(t+a)/2,y=s*-i*d/n+(e+h)/2,x=oe(((e-y)/i).toFixed(9)),w=oe(((h-y)/i).toFixed(9));(x=t<m?I-x:x)<0&&(x=2*I+x),(w=a<m?I-w:w)<0&&(w=2*I+w),o&&w<x&&(x-=2*I),!o&&x<w&&(w-=2*I)}he(w-x)>c&&(p=w,v=a,g=h,f=le(a=m+n*k(w=x+c*(o&&x<w?1:-1)),h=y+i*R(w),n,i,r,0,o,v,g,[w,p,m,y])),s=w-x;d=k(x),c=R(x),r=k(w),o=R(w),v=se(s/4),g=4/3*(n*v),p=4/3*(i*v),m=[t,e],y=[t+g*c,e-p*d],x=[a+g*o,h-p*r],w=[a,h];if(y[0]=2*m[0]-y[0],y[1]=2*m[1]-y[1],u)return[y,x,w].concat(f);for(var b=[],S=(f=[y,x,w].concat(f).join().split(",")).length,P=0;P<S;P++)b[P]=P%2?ce(f[P-1],f[P],l).y:ce(f[P],f[P+1],l).x;return b}function fe(t){var e,s,o;if(!(t=Array.isArray(t)&&Array.isArray(t&&t[0])?t:(e=t)?(s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[],String(e).replace(ie,function(t,e,n){var i=[],r=e.toLowerCase();for(n.replace(re,function(t,e){e&&i.push(+e)}),"m"===r&&2<i.length&&(o.push([e].concat(i.splice(0,2))),r="l",e="m"===e?"l":"L");s[r]<=i.length&&(o.push([e].concat(i.splice(0,s[r]))),s[r]););}),o):null)||!t.length)return[["M",0,0]];for(var n=[],i=0,r=0,a=0,h=0,u=t.length,c=0;c<u;c++){var l,f,d=[],g=(n.push(d),t[c]),p=g[0];if(p!=p.toUpperCase())switch(d[0]=p.toUpperCase(),d[0]){case"A":d[1]=g[1],d[2]=g[2],d[3]=g[3],d[4]=g[4],d[5]=g[5],d[6]=+g[6]+i,d[7]=+g[7]+r;break;case"V":d[1]=+g[1]+r;break;case"H":d[1]=+g[1]+i;break;case"M":for(a=+g[1]+i,h=+g[2]+r,l=g.length,f=1;f<l;f++)d[f]=+g[f]+(f%2?i:r);break;default:for(l=g.length,f=1;f<l;f++)d[f]=+g[f]+(f%2?i:r)}else for(var v=g.length,m=0;m<v;m++)d[m]=g[m];switch(d[0]){case"Z":i=+a,r=+h;break;case"H":i=d[1];break;case"V":r=d[1];break;case"M":a=d[d.length-2],h=d[d.length-1],i=d[d.length-2],r=d[d.length-1];break;default:i=d[d.length-2],r=d[d.length-1]}}return n}function de(t){var e=fe(t),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};for(var i=[],r="",s="",o=e.length,a=0;a<o;a++){"C"!==(r=e[a]?e[a][0]:r)&&(i[a]=r,0<a)&&(s=i[a-1]),e[a]=((t,e,n)=>{var i,r;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(t[0]in{T:1,Q:1}||(e.qx=null,e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=0===parseFloat(t[1])||0===parseFloat(t[2])?["L",t[6],t[7]]:["C"].concat(le.apply(0,[e.x,e.y].concat(t.slice(1))));break;case"S":r="C"===n||"S"===n?(i=2*e.x-e.bx,2*e.y-e.by):(i=e.x,e.y),t=["C",i,r].concat(t.slice(1));break;case"T":"Q"===n||"T"===n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"].concat(ue(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"].concat(ue(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"H":t=["L"].concat(t[1],e.y);break;case"V":t=["L"].concat(e.x,t[1])}return t})(e[a],n,s),"A"!==i[a]&&"C"===r&&(i[a]="C"),c=u=h=void 0;var h=e,u=a;if(7<h[u].length){h[u].shift();for(var c=h[u];c.length;)i[u]="A",h.splice(u++,0,["C"].concat(c.splice(0,6)));h.splice(u,1),o=e.length}var l=e[a],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=parseFloat(l[f-4])||n.x,n.by=parseFloat(l[f-3])||n.y}return e[0][0]&&"M"===e[0][0]||e.unshift(["M",0,0]),e}return O.createSVGMatrix=function(t){var e,n=M.createSVGMatrix();for(e in t)n[e]=t[e];return n},O.createSVGTransform=function(t){return O.isUndefined(t)?M.createSVGTransform():(t instanceof SVGMatrix||(t=O.createSVGMatrix(t)),M.createSVGTransformFromMatrix(t))},O.createSVGPoint=function(t,e){var n=M.createSVGPoint();return n.x=t,n.y=e,n},O.transformRect=function(t,e){var n=M.createSVGPoint(),i=(n.x=t.x,n.y=t.y,n.matrixTransform(e)),r=(n.x=t.x+t.width,n.y=t.y,n.matrixTransform(e)),s=(n.x=t.x+t.width,n.y=t.y+t.height,n.matrixTransform(e)),t=(n.x=t.x,n.y=t.y+t.height,n.matrixTransform(e)),n=N(i.x,r.x,s.x,t.x),e=Kt(i.x,r.x,s.x,t.x),o=N(i.y,r.y,s.y,t.y),i=Kt(i.y,r.y,s.y,t.y);return new A(n,o,e-n,i-o)},O.transformPoint=function(t,e){return new p(O.createSVGPoint(t.x,t.y).matrixTransform(e))},O.transformLine=function(t,e){return new d(O.transformPoint(t.start,e),O.transformPoint(t.end,e))},O.transformPolyline=function(t,e){for(var n=t instanceof l?t.points:t,i=[],r=0,s=(n=O.isArray(n)?n:[]).length;r<s;r++)i[r]=O.transformPoint(n[r],e);return new l(i)},O.styleToObject=function(t){for(var e={},n=t.split(";"),i=0;i<n.length;i++){var r=n[i].split("=");e[r[0].trim()]=r[1].trim()}return e},O.createSlicePathData=function(t,e,n,i){var r=2*Xt-1e-6,s=(i<n&&(s=n,n=i,i=s),i-n),o=s<Xt?"0":"1",a=Qt(n),n=_t(n),h=Qt(i),i=_t(i);return r<=s?t?"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":t?"M"+e*a+","+e*n+"A"+e+","+e+" 0 "+o+",1 "+e*h+","+e*i+"L"+t*h+","+t*i+"A"+t+","+t+" 0 "+o+",0 "+t*a+","+t*n+"Z":"M"+e*a+","+e*n+"A"+e+","+e+" 0 "+o+",1 "+e*h+","+e*i+"L0,0Z"},O.mergeAttrs=function(t,e){for(var n in e)"class"===n?t[n]=t[n]?t[n]+" "+e[n]:e[n]:"style"===n?O.isObject(t[n])&&O.isObject(e[n])?t[n]=O.mergeAttrs(t[n],e[n]):O.isObject(t[n])?t[n]=O.mergeAttrs(t[n],O.styleToObject(e[n])):O.isObject(e[n])?t[n]=O.mergeAttrs(O.styleToObject(t[n]),e[n]):t[n]=O.mergeAttrs(O.styleToObject(t[n]),O.styleToObject(e[n])):t[n]=e[n];return t},O.annotateString=function(t,e,n){e=e||[];for(var i,r,s=(n=n||{}).offset||0,o=[],a=[],h=0;h<t.length;h++){for(var u=a[h]=t[h],c=0;c<e.length;c++){var l=e[c];l.start+s<=h&&h<l.end+s&&(O.isObject(u)?u.attrs=O.mergeAttrs(O.mergeAttrs({},u.attrs),l.attrs):u=a[h]={t:t[h],attrs:l.attrs},n.includeAnnotationIndices)&&(u.annotations||(u.annotations=[])).push(c)}(r=a[h-1])?O.isObject(u)&&O.isObject(r)?JSON.stringify(u.attrs)===JSON.stringify(r.attrs)?i.t+=u.t:(o.push(i),i=u):i=O.isObject(u)||O.isObject(r)?(o.push(i),u):(i||"")+u:i=u}return i&&o.push(i),o},O.findAnnotationsAtIndex=function(t,e){var n=[];return t&&t.forEach(function(t){t.start<e&&e<=t.end&&n.push(t)}),n},O.findAnnotationsBetweenIndexes=function(t,e,n){var i=[];return t&&t.forEach(function(t){(e>=t.start&&e<t.end||n>t.start&&n<=t.end||t.start>=e&&t.end<n)&&i.push(t)}),i},O.shiftAnnotations=function(t,e,n){return t&&t.forEach(function(t){t.start<e&&t.end>=e?t.end+=n:t.start>=e&&(t.start+=n,t.end+=n)}),t},O.convertLineToPathData=function(t){return["M",(t=O(t)).attr("x1"),t.attr("y1"),"L",t.attr("x2"),t.attr("y2")].join(" ")},O.convertPolygonToPathData=function(t){t=O.getPointsFromSvgNode(t);return 0===t.length?null:O.svgPointsToPath(t)+" Z"},O.convertPolylineToPathData=function(t){t=O.getPointsFromSvgNode(t);return 0===t.length?null:O.svgPointsToPath(t)},O.svgPointsToPath=function(t){for(var e=0,n=t.length;e<n;e++)t[e]=t[e].x+" "+t[e].y;return"M "+t.join(" L")},O.getPointsFromSvgNode=function(t){var e=[],n=(t=O.toNode(t)).points;if(n)for(var i=0,r=n.numberOfItems;i<r;i++)e.push(n.getItem(i));return e},O.KAPPA=.551784,O.convertCircleToPathData=function(t){t=O(t);var e=parseFloat(t.attr("cx"))||0,n=parseFloat(t.attr("cy"))||0,t=parseFloat(t.attr("r")),i=t*O.KAPPA;return["M",e,n-t,"C",e+i,n-t,e+t,n-i,e+t,n,"C",e+t,n+i,e+i,n+t,e,n+t,"C",e-i,n+t,e-t,n+i,e-t,n,"C",e-t,n-i,e-i,n-t,e,n-t,"Z"].join(" ")},O.convertEllipseToPathData=function(t){t=O(t);var e=parseFloat(t.attr("cx"))||0,n=parseFloat(t.attr("cy"))||0,i=parseFloat(t.attr("rx")),t=parseFloat(t.attr("ry"))||i,r=i*O.KAPPA,s=t*O.KAPPA;return["M",e,n-t,"C",e+r,n-t,e+i,n-s,e+i,n,"C",e+i,n+s,e+r,n+t,e,n+t,"C",e-r,n+t,e-i,n+s,e-i,n,"C",e-i,n-s,e-r,n-t,e,n-t,"Z"].join(" ")},O.convertRectToPathData=function(t){return t=O(t),O.rectToPath({x:parseFloat(t.attr("x"))||0,y:parseFloat(t.attr("y"))||0,width:parseFloat(t.attr("width"))||0,height:parseFloat(t.attr("height"))||0,rx:parseFloat(t.attr("rx"))||0,ry:parseFloat(t.attr("ry"))||0})},O.rectToPath=function(t){var e=t.x,n=t.y,i=t.width,r=t.height,s=N(t.rx||t["top-rx"]||0,i/2),o=N(t.rx||t["bottom-rx"]||0,i/2),a=N(t.ry||t["top-ry"]||0,r/2),t=N(t.ry||t["bottom-ry"]||0,r/2),o=s||o||a||t?["M",e,n+a,"v",r-a-t,"a",o,t,0,0,0,o,t,"h",i-2*o,"a",o,t,0,0,0,o,-t,"v",-(r-t-a),"a",s,a,0,0,0,-s,-a,"h",-(i-2*s),"a",s,a,0,0,0,-s,a,"Z"]:["M",e,n,"H",e+i,"V",n+r,"H",e,"V",n,"Z"];return o.join(" ")},O.normalizePathData=(P="\t\n\v\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029",ie=new RegExp("([a-z])["+P+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+P+"]*,?["+P+"]*)+)","ig"),re=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+P+"]*,?["+P+"]*","ig"),P=Math,I=P.PI,R=P.sin,k=P.cos,se=P.tan,oe=P.asin,ae=P.sqrt,he=P.abs,function(t){return de(t).join(",").split(",").join(" ")}),O.namespace=F,O.g=b,O}}),"undefined"!=typeof V&&(g=V.g,Vectorizer=V);
|
package/dist/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joint/core",
|
|
3
3
|
"title": "JointJS",
|
|
4
|
-
"version": "4.0
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"description": "JavaScript diagramming library",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/joint.min.js",
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
"test-e2e-all": "grunt test:e2e:all",
|
|
53
53
|
"lint": "eslint types/**/*.d.ts src --ext .mjs,.js",
|
|
54
54
|
"lint-fix": "yarn run lint --fix",
|
|
55
|
-
"dist": "grunt dist"
|
|
56
|
-
"build-docs": "grunt build:docs"
|
|
55
|
+
"dist": "grunt dist"
|
|
57
56
|
},
|
|
58
57
|
"files": [
|
|
59
58
|
"dist/",
|
|
@@ -65,52 +64,48 @@
|
|
|
65
64
|
"./README.md"
|
|
66
65
|
],
|
|
67
66
|
"devDependencies": {
|
|
67
|
+
"@babel/core": "^7.25.2",
|
|
68
|
+
"@babel/preset-env": "^7.25.2",
|
|
68
69
|
"@microsoft/api-extractor": "7.33.7",
|
|
70
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
69
71
|
"@typescript-eslint/eslint-plugin": "5.48.1",
|
|
70
72
|
"@typescript-eslint/parser": "5.48.1",
|
|
71
73
|
"async": "2.6.1",
|
|
72
74
|
"chai": "4.2.0",
|
|
73
|
-
"cheerio": "0.22.0",
|
|
74
75
|
"core-js": "~3.8.3",
|
|
75
76
|
"es-module-shims": "0.2.4",
|
|
76
77
|
"eslint": "8.1.0",
|
|
77
78
|
"express": "4.16.3",
|
|
78
79
|
"grunt": "^1.3.0",
|
|
79
80
|
"grunt-browserify": "5.3.0",
|
|
80
|
-
"grunt-compile-docs": "1.2.1",
|
|
81
81
|
"grunt-contrib-clean": "2.0.0",
|
|
82
82
|
"grunt-contrib-concat": "1.0.1",
|
|
83
83
|
"grunt-contrib-copy": "1.0.0",
|
|
84
84
|
"grunt-contrib-qunit": "3.1.0",
|
|
85
|
-
"grunt-contrib-uglify": "4.0.
|
|
85
|
+
"grunt-contrib-uglify": "4.0.1",
|
|
86
86
|
"grunt-contrib-watch": "1.1.0",
|
|
87
87
|
"grunt-env": "0.4.4",
|
|
88
88
|
"grunt-eslint": "21.0.0",
|
|
89
|
-
"grunt-karma": "
|
|
89
|
+
"grunt-karma": "4.0.2",
|
|
90
90
|
"grunt-mocha-test": "0.13.3",
|
|
91
91
|
"grunt-newer": "1.3.0",
|
|
92
92
|
"grunt-shell": "3.0.1",
|
|
93
93
|
"grunt-ts": "6.0.0-beta.22",
|
|
94
94
|
"grunt-webpack": "6.0.0",
|
|
95
|
-
"handlebars": "4.7.7",
|
|
96
95
|
"jit-grunt": "0.10.0",
|
|
97
96
|
"jquery": "~3.7.1",
|
|
98
|
-
"karma": "
|
|
99
|
-
"karma-chrome-launcher": "
|
|
100
|
-
"karma-coverage": "
|
|
97
|
+
"karma": "6.4.4",
|
|
98
|
+
"karma-chrome-launcher": "3.2.0",
|
|
99
|
+
"karma-coverage": "2.2.1",
|
|
101
100
|
"karma-qunit": "2.1.0",
|
|
102
101
|
"karma-sinon": "1.0.5",
|
|
103
102
|
"load-grunt-config": "0.19.2",
|
|
104
103
|
"lodash": "~4.17.21",
|
|
105
104
|
"mocha": "5.2.0",
|
|
106
|
-
"open-sans-fontface": "https://github.com/clientIO/open-sans/archive/1.4.2.tar.gz",
|
|
107
|
-
"prism-themes": "1.9.0",
|
|
108
|
-
"prismjs": "1.24.0",
|
|
109
105
|
"puppeteer": "17.0.0",
|
|
110
106
|
"qunit": "2.8.0",
|
|
111
107
|
"requirejs": "2.3.6",
|
|
112
108
|
"rollup": "1.20.3",
|
|
113
|
-
"rollup-plugin-buble": "0.19.6",
|
|
114
109
|
"rollup-plugin-commonjs": "9.2.0",
|
|
115
110
|
"rollup-plugin-json": "4.0.0",
|
|
116
111
|
"rollup-plugin-node-resolve": "4.0.0",
|