@joint/core 4.2.0-alpha.0 → 4.2.0-alpha.1
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 +3 -1
- package/dist/geometry.js +2 -2
- package/dist/geometry.min.js +3 -2
- package/dist/joint.d.ts +280 -149
- package/dist/joint.js +1427 -475
- package/dist/joint.min.js +4 -3
- package/dist/joint.nowrap.js +1427 -475
- package/dist/joint.nowrap.min.js +4 -3
- package/dist/vectorizer.js +21 -8
- package/dist/vectorizer.min.js +4 -3
- package/dist/version.mjs +1 -1
- package/package.json +7 -7
- package/src/V/index.mjs +20 -5
- package/src/alg/Deque.mjs +126 -0
- package/src/cellTools/Boundary.mjs +15 -13
- package/src/cellTools/Button.mjs +7 -5
- package/src/cellTools/Control.mjs +37 -14
- package/src/cellTools/HoverConnect.mjs +5 -1
- package/src/cellTools/helpers.mjs +44 -3
- package/src/config/index.mjs +8 -0
- package/src/dia/Cell.mjs +26 -10
- package/src/dia/CellView.mjs +7 -0
- package/src/dia/Element.mjs +4 -2
- package/src/dia/ElementView.mjs +2 -1
- package/src/dia/HighlighterView.mjs +22 -0
- package/src/dia/LinkView.mjs +118 -98
- package/src/dia/Paper.mjs +697 -209
- package/src/dia/ToolView.mjs +4 -0
- package/src/dia/ToolsView.mjs +12 -3
- package/src/dia/attributes/text.mjs +4 -2
- package/src/dia/ports.mjs +202 -82
- package/src/elementTools/HoverConnect.mjs +14 -8
- package/src/env/index.mjs +6 -3
- package/src/layout/ports/port.mjs +30 -15
- package/src/layout/ports/portLabel.mjs +1 -1
- package/src/mvc/View.mjs +4 -0
- package/src/mvc/ViewBase.mjs +1 -1
- package/types/geometry.d.ts +64 -60
- package/types/joint.d.ts +205 -88
- package/types/vectorizer.d.ts +11 -1
package/dist/vectorizer.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! JointJS v4.2.0-alpha.
|
|
2
|
-
|
|
1
|
+
/*! JointJS v4.2.0-alpha.1 (2025-09-25) - JavaScript diagramming library
|
|
3
2
|
|
|
4
3
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
4
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
5
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
7
6
|
*/
|
|
7
|
+
|
|
8
8
|
(function (global, factory) {
|
|
9
9
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
10
10
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -5662,8 +5662,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
5662
5662
|
});
|
|
5663
5663
|
|
|
5664
5664
|
/**
|
|
5665
|
-
*
|
|
5666
|
-
* @
|
|
5665
|
+
* Calculates the transformation matrix from this element to the target element.
|
|
5666
|
+
* @param {SVGElement|V} target - The target element.
|
|
5667
|
+
* @param {Object} [opt] - Options object for transformation calculation.
|
|
5668
|
+
* @param {boolean} [opt.safe] - Use a safe traversal method to compute the matrix.
|
|
5669
|
+
* @returns {DOMMatrix} The transformation matrix from this element to the target element.
|
|
5667
5670
|
*/
|
|
5668
5671
|
VPrototype.getTransformToElement = function (target, opt) {
|
|
5669
5672
|
const node = this.node;
|
|
@@ -5996,11 +5999,18 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
5996
5999
|
}
|
|
5997
6000
|
VPrototype.text = function (content, opt) {
|
|
5998
6001
|
if (content && typeof content !== 'string') throw new Error('Vectorizer: text() expects the first argument to be a string.');
|
|
5999
|
-
|
|
6000
|
-
// Replace all spaces with the Unicode No-break space (http://www.fileformat.info/info/unicode/char/a0/index.htm).
|
|
6001
|
-
// IE would otherwise collapse all spaces into one.
|
|
6002
|
-
content = V.sanitizeText(content);
|
|
6003
6002
|
opt || (opt = {});
|
|
6003
|
+
|
|
6004
|
+
// Backwards-compatibility: if no content was provided, treat it as an
|
|
6005
|
+
// empty string so that subsequent string operations (e.g. split) do
|
|
6006
|
+
// not throw and behaviour matches the previous implementation that
|
|
6007
|
+
// always sanitised the input.
|
|
6008
|
+
if (content == null) content = '';
|
|
6009
|
+
if (opt.useNoBreakSpace) {
|
|
6010
|
+
// Replace all spaces with the Unicode No-break space (http://www.fileformat.info/info/unicode/char/a0/index.htm).
|
|
6011
|
+
// IE would otherwise collapse all spaces into one.
|
|
6012
|
+
content = V.sanitizeText(content);
|
|
6013
|
+
}
|
|
6004
6014
|
// Should we allow the text to be selected?
|
|
6005
6015
|
var displayEmpty = opt.displayEmpty;
|
|
6006
6016
|
// End of Line character
|
|
@@ -6743,6 +6753,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
6743
6753
|
// also exposed so that the programmer can use it in case he needs to. This is useful e.g. in tests
|
|
6744
6754
|
// when you want to compare the actual DOM text content without having to add the unicode character in
|
|
6745
6755
|
// the place of all spaces.
|
|
6756
|
+
/**
|
|
6757
|
+
* @deprecated Use regular spaces and rely on xml:space="preserve" instead.
|
|
6758
|
+
*/
|
|
6746
6759
|
V.sanitizeText = function (text) {
|
|
6747
6760
|
return (text || '').replace(/ /g, '\u00A0');
|
|
6748
6761
|
};
|
package/dist/vectorizer.min.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/*! JointJS v4.2.0-alpha.
|
|
2
|
-
|
|
1
|
+
/*! JointJS v4.2.0-alpha.1 (2025-09-25) - JavaScript diagramming library
|
|
3
2
|
|
|
4
3
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
4
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
5
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
7
6
|
*/
|
|
8
|
-
var g,Vectorizer;((t,n)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).V=n()})(this,function(){let{round:k,floor:V,PI:z}=Math;function r(t){return t%360+(t<0?360:0)}function j(t,n){return n*k(t/n)}function s(t){return 180*t/z%360}function o(t,n){return(t=(n=n||!1)?t:t%360)*z/180}function G(t,n){var e;return void 0===n?(n=void 0===t?1:t,t=0):n<t&&(e=t,t=n,n=e),V(Math.random()*(n-t+1)+t)}function n(t,n){var e=o(t.y),i=o(n.y),t=t.x,n=n.x,n=o(n-t),t=U(n)*a(i),e=a(e)*U(i)-U(e)*a(i)*a(n);return(i=s(H(t,e))-22.5)<0&&(i+=360),["NE","E","SE","S","SW","W","NW","N"][i=parseInt(i/45)]}function W(t,n){var e=t.x,t=t.y;return(e-=n.x)*e+(t-=n.y)*t}function B(t,n){return Math.sqrt(W(t,n))}function p(t,n){if(!(this instanceof p))return new p(t,n);var e;"string"==typeof t?(e=t.split(-1===t.indexOf("@")?" ":"@"),t=parseFloat(e[0]),n=parseFloat(e[1])):Object(t)===t&&(n=t.y,t=t.x),this.x=void 0===t?0:t,this.y=void 0===n?0:n}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:_,min:X,max:$,atan2:J,round:K,pow:Q,PI:tt}=Math;p.fromPolar=function(t,n,e){e=new p(e);var i=u(t*Z(n)),t=u(t*Y(n)),n=r(s(n));return n<90?t=-t:n<180?(i=-i,t=-t):n<270&&(i=-i),new p(e.x+i,e.y+t)},p.random=function(t,n,e,i){return new p(G(t,n),G(e,i))},p.prototype={type:h.Point,chooseClosest:function(t){var n=t.length;if(1===n)return new p(t[0]);for(var e=null,i=1/0,r=0;r<n;r++){var s=new p(t[r]),o=this.squaredDistance(s);o<i&&(e=s,i=o)}return e},adhereToRect:function(t){return t.containsPoint(this)||(this.x=X($(this.x,t.x),t.x+t.width),this.y=X($(this.y,t.y),t.y+t.height)),this},angleBetween:function(t,n){n=this.equals(t)||this.equals(n)?NaN:this.theta(n)-this.theta(t);return n<0&&(n+=360),n},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 p(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 p(this.x-(t||0),this.y-(n||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,n){var e=this.x,i=this.y;return new p((1-n)*e+n*t.x,(1-n)*i+n*t.y)},magnitude:function(){return _(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,n){t=o(new p(t).theta(this));return this.offset(Z(t)*n,-Y(t)*n)},normalize:function(t){t=(t||1)/this.magnitude();return this.scale(t,t)},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 p(t).move(this,this.distance(t))},rotate:function(t,n){var e,i;return 0!==n&&(t=t||new p(0,0),n=o(r(-n)),e=Z(n),n=Y(n),i=e*(this.x-t.x)-n*(this.y-t.y)+t.x,n=n*(this.x-t.x)+e*(this.y-t.y)+t.y,this.x=i,this.y=n),this},round:function(t){let n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=Q(10,t)}return this.x=K(this.x*n)/n,this.y=K(this.y*n)/n,this},scale:function(t,n,e){return e=e&&new p(e)||new p(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=j(this.x,t),this.y=j(this.y,n||t),this},squaredDistance:function(t){return W(this,t)},theta:function(t){var n=-((t=new p(t)).y-this.y),t=t.x-this.x,n=J(n,t);return 180*(n=n<0?2*tt+n:n)/tt},toJSON:function(){return{x:this.x,y:this.y}},toPolar:function(t){t=t&&new p(t)||new p(0,0);var n=this.x,e=this.y;return this.x=_((n-t.x)*(n-t.x)+(e-t.y)*(e-t.y)),this.y=o(t.theta(new p(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 p(0,0).angleBetween(this,t)}},p.prototype.translate=p.prototype.offset;var nt=p;let{max:et,min:it}=Math,d=function(t,n){return this instanceof d?t instanceof d?new d(t.start,t.end):(this.start=new p(t),void(this.end=new p(n))):new d(t,n)};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),n=it(this.start.y,this.end.y),e=et(this.start.x,this.end.x),i=et(this.start.y,this.end.y);return new A(t,n,e-t,i-n)},bearing:function(){return n(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,et(0,t/this.squaredLength()));return t!=t?0:t},closestPointTangent:function(t){return this.tangentAt(this.closestPointNormalizedLength(t))},containsPoint:function(t){var n,e=this.start,i=this.end;return 0===e.cross(t,i)&&(n=this.length(),!(new d(e,t).length()>n||new d(t,i).length()>n))},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,n){return t&&t.intersectionWithLine?(n=t.intersectionWithLine(this,n))&&t instanceof d?n[0]:n:null},intersectionWithLine:function(t){var n=new p(this.end.x-this.start.x,this.end.y-this.start.y),e=new p(t.end.x-t.start.x,t.end.y-t.start.y),i=n.x*e.y-n.y*e.x,t=new p(t.start.x-this.start.x,t.start.y-this.start.y),e=t.x*e.y-t.y*e.x,t=t.x*n.y-t.y*n.x;if(0==i||e*i<0||t*i<0)return null;if(0<i){if(i<e||i<t)return null}else if(e<i||t<i)return null;return[new p(this.start.x+e*n.x/i,this.start.y+e*n.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 n,e,i,r,s=this.clone();return this.isDifferentiable()&&({start:n,end:e}=s,i=n.clone().rotate(e,270),r=e.clone().rotate(n,90),n.move(r,t),e.move(i,t)),s},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,i=!0,r=(t<0&&(i=!1,t=-t),this.length());return r<=t?(i?e:n).clone():this.pointAt((i?t:r-t)/r)},pointOffset:function(t){t=new p(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();return n?this.scale(t=t/n,t,this.start):this},squaredLength:function(){return W(this.start,this.end)},tangentAt:function(t){var n,e;return this.isDifferentiable()?(n=this.start,e=this.end,t=this.pointAt(t),(e=new d(n,e)).translate(t.x-n.x,t.y-n.y),e):null},tangentAtLength:function(t){var n,e;return this.isDifferentiable()?(n=this.start,e=this.end,t=this.pointAtLength(t),(e=new d(n,e)).translate(t.x-n.x,t.y-n.y),e):null},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 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,n,e){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=n,void(this.b=e)):new c(t,n,e)}let{sqrt:st,round:e,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,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,i=t.end,r=this.a,s=this.b,t=t.vector(),o=e.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&&n.push(e.lerp(i,r)),0<=t&&t<=1&&n.push(e.lerp(i,t))}else{o=-a/s;if(!(0<=o&&o<=1))return null;n.push(e.lerp(i,o))}return n},intersectionWithLineFromCenterToPoint:function(t,n){t=new p(t),n&&t.rotate(new p(this.x,this.y),n);var e,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,e=this.b*this.b,i=st(1/(1/i+o/e)),o=t*(i=s<0?-i:i),new p(this.x+i,this.y+o)),n?r.rotate(new p(this.x,this.y),-n):r},normalizedDistance:function(t){var n=t.x,t=t.y,e=this.a,i=this.b,r=this.x,s=this.y;return(n-r)*(n-r)/(e*e)+(t-s)*(t-s)/(i*i)},round:function(t){let n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=ot(10,t)}return this.x=e(this.x*n)/n,this.y=e(this.y*n)/n,this.a=e(this.a*n)/n,this.b=e(this.b*n)/n,this},tangentTheta:function(t){var n,e,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?e=s*s/(i-h)-s*s*(r-u)*((n=i>a.x?r-30:r+30)-u)/(o*o*(i-h))+h:n=o*o/(r-u)-o*o*(i-h)*((e=r>a.y?i+30:i-30)-h)/(s*s*(r-u))+u,new p(e,n).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,n,e,i){if(!(this instanceof A))return new A(t,n,e,i);Object(t)===t&&(n=t.y,e=t.width,i=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===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(...n){if(0===n.length)return null;var e=new p;let i,r,s,o;i=r=1/0,s=o=-1/0;for(let t=0;t<n.length;t++){e.update(n[t]);var a=e.x,h=e.y;a<i&&(i=a),a>s&&(s=a),h<r&&(r=h),h>o&&(o=h)}return new A(i,r,s-i,o-r)},A.fromRectUnion=function(...n){if(0===n.length)return null;var e=new A;let i,r,s,o;i=r=1/0,s=o=-1/0;for(let t=0;t<n.length;t++){e.update(n[t]);var a=e.x,h=e.y,u=a+e.width,c=h+e.height;a<i&&(i=a),u>s&&(s=u),h<r&&(r=h),c>o&&(o=c)}return new A(i,r,s-i,o-r)},A.prototype={type:h.Rect,bbox:function(t){return this.clone().rotateAroundCenter(t)},rotateAroundCenter:function(t){var n,e,i,r;return t&&({width:i,height:n}=this,t=o(t),r=i*(e=ht(ct(t)))+n*(t=ht(ut(t))),this.x+=(i-(i=i*t+n*e))/2,this.y+=(n-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,n){let e,i;return t&&"string"!=typeof t?{x:e=0,y:i=0}=t:{x:e,y:i}=new p(t),n&&n.strict?e>this.x&&e<this.x+this.width&&i>this.y&&i<this.y+this.height:e>=this.x&&e<=this.x+this.width&&i>=this.y&&i<=this.y+this.height},containsRect:function(t){var n,e,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)&&(n=i.x,i=i.y,o+=e=t.x,r+=n,a+=t=t.y,s+=i,n<=e)&&o<=r&&i<=t&&a<=s},corner:function(){return new p(this.x+this.width,this.y+this.height)},equals:function(t){var n=new A(this).normalize(),t=new A(t).normalize();return n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.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,e=this.origin(),i=this.corner(),r=t.origin(),t=t.corner();return t.x<=e.x||t.y<=e.y||r.x>=i.x||r.y>=i.y?null:(n=lt(e.x,r.x),e=lt(e.y,r.y),new A(n,e,f(i.x,t.x)-n,f(i.y,t.y)-e))},intersectionWithLine:function(t){for(var n,e=[this.topLine(),this.rightLine(),this.bottomLine(),this.leftLine()],i=[],r=[],s=e.length,o=0;o<s;o++)null!==(n=t.intersect(e[o]))&&r.indexOf(n.toString())<0&&(i.push(n),r.push(n.toString()));return 0<i.length?i:null},intersectionWithLineFromCenterToPoint:function(t,n){t=new p(t);for(var e,i=new p(this.x+this.width/2,this.y+this.height/2),r=(n&&t.rotate(i,n),[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){e=a;break}}return e&&n&&e.rotate(i,-n),e},leftLine:function(){return new d(this.topLeft(),this.bottomLeft())},leftMiddle:function(){return new p(this.x,this.y+this.height/2)},maxRectScaleToFit:function(t,n){t=new A(t);var e,i,r,s,o,a,h,u=(n=n||t.center()).x,n=n.y,c=e=i=r=s=o=a=h=1/0,l=t.topLeft(),l=(l.x<u&&(c=(this.x-u)/(l.x-u)),l.y<n&&(s=(this.y-n)/(l.y-n)),t.bottomRight()),l=(l.x>u&&(e=(this.x+this.width-u)/(l.x-u)),n<l.y&&(o=(this.y+this.height-n)/(l.y-n)),t.topRight()),l=(l.x>u&&(i=(this.x+this.width-u)/(l.x-u)),l.y<n&&(a=(this.y-n)/(l.y-n)),t.bottomLeft());return l.x<u&&(r=(this.x-u)/(l.x-u)),n<l.y&&(h=(this.y+this.height-n)/(l.y-n)),{sx:f(c,e,i,r),sy:f(s,o,a,h)}},maxRectUniformScaleToFit:function(t,n){t=this.maxRectScaleToFit(t,n);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},moveAroundPoint:function(t,n){t=this.center().rotate(t,n);return this.x=t.x-this.width/2,this.y=t.y-this.height/2,this},normalize:function(){var t=this.x,n=this.y,e=this.width,i=this.height;return this.width<0&&(t=this.x+this.width,e=-this.width),this.height<0&&(n=this.y+this.height,i=-this.height),this.x=t,this.y=n,this.width=e,this.height=i,this},offset:function(t,n){return p.prototype.offset.call(this,t,n)},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 n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=ft(10,t)}return this.x=i(this.x*n)/n,this.y=i(this.y*n)/n,this.width=i(this.width*n)/n,this.height=i(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 p(t)).x-this.x,e=this.x+this.width-t.x,i=t.y-this.y,r="left";return e<n&&(n=e,r="right"),i<n&&(n=i,r="top"),r=this.y+this.height-t.y<n?"bottom":r},snapToGrid:function(t,n){var e=this.origin().snapToGrid(t,n),t=this.corner().snapToGrid(t,n);return this.x=e.x,this.y=e.y,this.width=t.x-e.x,this.height=t.y-e.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,n,e,i){return Object(t)===t&&(n=t.y,e=t.width,i=t.height,t=t.x),this.x=t||0,this.y=n||0,this.width=e||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 n=[],e=t.split(/\b\s*,\s*|,\s*|\s+/),i=e.length;for(let t=0;t<i;t+=2)n.push({x:+e[t],y:+e[t+1]});return n}function pt(n){var e=n.length;if(0===e)return[];var i=[];for(let t=0;t<e;t++){var r=n[t].clone();i.push(r)}return i}function vt(t){var n,e=Math.abs,i=t.length;if(0===i)return[];for(s=0;s<i;s++)(void 0===n||t[s].y<n.y||t[s].y===n.y&&t[s].x>n.x)&&(n=t[s]);for(var r=[],s=0;s<i;s++){var o=n.theta(t[s]),o=(0===o&&(o=360),[t[s],s,o]);r.push(o)}r.sort(function(t,n){var e=t[2]-n[2];return e=0===e?n[1]-t[1]:e}),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||e((v=d.angleBetween(p,h))-180)<1e-10||d.equals(h)||p.equals(d)?(c[f[0]+"@@"+f[1]]=d,l.push(g)):e((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,n,e,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(n),this.controlPoint2=new p(e),void(this.end=new p(i))):new m(t,n,e,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,n=-1/0,e=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),n<h&&(n=h),a<e&&(e=a),i<a&&(i=a)}return new A(t,e,n-t,i-e)},clone:function(){return new l(pt(this.points))},closestPoint:function(t){t=this.closestPointLength(t);return this.pointAtLength(t)},closestPointLength:function(t){var n,e=this.lengthPoints(),i=e.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(e[a],e[a+1]),u=h.length(),c=h.closestPointNormalizedLength(t),h=h.pointAt(c).squaredDistance(t);h<r&&(r=h,n=s+c*u),s+=u}return n},closestPointNormalizedLength:function(t){var n,t=this.closestPointLength(t);return 0===t||0===(n=this.length())?0:t/n},closestPointTangent:function(t){t=this.closestPointLength(t);return this.tangentAtLength(t)},containsPoint:function(t){var n=this.points,e=n.length;if(0===e)return!1;for(var i=t.x,r=t.y,s=e-1,o=0,a=0,h=new d,u=new d,c=new p;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;(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:n,points:e}=this;return t&&n&&!t.equals(n)&&e.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 n=this.points,e=t.points,i=n.length;if(e.length!==i)return!1;for(var r=0;r<i;r++){var s=n[r],o=t.points[r];if(!s.equals(o))return!1}return!0},intersectionWithLine:function(t){for(var n=new d(t),e=[],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=n.intersectionWithLine(r);a&&e.push(a[0])}return 0<e.length?e:null},isDifferentiable:function(){var t=this.points,n=t.length;if(0!==n)for(var e=new d,i=n-1,r=0;r<i;r++)if(e.start=t[r],e.end=t[r+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,i=n-1,r=0;r<i;r++)e+=t[r].distance(t[r+1]);return e},pointAt:function(t){var n=this.lengthPoints(),e=n.length;return 0===e?null:1===e||t<=0?n[0].clone():1<=t?n[e-1].clone():(n=this.length(),this.pointAtLength(n*t))},pointAtLength:function(t){var n=this.lengthPoints(),e=n.length;if(0===e)return null;if(1===e)return n[0].clone();for(var i=!0,r=(t<0&&(i=!1,t=-t),0),s=e-1,o=0;o<s;o++){var a=i?o:s-1-o,h=n[a],a=n[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?n[e-1]:n[0]).clone()},round:function(t){for(var n=this.points,e=n.length,i=0;i<e;i++)n[i].round(t);return this},scale:function(t,n,e){for(var i=this.points,r=i.length,s=0;s<r;s++)i[s].scale(t,n,e);return this},simplify:function(n={}){var e=this.points;if(!(e.length<3)){var i=n.threshold||1e-10;let t=0;for(;e[t+2];){var r=t,s=t+1,o=t+2,r=e[r],a=e[s],o=e[o];new d(r,o).closestPoint(a).distance(a)<=i?e.splice(s,1):t+=1}}return this},tangentAt:function(t){var n=this.lengthPoints().length;if(0===n)return null;if(1===n)return null;1<(t=t<0?0:t)&&(t=1);n=this.length();return this.tangentAtLength(n*t)},tangentAtLength:function(t){var n=this.lengthPoints(),e=n.length;if(0===e)return null;if(1===e)return null;for(var i,r=!0,s=(t<0&&(r=!1,t=-t),0),o=e-1,a=0;a<o;a++){var h=r?a:o-1-a,u=n[h],h=n[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,n){for(var e=this.points,i=e.length,r=0;r<i;r++)e[r].translate(t,n);return this},serialize:function(){var t=this.points,n=t.length;if(0===n)return"";for(var e="",i=0;i<n;i++){var r=t[i];e+=r.x+","+r.y+" "}return e.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 n=t.length,e=[],i=[],r=2;e[0]=t[0]/r;for(var s=1;s<n;s++)i[s]=1/r,e[s]=(t[s]-e[s-1])/(r=(s<n-1?4:3.5)-i[s]);for(s=1;s<n;s++)e[n-s-1]-=i[n-s]*e[n-s];return e}function t(t){for(var n=[],e=arguments.length,i=1;i<e;i++)n.push(arguments[i]);if(!t)throw new Error("Missing a parent object.");var r=Object.create(t);for(e=n.length,i=0;i<e;i++){var s,o,a=n[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 n=(t=>{var n=[],e=[],i=t.length-1;if(1==i)n[0]=new p((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),e[0]=new p(2*n[0].x-t[0].x,2*n[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++)n.push(new p(o[s],a[s])),e.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[n,e]})(t),e=[],i=n[0].length,r=0;r<i;r++){var s=new p(n[0][r].x,n[0][r].y),o=new p(n[1][r].x,n[1][r].y);e.push(new m(t[r],s,o,t[r+1]))}return e},m.prototype={type:h.Curve,bbox:function(){for(var t,n,e,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?(n=6*u-12*l+6*d,t=-3*u+9*l-9*d+3*p,3*l-3*u):(n=6*c-12*f+6*g,t=-3*c+9*f-9*g+3*v,3*f-3*c),T(t)<1e-12?T(n)<1e-12||0<(e=-i/n)&&e<1&&y.push(e):(i=n*n-4*i*t,r=mt(i),i<0||(0<(i=(-n+r)/(2*t))&&i<1&&y.push(i),0<(i=(-n-r)/(2*t))&&i<1&&y.push(i)));for(var b,S,P=y.length,s=P;P--;)e=y[P],x[0][P]=b=(S=1-e)*S*S*u+3*S*S*e*l+3*S*e*e*d+e*e*e*p,x[1][P]=S=S*S*S*c+3*S*S*e*f+3*S*e*e*g+e*e*e*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,n){return this.pointAtT(this.closestPointT(t,n))},closestPointLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions};return this.lengthAtT(this.closestPointT(t,e),e)},closestPointNormalizedLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions},n=this.closestPointLength(t,e);return!n||0===(t=this.length(e))?0:n/t},closestPointT:function(t,n){for(var e,i,r,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=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=(e=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=e.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?(e=y[0],r-=l,s=x,w):(e=y[1],i+=l,s=S,P)}},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){return t<=0?this.divideAtT(0):1<=t?this.divideAtT(1):(t=this.tAt(t,n),this.divideAtT(t))},divideAtLength:function(t,n){t=this.tAtLength(t,n);return this.divideAtT(t)},divideAtT:function(t){var n,e,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,n=r.divider,e=r.dividerControlPoint1,r=r.dividerControlPoint2,[new m(i,s,t,n),new m(n,e,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 n=this.start,e=this.controlPoint1,i=this.controlPoint2,r=this.end;return t<=0?{startControlPoint1:n.clone(),startControlPoint2:n.clone(),divider:n.clone(),dividerControlPoint1:e.clone(),dividerControlPoint2:i.clone()}:1<=t?{startControlPoint1:e.clone(),startControlPoint2:i.clone(),divider:r.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:r.clone()}:(n=new d(n,e).pointAt(t),e=new d(e,i).pointAt(t),i=new d(i,r).pointAt(t),r=new d(n,e).pointAt(t),e=new d(e,i).pointAt(t),{startControlPoint1:n,startControlPoint2:r,divider:new d(r,e).pointAt(t),dividerControlPoint1:e,dividerControlPoint2:i})},getSubdivisions:function(t){var t=void 0===(t=t||{}).precision?this.PRECISION:t.precision,n=this.start,e=this.controlPoint1,i=this.controlPoint2,r=this.end,s=[new m(n,e,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===e.cross(n,r)&&0===i.cross(n,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,n=this.controlPoint1,e=this.controlPoint2,i=this.end;return!(t.equals(n)&&n.equals(e)&&e.equals(i))},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,i=0,r=e.length,s=0;s<r;s++)i+=e[s].endpointDistance();return i},lengthAtT:function(t,n){return t<=0?0:(n=void 0===(n=n||{}).precision?this.PRECISION:n.precision,this.divide(t)[0].length({precision:n}))},pointAt:function(t,n){return t<=0?this.start.clone():1<=t?this.end.clone():(t=this.tAt(t,n),this.pointAtT(t))},pointAtLength:function(t,n){t=this.tAtLength(t,n);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,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);t=this.tAt(t,n);return this.tangentAtT(t)},tangentAtLength:function(t,n){return this.isDifferentiable()?(t=this.tAtLength(t,n),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),n=t.startControlPoint2,e=t.dividerControlPoint1,t=t.divider,e=new d(n,e);return e.translate(t.x-n.x,t.y-n.y),e},tAt:function(t,n){var e;return t<=0?0:1<=t?1:(e={precision:e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions},n=this.length(e),this.tAtLength(n*t,e))},tAtLength:function(t,n){for(var e,i,r,s=!0,o=(t<0&&(s=!1,t=-t),void 0===(n=n||{}).precision?this.PRECISION:n.precision),a=void 0===n.subdivisions?this.getSubdivisions({precision:o}):n.subdivisions,n={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){e=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(!e)return s?1:0;for(var p=this.length(n),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=e.divide(.5),x=(c/=2,y[0].endpointDistance()),w=y[1].endpointDistance(),y=b<=x?(e=y[0],r-=c,x-(m=b)):(e=y[1],i+=c,w-(m=b-x)),b=m,S=y}},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,i=[e[0].start.clone()],r=e.length,s=0;s<r;s++){var o=e[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,n){return this.start.translate(t,n),this.controlPoint1.translate(t,n),this.controlPoint2.translate(t,n),this.end.translate(t,n),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 n;if(this.segments=[],t)if(Array.isArray(t)&&0!==t.length)if(n=(t=t.reduce(function(t,n){return t.concat(n)},[])).length,t[0].isSegment)for(r=0;r<n;r++){var e=t[r];this.appendSegment(e)}else for(var i=null,r=0;r<n;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(n=t.points.length,r=0;r<n;r++){var o=t.points[r];0===r?this.appendSegment(S.createSegment("M",o)):this.appendSegment(S.createSegment("L",o))}}}function g(t,n){return n.unshift(null),new(Function.prototype.bind.apply(t,n))}S.parse=function(t){if(!t)return new S;for(var n=new S,e=t.match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g),i=e.length,r=0;r<i;r++){var s=e[r].match(/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g),s=S.createSegment.apply(this,s);n.appendSegment(s)}return n},S.createSegment=function(t){if(!t)throw new Error("Type must be provided.");var n=S.segmentTypes[t];if(!n)throw new Error(t+" is not a recognized path segment type.");for(var e=[],i=arguments.length,r=1;r<i;r++)e.push(arguments[r]);return g(n,e)},S.prototype={type:h.Path,appendSegment:function(t){var n=this.segments,e=n.length,i=0!==e?n[e-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 r=t.length,s=0;s<r;s++){var o=t[s],a=this.prepareSegment(o,i,null);n.push(a),i=a}}else{if(!t||!t.isSegment)throw new Error("Segment required.");a=this.prepareSegment(t,i,null),n.push(a)}},bbox:function(){var t=this.segments,n=t.length;if(0===n)return null;for(var e,i=0;i<n;i++){var r,s=t[i];s.isVisible&&(s=s.bbox(),r=r?r.union(s):s)}return r||(e=t[n-1],new A(e.end.x,e.end.y,0,0))},clone:function(){for(var t=this.segments,n=t.length,e=new S,i=0;i<n;i++){var r=t[i].clone();e.appendSegment(r)}return e},closestPoint:function(t,n){t=this.closestPointT(t,n);return t?this.pointAtT(t):null},closestPointLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.closestPointT(t,e);return n?this.lengthAtT(n,e):0},closestPointNormalizedLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.closestPointLength(t,e);return 0===n||0===(t=this.length(e))?0:n/t},closestPointT:function(t,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r,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<i;h++){var u=e[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,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r,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<i;h++){var u,c=e[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,n){var e=this.toPolylines(n);if(!e)return!1;for(var i=e.length,r=0,s=0;s<i;s++)e[s].containsPoint(t)&&r++;return r%2==1},divideAt:function(t,n){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e);return this.divideAtLength(n*t,e)},divideAtLength:function(t,n){var e=this.segments.length;if(0===e)return null;for(var i,r,s,o,a=!0,h=(t<0&&(a=!1,t=-t),void 0===(n=n||{}).precision?this.PRECISION:n.precision),u=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:h}):n.segmentSubdivisions,c=0,l=0;l<e;l++){var f=a?l:e-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(),n=(v.replaceSegment(r,i),r),m=r+1,y=r+2,x=(i[0].isDifferentiable()||(v.removeSegment(n),--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-n-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 n=this.segments,e=t.segments,i=n.length;if(e.length!==i)return!1;for(var r=0;r<i;r++){var s=n[r],o=e[r];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(e<=(t=t<0?e+t:t)||t<0)throw new Error("Index out of range.");return n[t]},getSegmentSubdivisions:function(t){for(var n=this.segments,e=n.length,i=void 0===(t=t||{}).precision?this.PRECISION:t.precision,r=[],s=0;s<e;s++){var o=n[s].getSubdivisions({precision:i});r.push(o)}return r},getSubpaths:function(){var n=this.clone().validate().segments,e=n.length,i=[];for(let t=0;t<e;t++){var r=n[t];r.isSubpathStart?i.push(new S(r)):i[i.length-1].appendSegment(r)}return i},insertSegment:function(t,n){var e=this.segments,i=e.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=e[t-1]).nextSegment:e[0]),Array.isArray(n)){if(!(n=n.reduce(function(t,n){return t.concat(n)},[]))[0].isSegment)throw new Error("Segments required.");for(var o=n.length,a=0;a<o;a++){var h=n[a],u=this.prepareSegment(h,r,s);e.splice(t+a,0,u),r=u}}else{if(!n||!n.isSegment)throw new Error("Segment required.");u=this.prepareSegment(n,r,s),e.splice(t,0,u)}},intersectionWithLine:function(t,n){var e=null,i=this.toPolylines(n);if(!i)return null;for(var r=0,s=i.length;r<s;r++){var o=i[r],o=t.intersect(o);o&&(e=e||[],Array.isArray(o)?Array.prototype.push.apply(e,o):e.push(o))}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 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<e;o++){var a=n[o],h=r[o];s+=a.length({subdivisions:h})}return s},lengthAtT:function(t,n){var e=this.segments,i=e.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===(n=n||{}).precision?this.PRECISION:n.precision),o=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):n.segmentSubdivisions,a=0,h=0;h<r;h++){var u=e[h],c=o[h];a+=u.length({precisison:s,subdivisions:c})}return c=o[r],a+=(u=e[r]).lengthAtT(t,{precisison:s,subdivisions:c})},pointAt:function(t,n){var e;return 0===this.segments.length?null:t<=0?this.start.clone():1<=t?this.end.clone():(e={precision:e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e),this.pointAtLength(n*t,e))},pointAtLength:function(t,n){var e=this.segments,i=e.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===(n=n||{}).precision?this.PRECISION:n.precision),a=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:o}):n.segmentSubdivisions,h=0,u=0;u<i;u++){var c=s?u:i-1-u,l=e[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:e[i-1].end.clone()},pointAtT:function(t){var n,e=this.segments,i=e.length;return 0===i?null:(n=t.segmentIndex)<0?e[0].pointAtT(0):i<=n?e[i-1].pointAtT(1):((i=t.value)<0?i=0:1<i&&(i=1),e[n].pointAtT(i))},PRECISION:3,prepareSegment:function(t,n,e){t.previousSegment=n,t.nextSegment=e,n&&(n.nextSegment=t),e&&(e.previousSegment=t);n=t;return t.isSubpathStart&&(t.subpathStartSegment=t,n=e),n&&this.updateSubpathStartSegment(n),t},removeSegment:function(t){var n=this.segments,e=n.length;if(0===e)throw new Error("Path has no segments.");if(e<=(t=t<0?e+t:t)||t<0)throw new Error("Index out of range.");e=n.splice(t,1)[0],n=e.previousSegment,t=e.nextSegment;n&&(n.nextSegment=t),t&&(t.previousSegment=n),e.isSubpathStart&&t&&this.updateSubpathStartSegment(t)},replaceSegment:function(t,n){var e=this.segments,i=e.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=e[t],r=i.previousSegment,s=i.nextSegment,o=i.isSubpathStart;if(Array.isArray(n)){if(!(n=n.reduce(function(t,n){return t.concat(n)},[]))[0].isSegment)throw new Error("Segments required.");e.splice(t,1);for(var a=n.length,h=0;h<a;h++){var u=n[h],c=this.prepareSegment(u,r,s);e.splice(t+h,0,c),r=c,o&&c.isSubpathStart&&(o=!1)}}else{if(!n||!n.isSegment)throw new Error("Segment required.");c=this.prepareSegment(n,r,s),e.splice(t,1,c),o&&c.isSubpathStart&&(o=!1)}o&&s&&this.updateSubpathStartSegment(s)},round:function(t){for(var n=this.segments,e=n.length,i=0;i<e;i++)n[i].round(t);return this},scale:function(t,n,e){for(var i=this.segments,r=i.length,s=0;s<r;s++)i[s].scale(t,n,e);return this},segmentAt:function(t,n){t=this.segmentIndexAt(t,n);return t?this.getSegment(t):null},segmentAtLength:function(t,n){t=this.segmentIndexAtLength(t,n);return t?this.getSegment(t):null},segmentIndexAt:function(t,n){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e);return this.segmentIndexAtLength(n*t,e)},segmentIndexAtLength:function(t,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r=!0,s=(t<0&&(r=!1,t=-t),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<i;u++){var c=r?u:i-1-u,l=e[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,n){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e);return this.tangentAtLength(n*t,e)},tangentAtLength:function(t,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r,s=!0,o=(t<0&&(s=!1,t=-t),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<i;u++){var c=s?u:i-1-u,l=e[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 n,e=this.segments,i=e.length;return 0===i?null:(n=t.segmentIndex)<0?e[0].tangentAtT(0):i<=n?e[i-1].tangentAtT(1):((i=t.value)<0?i=0:1<i&&(i=1),e[n].tangentAtT(i))},toPoints:function(t){var n=this.segments,e=n.length;if(0===e)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<e;a++){var h,u=n[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(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 i=0,r=e.length;i<r;i++)n.push(new l(e[i]));return n},toString:function(){for(var t=this.segments,n=t.length,e="",i=0;i<n;i++)e+=t[i].serialize()+" ";return e.trim()},translate:function(t,n){for(var e=this.segments,i=e.length,r=0;r<i;r++)e[r].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,S.createSegment("M",0,0)),this}},Object.defineProperty(S.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 i=t[e];if(i.isVisible)return i.start}return t[n-1].end}}),Object.defineProperty(S.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 i=t[e];if(i.isVisible)return i.end}return t[n-1].end}});function v(){for(var t=[],n=arguments.length,e=0;e<n;e++)t.push(arguments[e]);if(!(this instanceof v))return g(v,t);if(0===n)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates (none provided).");if(t[0]instanceof d){if(1===n)return this.end=t[0].end.clone(),this;throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+n+" lines provided).")}if("string"==typeof t[0]||"number"==typeof t[0]){if(2===n)return this.end=new p(+t[0],+t[1]),this;if(n<2)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+n+" coordinates provided).");for(var i,r=[],e=0;e<n;e+=2)i=t.slice(e,e+2),r.push(g(v,i))}else{if(1===n)return this.end=new p(t[0]),this;for(r=[],e=0;e<n;e+=1)r.push(new v(t[e]))}return r}function y(){for(var t,n=[],e=arguments.length,i=0;i<e;i++)n.push(arguments[i]);if(!(this instanceof y))return g(y,n);if(0===e)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates (none provided).");if(n[0]instanceof m){if(1===e)return this.controlPoint1=n[0].controlPoint1.clone(),this.controlPoint2=n[0].controlPoint2.clone(),this.end=n[0].end.clone(),this;throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+e+" curves provided).")}if("string"==typeof n[0]||"number"==typeof n[0]){if(6===e)return this.controlPoint1=new p(+n[0],+n[1]),this.controlPoint2=new p(+n[2],+n[3]),this.end=new p(+n[4],+n[5]),this;if(e<6)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+e+" coordinates provided).");for(var r,s=[],i=0;i<e;i+=6)r=n.slice(i,i+6),s.push(g(y,r))}else{if(3===e)return this.controlPoint1=new p(n[0]),this.controlPoint2=new p(n[1]),this.end=new p(n[2]),this;if(e<3)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+e+" points provided).");for(s=[],i=0;i<e;i+=3)t=n.slice(i,i+3),s.push(g(y,t))}return s}function x(){for(var t,n=[],e=arguments.length,i=0;i<e;i++)n.push(arguments[i]);if(!(this instanceof x))return g(x,n);if(0===e)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates (none provided).");if(n[0]instanceof d){if(1===e)return this.end=n[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+e+" lines provided).")}if(n[0]instanceof m){if(1===e)return this.end=n[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+e+" curves provided).")}if("string"==typeof n[0]||"number"==typeof n[0]){if(2===e)return this.end=new p(+n[0],+n[1]),this;if(e<2)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+e+" coordinates provided).");for(var r,s=[],i=0;i<e;i+=2)r=n.slice(i,i+2),0===i?s.push(g(x,r)):s.push(g(v,r))}else{if(1===e)return this.end=new p(n[0]),this;for(s=[],i=0;i<e;i+=1)t=n[i],0===i?s.push(new x(t)):s.push(new v(t))}return s}function w(){for(var t=[],n=arguments.length,e=0;e<n;e++)t.push(arguments[e]);if(!(this instanceof w))return g(w,t);if(0<n)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 n;return t<=0?0:(n=this.length(),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.")}},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,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}}),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,n){t=new m(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAt(t,n);return[new y(t[0]),new y(t[1])]},divideAtLength:function(t,n){t=new m(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAtLength(t,n);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,n,e,i;return!(!this.previousSegment||(t=this.start,n=this.controlPoint1,e=this.controlPoint2,i=this.end,t.equals(n)&&n.equals(e)&&e.equals(i)))},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}}),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,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}}),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 n=[],e=[],i=t.length-1;if(1==i)n[0]=new p((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),e[0]=new p(2*n[0].x-t[0].x,2*n[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++)n.push(new p(o[s],a[s])),e.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[n,e]},getCurveDivider:function(t,n,e,i){console.warn("deprecated");var r=new m(t,n,e,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 n=t.length,e=[],i=[],r=2;e[0]=t[0]/r;for(var s=1;s<n;s++)i[s]=1/r,e[s]=(t[s]-e[s-1])/(r=(s<n-1?4:3.5)-i[s]);for(s=1;s<n;s++)e[n-s-1]-=i[n-s]*e[n-s];return e},getInversionSolver:function(t,n,e,i){console.warn("deprecated");var r=new m(t,n,e,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,n){var e=t.start.x,i=t.start.y,r=t.end.x,t=t.end.y,s=n.start.x,o=n.start.y,r=r-e,t=t-i,a=n.end.x-s,n=n.end.y-o,e=e-s,s=i-o,i=r*n-a*t,o=(r*s-t*e)/i,r=(a*s-n*e)/i;return 0<=o&&o<=1&&0<=r&&r<=1}function St(t,n){var e=t.a,i=t.b,r=t.x,t=t.y,s=n.start.x-r,r=n.end.x-r,o=n.start.y-t,e=e*e,i=i*i,r=r-s,n=n.end.y-t-o,t=r*r/e+n*n/i,r=2*s*r/e+2*o*n/i,n=r*r-4*t*(s*s/e+o*o/i-1);return 0==n?0<=(s=-r/2/t)&&s<=1:0<n&&(o=(-r-(e=Math.sqrt(n)))/2/t,0<=(i=(-r+e)/2/t)&&i<=1||0<=o&&o<=1)}function Pt(C,N){{var I=0,O=0;let{cos:t,sin:n}=Math,e=n(I),i=t(I),r=n(O),s=t(O),o=e*e,a=i*i,h=e*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=R([[v,w,S],[w,y,A],[S,A,L]]),O=R([[m,b,P],[b,x,T],[P,T,E]]),C=.33333333*(R([[m,w,S],[b,y,A],[P,A,L]])+R([[v,b,S],[w,x,A],[S,T,L]])+R([[v,w,P],[w,y,T],[S,A,E]])),N=.33333333*(R([[v,b,P],[w,x,T],[S,T,E]])+R([[m,w,P],[b,y,T],[P,A,E]])+R([[m,b,S],[b,x,A],[P,T,L]])),D=Yt([[I,C],[C,N]]),I=Yt([[I,N],[C,O]]),O=Yt([[C,N],[N,O]]);return!(0<(D=Yt([[2*D,I],[I,2*O]]))&&(0<N||0<C))}}function At(t,n){var{start:e,end:i}=n,{x:r,y:s,width:o,height:a}=t;return!(e.x>r+o&&i.x>r+o||e.x<r&&i.x<r||e.y>s+a&&i.y>s+a||e.y<s&&i.y<s)&&(!(!t.containsPoint(n.start)&&!t.containsPoint(n.end))||E(t.topLine(),n)||E(t.rightLine(),n)||E(t.bottomLine(),n)||E(t.leftLine(),n))}function Tt(t,n){return!!Lt(t,A.fromEllipse(n))&&Ot(L.fromRect(t),n)}function Lt(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 C(t,n){return Gt(t,n,{interior:!1})}function Et(t,n){return Wt(t,n,{interior:!1})}function Ct(t,n){return Bt(t,n,{interior:!1})}function Nt(t,n){return Ht(t,n,{interior:!1})}function It(t,n){return Gt(t,n,{interior:!0})}function Ot(t,n){return Wt(t,n,{interior:!0})}function Dt(t,n){return Bt(t,n,{interior:!0})}function Rt(t,n){return Ht(t,n,{interior:!0})}function Mt(t,n){return Zt(t,n,{interior:!0})}function qt(t,e,i){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?It:C)(n,e)})}function Ft(t,e,i){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?Ot:Et)(n,e)})}function kt(t,n,e){return zt(t,L.fromRect(n),e)}function Vt(t,n,e){return Ut(t,n,e,{interior:!1})}function zt(t,n,e){return Ut(t,n,e,{interior:!0})}function jt(t,e,i,r){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?zt:Vt)(e,n,r)})}function Gt(t,n,e={}){var{interior:e=!1}=e;let i;if(e){if(t.containsPoint(n.start))return!0;var{start:e,end:r,points:s}=t;i=r.equals(e)?s:[...s,e]}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(n,a))return!0;return!1}function Wt(t,n,e={}){var{start:i,end:r,points:s}=t;if(n.containsPoint(i))return!0;let o;var{interior:e=!1}=e;if(e){if(t.containsPoint(n.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(n,h))return!0;return!1}function Bt(t,n,e){return Zt(t,L.fromRect(n),e)}function Ut(t,e,i,r){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?Zt:Ht)(e,n,r)})}function Ht(t,n,e={}){var{interior:e=!1}=e;let i;if(e){e=n.start;if(t.containsPoint(e))return!0;i=t.clone().close()}else i=t;var r=n.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,n,e){return n.containsPoint(t.start)||Ht(t,n.clone().close(),e)}function Yt(t){return t[0][0]*t[1][1]-t[0][1]*t[1][0]}function R(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:n,points:e}=this;return e.length<=1||t.equals(n)?e:[...e,t.clone()]}});b={__proto__:null,Curve:m,Ellipse:c,Line:d,Path:S,Point:p,Polygon:L,Polyline:l,Rect:A,bezier:P,ellipse:at,intersection:{__proto__:null,ellipseWithEllipse:Pt,ellipseWithLine:St,exists:function t(n,e,i,r){switch(n.type){case h.Line:if(e.type===h.Line)return E(n,e);break;case h.Ellipse:switch(e.type){case h.Line:return St(n,e);case h.Ellipse:return Pt(n,e)}break;case h.Rect:switch(e.type){case h.Line:return At(n,e);case h.Ellipse:return Tt(n,e);case h.Rect:return Lt(n,e)}break;case h.Polyline:switch(e.type){case h.Line:return C(n,e);case h.Ellipse:return Et(n,e);case h.Rect:return Ct(n,e);case h.Polyline:return Nt(n,e)}break;case h.Polygon:switch(e.type){case h.Line:return It(n,e);case h.Ellipse:return Ot(n,e);case h.Rect:return Dt(n,e);case h.Polyline:return Rt(n,e);case h.Polygon:return Mt(n,e)}break;case h.Path:switch(e.type){case h.Line:return qt(n,e,i);case h.Ellipse:return Ft(n,e,i);case h.Rect:return kt(n,e,i);case h.Polyline:return Vt(n,e,i);case h.Polygon:return zt(n,e,i);case h.Path:return jt(n,e,i,r)}}switch(e.type){case h.Ellipse:case h.Rect:case h.Polyline:case h.Polygon:case h.Path:return t(e,n,r,i);default:throw Error(`The intersection for ${n} and ${e} could not be found.`)}},lineWithLine:E,pathWithEllipse:Ft,pathWithLine:qt,pathWithPath:jt,pathWithPolygon:zt,pathWithPolyline:Vt,pathWithRect:kt,polygonWithEllipse:Ot,polygonWithLine:It,polygonWithPolygon:Mt,polygonWithPolyline:Rt,polygonWithRect:Dt,polylineWithEllipse:Et,polylineWithLine:C,polylineWithPolyline:Nt,polylineWithRect:Ct,rectWithEllipse:Tt,rectWithLine:At,rectWithRect:Lt},line:rt,normalizeAngle:r,point:nt,random:G,rect:dt,scale:{linear:function(t,n,e){var i=t[1]-t[0],r=n[1]-n[0];return(e-t[0])/i*r+n[0]||0}},snapToGrid:j,toDeg:s,toRad:o,types:h};let _t="http://www.w3.org/2000/svg",Xt="http://www.w3.org/2000/xmlns/";let $t="http://www.w3.org/1999/xlink";var Jt={__proto__:null,svg:_t,xhtml:"http://www.w3.org/1999/xhtml",xlink:$t,xml:"http://www.w3.org/XML/1998/namespace",xmlns:Xt};let Kt="object"==typeof window&&!!window.SVGAngle,N=Kt?tn():null,Qt=Kt?nn("g"):null;function tn(){var t=nn("svg");return t.setAttributeNS(Xt,"xmlns:xlink",$t),t.setAttribute("version","1.1"),t}function nn(t){return document.createElementNS(_t,t)}function en(t,n){let e=t;do{if(e.contains(n))return e}while(e=e.parentNode);return null}function I(){return N.createSVGMatrix()}function rn(t={}){var n=N.createSVGMatrix();return t&&("a"in t&&(n.a=t.a),"b"in t&&(n.b=t.b),"c"in t&&(n.c=t.c),"d"in t&&(n.d=t.d),"e"in t&&(n.e=t.e),"f"in t)&&(n.f=t.f),n}function sn(t){t=t.transform.baseVal.consolidate();return t?t.matrix:null}function on(t,n){var e=N.createSVGTransform(),n=hn(n)?n:rn(n);e.setMatrix(n),t.transform.baseVal.appendItem(e)}let an="[object SVGMatrix]";function hn(t){return Object.prototype.toString.call(t)===an}function un(t={}){var{a:t=1,b:n=0,c:e=0,d:i=1,e:r=0,f:s=0}=t;return`matrix(${t},${n},${e},${i},${r},${s})`}function cn(t,n){var e=[];let i=n;for(;i&&i.nodeType===Node.ELEMENT_NODE&&i!==t;){var r=sn(i);r&&e.unshift(r),i=i.parentNode}return e.reduce((t,n)=>t.multiply(n),I())}{if(!Kt)return function(){throw new Error("SVG is required to use Vectorizer.")};function D(t,n,e){if(!(this instanceof D))return D.apply(Object.create(D.prototype),arguments);if(t){if(D.isV(t)&&(t=t.node),n=n||{},D.isString(t)){if("svg"===(t=t.trim()).toLowerCase())t=D.createSvgDocument();else if("<"===t[0]){var i=D.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 D(document.importNode(a,!0)))}return r}t=document.importNode(i.firstChild,!0)}else t=nn(t);D.ensureId(t)}return this.node=t,this.setAttributes(n),e&&this.append(e),this}}var ln=(P=Math).PI,fn=P.atan2,dn=P.sqrt,O=P.min,gn=P.max,pn=P.cos,vn=P.sin,P=D.prototype;Object.defineProperty(P,"id",{enumerable:!0,get:function(){return this.node.id},set:function(t){this.node.id=t}}),P.getTransformToElement=function(t,n){var e,i,r=this.node,t=D.toNode(t);let s;return(s=D.isSVGGraphicsElement(t)&&D.isSVGGraphicsElement(r)?n&&n.safe?(n=r)===(e=t)?I():(i=n.compareDocumentPosition(e))&Node.DOCUMENT_POSITION_CONTAINED_BY?cn(n,e).inverse():i&Node.DOCUMENT_POSITION_CONTAINS?cn(e,n):(i=en(n,e))?(n=cn(i,n),cn(i,e).inverse().multiply(n)):null:(i=t,((e=r).ownerSVGElement||e)===(i.ownerSVGElement||i)&&(i=i.getScreenCTM())&&(e=e.getScreenCTM())?i.inverse().multiply(e):null):s)||I()},P.transform=function(t,n){var e=this.node;return D.isUndefined(t)?sn(e)||I():(n&&n.absolute?e.setAttribute("transform",un(t)):on(e,t),this)},P.translate=function(t,n,e){e=e||{},n=n||0;var i=this.attr("transform")||"",r=D.parseTransformString(i),i=r.value;if(D.isUndefined(t))return r.translate;i=i.replace(/translate\([^)]*\)/g,"").trim();t=e.absolute?t:r.translate.tx+t,e=e.absolute?n:r.translate.ty+n;return this.attr("transform",("translate("+t+","+e+")"+" "+i).trim()),this},P.rotate=function(t,n,e,i){i=i||{};var r=this.attr("transform")||"",s=D.parseTransformString(r),r=s.value;if(D.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!==n&&void 0!==e?","+n+","+e:"")+")")).trim()),this},P.scale=function(t,n){n=D.isUndefined(n)?t:n;var e=this.attr("transform")||"",i=D.parseTransformString(e),e=i.value;return D.isUndefined(t)?i.scale:(e=e.replace(/scale\([^)]*\)/g,"").trim(),this.attr("transform",(e+" "+("scale("+t+","+n+")")).trim()),this)},P.bbox=function(t,n){var e,i=this.node,r=i.ownerSVGElement;if(!r)return new A(0,0,0,0);try{e=i.getBBox()}catch{e={x:i.clientLeft,y:i.clientTop,width:i.clientWidth,height:i.clientHeight}}return t?new A(e):(i=this.getTransformToElement(n||r),D.transformRect(e,i))},P.getBBox=function(t){var n={},e=this.node;if(!e.ownerSVGElement||!D.isSVGGraphicsElement(e))return new A(0,0,0,0);if(t&&(t.target&&(n.target=D.toNode(t.target)),t.recursive)&&(n.recursive=t.recursive),n.recursive){var i=this.children(),r=i.length;if(0===r)return this.getBBox({target:n.target,recursive:!1});n.target||(n.target=this);for(var s=0;s<r;s++)var o=i[s],o=0===o.children().length?o.getBBox({target:n.target,recursive:!1}):o.getBBox({target:n.target,recursive:!0}),a=a?a.union(o):o;return a}try{a=e.getBBox()}catch{a={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return n.target?(t=this.getTransformToElement(n.target),D.transformRect(a,t)):new A(a)};var mn,yn,M,q,F,xn,wn,bn,Sn,Pn=/em$/;function An(t,n){var e=parseFloat(t);return Pn.test(t)?e*n:e}P.text=function(t,n){if(t&&"string"!=typeof t)throw new Error("Vectorizer: text() expects the first argument to be a string.");t=D.sanitizeText(t);for(var e,i,r,s,o=(n=n||{}).displayEmpty,a=n.eol,h=n.textPath,u=n.textVerticalAnchor,c="middle"===u||"bottom"===u||"top"===u,l=n.x,f=(void 0===l&&(l=this.attr("x")||0),n.includeAnnotationIndices),d=n.annotations,n=(d&&!D.isArray(d)&&(d=[d]),n.lineHeight),g="auto"===n,p=g?"1.5em":n||"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?(n=this,o=(o=h="string"==typeof h?{d:h}:h)||{},e=D("textPath"),(i=o.d)&&void 0===o["xlink:href"]&&(i=D("path").attr("d",i).appendTo(n.defs()),e.attr("xlink:href","#"+i.id)),D.isObject(o)&&e.attr(o),e.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(_t,"tspan"),N=w[S];if(N)d?((I=(T=((t,n,e)=>{for(var i=(e=e||{}).includeAnnotationIndices,r=e.eol,s=e.lineHeight,o=e.baseSize,a=0,e={},h=n.length-1,u=0;u<=h;u++){var c,l,f,d,g=n[u],p=null;D.isObject(g)?(c=g.attrs,f=(l=D("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&&(e.maxFontSize=a),s?e.lineHeight=s:a&&(e.lineHeight=1.2*a),e})(C,A=D.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 n=v;for(let t=(A=D.findAnnotationsAtIndex(d,x)).length;0<t;t--){var O=A[t-1].attrs;if(O&&"font-size"in O){O=parseFloat(O["font-size"]);if(isFinite(O)){n=O;break}}}g&&(0<S?L=1.2*n:r=.8*n),C.setAttribute("font-size",n),T.maxFontSize=n}}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,n,e,i)=>{if(!Array.isArray(n))return 0;var r=n.length;if(!r)return 0;for(var s=n[0],o=An(s.maxFontSize,e)||e,a=0,h=An(i,e),u=1;u<r;u++)a+=An((s=n[u]).lineHeight,e)||h;var c,l=An(s.maxFontSize,e)||e;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,Pn.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:n,local:e}=D.qualifyAttr(t),i=this.node;return n?i.hasAttributeNS(n,e)&&i.removeAttributeNS(n,e):i.hasAttribute(t)&&i.removeAttribute(t),this},P.attr=function(t,n){if(D.isUndefined(t)){for(var e=this.node.attributes,i={},r=0;r<e.length;r++)i[e[r].name]=e[r].value;return i}if(D.isString(t)&&D.isUndefined(n))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,n);return this},P.normalizePath=function(){return"PATH"===this.tagName()&&this.attr("d",D.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 n in t)t.hasOwnProperty(n)&&this.setAttribute(n,t[n]);return this},P.append=function(t){for(var n=0,e=(t=D.isArray(t)?t:[t]).length;n<e;n++)this.node.appendChild(D.toNode(t[n]));return this},P.prepend=function(t){var n=this.node.firstChild;return n?D(n).before(t):this.append(t)},P.before=function(t){var n=this.node,e=n.parentNode;if(e)for(var i=0,r=(t=D.isArray(t)?t:[t]).length;i<r;i++)e.insertBefore(D.toNode(t[i]),n);return this},P.appendTo=function(t){return D.toNode(t).appendChild(this.node),this},P.svg=function(){return this.node instanceof window.SVGSVGElement?this:D(this.node.ownerSVGElement)},P.tagName=function(){return this.node.tagName.toUpperCase()},P.defs=function(){var t=this.svg()||this,n=t.node.getElementsByTagName("defs")[0];return n?D(n):D("defs").appendTo(t)},P.clone=function(){var t=D(this.node.cloneNode(!0));return t.node.id=D.uniqueId(),t},P.findOne=function(t){t=this.node.querySelector(t);return t?D(t):void 0},P.find=function(t){var n=[],e=this.node.querySelectorAll(t);if(e)for(var i=0;i<e.length;i++)n.push(D(e[i]));return n},P.children=function(){for(var t=this.node.childNodes,n=[],e=0;e<t.length;e++)1===t[e].nodeType&&n.push(D(t[e]));return n},P.parent=function(){return D(this.node.parentNode)||null},P.index=function(){for(var t=0,n=this.node.previousSibling;n;)1===n.nodeType&&t++,n=n.previousSibling;return t},P.findParentByClass=function(t,n){for(var e=this.node.ownerSVGElement,i=this.node.parentNode;i&&i!==n&&i!==e;){var r=D(i);if(r.hasClass(t))return r;i=i.parentNode}return null},P.contains=function(t){var n=this.node,t=D.toNode(t),t=t&&t.parentNode;return n===t||!!(t&&1===t.nodeType&&16&n.compareDocumentPosition(t))},P.toLocalPoint=function(t,n){var e=this.svg().node,i=e.createSVGPoint();i.x=t,i.y=n;try{var r=i.matrixTransform(e.getScreenCTM().inverse()),s=this.getTransformToElement(e).inverse()}catch{return i}return r.matrixTransform(s)},P.translateCenterToPoint=function(t){var n=this.getBBox({target:this.svg()}).center();return this.translate(t.x-n.x,t.y-n.y),this},P.translateAndAutoOrient=function(t,n,e){t=new p(t),n=new p(n),e=e||this.svg();var i=this.scale(),r=(this.attr("transform",""),this.getBBox({target:e}).scale(i.sx,i.sy)),s=D.createSVGTransform(),o=(s.setTranslate(-r.x-r.width/2,-r.y-r.height/2),D.createSVGTransform()),a=t.angleBetween(n,t.clone().offset(1,0)),a=(a&&o.setRotate(a,0,0),D.createSVGTransform()),n=t.clone().move(n,r.width/2),r=(a.setTranslate(2*t.x-n.x,2*t.y-n.y),this.getTransformToElement(e)),t=D.createSVGTransform();return t.setMatrix(a.matrix.multiply(o.matrix.multiply(s.matrix.multiply(r.scale(i.sx,i.sy))))),this.attr("transform",un(t.matrix)),this},P.animateAlongPath=function(t,n){n=D.toNode(n);n=D.ensureId(n),t=D("animateMotion",t),n=D("mpath",{"xlink:href":"#"+n});t.append(n),this.append(t);try{t.node.beginElement()}catch{if("fake"===document.documentElement.getAttribute("smiling"))for(var e=t.node,n=(e.animators=[],e.getAttribute("id")),i=(n&&(id2anim[n]=e),getTargets(e)),r=0,s=i.length;r<s;r++){var o=i[r],o=new Animator(e,o,r);animators.push(o),(e.animators[r]=o).register()}}return this};let n=/[^\x20\t\r\n\f]+/g;function Tn(t){return D.isString(t)&&t.trim().match(n)||[]}P.hasClass=function(t){return!!D.isString(t)&&this.node.classList.contains(t.trim())},P.addClass=function(t){return this.node.classList.add(...Tn(t)),this},P.removeClass=function(t){return this.node.classList.remove(...Tn(t)),this},P.toggleClass=function(t,n){var e=Tn(t);for(let t=0;t<e.length;t++)this.node.classList.toggle(e[t],n);return this},P.sample=function(t){t=t||1;for(var n,e=this.node,i=e.getTotalLength(),r=[],s=0;s<i;)n=e.getPointAtLength(s),r.push({x:n.x,y:n.y,distance:s}),s+=t;return r},P.convertToPath=function(){var t=D("path"),n=(t.attr(this.attr()),this.convertToPathData());return n&&t.attr("d",n),t},P.convertToPathData=function(){var t=this.tagName();switch(t){case"PATH":return this.attr("d");case"LINE":return D.convertLineToPathData(this.node);case"POLYGON":return D.convertPolygonToPathData(this.node);case"POLYLINE":return D.convertPolylineToPathData(this.node);case"ELLIPSE":return D.convertEllipseToPathData(this.node);case"CIRCLE":return D.convertCircleToPathData(this.node);case"RECT":return D.convertRectToPathData(this.node)}throw new Error(t+" cannot be converted to PATH.")},D.prototype.toGeometryShape=function(){var t,n,e,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,e=parseFloat(this.attr("height"))||0,new A(i,o,t,e);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 n=D.getPointsFromSvgNode(this),new l(n);case"POLYGON":return 1<(n=D.getPointsFromSvgNode(this)).length&&n.push(n[0]),new l(n);case"PATH":return e=this.attr("d"),S.isDataSupported(e)||(e=D.normalizePathData(e)),new S(e);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,n){var e=this.svg().node,i=this.getBBox({target:n=n||e}),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(n),a=D.decomposeMatrix(o),e=e.createSVGTransform(),s=(e.setRotate(-a.rotation,r.x,r.y),D.transformRect(s,e.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=D.createSVGPoint(h.x,h.y)).matrixTransform(this.getTransformToElement(n)),(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,n){return t.refDistance-n.refDistance}),d[0]&&(o=d[0].sample)}return o}},P.setAttribute=function(t,n){var e,i=this.node;return null===n?this.removeAttr(t):(t=o[t],e=D.qualifyAttr(t).ns,e?i.setAttributeNS(e,t,n):"id"===t?i.id=n:i.setAttribute(t,n)),this},D.createSvgDocument=function(t){return t?(t=`<svg xmlns="${_t}" xmlns:xlink="${$t}" version="1.1">${t}</svg>`,t=D.parseXML(t,{async:!1}).documentElement,t):tn()},D.createSVGStyle=function(t){t=D("style",{type:"text/css"},[D.createCDATASection(t)]).node;return t},D.createCDATASection=function(t=""){return document.implementation.createDocument(null,"xml",null).createCDATASection(t)},D.idCounter=0,D.uniqueId=function(){return"v-"+ ++D.idCounter},D.toNode=function(t){return D.isV(t)?t.node:t.nodeName&&t||t[0]},D.ensureId=function(t){return(t=D.toNode(t)).id||(t.id=D.uniqueId())},D.sanitizeText=function(t){return(t||"").replace(/ /g,"\xa0")},D.isUndefined=function(t){return void 0===t},D.isString=function(t){return"string"==typeof t},D.isObject=function(t){return t&&"object"==typeof t},D.isArray=Array.isArray,D.parseXML=function(t,n){var e;n=n||{};try{var i=new DOMParser;D.isUndefined(n.async)||(i.async=n.async),e=i.parseFromString(t,"text/xml")}catch{e=void 0}if(!e||e.getElementsByTagName("parsererror").length)throw new Error("Invalid XML: "+t);return e};let e=Object.create(null),o=(["attributeName","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","repeatCount","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].forEach(t=>e[t]=t),e.xlinkShow="xlink:show",e.xlinkRole="xlink:role",e.xlinkActuate="xlink:actuate",e.xlinkHref="xlink:href",e.xlinkType="xlink:type",e.xlinkTitle="xlink:title",e.xmlBase="xml:base",e.xmlLang="xml:lang",e.xmlSpace="xml:space",new Proxy(e,{get(t,n){return D.supportCamelCaseAttributes?n in t?t[n]:t[n]=n.replace(/[A-Z]/g,"-$&").toLowerCase():n}}));function Ln(t,n,e,i,r,s){return[1/3*t+2/3*e,1/3*n+2/3*i,1/3*r+2/3*e,1/3*s+2/3*i,r,s]}function En(t,n,e){return{x:t*F(e)-n*q(e),y:t*q(e)+n*F(e)}}function Cn(t,n,e,i,r,s,o,a,h,u){var c=120*M/180,l=M/180*(+r||0),f=[];if(u)x=u[0],w=u[1],m=u[2],y=u[3];else{t=(g=En(t,n,-l)).x,n=g.y;var d=(t-(a=(g=En(a,h,-l)).x))/2,g=(n-(h=g.y))/2,p=d*d/(e*e)+g*g/(i*i),p=(1<p&&(e*=p=bn(p),i*=p),e*e),v=i*i,s=(s==o?-1:1)*bn(Sn((p*v-p*g*g-v*d*d)/(p*g*g+v*d*d)));if(!Number.isFinite(s))return[t,n,a,h,a,h];var m=s*e*g/i+(t+a)/2,y=s*-i*d/e+(n+h)/2,x=wn(((n-y)/i).toFixed(9)),w=wn(((h-y)/i).toFixed(9));(x=t<m?M-x:x)<0&&(x=2*M+x),(w=a<m?M-w:w)<0&&(w=2*M+w),o&&w<x&&(x-=2*M),!o&&x<w&&(w-=2*M)}Sn(w-x)>c&&(p=w,v=a,g=h,f=Cn(a=m+e*F(w=x+c*(o&&x<w?1:-1)),h=y+i*q(w),e,i,r,0,o,v,g,[w,p,m,y])),s=w-x;d=F(x),c=q(x),r=F(w),o=q(w),v=xn(s/4),g=4/3*(e*v),p=4/3*(i*v),m=[t,n],y=[t+g*c,n-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?En(f[P-1],f[P],l).y:En(f[P],f[P+1],l).x;return b}function Nn(t){var n,s,o;if(!(t=Array.isArray(t)&&Array.isArray(t&&t[0])?t:(n=t)?(s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[],String(n).replace(mn,function(t,n,e){var i=[],r=n.toLowerCase();for(e.replace(yn,function(t,n){n&&i.push(+n)}),"m"===r&&2<i.length&&(o.push([n].concat(i.splice(0,2))),r="l",n="m"===n?"l":"L");s[r]<=i.length&&(o.push([n].concat(i.splice(0,s[r]))),s[r]););}),o):null)||!t.length)return[["M",0,0]];for(var e=[],i=0,r=0,a=0,h=0,u=t.length,c=0;c<u;c++){var l,f,d=[],g=(e.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 e}function In(t){var n=Nn(t),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};for(var i=[],r="",s="",o=n.length,a=0;a<o;a++){"C"!==(r=n[a]?n[a][0]:r)&&(i[a]=r,0<a)&&(s=i[a-1]),n[a]=((t,n,e)=>{var i,r;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(Cn.apply(0,[n.x,n.y].concat(t.slice(1))));break;case"S":r="C"===e||"S"===e?(i=2*n.x-n.bx,2*n.y-n.by):(i=n.x,n.y),t=["C",i,r].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(Ln(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(Ln(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})(n[a],e,s),"A"!==i[a]&&"C"===r&&(i[a]="C"),c=u=h=void 0;var h=n,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=n.length}var l=n[a],f=l.length;e.x=l[f-2],e.y=l[f-1],e.bx=parseFloat(l[f-4])||e.x,e.by=parseFloat(l[f-3])||e.y}return n[0][0]&&"M"===n[0][0]||n.unshift(["M",0,0]),n}return Object.defineProperty(D,"attributeNames",{enumerable:!0,value:o,writable:!1}),Object.defineProperty(D,"supportCamelCaseAttributes",{enumerable:!0,value:!0,writable:!0}),D.qualifyAttr=function(t){var n;return-1!==t.indexOf(":")?(n=t.split(":"),{ns:Jt[n[0]],local:n[1]}):{ns:null,local:t}},D.transformSeparatorRegex=/[ ,]+/,D.transformFunctionRegex=/\b(\w+)\(([^()]+)\)/,D.transformTranslateRegex=/\btranslate\(([^()]+)\)/,D.transformRotateRegex=/\brotate\(([^()]+)\)/,D.transformScaleRegex=/\bscale\(([^()]+)\)/,D.transformStringToMatrix=function(t){let n;return(n=D.isString(t)?(t=t,Qt.setAttribute("transform",t),sn(Qt)):n)||I()},D.matrixToTransformString=un,D.parseTransformString=function(t){t&&(n=D.transformSeparatorRegex,0<=t.trim().indexOf("matrix")?(r=D.transformStringToMatrix(t),e=[(r=D.decomposeMatrix(r)).translateX,r.translateY],i=[r.scaleX,r.scaleY],r=[r.rotation],s=[],0===e[0]&&0===e[1]||s.push("translate("+e+")"),1===i[0]&&1===i[1]||s.push("scale("+i+")"),0!==r[0]&&s.push("rotate("+r+")"),t=s.join(" ")):((s=t.match(D.transformTranslateRegex))&&(e=s[1].split(n)),(s=t.match(D.transformRotateRegex))&&(r=s[1].split(n)),(s=t.match(D.transformScaleRegex))&&(i=s[1].split(n))));var n,e,i,r,s=i&&i[0]?parseFloat(i[0]):1;return{value:t,translate:{tx:e&&e[0]?parseInt(e[0],10):0,ty:e&&e[1]?parseInt(e[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}}},D.deltaTransformPoint=function(t,n){return{x:n.x*t.a+n.y*t.c,y:n.x*t.b+n.y*t.d}},D.decomposeMatrix=function(t){var n=D.deltaTransformPoint(t,{x:0,y:1}),e=D.deltaTransformPoint(t,{x:1,y:0}),n=180/ln*fn(n.y,n.x)-90,e=180/ln*fn(e.y,e.x);return{translateX:t.e,translateY:t.f,scaleX:dn(t.a*t.a+t.b*t.b),scaleY:dn(t.c*t.c+t.d*t.d),skewX:n,skewY:e,rotation:n}},D.matrixToScale=function(t){var n,e,i,r;return t?(n=D.isUndefined(t.a)?1:t.a,r=D.isUndefined(t.d)?1:t.d,e=t.b,i=t.c):n=r=1,{sx:e?dn(n*n+e*e):n,sy:i?dn(i*i+r*r):r}},D.matrixToRotate=function(t){var n={x:0,y:1};return t&&(n=D.deltaTransformPoint(t,n)),{angle:r(s(fn(n.y,n.x))-90)}},D.matrixToTranslate=function(t){return{tx:t&&t.e||0,ty:t&&t.f||0}},D.isVElement=D.isV=function(t){return t instanceof D},D.isSVGGraphicsElement=function(t){return!!t&&(t=D.toNode(t))instanceof SVGElement&&"function"==typeof t.getScreenCTM},D.createSVGMatrix=rn,D.createSVGTransform=function(t){return D.isUndefined(t)?N.createSVGTransform():(hn(t)||(t=rn(t)),N.createSVGTransformFromMatrix(t))},D.createSVGPoint=function(t,n){var e=N.createSVGPoint();return e.x=t,e.y=n,e},D.transformRect=function(t,n){var e=N.createSVGPoint(),i=(e.x=t.x,e.y=t.y,e.matrixTransform(n)),r=(e.x=t.x+t.width,e.y=t.y,e.matrixTransform(n)),s=(e.x=t.x+t.width,e.y=t.y+t.height,e.matrixTransform(n)),t=(e.x=t.x,e.y=t.y+t.height,e.matrixTransform(n)),e=O(i.x,r.x,s.x,t.x),n=gn(i.x,r.x,s.x,t.x),o=O(i.y,r.y,s.y,t.y),i=gn(i.y,r.y,s.y,t.y);return new A(e,o,n-e,i-o)},D.transformPoint=function(t,n){return new p(D.createSVGPoint(t.x,t.y).matrixTransform(n))},D.transformLine=function(t,n){return new d(D.transformPoint(t.start,n),D.transformPoint(t.end,n))},D.transformPolyline=function(t,n){for(var e=t instanceof l?t.points:t,i=[],r=0,s=(e=D.isArray(e)?e:[]).length;r<s;r++)i[r]=D.transformPoint(e[r],n);return new l(i)},D.styleToObject=function(t){for(var n={},e=t.split(";"),i=0;i<e.length;i++){var r=e[i].split("=");n[r[0].trim()]=r[1].trim()}return n},D.createSlicePathData=function(t,n,e,i){var r=2*ln-1e-6,s=(i<e&&(s=e,e=i,i=s),i-e),o=s<ln?"0":"1",a=pn(e),e=vn(e),h=pn(i),i=vn(i);return r<=s?t?"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z":t?"M"+n*a+","+n*e+"A"+n+","+n+" 0 "+o+",1 "+n*h+","+n*i+"L"+t*h+","+t*i+"A"+t+","+t+" 0 "+o+",0 "+t*a+","+t*e+"Z":"M"+n*a+","+n*e+"A"+n+","+n+" 0 "+o+",1 "+n*h+","+n*i+"L0,0Z"},D.mergeAttrs=function(t,n){for(var e in n)"class"===e?t[e]=t[e]?t[e]+" "+n[e]:n[e]:"style"===e?D.isObject(t[e])&&D.isObject(n[e])?t[e]=D.mergeAttrs(t[e],n[e]):D.isObject(t[e])?t[e]=D.mergeAttrs(t[e],D.styleToObject(n[e])):D.isObject(n[e])?t[e]=D.mergeAttrs(D.styleToObject(t[e]),n[e]):t[e]=D.mergeAttrs(D.styleToObject(t[e]),D.styleToObject(n[e])):t[e]=n[e];return t},D.annotateString=function(t,n,e){n=n||[];for(var i,r,s=(e=e||{}).offset||0,o=[],a=[],h=0;h<t.length;h++){for(var u=a[h]=t[h],c=0;c<n.length;c++){var l=n[c];l.start+s<=h&&h<l.end+s&&(D.isObject(u)?u.attrs=D.mergeAttrs(D.mergeAttrs({},u.attrs),l.attrs):u=a[h]={t:t[h],attrs:l.attrs},e.includeAnnotationIndices)&&(u.annotations||(u.annotations=[])).push(c)}(r=a[h-1])?D.isObject(u)&&D.isObject(r)?JSON.stringify(u.attrs)===JSON.stringify(r.attrs)?i.t+=u.t:(o.push(i),i=u):i=D.isObject(u)||D.isObject(r)?(o.push(i),u):(i||"")+u:i=u}return i&&o.push(i),o},D.findAnnotationsAtIndex=function(t,n){var e=[];return t&&t.forEach(function(t){t.start<n&&n<=t.end&&e.push(t)}),e},D.findAnnotationsBetweenIndexes=function(t,n,e){var i=[];return t&&t.forEach(function(t){(n>=t.start&&n<t.end||e>t.start&&e<=t.end||t.start>=n&&t.end<e)&&i.push(t)}),i},D.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},D.convertLineToPathData=function(t){return["M",(t=D(t)).attr("x1")||"0",t.attr("y1")||"0","L",t.attr("x2")||"0",t.attr("y2")||"0"].join(" ")},D.convertPolygonToPathData=function(t){t=D.getPointsFromSvgNode(t);return 0===t.length?null:D.svgPointsToPath(t)+" Z"},D.convertPolylineToPathData=function(t){t=D.getPointsFromSvgNode(t);return 0===t.length?null:D.svgPointsToPath(t)},D.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")},D.getPointsFromSvgNode=function(t){var n=[],e=(t=D.toNode(t)).points;if(e)for(var i=0,r=e.numberOfItems;i<r;i++)n.push(e.getItem(i));return n},D.KAPPA=.551784,D.convertCircleToPathData=function(t){t=D(t);var n=parseFloat(t.attr("cx"))||0,e=parseFloat(t.attr("cy"))||0,t=parseFloat(t.attr("r")),i=t*D.KAPPA;return["M",n,e-t,"C",n+i,e-t,n+t,e-i,n+t,e,"C",n+t,e+i,n+i,e+t,n,e+t,"C",n-i,e+t,n-t,e+i,n-t,e,"C",n-t,e-i,n-i,e-t,n,e-t,"Z"].join(" ")},D.convertEllipseToPathData=function(t){t=D(t);var n=parseFloat(t.attr("cx"))||0,e=parseFloat(t.attr("cy"))||0,i=parseFloat(t.attr("rx")),t=parseFloat(t.attr("ry"))||i,r=i*D.KAPPA,s=t*D.KAPPA;return["M",n,e-t,"C",n+r,e-t,n+i,e-s,n+i,e,"C",n+i,e+s,n+r,e+t,n,e+t,"C",n-r,e+t,n-i,e+s,n-i,e,"C",n-i,e-s,n-r,e-t,n,e-t,"Z"].join(" ")},D.convertRectToPathData=function(t){return t=D(t),D.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})},D.rectToPath=function(t){var n=t.x,e=t.y,i=t.width,r=t.height,s=O(t.rx||t["top-rx"]||0,i/2),o=O(t.rx||t["bottom-rx"]||0,i/2),a=O(t.ry||t["top-ry"]||0,r/2),t=O(t.ry||t["bottom-ry"]||0,r/2),o=s||o||a||t?["M",n,e+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",n,e,"H",n+i,"V",e+r,"H",n,"V",e,"Z"];return o.join(" ")},D.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",mn=new RegExp("([a-z])["+P+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+P+"]*,?["+P+"]*)+)","ig"),yn=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+P+"]*,?["+P+"]*","ig"),P=Math,M=P.PI,q=P.sin,F=P.cos,xn=P.tan,wn=P.asin,bn=P.sqrt,Sn=P.abs,function(t){return In(t).join(",").split(",").join(" ")}),D.getCommonAncestor=function(t,n){return t&&n?en(D.toNode(t),D.toNode(n)):null},D.namespace={...Jt},D.g=b,D}}),"undefined"!=typeof V&&(g=V.g,Vectorizer=V);
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
var g,Vectorizer;((t,n)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).V=n()})(this,function(){let{round:k,floor:V,PI:z}=Math;function r(t){return t%360+(t<0?360:0)}function j(t,n){return n*k(t/n)}function s(t){return 180*t/z%360}function o(t,n){return(t=(n=n||!1)?t:t%360)*z/180}function G(t,n){var e;return void 0===n?(n=void 0===t?1:t,t=0):n<t&&(e=t,t=n,n=e),V(Math.random()*(n-t+1)+t)}function n(t,n){var e=o(t.y),i=o(n.y),t=t.x,n=n.x,n=o(n-t),t=U(n)*a(i),e=a(e)*U(i)-U(e)*a(i)*a(n);return(i=s(H(t,e))-22.5)<0&&(i+=360),["NE","E","SE","S","SW","W","NW","N"][i=parseInt(i/45)]}function W(t,n){var e=t.x,t=t.y;return(e-=n.x)*e+(t-=n.y)*t}function B(t,n){return Math.sqrt(W(t,n))}function p(t,n){if(!(this instanceof p))return new p(t,n);var e;"string"==typeof t?(e=t.split(-1===t.indexOf("@")?" ":"@"),t=parseFloat(e[0]),n=parseFloat(e[1])):Object(t)===t&&(n=t.y,t=t.x),this.x=void 0===t?0:t,this.y=void 0===n?0:n}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:_,min:X,max:$,atan2:J,round:K,pow:Q,PI:tt}=Math;p.fromPolar=function(t,n,e){e=new p(e);var i=u(t*Z(n)),t=u(t*Y(n)),n=r(s(n));return n<90?t=-t:n<180?(i=-i,t=-t):n<270&&(i=-i),new p(e.x+i,e.y+t)},p.random=function(t,n,e,i){return new p(G(t,n),G(e,i))},p.prototype={type:h.Point,chooseClosest:function(t){var n=t.length;if(1===n)return new p(t[0]);for(var e=null,i=1/0,r=0;r<n;r++){var s=new p(t[r]),o=this.squaredDistance(s);o<i&&(e=s,i=o)}return e},adhereToRect:function(t){return t.containsPoint(this)||(this.x=X($(this.x,t.x),t.x+t.width),this.y=X($(this.y,t.y),t.y+t.height)),this},angleBetween:function(t,n){n=this.equals(t)||this.equals(n)?NaN:this.theta(n)-this.theta(t);return n<0&&(n+=360),n},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 p(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 p(this.x-(t||0),this.y-(n||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,n){var e=this.x,i=this.y;return new p((1-n)*e+n*t.x,(1-n)*i+n*t.y)},magnitude:function(){return _(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,n){t=o(new p(t).theta(this));return this.offset(Z(t)*n,-Y(t)*n)},normalize:function(t){t=(t||1)/this.magnitude();return this.scale(t,t)},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 p(t).move(this,this.distance(t))},rotate:function(t,n){var e,i;return 0!==n&&(t=t||new p(0,0),n=o(r(-n)),e=Z(n),n=Y(n),i=e*(this.x-t.x)-n*(this.y-t.y)+t.x,n=n*(this.x-t.x)+e*(this.y-t.y)+t.y,this.x=i,this.y=n),this},round:function(t){let n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=Q(10,t)}return this.x=K(this.x*n)/n,this.y=K(this.y*n)/n,this},scale:function(t,n,e){return e=e&&new p(e)||new p(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=j(this.x,t),this.y=j(this.y,n||t),this},squaredDistance:function(t){return W(this,t)},theta:function(t){var n=-((t=new p(t)).y-this.y),t=t.x-this.x,n=J(n,t);return 180*(n=n<0?2*tt+n:n)/tt},toJSON:function(){return{x:this.x,y:this.y}},toPolar:function(t){t=t&&new p(t)||new p(0,0);var n=this.x,e=this.y;return this.x=_((n-t.x)*(n-t.x)+(e-t.y)*(e-t.y)),this.y=o(t.theta(new p(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 p(0,0).angleBetween(this,t)}},p.prototype.translate=p.prototype.offset;var nt=p;let{max:et,min:it}=Math,d=function(t,n){return this instanceof d?t instanceof d?new d(t.start,t.end):(this.start=new p(t),void(this.end=new p(n))):new d(t,n)};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),n=it(this.start.y,this.end.y),e=et(this.start.x,this.end.x),i=et(this.start.y,this.end.y);return new A(t,n,e-t,i-n)},bearing:function(){return n(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,et(0,t/this.squaredLength()));return t!=t?0:t},closestPointTangent:function(t){return this.tangentAt(this.closestPointNormalizedLength(t))},containsPoint:function(t){var n,e=this.start,i=this.end;return 0===e.cross(t,i)&&(n=this.length(),!(new d(e,t).length()>n||new d(t,i).length()>n))},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,n){return t&&t.intersectionWithLine?(n=t.intersectionWithLine(this,n))&&t instanceof d?n[0]:n:null},intersectionWithLine:function(t){var n=new p(this.end.x-this.start.x,this.end.y-this.start.y),e=new p(t.end.x-t.start.x,t.end.y-t.start.y),i=n.x*e.y-n.y*e.x,t=new p(t.start.x-this.start.x,t.start.y-this.start.y),e=t.x*e.y-t.y*e.x,t=t.x*n.y-t.y*n.x;if(0==i||e*i<0||t*i<0)return null;if(0<i){if(i<e||i<t)return null}else if(e<i||t<i)return null;return[new p(this.start.x+e*n.x/i,this.start.y+e*n.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 n,e,i,r,s=this.clone();return this.isDifferentiable()&&({start:n,end:e}=s,i=n.clone().rotate(e,270),r=e.clone().rotate(n,90),n.move(r,t),e.move(i,t)),s},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,i=!0,r=(t<0&&(i=!1,t=-t),this.length());return r<=t?(i?e:n).clone():this.pointAt((i?t:r-t)/r)},pointOffset:function(t){t=new p(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();return n?this.scale(t=t/n,t,this.start):this},squaredLength:function(){return W(this.start,this.end)},tangentAt:function(t){var n,e;return this.isDifferentiable()?(n=this.start,e=this.end,t=this.pointAt(t),(e=new d(n,e)).translate(t.x-n.x,t.y-n.y),e):null},tangentAtLength:function(t){var n,e;return this.isDifferentiable()?(n=this.start,e=this.end,t=this.pointAtLength(t),(e=new d(n,e)).translate(t.x-n.x,t.y-n.y),e):null},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 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,n,e){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=n,void(this.b=e)):new c(t,n,e)}let{sqrt:st,round:e,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,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,i=t.end,r=this.a,s=this.b,t=t.vector(),o=e.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&&n.push(e.lerp(i,r)),0<=t&&t<=1&&n.push(e.lerp(i,t))}else{o=-a/s;if(!(0<=o&&o<=1))return null;n.push(e.lerp(i,o))}return n},intersectionWithLineFromCenterToPoint:function(t,n){t=new p(t),n&&t.rotate(new p(this.x,this.y),n);var e,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,e=this.b*this.b,i=st(1/(1/i+o/e)),o=t*(i=s<0?-i:i),new p(this.x+i,this.y+o)),n?r.rotate(new p(this.x,this.y),-n):r},normalizedDistance:function(t){var n=t.x,t=t.y,e=this.a,i=this.b,r=this.x,s=this.y;return(n-r)*(n-r)/(e*e)+(t-s)*(t-s)/(i*i)},round:function(t){let n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=ot(10,t)}return this.x=e(this.x*n)/n,this.y=e(this.y*n)/n,this.a=e(this.a*n)/n,this.b=e(this.b*n)/n,this},tangentTheta:function(t){var n,e,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?e=s*s/(i-h)-s*s*(r-u)*((n=i>a.x?r-30:r+30)-u)/(o*o*(i-h))+h:n=o*o/(r-u)-o*o*(i-h)*((e=r>a.y?i+30:i-30)-h)/(s*s*(r-u))+u,new p(e,n).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,n,e,i){if(!(this instanceof A))return new A(t,n,e,i);Object(t)===t&&(n=t.y,e=t.width,i=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===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(...n){if(0===n.length)return null;var e=new p;let i,r,s,o;i=r=1/0,s=o=-1/0;for(let t=0;t<n.length;t++){e.update(n[t]);var a=e.x,h=e.y;a<i&&(i=a),a>s&&(s=a),h<r&&(r=h),h>o&&(o=h)}return new A(i,r,s-i,o-r)},A.fromRectUnion=function(...n){if(0===n.length)return null;var e=new A;let i,r,s,o;i=r=1/0,s=o=-1/0;for(let t=0;t<n.length;t++){e.update(n[t]);var a=e.x,h=e.y,u=a+e.width,c=h+e.height;a<i&&(i=a),u>s&&(s=u),h<r&&(r=h),c>o&&(o=c)}return new A(i,r,s-i,o-r)},A.prototype={type:h.Rect,bbox:function(t){return this.clone().rotateAroundCenter(t)},rotateAroundCenter:function(t){var n,e,i,r;return t&&({width:i,height:n}=this,t=o(t),r=i*(e=ht(ct(t)))+n*(t=ht(ut(t))),this.x+=(i-(i=i*t+n*e))/2,this.y+=(n-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,n){let e,i;return t&&"string"!=typeof t?{x:e=0,y:i=0}=t:{x:e,y:i}=new p(t),n&&n.strict?e>this.x&&e<this.x+this.width&&i>this.y&&i<this.y+this.height:e>=this.x&&e<=this.x+this.width&&i>=this.y&&i<=this.y+this.height},containsRect:function(t){var n,e,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)&&(n=i.x,i=i.y,o+=e=t.x,r+=n,a+=t=t.y,s+=i,n<=e)&&o<=r&&i<=t&&a<=s},corner:function(){return new p(this.x+this.width,this.y+this.height)},equals:function(t){var n=new A(this).normalize(),t=new A(t).normalize();return n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.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,e=this.origin(),i=this.corner(),r=t.origin(),t=t.corner();return t.x<=e.x||t.y<=e.y||r.x>=i.x||r.y>=i.y?null:(n=lt(e.x,r.x),e=lt(e.y,r.y),new A(n,e,f(i.x,t.x)-n,f(i.y,t.y)-e))},intersectionWithLine:function(t){for(var n,e=[this.topLine(),this.rightLine(),this.bottomLine(),this.leftLine()],i=[],r=[],s=e.length,o=0;o<s;o++)null!==(n=t.intersect(e[o]))&&r.indexOf(n.toString())<0&&(i.push(n),r.push(n.toString()));return 0<i.length?i:null},intersectionWithLineFromCenterToPoint:function(t,n){t=new p(t);for(var e,i=new p(this.x+this.width/2,this.y+this.height/2),r=(n&&t.rotate(i,n),[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){e=a;break}}return e&&n&&e.rotate(i,-n),e},leftLine:function(){return new d(this.topLeft(),this.bottomLeft())},leftMiddle:function(){return new p(this.x,this.y+this.height/2)},maxRectScaleToFit:function(t,n){t=new A(t);var e,i,r,s,o,a,h,u=(n=n||t.center()).x,n=n.y,c=e=i=r=s=o=a=h=1/0,l=t.topLeft(),l=(l.x<u&&(c=(this.x-u)/(l.x-u)),l.y<n&&(s=(this.y-n)/(l.y-n)),t.bottomRight()),l=(l.x>u&&(e=(this.x+this.width-u)/(l.x-u)),n<l.y&&(o=(this.y+this.height-n)/(l.y-n)),t.topRight()),l=(l.x>u&&(i=(this.x+this.width-u)/(l.x-u)),l.y<n&&(a=(this.y-n)/(l.y-n)),t.bottomLeft());return l.x<u&&(r=(this.x-u)/(l.x-u)),n<l.y&&(h=(this.y+this.height-n)/(l.y-n)),{sx:f(c,e,i,r),sy:f(s,o,a,h)}},maxRectUniformScaleToFit:function(t,n){t=this.maxRectScaleToFit(t,n);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},moveAroundPoint:function(t,n){t=this.center().rotate(t,n);return this.x=t.x-this.width/2,this.y=t.y-this.height/2,this},normalize:function(){var t=this.x,n=this.y,e=this.width,i=this.height;return this.width<0&&(t=this.x+this.width,e=-this.width),this.height<0&&(n=this.y+this.height,i=-this.height),this.x=t,this.y=n,this.width=e,this.height=i,this},offset:function(t,n){return p.prototype.offset.call(this,t,n)},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 n=1;if(t)switch(t){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;default:n=ft(10,t)}return this.x=i(this.x*n)/n,this.y=i(this.y*n)/n,this.width=i(this.width*n)/n,this.height=i(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 p(t)).x-this.x,e=this.x+this.width-t.x,i=t.y-this.y,r="left";return e<n&&(n=e,r="right"),i<n&&(n=i,r="top"),r=this.y+this.height-t.y<n?"bottom":r},snapToGrid:function(t,n){var e=this.origin().snapToGrid(t,n),t=this.corner().snapToGrid(t,n);return this.x=e.x,this.y=e.y,this.width=t.x-e.x,this.height=t.y-e.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,n,e,i){return Object(t)===t&&(n=t.y,e=t.width,i=t.height,t=t.x),this.x=t||0,this.y=n||0,this.width=e||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 n=[],e=t.split(/\b\s*,\s*|,\s*|\s+/),i=e.length;for(let t=0;t<i;t+=2)n.push({x:+e[t],y:+e[t+1]});return n}function pt(n){var e=n.length;if(0===e)return[];var i=[];for(let t=0;t<e;t++){var r=n[t].clone();i.push(r)}return i}function vt(t){var n,e=Math.abs,i=t.length;if(0===i)return[];for(s=0;s<i;s++)(void 0===n||t[s].y<n.y||t[s].y===n.y&&t[s].x>n.x)&&(n=t[s]);for(var r=[],s=0;s<i;s++){var o=n.theta(t[s]),o=(0===o&&(o=360),[t[s],s,o]);r.push(o)}r.sort(function(t,n){var e=t[2]-n[2];return e=0===e?n[1]-t[1]:e}),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||e((v=d.angleBetween(p,h))-180)<1e-10||d.equals(h)||p.equals(d)?(c[f[0]+"@@"+f[1]]=d,l.push(g)):e((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,n,e,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(n),this.controlPoint2=new p(e),void(this.end=new p(i))):new m(t,n,e,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,n=-1/0,e=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),n<h&&(n=h),a<e&&(e=a),i<a&&(i=a)}return new A(t,e,n-t,i-e)},clone:function(){return new l(pt(this.points))},closestPoint:function(t){t=this.closestPointLength(t);return this.pointAtLength(t)},closestPointLength:function(t){var n,e=this.lengthPoints(),i=e.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(e[a],e[a+1]),u=h.length(),c=h.closestPointNormalizedLength(t),h=h.pointAt(c).squaredDistance(t);h<r&&(r=h,n=s+c*u),s+=u}return n},closestPointNormalizedLength:function(t){var n,t=this.closestPointLength(t);return 0===t||0===(n=this.length())?0:t/n},closestPointTangent:function(t){t=this.closestPointLength(t);return this.tangentAtLength(t)},containsPoint:function(t){var n=this.points,e=n.length;if(0===e)return!1;for(var i=t.x,r=t.y,s=e-1,o=0,a=0,h=new d,u=new d,c=new p;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;(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:n,points:e}=this;return t&&n&&!t.equals(n)&&e.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 n=this.points,e=t.points,i=n.length;if(e.length!==i)return!1;for(var r=0;r<i;r++){var s=n[r],o=t.points[r];if(!s.equals(o))return!1}return!0},intersectionWithLine:function(t){for(var n=new d(t),e=[],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=n.intersectionWithLine(r);a&&e.push(a[0])}return 0<e.length?e:null},isDifferentiable:function(){var t=this.points,n=t.length;if(0!==n)for(var e=new d,i=n-1,r=0;r<i;r++)if(e.start=t[r],e.end=t[r+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,i=n-1,r=0;r<i;r++)e+=t[r].distance(t[r+1]);return e},pointAt:function(t){var n=this.lengthPoints(),e=n.length;return 0===e?null:1===e||t<=0?n[0].clone():1<=t?n[e-1].clone():(n=this.length(),this.pointAtLength(n*t))},pointAtLength:function(t){var n=this.lengthPoints(),e=n.length;if(0===e)return null;if(1===e)return n[0].clone();for(var i=!0,r=(t<0&&(i=!1,t=-t),0),s=e-1,o=0;o<s;o++){var a=i?o:s-1-o,h=n[a],a=n[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?n[e-1]:n[0]).clone()},round:function(t){for(var n=this.points,e=n.length,i=0;i<e;i++)n[i].round(t);return this},scale:function(t,n,e){for(var i=this.points,r=i.length,s=0;s<r;s++)i[s].scale(t,n,e);return this},simplify:function(n={}){var e=this.points;if(!(e.length<3)){var i=n.threshold||1e-10;let t=0;for(;e[t+2];){var r=t,s=t+1,o=t+2,r=e[r],a=e[s],o=e[o];new d(r,o).closestPoint(a).distance(a)<=i?e.splice(s,1):t+=1}}return this},tangentAt:function(t){var n=this.lengthPoints().length;if(0===n)return null;if(1===n)return null;1<(t=t<0?0:t)&&(t=1);n=this.length();return this.tangentAtLength(n*t)},tangentAtLength:function(t){var n=this.lengthPoints(),e=n.length;if(0===e)return null;if(1===e)return null;for(var i,r=!0,s=(t<0&&(r=!1,t=-t),0),o=e-1,a=0;a<o;a++){var h=r?a:o-1-a,u=n[h],h=n[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,n){for(var e=this.points,i=e.length,r=0;r<i;r++)e[r].translate(t,n);return this},serialize:function(){var t=this.points,n=t.length;if(0===n)return"";for(var e="",i=0;i<n;i++){var r=t[i];e+=r.x+","+r.y+" "}return e.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 n=t.length,e=[],i=[],r=2;e[0]=t[0]/r;for(var s=1;s<n;s++)i[s]=1/r,e[s]=(t[s]-e[s-1])/(r=(s<n-1?4:3.5)-i[s]);for(s=1;s<n;s++)e[n-s-1]-=i[n-s]*e[n-s];return e}function t(t){for(var n=[],e=arguments.length,i=1;i<e;i++)n.push(arguments[i]);if(!t)throw new Error("Missing a parent object.");var r=Object.create(t);for(e=n.length,i=0;i<e;i++){var s,o,a=n[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 n=(t=>{var n=[],e=[],i=t.length-1;if(1==i)n[0]=new p((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),e[0]=new p(2*n[0].x-t[0].x,2*n[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++)n.push(new p(o[s],a[s])),e.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[n,e]})(t),e=[],i=n[0].length,r=0;r<i;r++){var s=new p(n[0][r].x,n[0][r].y),o=new p(n[1][r].x,n[1][r].y);e.push(new m(t[r],s,o,t[r+1]))}return e},m.prototype={type:h.Curve,bbox:function(){for(var t,n,e,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?(n=6*u-12*l+6*d,t=-3*u+9*l-9*d+3*p,3*l-3*u):(n=6*c-12*f+6*g,t=-3*c+9*f-9*g+3*v,3*f-3*c),T(t)<1e-12?T(n)<1e-12||0<(e=-i/n)&&e<1&&y.push(e):(i=n*n-4*i*t,r=mt(i),i<0||(0<(i=(-n+r)/(2*t))&&i<1&&y.push(i),0<(i=(-n-r)/(2*t))&&i<1&&y.push(i)));for(var b,S,P=y.length,s=P;P--;)e=y[P],x[0][P]=b=(S=1-e)*S*S*u+3*S*S*e*l+3*S*e*e*d+e*e*e*p,x[1][P]=S=S*S*S*c+3*S*S*e*f+3*S*e*e*g+e*e*e*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,n){return this.pointAtT(this.closestPointT(t,n))},closestPointLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions};return this.lengthAtT(this.closestPointT(t,e),e)},closestPointNormalizedLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions},n=this.closestPointLength(t,e);return!n||0===(t=this.length(e))?0:n/t},closestPointT:function(t,n){for(var e,i,r,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=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=(e=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=e.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?(e=y[0],r-=l,s=x,w):(e=y[1],i+=l,s=S,P)}},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){return t<=0?this.divideAtT(0):1<=t?this.divideAtT(1):(t=this.tAt(t,n),this.divideAtT(t))},divideAtLength:function(t,n){t=this.tAtLength(t,n);return this.divideAtT(t)},divideAtT:function(t){var n,e,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,n=r.divider,e=r.dividerControlPoint1,r=r.dividerControlPoint2,[new m(i,s,t,n),new m(n,e,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 n=this.start,e=this.controlPoint1,i=this.controlPoint2,r=this.end;return t<=0?{startControlPoint1:n.clone(),startControlPoint2:n.clone(),divider:n.clone(),dividerControlPoint1:e.clone(),dividerControlPoint2:i.clone()}:1<=t?{startControlPoint1:e.clone(),startControlPoint2:i.clone(),divider:r.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:r.clone()}:(n=new d(n,e).pointAt(t),e=new d(e,i).pointAt(t),i=new d(i,r).pointAt(t),r=new d(n,e).pointAt(t),e=new d(e,i).pointAt(t),{startControlPoint1:n,startControlPoint2:r,divider:new d(r,e).pointAt(t),dividerControlPoint1:e,dividerControlPoint2:i})},getSubdivisions:function(t){var t=void 0===(t=t||{}).precision?this.PRECISION:t.precision,n=this.start,e=this.controlPoint1,i=this.controlPoint2,r=this.end,s=[new m(n,e,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===e.cross(n,r)&&0===i.cross(n,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,n=this.controlPoint1,e=this.controlPoint2,i=this.end;return!(t.equals(n)&&n.equals(e)&&e.equals(i))},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,i=0,r=e.length,s=0;s<r;s++)i+=e[s].endpointDistance();return i},lengthAtT:function(t,n){return t<=0?0:(n=void 0===(n=n||{}).precision?this.PRECISION:n.precision,this.divide(t)[0].length({precision:n}))},pointAt:function(t,n){return t<=0?this.start.clone():1<=t?this.end.clone():(t=this.tAt(t,n),this.pointAtT(t))},pointAtLength:function(t,n){t=this.tAtLength(t,n);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,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);t=this.tAt(t,n);return this.tangentAtT(t)},tangentAtLength:function(t,n){return this.isDifferentiable()?(t=this.tAtLength(t,n),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),n=t.startControlPoint2,e=t.dividerControlPoint1,t=t.divider,e=new d(n,e);return e.translate(t.x-n.x,t.y-n.y),e},tAt:function(t,n){var e;return t<=0?0:1<=t?1:(e={precision:e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,subdivisions:void 0===n.subdivisions?this.getSubdivisions({precision:e}):n.subdivisions},n=this.length(e),this.tAtLength(n*t,e))},tAtLength:function(t,n){for(var e,i,r,s=!0,o=(t<0&&(s=!1,t=-t),void 0===(n=n||{}).precision?this.PRECISION:n.precision),a=void 0===n.subdivisions?this.getSubdivisions({precision:o}):n.subdivisions,n={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){e=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(!e)return s?1:0;for(var p=this.length(n),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=e.divide(.5),x=(c/=2,y[0].endpointDistance()),w=y[1].endpointDistance(),y=b<=x?(e=y[0],r-=c,x-(m=b)):(e=y[1],i+=c,w-(m=b-x)),b=m,S=y}},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,i=[e[0].start.clone()],r=e.length,s=0;s<r;s++){var o=e[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,n){return this.start.translate(t,n),this.controlPoint1.translate(t,n),this.controlPoint2.translate(t,n),this.end.translate(t,n),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 n;if(this.segments=[],t)if(Array.isArray(t)&&0!==t.length)if(n=(t=t.reduce(function(t,n){return t.concat(n)},[])).length,t[0].isSegment)for(r=0;r<n;r++){var e=t[r];this.appendSegment(e)}else for(var i=null,r=0;r<n;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(n=t.points.length,r=0;r<n;r++){var o=t.points[r];0===r?this.appendSegment(S.createSegment("M",o)):this.appendSegment(S.createSegment("L",o))}}}function g(t,n){return n.unshift(null),new(Function.prototype.bind.apply(t,n))}S.parse=function(t){if(!t)return new S;for(var n=new S,e=t.match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g),i=e.length,r=0;r<i;r++){var s=e[r].match(/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g),s=S.createSegment.apply(this,s);n.appendSegment(s)}return n},S.createSegment=function(t){if(!t)throw new Error("Type must be provided.");var n=S.segmentTypes[t];if(!n)throw new Error(t+" is not a recognized path segment type.");for(var e=[],i=arguments.length,r=1;r<i;r++)e.push(arguments[r]);return g(n,e)},S.prototype={type:h.Path,appendSegment:function(t){var n=this.segments,e=n.length,i=0!==e?n[e-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 r=t.length,s=0;s<r;s++){var o=t[s],a=this.prepareSegment(o,i,null);n.push(a),i=a}}else{if(!t||!t.isSegment)throw new Error("Segment required.");a=this.prepareSegment(t,i,null),n.push(a)}},bbox:function(){var t=this.segments,n=t.length;if(0===n)return null;for(var e,i=0;i<n;i++){var r,s=t[i];s.isVisible&&(s=s.bbox(),r=r?r.union(s):s)}return r||(e=t[n-1],new A(e.end.x,e.end.y,0,0))},clone:function(){for(var t=this.segments,n=t.length,e=new S,i=0;i<n;i++){var r=t[i].clone();e.appendSegment(r)}return e},closestPoint:function(t,n){t=this.closestPointT(t,n);return t?this.pointAtT(t):null},closestPointLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.closestPointT(t,e);return n?this.lengthAtT(n,e):0},closestPointNormalizedLength:function(t,n){var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.closestPointLength(t,e);return 0===n||0===(t=this.length(e))?0:n/t},closestPointT:function(t,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r,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<i;h++){var u=e[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,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r,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<i;h++){var u,c=e[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,n){var e=this.toPolylines(n);if(!e)return!1;for(var i=e.length,r=0,s=0;s<i;s++)e[s].containsPoint(t)&&r++;return r%2==1},divideAt:function(t,n){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e);return this.divideAtLength(n*t,e)},divideAtLength:function(t,n){var e=this.segments.length;if(0===e)return null;for(var i,r,s,o,a=!0,h=(t<0&&(a=!1,t=-t),void 0===(n=n||{}).precision?this.PRECISION:n.precision),u=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:h}):n.segmentSubdivisions,c=0,l=0;l<e;l++){var f=a?l:e-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(),n=(v.replaceSegment(r,i),r),m=r+1,y=r+2,x=(i[0].isDifferentiable()||(v.removeSegment(n),--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-n-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 n=this.segments,e=t.segments,i=n.length;if(e.length!==i)return!1;for(var r=0;r<i;r++){var s=n[r],o=e[r];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(e<=(t=t<0?e+t:t)||t<0)throw new Error("Index out of range.");return n[t]},getSegmentSubdivisions:function(t){for(var n=this.segments,e=n.length,i=void 0===(t=t||{}).precision?this.PRECISION:t.precision,r=[],s=0;s<e;s++){var o=n[s].getSubdivisions({precision:i});r.push(o)}return r},getSubpaths:function(){var n=this.clone().validate().segments,e=n.length,i=[];for(let t=0;t<e;t++){var r=n[t];r.isSubpathStart?i.push(new S(r)):i[i.length-1].appendSegment(r)}return i},insertSegment:function(t,n){var e=this.segments,i=e.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=e[t-1]).nextSegment:e[0]),Array.isArray(n)){if(!(n=n.reduce(function(t,n){return t.concat(n)},[]))[0].isSegment)throw new Error("Segments required.");for(var o=n.length,a=0;a<o;a++){var h=n[a],u=this.prepareSegment(h,r,s);e.splice(t+a,0,u),r=u}}else{if(!n||!n.isSegment)throw new Error("Segment required.");u=this.prepareSegment(n,r,s),e.splice(t,0,u)}},intersectionWithLine:function(t,n){var e=null,i=this.toPolylines(n);if(!i)return null;for(var r=0,s=i.length;r<s;r++){var o=i[r],o=t.intersect(o);o&&(e=e||[],Array.isArray(o)?Array.prototype.push.apply(e,o):e.push(o))}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 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<e;o++){var a=n[o],h=r[o];s+=a.length({subdivisions:h})}return s},lengthAtT:function(t,n){var e=this.segments,i=e.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===(n=n||{}).precision?this.PRECISION:n.precision),o=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:s}):n.segmentSubdivisions,a=0,h=0;h<r;h++){var u=e[h],c=o[h];a+=u.length({precisison:s,subdivisions:c})}return c=o[r],a+=(u=e[r]).lengthAtT(t,{precisison:s,subdivisions:c})},pointAt:function(t,n){var e;return 0===this.segments.length?null:t<=0?this.start.clone():1<=t?this.end.clone():(e={precision:e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e),this.pointAtLength(n*t,e))},pointAtLength:function(t,n){var e=this.segments,i=e.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===(n=n||{}).precision?this.PRECISION:n.precision),a=void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:o}):n.segmentSubdivisions,h=0,u=0;u<i;u++){var c=s?u:i-1-u,l=e[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:e[i-1].end.clone()},pointAtT:function(t){var n,e=this.segments,i=e.length;return 0===i?null:(n=t.segmentIndex)<0?e[0].pointAtT(0):i<=n?e[i-1].pointAtT(1):((i=t.value)<0?i=0:1<i&&(i=1),e[n].pointAtT(i))},PRECISION:3,prepareSegment:function(t,n,e){t.previousSegment=n,t.nextSegment=e,n&&(n.nextSegment=t),e&&(e.previousSegment=t);n=t;return t.isSubpathStart&&(t.subpathStartSegment=t,n=e),n&&this.updateSubpathStartSegment(n),t},removeSegment:function(t){var n=this.segments,e=n.length;if(0===e)throw new Error("Path has no segments.");if(e<=(t=t<0?e+t:t)||t<0)throw new Error("Index out of range.");e=n.splice(t,1)[0],n=e.previousSegment,t=e.nextSegment;n&&(n.nextSegment=t),t&&(t.previousSegment=n),e.isSubpathStart&&t&&this.updateSubpathStartSegment(t)},replaceSegment:function(t,n){var e=this.segments,i=e.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=e[t],r=i.previousSegment,s=i.nextSegment,o=i.isSubpathStart;if(Array.isArray(n)){if(!(n=n.reduce(function(t,n){return t.concat(n)},[]))[0].isSegment)throw new Error("Segments required.");e.splice(t,1);for(var a=n.length,h=0;h<a;h++){var u=n[h],c=this.prepareSegment(u,r,s);e.splice(t+h,0,c),r=c,o&&c.isSubpathStart&&(o=!1)}}else{if(!n||!n.isSegment)throw new Error("Segment required.");c=this.prepareSegment(n,r,s),e.splice(t,1,c),o&&c.isSubpathStart&&(o=!1)}o&&s&&this.updateSubpathStartSegment(s)},round:function(t){for(var n=this.segments,e=n.length,i=0;i<e;i++)n[i].round(t);return this},scale:function(t,n,e){for(var i=this.segments,r=i.length,s=0;s<r;s++)i[s].scale(t,n,e);return this},segmentAt:function(t,n){t=this.segmentIndexAt(t,n);return t?this.getSegment(t):null},segmentAtLength:function(t,n){t=this.segmentIndexAtLength(t,n);return t?this.getSegment(t):null},segmentIndexAt:function(t,n){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e);return this.segmentIndexAtLength(n*t,e)},segmentIndexAtLength:function(t,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r=!0,s=(t<0&&(r=!1,t=-t),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<i;u++){var c=r?u:i-1-u,l=e[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,n){if(0===this.segments.length)return null;1<(t=t<0?0:t)&&(t=1);var e=void 0===(n=n||{}).precision?this.PRECISION:n.precision,e={precision:e,segmentSubdivisions:void 0===n.segmentSubdivisions?this.getSegmentSubdivisions({precision:e}):n.segmentSubdivisions},n=this.length(e);return this.tangentAtLength(n*t,e)},tangentAtLength:function(t,n){var e=this.segments,i=e.length;if(0===i)return null;for(var r,s=!0,o=(t<0&&(s=!1,t=-t),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<i;u++){var c=s?u:i-1-u,l=e[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 n,e=this.segments,i=e.length;return 0===i?null:(n=t.segmentIndex)<0?e[0].tangentAtT(0):i<=n?e[i-1].tangentAtT(1):((i=t.value)<0?i=0:1<i&&(i=1),e[n].tangentAtT(i))},toPoints:function(t){var n=this.segments,e=n.length;if(0===e)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<e;a++){var h,u=n[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(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 i=0,r=e.length;i<r;i++)n.push(new l(e[i]));return n},toString:function(){for(var t=this.segments,n=t.length,e="",i=0;i<n;i++)e+=t[i].serialize()+" ";return e.trim()},translate:function(t,n){for(var e=this.segments,i=e.length,r=0;r<i;r++)e[r].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,S.createSegment("M",0,0)),this}},Object.defineProperty(S.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 i=t[e];if(i.isVisible)return i.start}return t[n-1].end}}),Object.defineProperty(S.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 i=t[e];if(i.isVisible)return i.end}return t[n-1].end}});function v(){for(var t=[],n=arguments.length,e=0;e<n;e++)t.push(arguments[e]);if(!(this instanceof v))return g(v,t);if(0===n)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates (none provided).");if(t[0]instanceof d){if(1===n)return this.end=t[0].end.clone(),this;throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+n+" lines provided).")}if("string"==typeof t[0]||"number"==typeof t[0]){if(2===n)return this.end=new p(+t[0],+t[1]),this;if(n<2)throw new Error("Lineto constructor expects a line, 1 point, or 2 coordinates ("+n+" coordinates provided).");for(var i,r=[],e=0;e<n;e+=2)i=t.slice(e,e+2),r.push(g(v,i))}else{if(1===n)return this.end=new p(t[0]),this;for(r=[],e=0;e<n;e+=1)r.push(new v(t[e]))}return r}function y(){for(var t,n=[],e=arguments.length,i=0;i<e;i++)n.push(arguments[i]);if(!(this instanceof y))return g(y,n);if(0===e)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates (none provided).");if(n[0]instanceof m){if(1===e)return this.controlPoint1=n[0].controlPoint1.clone(),this.controlPoint2=n[0].controlPoint2.clone(),this.end=n[0].end.clone(),this;throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+e+" curves provided).")}if("string"==typeof n[0]||"number"==typeof n[0]){if(6===e)return this.controlPoint1=new p(+n[0],+n[1]),this.controlPoint2=new p(+n[2],+n[3]),this.end=new p(+n[4],+n[5]),this;if(e<6)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+e+" coordinates provided).");for(var r,s=[],i=0;i<e;i+=6)r=n.slice(i,i+6),s.push(g(y,r))}else{if(3===e)return this.controlPoint1=new p(n[0]),this.controlPoint2=new p(n[1]),this.end=new p(n[2]),this;if(e<3)throw new Error("Curveto constructor expects a curve, 3 points, or 6 coordinates ("+e+" points provided).");for(s=[],i=0;i<e;i+=3)t=n.slice(i,i+3),s.push(g(y,t))}return s}function x(){for(var t,n=[],e=arguments.length,i=0;i<e;i++)n.push(arguments[i]);if(!(this instanceof x))return g(x,n);if(0===e)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates (none provided).");if(n[0]instanceof d){if(1===e)return this.end=n[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+e+" lines provided).")}if(n[0]instanceof m){if(1===e)return this.end=n[0].end.clone(),this;throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+e+" curves provided).")}if("string"==typeof n[0]||"number"==typeof n[0]){if(2===e)return this.end=new p(+n[0],+n[1]),this;if(e<2)throw new Error("Moveto constructor expects a line, a curve, 1 point, or 2 coordinates ("+e+" coordinates provided).");for(var r,s=[],i=0;i<e;i+=2)r=n.slice(i,i+2),0===i?s.push(g(x,r)):s.push(g(v,r))}else{if(1===e)return this.end=new p(n[0]),this;for(s=[],i=0;i<e;i+=1)t=n[i],0===i?s.push(new x(t)):s.push(new v(t))}return s}function w(){for(var t=[],n=arguments.length,e=0;e<n;e++)t.push(arguments[e]);if(!(this instanceof w))return g(w,t);if(0<n)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 n;return t<=0?0:(n=this.length(),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.")}},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,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}}),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,n){t=new m(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAt(t,n);return[new y(t[0]),new y(t[1])]},divideAtLength:function(t,n){t=new m(this.start,this.controlPoint1,this.controlPoint2,this.end).divideAtLength(t,n);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,n,e,i;return!(!this.previousSegment||(t=this.start,n=this.controlPoint1,e=this.controlPoint2,i=this.end,t.equals(n)&&n.equals(e)&&e.equals(i)))},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}}),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,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}}),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 n=[],e=[],i=t.length-1;if(1==i)n[0]=new p((2*t[0].x+t[1].x)/3,(2*t[0].y+t[1].y)/3),e[0]=new p(2*n[0].x-t[0].x,2*n[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++)n.push(new p(o[s],a[s])),e.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[n,e]},getCurveDivider:function(t,n,e,i){console.warn("deprecated");var r=new m(t,n,e,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 n=t.length,e=[],i=[],r=2;e[0]=t[0]/r;for(var s=1;s<n;s++)i[s]=1/r,e[s]=(t[s]-e[s-1])/(r=(s<n-1?4:3.5)-i[s]);for(s=1;s<n;s++)e[n-s-1]-=i[n-s]*e[n-s];return e},getInversionSolver:function(t,n,e,i){console.warn("deprecated");var r=new m(t,n,e,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,n){var e=t.start.x,i=t.start.y,r=t.end.x,t=t.end.y,s=n.start.x,o=n.start.y,r=r-e,t=t-i,a=n.end.x-s,n=n.end.y-o,e=e-s,s=i-o,i=r*n-a*t,o=(r*s-t*e)/i,r=(a*s-n*e)/i;return 0<=o&&o<=1&&0<=r&&r<=1}function St(t,n){var e=t.a,i=t.b,r=t.x,t=t.y,s=n.start.x-r,r=n.end.x-r,o=n.start.y-t,e=e*e,i=i*i,r=r-s,n=n.end.y-t-o,t=r*r/e+n*n/i,r=2*s*r/e+2*o*n/i,n=r*r-4*t*(s*s/e+o*o/i-1);return 0==n?0<=(s=-r/2/t)&&s<=1:0<n&&(o=(-r-(e=Math.sqrt(n)))/2/t,0<=(i=(-r+e)/2/t)&&i<=1||0<=o&&o<=1)}function Pt(C,N){{var I=0,O=0;let{cos:t,sin:n}=Math,e=n(I),i=t(I),r=n(O),s=t(O),o=e*e,a=i*i,h=e*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=R([[v,w,S],[w,y,A],[S,A,L]]),O=R([[m,b,P],[b,x,T],[P,T,E]]),C=.33333333*(R([[m,w,S],[b,y,A],[P,A,L]])+R([[v,b,S],[w,x,A],[S,T,L]])+R([[v,w,P],[w,y,T],[S,A,E]])),N=.33333333*(R([[v,b,P],[w,x,T],[S,T,E]])+R([[m,w,P],[b,y,T],[P,A,E]])+R([[m,b,S],[b,x,A],[P,T,L]])),D=Yt([[I,C],[C,N]]),I=Yt([[I,N],[C,O]]),O=Yt([[C,N],[N,O]]);return!(0<(D=Yt([[2*D,I],[I,2*O]]))&&(0<N||0<C))}}function At(t,n){var{start:e,end:i}=n,{x:r,y:s,width:o,height:a}=t;return!(e.x>r+o&&i.x>r+o||e.x<r&&i.x<r||e.y>s+a&&i.y>s+a||e.y<s&&i.y<s)&&(!(!t.containsPoint(n.start)&&!t.containsPoint(n.end))||E(t.topLine(),n)||E(t.rightLine(),n)||E(t.bottomLine(),n)||E(t.leftLine(),n))}function Tt(t,n){return!!Lt(t,A.fromEllipse(n))&&Ot(L.fromRect(t),n)}function Lt(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 C(t,n){return Gt(t,n,{interior:!1})}function Et(t,n){return Wt(t,n,{interior:!1})}function Ct(t,n){return Bt(t,n,{interior:!1})}function Nt(t,n){return Ht(t,n,{interior:!1})}function It(t,n){return Gt(t,n,{interior:!0})}function Ot(t,n){return Wt(t,n,{interior:!0})}function Dt(t,n){return Bt(t,n,{interior:!0})}function Rt(t,n){return Ht(t,n,{interior:!0})}function Mt(t,n){return Zt(t,n,{interior:!0})}function qt(t,e,i){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?It:C)(n,e)})}function Ft(t,e,i){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?Ot:Et)(n,e)})}function kt(t,n,e){return zt(t,L.fromRect(n),e)}function Vt(t,n,e){return Ut(t,n,e,{interior:!1})}function zt(t,n,e){return Ut(t,n,e,{interior:!0})}function jt(t,e,i,r){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?zt:Vt)(e,n,r)})}function Gt(t,n,e={}){var{interior:e=!1}=e;let i;if(e){if(t.containsPoint(n.start))return!0;var{start:e,end:r,points:s}=t;i=r.equals(e)?s:[...s,e]}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(n,a))return!0;return!1}function Wt(t,n,e={}){var{start:i,end:r,points:s}=t;if(n.containsPoint(i))return!0;let o;var{interior:e=!1}=e;if(e){if(t.containsPoint(n.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(n,h))return!0;return!1}function Bt(t,n,e){return Zt(t,L.fromRect(n),e)}function Ut(t,e,i,r){return t.getSubpaths().some(t=>{var[n]=t.toPolylines(i),t=t.getSegment(-1).type;return("Z"===t?Zt:Ht)(e,n,r)})}function Ht(t,n,e={}){var{interior:e=!1}=e;let i;if(e){e=n.start;if(t.containsPoint(e))return!0;i=t.clone().close()}else i=t;var r=n.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,n,e){return n.containsPoint(t.start)||Ht(t,n.clone().close(),e)}function Yt(t){return t[0][0]*t[1][1]-t[0][1]*t[1][0]}function R(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:n,points:e}=this;return e.length<=1||t.equals(n)?e:[...e,t.clone()]}});b={__proto__:null,Curve:m,Ellipse:c,Line:d,Path:S,Point:p,Polygon:L,Polyline:l,Rect:A,bezier:P,ellipse:at,intersection:{__proto__:null,ellipseWithEllipse:Pt,ellipseWithLine:St,exists:function t(n,e,i,r){switch(n.type){case h.Line:if(e.type===h.Line)return E(n,e);break;case h.Ellipse:switch(e.type){case h.Line:return St(n,e);case h.Ellipse:return Pt(n,e)}break;case h.Rect:switch(e.type){case h.Line:return At(n,e);case h.Ellipse:return Tt(n,e);case h.Rect:return Lt(n,e)}break;case h.Polyline:switch(e.type){case h.Line:return C(n,e);case h.Ellipse:return Et(n,e);case h.Rect:return Ct(n,e);case h.Polyline:return Nt(n,e)}break;case h.Polygon:switch(e.type){case h.Line:return It(n,e);case h.Ellipse:return Ot(n,e);case h.Rect:return Dt(n,e);case h.Polyline:return Rt(n,e);case h.Polygon:return Mt(n,e)}break;case h.Path:switch(e.type){case h.Line:return qt(n,e,i);case h.Ellipse:return Ft(n,e,i);case h.Rect:return kt(n,e,i);case h.Polyline:return Vt(n,e,i);case h.Polygon:return zt(n,e,i);case h.Path:return jt(n,e,i,r)}}switch(e.type){case h.Ellipse:case h.Rect:case h.Polyline:case h.Polygon:case h.Path:return t(e,n,r,i);default:throw Error(`The intersection for ${n} and ${e} could not be found.`)}},lineWithLine:E,pathWithEllipse:Ft,pathWithLine:qt,pathWithPath:jt,pathWithPolygon:zt,pathWithPolyline:Vt,pathWithRect:kt,polygonWithEllipse:Ot,polygonWithLine:It,polygonWithPolygon:Mt,polygonWithPolyline:Rt,polygonWithRect:Dt,polylineWithEllipse:Et,polylineWithLine:C,polylineWithPolyline:Nt,polylineWithRect:Ct,rectWithEllipse:Tt,rectWithLine:At,rectWithRect:Lt},line:rt,normalizeAngle:r,point:nt,random:G,rect:dt,scale:{linear:function(t,n,e){var i=t[1]-t[0],r=n[1]-n[0];return(e-t[0])/i*r+n[0]||0}},snapToGrid:j,toDeg:s,toRad:o,types:h};let _t="http://www.w3.org/2000/svg",Xt="http://www.w3.org/2000/xmlns/";let $t="http://www.w3.org/1999/xlink";var Jt={__proto__:null,svg:_t,xhtml:"http://www.w3.org/1999/xhtml",xlink:$t,xml:"http://www.w3.org/XML/1998/namespace",xmlns:Xt};let Kt="object"==typeof window&&!!window.SVGAngle,N=Kt?tn():null,Qt=Kt?nn("g"):null;function tn(){var t=nn("svg");return t.setAttributeNS(Xt,"xmlns:xlink",$t),t.setAttribute("version","1.1"),t}function nn(t){return document.createElementNS(_t,t)}function en(t,n){let e=t;do{if(e.contains(n))return e}while(e=e.parentNode);return null}function I(){return N.createSVGMatrix()}function rn(t={}){var n=N.createSVGMatrix();return t&&("a"in t&&(n.a=t.a),"b"in t&&(n.b=t.b),"c"in t&&(n.c=t.c),"d"in t&&(n.d=t.d),"e"in t&&(n.e=t.e),"f"in t)&&(n.f=t.f),n}function sn(t){t=t.transform.baseVal.consolidate();return t?t.matrix:null}function on(t,n){var e=N.createSVGTransform(),n=hn(n)?n:rn(n);e.setMatrix(n),t.transform.baseVal.appendItem(e)}let an="[object SVGMatrix]";function hn(t){return Object.prototype.toString.call(t)===an}function un(t={}){var{a:t=1,b:n=0,c:e=0,d:i=1,e:r=0,f:s=0}=t;return`matrix(${t},${n},${e},${i},${r},${s})`}function cn(t,n){var e=[];let i=n;for(;i&&i.nodeType===Node.ELEMENT_NODE&&i!==t;){var r=sn(i);r&&e.unshift(r),i=i.parentNode}return e.reduce((t,n)=>t.multiply(n),I())}{if(!Kt)return function(){throw new Error("SVG is required to use Vectorizer.")};function D(t,n,e){if(!(this instanceof D))return D.apply(Object.create(D.prototype),arguments);if(t){if(D.isV(t)&&(t=t.node),n=n||{},D.isString(t)){if("svg"===(t=t.trim()).toLowerCase())t=D.createSvgDocument();else if("<"===t[0]){var i=D.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 D(document.importNode(a,!0)))}return r}t=document.importNode(i.firstChild,!0)}else t=nn(t);D.ensureId(t)}return this.node=t,this.setAttributes(n),e&&this.append(e),this}}var ln=(P=Math).PI,fn=P.atan2,dn=P.sqrt,O=P.min,gn=P.max,pn=P.cos,vn=P.sin,P=D.prototype;Object.defineProperty(P,"id",{enumerable:!0,get:function(){return this.node.id},set:function(t){this.node.id=t}}),P.getTransformToElement=function(t,n){var e,i,r=this.node,t=D.toNode(t);let s;return(s=D.isSVGGraphicsElement(t)&&D.isSVGGraphicsElement(r)?n&&n.safe?(n=r)===(e=t)?I():(i=n.compareDocumentPosition(e))&Node.DOCUMENT_POSITION_CONTAINED_BY?cn(n,e).inverse():i&Node.DOCUMENT_POSITION_CONTAINS?cn(e,n):(i=en(n,e))?(n=cn(i,n),cn(i,e).inverse().multiply(n)):null:(i=t,((e=r).ownerSVGElement||e)===(i.ownerSVGElement||i)&&(i=i.getScreenCTM())&&(e=e.getScreenCTM())?i.inverse().multiply(e):null):s)||I()},P.transform=function(t,n){var e=this.node;return D.isUndefined(t)?sn(e)||I():(n&&n.absolute?e.setAttribute("transform",un(t)):on(e,t),this)},P.translate=function(t,n,e){e=e||{},n=n||0;var i=this.attr("transform")||"",r=D.parseTransformString(i),i=r.value;if(D.isUndefined(t))return r.translate;i=i.replace(/translate\([^)]*\)/g,"").trim();t=e.absolute?t:r.translate.tx+t,e=e.absolute?n:r.translate.ty+n;return this.attr("transform",("translate("+t+","+e+")"+" "+i).trim()),this},P.rotate=function(t,n,e,i){i=i||{};var r=this.attr("transform")||"",s=D.parseTransformString(r),r=s.value;if(D.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!==n&&void 0!==e?","+n+","+e:"")+")")).trim()),this},P.scale=function(t,n){n=D.isUndefined(n)?t:n;var e=this.attr("transform")||"",i=D.parseTransformString(e),e=i.value;return D.isUndefined(t)?i.scale:(e=e.replace(/scale\([^)]*\)/g,"").trim(),this.attr("transform",(e+" "+("scale("+t+","+n+")")).trim()),this)},P.bbox=function(t,n){var e,i=this.node,r=i.ownerSVGElement;if(!r)return new A(0,0,0,0);try{e=i.getBBox()}catch{e={x:i.clientLeft,y:i.clientTop,width:i.clientWidth,height:i.clientHeight}}return t?new A(e):(i=this.getTransformToElement(n||r),D.transformRect(e,i))},P.getBBox=function(t){var n={},e=this.node;if(!e.ownerSVGElement||!D.isSVGGraphicsElement(e))return new A(0,0,0,0);if(t&&(t.target&&(n.target=D.toNode(t.target)),t.recursive)&&(n.recursive=t.recursive),n.recursive){var i=this.children(),r=i.length;if(0===r)return this.getBBox({target:n.target,recursive:!1});n.target||(n.target=this);for(var s=0;s<r;s++)var o=i[s],o=0===o.children().length?o.getBBox({target:n.target,recursive:!1}):o.getBBox({target:n.target,recursive:!0}),a=a?a.union(o):o;return a}try{a=e.getBBox()}catch{a={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return n.target?(t=this.getTransformToElement(n.target),D.transformRect(a,t)):new A(a)};var mn,yn,M,q,F,xn,wn,bn,Sn,Pn=/em$/;function An(t,n){var e=parseFloat(t);return Pn.test(t)?e*n:e}P.text=function(t,n){if(t&&"string"!=typeof t)throw new Error("Vectorizer: text() expects the first argument to be a string.");null==t&&(t=""),(n=n||{}).useNoBreakSpace&&(t=D.sanitizeText(t));for(var e,i,r,s,o=n.displayEmpty,a=n.eol,h=n.textPath,u=n.textVerticalAnchor,c="middle"===u||"bottom"===u||"top"===u,l=n.x,f=(void 0===l&&(l=this.attr("x")||0),n.includeAnnotationIndices),d=n.annotations,n=(d&&!D.isArray(d)&&(d=[d]),n.lineHeight),g="auto"===n,p=g?"1.5em":n||"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?(n=this,o=(o=h="string"==typeof h?{d:h}:h)||{},e=D("textPath"),(i=o.d)&&void 0===o["xlink:href"]&&(i=D("path").attr("d",i).appendTo(n.defs()),e.attr("xlink:href","#"+i.id)),D.isObject(o)&&e.attr(o),e.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(_t,"tspan"),N=w[S];if(N)d?((I=(T=((t,n,e)=>{for(var i=(e=e||{}).includeAnnotationIndices,r=e.eol,s=e.lineHeight,o=e.baseSize,a=0,e={},h=n.length-1,u=0;u<=h;u++){var c,l,f,d,g=n[u],p=null;D.isObject(g)?(c=g.attrs,f=(l=D("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&&(e.maxFontSize=a),s?e.lineHeight=s:a&&(e.lineHeight=1.2*a),e})(C,A=D.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 n=v;for(let t=(A=D.findAnnotationsAtIndex(d,x)).length;0<t;t--){var O=A[t-1].attrs;if(O&&"font-size"in O){O=parseFloat(O["font-size"]);if(isFinite(O)){n=O;break}}}g&&(0<S?L=1.2*n:r=.8*n),C.setAttribute("font-size",n),T.maxFontSize=n}}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,n,e,i)=>{if(!Array.isArray(n))return 0;var r=n.length;if(!r)return 0;for(var s=n[0],o=An(s.maxFontSize,e)||e,a=0,h=An(i,e),u=1;u<r;u++)a+=An((s=n[u]).lineHeight,e)||h;var c,l=An(s.maxFontSize,e)||e;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,Pn.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:n,local:e}=D.qualifyAttr(t),i=this.node;return n?i.hasAttributeNS(n,e)&&i.removeAttributeNS(n,e):i.hasAttribute(t)&&i.removeAttribute(t),this},P.attr=function(t,n){if(D.isUndefined(t)){for(var e=this.node.attributes,i={},r=0;r<e.length;r++)i[e[r].name]=e[r].value;return i}if(D.isString(t)&&D.isUndefined(n))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,n);return this},P.normalizePath=function(){return"PATH"===this.tagName()&&this.attr("d",D.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 n in t)t.hasOwnProperty(n)&&this.setAttribute(n,t[n]);return this},P.append=function(t){for(var n=0,e=(t=D.isArray(t)?t:[t]).length;n<e;n++)this.node.appendChild(D.toNode(t[n]));return this},P.prepend=function(t){var n=this.node.firstChild;return n?D(n).before(t):this.append(t)},P.before=function(t){var n=this.node,e=n.parentNode;if(e)for(var i=0,r=(t=D.isArray(t)?t:[t]).length;i<r;i++)e.insertBefore(D.toNode(t[i]),n);return this},P.appendTo=function(t){return D.toNode(t).appendChild(this.node),this},P.svg=function(){return this.node instanceof window.SVGSVGElement?this:D(this.node.ownerSVGElement)},P.tagName=function(){return this.node.tagName.toUpperCase()},P.defs=function(){var t=this.svg()||this,n=t.node.getElementsByTagName("defs")[0];return n?D(n):D("defs").appendTo(t)},P.clone=function(){var t=D(this.node.cloneNode(!0));return t.node.id=D.uniqueId(),t},P.findOne=function(t){t=this.node.querySelector(t);return t?D(t):void 0},P.find=function(t){var n=[],e=this.node.querySelectorAll(t);if(e)for(var i=0;i<e.length;i++)n.push(D(e[i]));return n},P.children=function(){for(var t=this.node.childNodes,n=[],e=0;e<t.length;e++)1===t[e].nodeType&&n.push(D(t[e]));return n},P.parent=function(){return D(this.node.parentNode)||null},P.index=function(){for(var t=0,n=this.node.previousSibling;n;)1===n.nodeType&&t++,n=n.previousSibling;return t},P.findParentByClass=function(t,n){for(var e=this.node.ownerSVGElement,i=this.node.parentNode;i&&i!==n&&i!==e;){var r=D(i);if(r.hasClass(t))return r;i=i.parentNode}return null},P.contains=function(t){var n=this.node,t=D.toNode(t),t=t&&t.parentNode;return n===t||!!(t&&1===t.nodeType&&16&n.compareDocumentPosition(t))},P.toLocalPoint=function(t,n){var e=this.svg().node,i=e.createSVGPoint();i.x=t,i.y=n;try{var r=i.matrixTransform(e.getScreenCTM().inverse()),s=this.getTransformToElement(e).inverse()}catch{return i}return r.matrixTransform(s)},P.translateCenterToPoint=function(t){var n=this.getBBox({target:this.svg()}).center();return this.translate(t.x-n.x,t.y-n.y),this},P.translateAndAutoOrient=function(t,n,e){t=new p(t),n=new p(n),e=e||this.svg();var i=this.scale(),r=(this.attr("transform",""),this.getBBox({target:e}).scale(i.sx,i.sy)),s=D.createSVGTransform(),o=(s.setTranslate(-r.x-r.width/2,-r.y-r.height/2),D.createSVGTransform()),a=t.angleBetween(n,t.clone().offset(1,0)),a=(a&&o.setRotate(a,0,0),D.createSVGTransform()),n=t.clone().move(n,r.width/2),r=(a.setTranslate(2*t.x-n.x,2*t.y-n.y),this.getTransformToElement(e)),t=D.createSVGTransform();return t.setMatrix(a.matrix.multiply(o.matrix.multiply(s.matrix.multiply(r.scale(i.sx,i.sy))))),this.attr("transform",un(t.matrix)),this},P.animateAlongPath=function(t,n){n=D.toNode(n);n=D.ensureId(n),t=D("animateMotion",t),n=D("mpath",{"xlink:href":"#"+n});t.append(n),this.append(t);try{t.node.beginElement()}catch{if("fake"===document.documentElement.getAttribute("smiling"))for(var e=t.node,n=(e.animators=[],e.getAttribute("id")),i=(n&&(id2anim[n]=e),getTargets(e)),r=0,s=i.length;r<s;r++){var o=i[r],o=new Animator(e,o,r);animators.push(o),(e.animators[r]=o).register()}}return this};let n=/[^\x20\t\r\n\f]+/g;function Tn(t){return D.isString(t)&&t.trim().match(n)||[]}P.hasClass=function(t){return!!D.isString(t)&&this.node.classList.contains(t.trim())},P.addClass=function(t){return this.node.classList.add(...Tn(t)),this},P.removeClass=function(t){return this.node.classList.remove(...Tn(t)),this},P.toggleClass=function(t,n){var e=Tn(t);for(let t=0;t<e.length;t++)this.node.classList.toggle(e[t],n);return this},P.sample=function(t){t=t||1;for(var n,e=this.node,i=e.getTotalLength(),r=[],s=0;s<i;)n=e.getPointAtLength(s),r.push({x:n.x,y:n.y,distance:s}),s+=t;return r},P.convertToPath=function(){var t=D("path"),n=(t.attr(this.attr()),this.convertToPathData());return n&&t.attr("d",n),t},P.convertToPathData=function(){var t=this.tagName();switch(t){case"PATH":return this.attr("d");case"LINE":return D.convertLineToPathData(this.node);case"POLYGON":return D.convertPolygonToPathData(this.node);case"POLYLINE":return D.convertPolylineToPathData(this.node);case"ELLIPSE":return D.convertEllipseToPathData(this.node);case"CIRCLE":return D.convertCircleToPathData(this.node);case"RECT":return D.convertRectToPathData(this.node)}throw new Error(t+" cannot be converted to PATH.")},D.prototype.toGeometryShape=function(){var t,n,e,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,e=parseFloat(this.attr("height"))||0,new A(i,o,t,e);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 n=D.getPointsFromSvgNode(this),new l(n);case"POLYGON":return 1<(n=D.getPointsFromSvgNode(this)).length&&n.push(n[0]),new l(n);case"PATH":return e=this.attr("d"),S.isDataSupported(e)||(e=D.normalizePathData(e)),new S(e);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,n){var e=this.svg().node,i=this.getBBox({target:n=n||e}),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(n),a=D.decomposeMatrix(o),e=e.createSVGTransform(),s=(e.setRotate(-a.rotation,r.x,r.y),D.transformRect(s,e.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=D.createSVGPoint(h.x,h.y)).matrixTransform(this.getTransformToElement(n)),(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,n){return t.refDistance-n.refDistance}),d[0]&&(o=d[0].sample)}return o}},P.setAttribute=function(t,n){var e,i=this.node;return null===n?this.removeAttr(t):(t=o[t],e=D.qualifyAttr(t).ns,e?i.setAttributeNS(e,t,n):"id"===t?i.id=n:i.setAttribute(t,n)),this},D.createSvgDocument=function(t){return t?(t=`<svg xmlns="${_t}" xmlns:xlink="${$t}" version="1.1">${t}</svg>`,t=D.parseXML(t,{async:!1}).documentElement,t):tn()},D.createSVGStyle=function(t){t=D("style",{type:"text/css"},[D.createCDATASection(t)]).node;return t},D.createCDATASection=function(t=""){return document.implementation.createDocument(null,"xml",null).createCDATASection(t)},D.idCounter=0,D.uniqueId=function(){return"v-"+ ++D.idCounter},D.toNode=function(t){return D.isV(t)?t.node:t.nodeName&&t||t[0]},D.ensureId=function(t){return(t=D.toNode(t)).id||(t.id=D.uniqueId())},D.sanitizeText=function(t){return(t||"").replace(/ /g,"\xa0")},D.isUndefined=function(t){return void 0===t},D.isString=function(t){return"string"==typeof t},D.isObject=function(t){return t&&"object"==typeof t},D.isArray=Array.isArray,D.parseXML=function(t,n){var e;n=n||{};try{var i=new DOMParser;D.isUndefined(n.async)||(i.async=n.async),e=i.parseFromString(t,"text/xml")}catch{e=void 0}if(!e||e.getElementsByTagName("parsererror").length)throw new Error("Invalid XML: "+t);return e};let e=Object.create(null),o=(["attributeName","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","repeatCount","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].forEach(t=>e[t]=t),e.xlinkShow="xlink:show",e.xlinkRole="xlink:role",e.xlinkActuate="xlink:actuate",e.xlinkHref="xlink:href",e.xlinkType="xlink:type",e.xlinkTitle="xlink:title",e.xmlBase="xml:base",e.xmlLang="xml:lang",e.xmlSpace="xml:space",new Proxy(e,{get(t,n){return D.supportCamelCaseAttributes?n in t?t[n]:t[n]=n.replace(/[A-Z]/g,"-$&").toLowerCase():n}}));function Ln(t,n,e,i,r,s){return[1/3*t+2/3*e,1/3*n+2/3*i,1/3*r+2/3*e,1/3*s+2/3*i,r,s]}function En(t,n,e){return{x:t*F(e)-n*q(e),y:t*q(e)+n*F(e)}}function Cn(t,n,e,i,r,s,o,a,h,u){var c=120*M/180,l=M/180*(+r||0),f=[];if(u)x=u[0],w=u[1],m=u[2],y=u[3];else{t=(g=En(t,n,-l)).x,n=g.y;var d=(t-(a=(g=En(a,h,-l)).x))/2,g=(n-(h=g.y))/2,p=d*d/(e*e)+g*g/(i*i),p=(1<p&&(e*=p=bn(p),i*=p),e*e),v=i*i,s=(s==o?-1:1)*bn(Sn((p*v-p*g*g-v*d*d)/(p*g*g+v*d*d)));if(!Number.isFinite(s))return[t,n,a,h,a,h];var m=s*e*g/i+(t+a)/2,y=s*-i*d/e+(n+h)/2,x=wn(((n-y)/i).toFixed(9)),w=wn(((h-y)/i).toFixed(9));(x=t<m?M-x:x)<0&&(x=2*M+x),(w=a<m?M-w:w)<0&&(w=2*M+w),o&&w<x&&(x-=2*M),!o&&x<w&&(w-=2*M)}Sn(w-x)>c&&(p=w,v=a,g=h,f=Cn(a=m+e*F(w=x+c*(o&&x<w?1:-1)),h=y+i*q(w),e,i,r,0,o,v,g,[w,p,m,y])),s=w-x;d=F(x),c=q(x),r=F(w),o=q(w),v=xn(s/4),g=4/3*(e*v),p=4/3*(i*v),m=[t,n],y=[t+g*c,n-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?En(f[P-1],f[P],l).y:En(f[P],f[P+1],l).x;return b}function Nn(t){var n,s,o;if(!(t=Array.isArray(t)&&Array.isArray(t&&t[0])?t:(n=t)?(s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[],String(n).replace(mn,function(t,n,e){var i=[],r=n.toLowerCase();for(e.replace(yn,function(t,n){n&&i.push(+n)}),"m"===r&&2<i.length&&(o.push([n].concat(i.splice(0,2))),r="l",n="m"===n?"l":"L");s[r]<=i.length&&(o.push([n].concat(i.splice(0,s[r]))),s[r]););}),o):null)||!t.length)return[["M",0,0]];for(var e=[],i=0,r=0,a=0,h=0,u=t.length,c=0;c<u;c++){var l,f,d=[],g=(e.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 e}function In(t){var n=Nn(t),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};for(var i=[],r="",s="",o=n.length,a=0;a<o;a++){"C"!==(r=n[a]?n[a][0]:r)&&(i[a]=r,0<a)&&(s=i[a-1]),n[a]=((t,n,e)=>{var i,r;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(Cn.apply(0,[n.x,n.y].concat(t.slice(1))));break;case"S":r="C"===e||"S"===e?(i=2*n.x-n.bx,2*n.y-n.by):(i=n.x,n.y),t=["C",i,r].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(Ln(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(Ln(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})(n[a],e,s),"A"!==i[a]&&"C"===r&&(i[a]="C"),c=u=h=void 0;var h=n,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=n.length}var l=n[a],f=l.length;e.x=l[f-2],e.y=l[f-1],e.bx=parseFloat(l[f-4])||e.x,e.by=parseFloat(l[f-3])||e.y}return n[0][0]&&"M"===n[0][0]||n.unshift(["M",0,0]),n}return Object.defineProperty(D,"attributeNames",{enumerable:!0,value:o,writable:!1}),Object.defineProperty(D,"supportCamelCaseAttributes",{enumerable:!0,value:!0,writable:!0}),D.qualifyAttr=function(t){var n;return-1!==t.indexOf(":")?(n=t.split(":"),{ns:Jt[n[0]],local:n[1]}):{ns:null,local:t}},D.transformSeparatorRegex=/[ ,]+/,D.transformFunctionRegex=/\b(\w+)\(([^()]+)\)/,D.transformTranslateRegex=/\btranslate\(([^()]+)\)/,D.transformRotateRegex=/\brotate\(([^()]+)\)/,D.transformScaleRegex=/\bscale\(([^()]+)\)/,D.transformStringToMatrix=function(t){let n;return(n=D.isString(t)?(t=t,Qt.setAttribute("transform",t),sn(Qt)):n)||I()},D.matrixToTransformString=un,D.parseTransformString=function(t){t&&(n=D.transformSeparatorRegex,0<=t.trim().indexOf("matrix")?(r=D.transformStringToMatrix(t),e=[(r=D.decomposeMatrix(r)).translateX,r.translateY],i=[r.scaleX,r.scaleY],r=[r.rotation],s=[],0===e[0]&&0===e[1]||s.push("translate("+e+")"),1===i[0]&&1===i[1]||s.push("scale("+i+")"),0!==r[0]&&s.push("rotate("+r+")"),t=s.join(" ")):((s=t.match(D.transformTranslateRegex))&&(e=s[1].split(n)),(s=t.match(D.transformRotateRegex))&&(r=s[1].split(n)),(s=t.match(D.transformScaleRegex))&&(i=s[1].split(n))));var n,e,i,r,s=i&&i[0]?parseFloat(i[0]):1;return{value:t,translate:{tx:e&&e[0]?parseInt(e[0],10):0,ty:e&&e[1]?parseInt(e[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}}},D.deltaTransformPoint=function(t,n){return{x:n.x*t.a+n.y*t.c,y:n.x*t.b+n.y*t.d}},D.decomposeMatrix=function(t){var n=D.deltaTransformPoint(t,{x:0,y:1}),e=D.deltaTransformPoint(t,{x:1,y:0}),n=180/ln*fn(n.y,n.x)-90,e=180/ln*fn(e.y,e.x);return{translateX:t.e,translateY:t.f,scaleX:dn(t.a*t.a+t.b*t.b),scaleY:dn(t.c*t.c+t.d*t.d),skewX:n,skewY:e,rotation:n}},D.matrixToScale=function(t){var n,e,i,r;return t?(n=D.isUndefined(t.a)?1:t.a,r=D.isUndefined(t.d)?1:t.d,e=t.b,i=t.c):n=r=1,{sx:e?dn(n*n+e*e):n,sy:i?dn(i*i+r*r):r}},D.matrixToRotate=function(t){var n={x:0,y:1};return t&&(n=D.deltaTransformPoint(t,n)),{angle:r(s(fn(n.y,n.x))-90)}},D.matrixToTranslate=function(t){return{tx:t&&t.e||0,ty:t&&t.f||0}},D.isVElement=D.isV=function(t){return t instanceof D},D.isSVGGraphicsElement=function(t){return!!t&&(t=D.toNode(t))instanceof SVGElement&&"function"==typeof t.getScreenCTM},D.createSVGMatrix=rn,D.createSVGTransform=function(t){return D.isUndefined(t)?N.createSVGTransform():(hn(t)||(t=rn(t)),N.createSVGTransformFromMatrix(t))},D.createSVGPoint=function(t,n){var e=N.createSVGPoint();return e.x=t,e.y=n,e},D.transformRect=function(t,n){var e=N.createSVGPoint(),i=(e.x=t.x,e.y=t.y,e.matrixTransform(n)),r=(e.x=t.x+t.width,e.y=t.y,e.matrixTransform(n)),s=(e.x=t.x+t.width,e.y=t.y+t.height,e.matrixTransform(n)),t=(e.x=t.x,e.y=t.y+t.height,e.matrixTransform(n)),e=O(i.x,r.x,s.x,t.x),n=gn(i.x,r.x,s.x,t.x),o=O(i.y,r.y,s.y,t.y),i=gn(i.y,r.y,s.y,t.y);return new A(e,o,n-e,i-o)},D.transformPoint=function(t,n){return new p(D.createSVGPoint(t.x,t.y).matrixTransform(n))},D.transformLine=function(t,n){return new d(D.transformPoint(t.start,n),D.transformPoint(t.end,n))},D.transformPolyline=function(t,n){for(var e=t instanceof l?t.points:t,i=[],r=0,s=(e=D.isArray(e)?e:[]).length;r<s;r++)i[r]=D.transformPoint(e[r],n);return new l(i)},D.styleToObject=function(t){for(var n={},e=t.split(";"),i=0;i<e.length;i++){var r=e[i].split("=");n[r[0].trim()]=r[1].trim()}return n},D.createSlicePathData=function(t,n,e,i){var r=2*ln-1e-6,s=(i<e&&(s=e,e=i,i=s),i-e),o=s<ln?"0":"1",a=pn(e),e=vn(e),h=pn(i),i=vn(i);return r<=s?t?"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z":t?"M"+n*a+","+n*e+"A"+n+","+n+" 0 "+o+",1 "+n*h+","+n*i+"L"+t*h+","+t*i+"A"+t+","+t+" 0 "+o+",0 "+t*a+","+t*e+"Z":"M"+n*a+","+n*e+"A"+n+","+n+" 0 "+o+",1 "+n*h+","+n*i+"L0,0Z"},D.mergeAttrs=function(t,n){for(var e in n)"class"===e?t[e]=t[e]?t[e]+" "+n[e]:n[e]:"style"===e?D.isObject(t[e])&&D.isObject(n[e])?t[e]=D.mergeAttrs(t[e],n[e]):D.isObject(t[e])?t[e]=D.mergeAttrs(t[e],D.styleToObject(n[e])):D.isObject(n[e])?t[e]=D.mergeAttrs(D.styleToObject(t[e]),n[e]):t[e]=D.mergeAttrs(D.styleToObject(t[e]),D.styleToObject(n[e])):t[e]=n[e];return t},D.annotateString=function(t,n,e){n=n||[];for(var i,r,s=(e=e||{}).offset||0,o=[],a=[],h=0;h<t.length;h++){for(var u=a[h]=t[h],c=0;c<n.length;c++){var l=n[c];l.start+s<=h&&h<l.end+s&&(D.isObject(u)?u.attrs=D.mergeAttrs(D.mergeAttrs({},u.attrs),l.attrs):u=a[h]={t:t[h],attrs:l.attrs},e.includeAnnotationIndices)&&(u.annotations||(u.annotations=[])).push(c)}(r=a[h-1])?D.isObject(u)&&D.isObject(r)?JSON.stringify(u.attrs)===JSON.stringify(r.attrs)?i.t+=u.t:(o.push(i),i=u):i=D.isObject(u)||D.isObject(r)?(o.push(i),u):(i||"")+u:i=u}return i&&o.push(i),o},D.findAnnotationsAtIndex=function(t,n){var e=[];return t&&t.forEach(function(t){t.start<n&&n<=t.end&&e.push(t)}),e},D.findAnnotationsBetweenIndexes=function(t,n,e){var i=[];return t&&t.forEach(function(t){(n>=t.start&&n<t.end||e>t.start&&e<=t.end||t.start>=n&&t.end<e)&&i.push(t)}),i},D.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},D.convertLineToPathData=function(t){return["M",(t=D(t)).attr("x1")||"0",t.attr("y1")||"0","L",t.attr("x2")||"0",t.attr("y2")||"0"].join(" ")},D.convertPolygonToPathData=function(t){t=D.getPointsFromSvgNode(t);return 0===t.length?null:D.svgPointsToPath(t)+" Z"},D.convertPolylineToPathData=function(t){t=D.getPointsFromSvgNode(t);return 0===t.length?null:D.svgPointsToPath(t)},D.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")},D.getPointsFromSvgNode=function(t){var n=[],e=(t=D.toNode(t)).points;if(e)for(var i=0,r=e.numberOfItems;i<r;i++)n.push(e.getItem(i));return n},D.KAPPA=.551784,D.convertCircleToPathData=function(t){t=D(t);var n=parseFloat(t.attr("cx"))||0,e=parseFloat(t.attr("cy"))||0,t=parseFloat(t.attr("r")),i=t*D.KAPPA;return["M",n,e-t,"C",n+i,e-t,n+t,e-i,n+t,e,"C",n+t,e+i,n+i,e+t,n,e+t,"C",n-i,e+t,n-t,e+i,n-t,e,"C",n-t,e-i,n-i,e-t,n,e-t,"Z"].join(" ")},D.convertEllipseToPathData=function(t){t=D(t);var n=parseFloat(t.attr("cx"))||0,e=parseFloat(t.attr("cy"))||0,i=parseFloat(t.attr("rx")),t=parseFloat(t.attr("ry"))||i,r=i*D.KAPPA,s=t*D.KAPPA;return["M",n,e-t,"C",n+r,e-t,n+i,e-s,n+i,e,"C",n+i,e+s,n+r,e+t,n,e+t,"C",n-r,e+t,n-i,e+s,n-i,e,"C",n-i,e-s,n-r,e-t,n,e-t,"Z"].join(" ")},D.convertRectToPathData=function(t){return t=D(t),D.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})},D.rectToPath=function(t){var n=t.x,e=t.y,i=t.width,r=t.height,s=O(t.rx||t["top-rx"]||0,i/2),o=O(t.rx||t["bottom-rx"]||0,i/2),a=O(t.ry||t["top-ry"]||0,r/2),t=O(t.ry||t["bottom-ry"]||0,r/2),o=s||o||a||t?["M",n,e+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",n,e,"H",n+i,"V",e+r,"H",n,"V",e,"Z"];return o.join(" ")},D.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",mn=new RegExp("([a-z])["+P+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+P+"]*,?["+P+"]*)+)","ig"),yn=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+P+"]*,?["+P+"]*","ig"),P=Math,M=P.PI,q=P.sin,F=P.cos,xn=P.tan,wn=P.asin,bn=P.sqrt,Sn=P.abs,function(t){return In(t).join(",").split(",").join(" ")}),D.getCommonAncestor=function(t,n){return t&&n?en(D.toNode(t),D.toNode(n)):null},D.namespace={...Jt},D.g=b,D}}),"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.2.0-alpha.
|
|
4
|
+
"version": "4.2.0-alpha.1",
|
|
5
5
|
"description": "JavaScript diagramming library",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/joint.min.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@babel/preset-env": "7.26.9",
|
|
69
69
|
"@eslint/eslintrc": "3.3.1",
|
|
70
70
|
"@eslint/js": "9.23.0",
|
|
71
|
-
"@microsoft/api-extractor": "7.
|
|
71
|
+
"@microsoft/api-extractor": "7.52.10",
|
|
72
72
|
"@rollup/plugin-babel": "^6.0.4",
|
|
73
73
|
"@typescript-eslint/eslint-plugin": "8.28.0",
|
|
74
74
|
"@typescript-eslint/parser": "8.27.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"grunt-contrib-clean": "2.0.0",
|
|
85
85
|
"grunt-contrib-concat": "1.0.1",
|
|
86
86
|
"grunt-contrib-copy": "1.0.0",
|
|
87
|
-
"grunt-contrib-qunit": "
|
|
87
|
+
"grunt-contrib-qunit": "7.0.1",
|
|
88
88
|
"grunt-contrib-uglify": "4.0.1",
|
|
89
89
|
"grunt-contrib-watch": "1.1.0",
|
|
90
90
|
"grunt-env": "0.4.4",
|
|
@@ -100,13 +100,13 @@
|
|
|
100
100
|
"karma": "6.4.4",
|
|
101
101
|
"karma-chrome-launcher": "3.2.0",
|
|
102
102
|
"karma-coverage": "2.2.1",
|
|
103
|
-
"karma-qunit": "2.1
|
|
103
|
+
"karma-qunit": "4.2.1",
|
|
104
104
|
"karma-sinon": "1.0.5",
|
|
105
|
-
"load-grunt-config": "0.
|
|
105
|
+
"load-grunt-config": "4.0.1",
|
|
106
106
|
"lodash": "~4.17.21",
|
|
107
107
|
"mocha": "11.1.0",
|
|
108
|
-
"puppeteer": "24.
|
|
109
|
-
"qunit": "2.
|
|
108
|
+
"puppeteer": "24.22.0",
|
|
109
|
+
"qunit": "2.24.1",
|
|
110
110
|
"requirejs": "2.3.6",
|
|
111
111
|
"rollup": "4.36.0",
|
|
112
112
|
"rollup-plugin-commonjs": "10.1.0",
|