/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var tr=function(t,e){return(tr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,i){h.__proto__=i}||function(h,i){for(var p in i)Object.prototype.hasOwnProperty.call(i,p)&&(h[p]=i[p])})(t,e)};function er(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function h(){this.constructor=t}tr(t,e),t.prototype=e===null?Object.create(e):(h.prototype=e.prototype,new h)}function sr(t){var e="";Array.isArray(t)||(t=[t]);for(var h=0;h<t.length;h++){var i=t[h];if(i.type===c.CLOSE_PATH)e+="z";else if(i.type===c.HORIZ_LINE_TO)e+=(i.relative?"h":"H")+i.x;else if(i.type===c.VERT_LINE_TO)e+=(i.relative?"v":"V")+i.y;else if(i.type===c.MOVE_TO)e+=(i.relative?"m":"M")+i.x+" "+i.y;else if(i.type===c.LINE_TO)e+=(i.relative?"l":"L")+i.x+" "+i.y;else if(i.type===c.CURVE_TO)e+=(i.relative?"c":"C")+i.x1+" "+i.y1+" "+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===c.SMOOTH_CURVE_TO)e+=(i.relative?"s":"S")+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===c.QUAD_TO)e+=(i.relative?"q":"Q")+i.x1+" "+i.y1+" "+i.x+" "+i.y;else if(i.type===c.SMOOTH_QUAD_TO)e+=(i.relative?"t":"T")+i.x+" "+i.y;else{if(i.type!==c.ARC)throw new Error('Unexpected command type "'+i.type+'" at index '+h+".");e+=(i.relative?"a":"A")+i.rX+" "+i.rY+" "+i.xRot+" "+ +i.lArcFlag+" "+ +i.sweepFlag+" "+i.x+" "+i.y}}return e}function z(t,e){var h=t[0],i=t[1];return[h*Math.cos(e)-i*Math.sin(e),h*Math.sin(e)+i*Math.cos(e)]}function U(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var h=0;h<t.length;h++)if(typeof t[h]!="number")throw new Error("assertNumbers arguments["+h+"] is not a number. "+typeof t[h]+" == typeof "+t[h]);return!0}var Z=Math.PI;function j(t,e,h){t.lArcFlag=t.lArcFlag===0?0:1,t.sweepFlag=t.sweepFlag===0?0:1;var i=t.rX,p=t.rY,l=t.x,f=t.y;i=Math.abs(t.rX),p=Math.abs(t.rY);var r=z([(e-l)/2,(h-f)/2],-t.xRot/180*Z),s=r[0],n=r[1],o=Math.pow(s,2)/Math.pow(i,2)+Math.pow(n,2)/Math.pow(p,2);1<o&&(i*=Math.sqrt(o),p*=Math.sqrt(o)),t.rX=i,t.rY=p;var y=Math.pow(i,2)*Math.pow(n,2)+Math.pow(p,2)*Math.pow(s,2),a=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(i,2)*Math.pow(p,2)-y)/y)),u=i*n/p*a,_=-p*s/i*a,m=z([u,_],t.xRot/180*Z);t.cX=m[0]+(e+l)/2,t.cY=m[1]+(h+f)/2,t.phi1=Math.atan2((n-_)/p,(s-u)/i),t.phi2=Math.atan2((-n-_)/p,(-s-u)/i),t.sweepFlag===0&&t.phi2>t.phi1&&(t.phi2-=2*Z),t.sweepFlag===1&&t.phi2<t.phi1&&(t.phi2+=2*Z),t.phi1*=180/Z,t.phi2*=180/Z}function K(t,e,h){U(t,e,h);var i=t*t+e*e-h*h;if(0>i)return[];if(i===0)return[[t*h/(t*t+e*e),e*h/(t*t+e*e)]];var p=Math.sqrt(i);return[[(t*h+e*p)/(t*t+e*e),(e*h-t*p)/(t*t+e*e)],[(t*h-e*p)/(t*t+e*e),(e*h+t*p)/(t*t+e*e)]]}var d,X=Math.PI/180;function k(t,e,h){return(1-h)*t+h*e}function G(t,e,h,i){return t+Math.cos(i/180*Z)*e+Math.sin(i/180*Z)*h}function J(t,e,h,i){var p=1e-6,l=e-t,f=h-e,r=3*l+3*(i-h)-6*f,s=6*(f-l),n=3*l;return Math.abs(r)<p?[-n/s]:function(o,y,a){a===void 0&&(a=1e-6);var u=o*o/4-y;if(u<-a)return[];if(u<=a)return[-o/2];var _=Math.sqrt(u);return[-o/2-_,-o/2+_]}(s/r,n/r,p)}function $(t,e,h,i,p){var l=1-p;return t*(l*l*l)+e*(3*l*l*p)+h*(3*l*p*p)+i*(p*p*p)}(function(t){function e(){return p(function(r,s,n){return r.relative&&(r.x1!==void 0&&(r.x1+=s),r.y1!==void 0&&(r.y1+=n),r.x2!==void 0&&(r.x2+=s),r.y2!==void 0&&(r.y2+=n),r.x!==void 0&&(r.x+=s),r.y!==void 0&&(r.y+=n),r.relative=!1),r})}function h(){var r=NaN,s=NaN,n=NaN,o=NaN;return p(function(y,a,u){return y.type&c.SMOOTH_CURVE_TO&&(y.type=c.CURVE_TO,r=isNaN(r)?a:r,s=isNaN(s)?u:s,y.x1=y.relative?a-r:2*a-r,y.y1=y.relative?u-s:2*u-s),y.type&c.CURVE_TO?(r=y.relative?a+y.x2:y.x2,s=y.relative?u+y.y2:y.y2):(r=NaN,s=NaN),y.type&c.SMOOTH_QUAD_TO&&(y.type=c.QUAD_TO,n=isNaN(n)?a:n,o=isNaN(o)?u:o,y.x1=y.relative?a-n:2*a-n,y.y1=y.relative?u-o:2*u-o),y.type&c.QUAD_TO?(n=y.relative?a+y.x1:y.x1,o=y.relative?u+y.y1:y.y1):(n=NaN,o=NaN),y})}function i(){var r=NaN,s=NaN;return p(function(n,o,y){if(n.type&c.SMOOTH_QUAD_TO&&(n.type=c.QUAD_TO,r=isNaN(r)?o:r,s=isNaN(s)?y:s,n.x1=n.relative?o-r:2*o-r,n.y1=n.relative?y-s:2*y-s),n.type&c.QUAD_TO){r=n.relative?o+n.x1:n.x1,s=n.relative?y+n.y1:n.y1;var a=n.x1,u=n.y1;n.type=c.CURVE_TO,n.x1=((n.relative?0:o)+2*a)/3,n.y1=((n.relative?0:y)+2*u)/3,n.x2=(n.x+2*a)/3,n.y2=(n.y+2*u)/3}else r=NaN,s=NaN;return n})}function p(r){var s=0,n=0,o=NaN,y=NaN;return function(a){if(isNaN(o)&&!(a.type&c.MOVE_TO))throw new Error("path must start with moveto");var u=r(a,s,n,o,y);return a.type&c.CLOSE_PATH&&(s=o,n=y),a.x!==void 0&&(s=a.relative?s+a.x:a.x),a.y!==void 0&&(n=a.relative?n+a.y:a.y),a.type&c.MOVE_TO&&(o=s,y=n),u}}function l(r,s,n,o,y,a){return U(r,s,n,o,y,a),p(function(u,_,m,C){var x=u.x1,g=u.x2,N=u.relative&&!isNaN(C),O=u.x!==void 0?u.x:N?0:_,I=u.y!==void 0?u.y:N?0:m;function v(q){return q*q}u.type&c.HORIZ_LINE_TO&&s!==0&&(u.type=c.LINE_TO,u.y=u.relative?0:m),u.type&c.VERT_LINE_TO&&n!==0&&(u.type=c.LINE_TO,u.x=u.relative?0:_),u.x!==void 0&&(u.x=u.x*r+I*n+(N?0:y)),u.y!==void 0&&(u.y=O*s+u.y*o+(N?0:a)),u.x1!==void 0&&(u.x1=u.x1*r+u.y1*n+(N?0:y)),u.y1!==void 0&&(u.y1=x*s+u.y1*o+(N?0:a)),u.x2!==void 0&&(u.x2=u.x2*r+u.y2*n+(N?0:y)),u.y2!==void 0&&(u.y2=g*s+u.y2*o+(N?0:a));var T=r*o-s*n;if(u.xRot!==void 0&&(r!==1||s!==0||n!==0||o!==1))if(T===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=c.LINE_TO;else{var M=u.xRot*Math.PI/180,R=Math.sin(M),P=Math.cos(M),S=1/v(u.rX),H=1/v(u.rY),Q=v(P)*S+v(R)*H,F=2*R*P*(S-H),b=v(R)*S+v(P)*H,D=Q*o*o-F*s*o+b*s*s,V=F*(r*o+s*n)-2*(Q*n*o+b*r*s),Y=Q*n*n-F*r*n+b*r*r,E=(Math.atan2(V,D-Y)+Math.PI)%Math.PI/2,A=Math.sin(E),w=Math.cos(E);u.rX=Math.abs(T)/Math.sqrt(D*v(w)+V*A*w+Y*v(A)),u.rY=Math.abs(T)/Math.sqrt(D*v(A)-V*A*w+Y*v(w)),u.xRot=180*E/Math.PI}return u.sweepFlag!==void 0&&0>T&&(u.sweepFlag=+!u.sweepFlag),u})}function f(){return function(r){var s={};for(var n in r)s[n]=r[n];return s}}t.ROUND=function(r){function s(n){return Math.round(n*r)/r}return r===void 0&&(r=1e13),U(r),function(n){return n.x1!==void 0&&(n.x1=s(n.x1)),n.y1!==void 0&&(n.y1=s(n.y1)),n.x2!==void 0&&(n.x2=s(n.x2)),n.y2!==void 0&&(n.y2=s(n.y2)),n.x!==void 0&&(n.x=s(n.x)),n.y!==void 0&&(n.y=s(n.y)),n.rX!==void 0&&(n.rX=s(n.rX)),n.rY!==void 0&&(n.rY=s(n.rY)),n}},t.TO_ABS=e,t.TO_REL=function(){return p(function(r,s,n){return r.relative||(r.x1!==void 0&&(r.x1-=s),r.y1!==void 0&&(r.y1-=n),r.x2!==void 0&&(r.x2-=s),r.y2!==void 0&&(r.y2-=n),r.x!==void 0&&(r.x-=s),r.y!==void 0&&(r.y-=n),r.relative=!0),r})},t.NORMALIZE_HVZ=function(r,s,n){return r===void 0&&(r=!0),s===void 0&&(s=!0),n===void 0&&(n=!0),p(function(o,y,a,u,_){if(isNaN(u)&&!(o.type&c.MOVE_TO))throw new Error("path must start with moveto");return s&&o.type&c.HORIZ_LINE_TO&&(o.type=c.LINE_TO,o.y=o.relative?0:a),n&&o.type&c.VERT_LINE_TO&&(o.type=c.LINE_TO,o.x=o.relative?0:y),r&&o.type&c.CLOSE_PATH&&(o.type=c.LINE_TO,o.x=o.relative?u-y:u,o.y=o.relative?_-a:_),o.type&c.ARC&&(o.rX===0||o.rY===0)&&(o.type=c.LINE_TO,delete o.rX,delete o.rY,delete o.xRot,delete o.lArcFlag,delete o.sweepFlag),o})},t.NORMALIZE_ST=h,t.QT_TO_C=i,t.INFO=p,t.SANITIZE=function(r){r===void 0&&(r=0),U(r);var s=NaN,n=NaN,o=NaN,y=NaN;return p(function(a,u,_,m,C){var x=Math.abs,g=!1,N=0,O=0;if(a.type&c.SMOOTH_CURVE_TO&&(N=isNaN(s)?0:u-s,O=isNaN(n)?0:_-n),a.type&(c.CURVE_TO|c.SMOOTH_CURVE_TO)?(s=a.relative?u+a.x2:a.x2,n=a.relative?_+a.y2:a.y2):(s=NaN,n=NaN),a.type&c.SMOOTH_QUAD_TO?(o=isNaN(o)?u:2*u-o,y=isNaN(y)?_:2*_-y):a.type&c.QUAD_TO?(o=a.relative?u+a.x1:a.x1,y=a.relative?_+a.y1:a.y2):(o=NaN,y=NaN),a.type&c.LINE_COMMANDS||a.type&c.ARC&&(a.rX===0||a.rY===0||!a.lArcFlag)||a.type&c.CURVE_TO||a.type&c.SMOOTH_CURVE_TO||a.type&c.QUAD_TO||a.type&c.SMOOTH_QUAD_TO){var I=a.x===void 0?0:a.relative?a.x:a.x-u,v=a.y===void 0?0:a.relative?a.y:a.y-_;N=isNaN(o)?a.x1===void 0?N:a.relative?a.x:a.x1-u:o-u,O=isNaN(y)?a.y1===void 0?O:a.relative?a.y:a.y1-_:y-_;var T=a.x2===void 0?0:a.relative?a.x:a.x2-u,M=a.y2===void 0?0:a.relative?a.y:a.y2-_;x(I)<=r&&x(v)<=r&&x(N)<=r&&x(O)<=r&&x(T)<=r&&x(M)<=r&&(g=!0)}return a.type&c.CLOSE_PATH&&x(u-m)<=r&&x(_-C)<=r&&(g=!0),g?[]:a})},t.MATRIX=l,t.ROTATE=function(r,s,n){s===void 0&&(s=0),n===void 0&&(n=0),U(r,s,n);var o=Math.sin(r),y=Math.cos(r);return l(y,o,-o,y,s-s*y+n*o,n-s*o-n*y)},t.TRANSLATE=function(r,s){return s===void 0&&(s=0),U(r,s),l(1,0,0,1,r,s)},t.SCALE=function(r,s){return s===void 0&&(s=r),U(r,s),l(r,0,0,s,0,0)},t.SKEW_X=function(r){return U(r),l(1,0,Math.atan(r),1,0,0)},t.SKEW_Y=function(r){return U(r),l(1,Math.atan(r),0,1,0,0)},t.X_AXIS_SYMMETRY=function(r){return r===void 0&&(r=0),U(r),l(-1,0,0,1,r,0)},t.Y_AXIS_SYMMETRY=function(r){return r===void 0&&(r=0),U(r),l(1,0,0,-1,0,r)},t.A_TO_C=function(){return p(function(r,s,n){return c.ARC===r.type?function(o,y,a){var u,_,m,C;o.cX||j(o,y,a);for(var x=Math.min(o.phi1,o.phi2),g=Math.max(o.phi1,o.phi2)-x,N=Math.ceil(g/90),O=new Array(N),I=y,v=a,T=0;T<N;T++){var M=k(o.phi1,o.phi2,T/N),R=k(o.phi1,o.phi2,(T+1)/N),P=R-M,S=4/3*Math.tan(P*X/4),H=[Math.cos(M*X)-S*Math.sin(M*X),Math.sin(M*X)+S*Math.cos(M*X)],Q=H[0],F=H[1],b=[Math.cos(R*X),Math.sin(R*X)],D=b[0],V=b[1],Y=[D+S*Math.sin(R*X),V-S*Math.cos(R*X)],E=Y[0],A=Y[1];O[T]={relative:o.relative,type:c.CURVE_TO};var w=function(q,W){var B=z([q*o.rX,W*o.rY],o.xRot),ir=B[0],or=B[1];return[o.cX+ir,o.cY+or]};u=w(Q,F),O[T].x1=u[0],O[T].y1=u[1],_=w(E,A),O[T].x2=_[0],O[T].y2=_[1],m=w(D,V),O[T].x=m[0],O[T].y=m[1],o.relative&&(O[T].x1-=I,O[T].y1-=v,O[T].x2-=I,O[T].y2-=v,O[T].x-=I,O[T].y-=v),I=(C=[O[T].x,O[T].y])[0],v=C[1]}return O}(r,r.relative?0:s,r.relative?0:n):r})},t.ANNOTATE_ARCS=function(){return p(function(r,s,n){return r.relative&&(s=0,n=0),c.ARC===r.type&&j(r,s,n),r})},t.CLONE=f,t.CALCULATE_BOUNDS=function(){var r=function(a){var u={};for(var _ in a)u[_]=a[_];return u},s=e(),n=i(),o=h(),y=p(function(a,u,_){var m=o(n(s(r(a))));function C(A){A>y.maxX&&(y.maxX=A),A<y.minX&&(y.minX=A)}function x(A){A>y.maxY&&(y.maxY=A),A<y.minY&&(y.minY=A)}if(m.type&c.DRAWING_COMMANDS&&(C(u),x(_)),m.type&c.HORIZ_LINE_TO&&C(m.x),m.type&c.VERT_LINE_TO&&x(m.y),m.type&c.LINE_TO&&(C(m.x),x(m.y)),m.type&c.CURVE_TO){C(m.x),x(m.y);for(var g=0,N=J(u,m.x1,m.x2,m.x);g<N.length;g++)0<(E=N[g])&&1>E&&C($(u,m.x1,m.x2,m.x,E));for(var O=0,I=J(_,m.y1,m.y2,m.y);O<I.length;O++)0<(E=I[O])&&1>E&&x($(_,m.y1,m.y2,m.y,E))}if(m.type&c.ARC){C(m.x),x(m.y),j(m,u,_);for(var v=m.xRot/180*Math.PI,T=Math.cos(v)*m.rX,M=Math.sin(v)*m.rX,R=-Math.sin(v)*m.rY,P=Math.cos(v)*m.rY,S=m.phi1<m.phi2?[m.phi1,m.phi2]:-180>m.phi2?[m.phi2+360,m.phi1+360]:[m.phi2,m.phi1],H=S[0],Q=S[1],F=function(A){var w=A[0],q=A[1],W=180*Math.atan2(q,w)/Math.PI;return W<H?W+360:W},b=0,D=K(R,-T,0).map(F);b<D.length;b++)(E=D[b])>H&&E<Q&&C(G(m.cX,T,R,E));for(var V=0,Y=K(P,-M,0).map(F);V<Y.length;V++){var E;(E=Y[V])>H&&E<Q&&x(G(m.cY,M,P,E))}}return a});return y.minX=1/0,y.maxX=-1/0,y.minY=1/0,y.maxY=-1/0,y}})(d||(d={}));var L,nr=function(){function t(){}return t.prototype.round=function(e){return this.transform(d.ROUND(e))},t.prototype.toAbs=function(){return this.transform(d.TO_ABS())},t.prototype.toRel=function(){return this.transform(d.TO_REL())},t.prototype.normalizeHVZ=function(e,h,i){return this.transform(d.NORMALIZE_HVZ(e,h,i))},t.prototype.normalizeST=function(){return this.transform(d.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform(d.QT_TO_C())},t.prototype.aToC=function(){return this.transform(d.A_TO_C())},t.prototype.sanitize=function(e){return this.transform(d.SANITIZE(e))},t.prototype.translate=function(e,h){return this.transform(d.TRANSLATE(e,h))},t.prototype.scale=function(e,h){return this.transform(d.SCALE(e,h))},t.prototype.rotate=function(e,h,i){return this.transform(d.ROTATE(e,h,i))},t.prototype.matrix=function(e,h,i,p,l,f){return this.transform(d.MATRIX(e,h,i,p,l,f))},t.prototype.skewX=function(e){return this.transform(d.SKEW_X(e))},t.prototype.skewY=function(e){return this.transform(d.SKEW_Y(e))},t.prototype.xSymmetry=function(e){return this.transform(d.X_AXIS_SYMMETRY(e))},t.prototype.ySymmetry=function(e){return this.transform(d.Y_AXIS_SYMMETRY(e))},t.prototype.annotateArcs=function(){return this.transform(d.ANNOTATE_ARCS())},t}(),ar=function(t){return t===" "||t==="	"||t==="\r"||t===`
`},rr=function(t){return"0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0)},ur=function(t){function e(){var h=t.call(this)||this;return h.curNumber="",h.curCommandType=-1,h.curCommandRelative=!1,h.canParseCommandOrComma=!0,h.curNumberHasExp=!1,h.curNumberHasExpDigits=!1,h.curNumberHasDecimal=!1,h.curArgs=[],h}return er(e,t),e.prototype.finish=function(h){if(h===void 0&&(h=[]),this.parse(" ",h),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return h},e.prototype.parse=function(h,i){var p=this;i===void 0&&(i=[]);for(var l=function(y){i.push(y),p.curArgs.length=0,p.canParseCommandOrComma=!0},f=0;f<h.length;f++){var r=h[f],s=!(this.curCommandType!==c.ARC||this.curArgs.length!==3&&this.curArgs.length!==4||this.curNumber.length!==1||this.curNumber!=="0"&&this.curNumber!=="1"),n=rr(r)&&(this.curNumber==="0"&&r==="0"||s);if(!rr(r)||n)if(r!=="e"&&r!=="E")if(r!=="-"&&r!=="+"||!this.curNumberHasExp||this.curNumberHasExpDigits)if(r!=="."||this.curNumberHasExp||this.curNumberHasDecimal||s){if(this.curNumber&&this.curCommandType!==-1){var o=Number(this.curNumber);if(isNaN(o))throw new SyntaxError("Invalid number ending at "+f);if(this.curCommandType===c.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>o)throw new SyntaxError('Expected positive number, got "'+o+'" at index "'+f+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+f+'"')}this.curArgs.push(o),this.curArgs.length===cr[this.curCommandType]&&(c.HORIZ_LINE_TO===this.curCommandType?l({type:c.HORIZ_LINE_TO,relative:this.curCommandRelative,x:o}):c.VERT_LINE_TO===this.curCommandType?l({type:c.VERT_LINE_TO,relative:this.curCommandRelative,y:o}):this.curCommandType===c.MOVE_TO||this.curCommandType===c.LINE_TO||this.curCommandType===c.SMOOTH_QUAD_TO?(l({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),c.MOVE_TO===this.curCommandType&&(this.curCommandType=c.LINE_TO)):this.curCommandType===c.CURVE_TO?l({type:c.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===c.SMOOTH_CURVE_TO?l({type:c.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===c.QUAD_TO?l({type:c.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===c.ARC&&l({type:c.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!ar(r))if(r===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(r!=="+"&&r!=="-"&&r!==".")if(n)this.curNumber=r,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+f+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+r+'" at index '+f+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,r!=="z"&&r!=="Z")if(r==="h"||r==="H")this.curCommandType=c.HORIZ_LINE_TO,this.curCommandRelative=r==="h";else if(r==="v"||r==="V")this.curCommandType=c.VERT_LINE_TO,this.curCommandRelative=r==="v";else if(r==="m"||r==="M")this.curCommandType=c.MOVE_TO,this.curCommandRelative=r==="m";else if(r==="l"||r==="L")this.curCommandType=c.LINE_TO,this.curCommandRelative=r==="l";else if(r==="c"||r==="C")this.curCommandType=c.CURVE_TO,this.curCommandRelative=r==="c";else if(r==="s"||r==="S")this.curCommandType=c.SMOOTH_CURVE_TO,this.curCommandRelative=r==="s";else if(r==="q"||r==="Q")this.curCommandType=c.QUAD_TO,this.curCommandRelative=r==="q";else if(r==="t"||r==="T")this.curCommandType=c.SMOOTH_QUAD_TO,this.curCommandRelative=r==="t";else{if(r!=="a"&&r!=="A")throw new SyntaxError('Unexpected character "'+r+'" at index '+f+".");this.curCommandType=c.ARC,this.curCommandRelative=r==="a"}else i.push({type:c.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=r,this.curNumberHasDecimal=r==="."}else this.curNumber+=r,this.curNumberHasDecimal=!0;else this.curNumber+=r;else this.curNumber+=r,this.curNumberHasExp=!0;else this.curNumber+=r,this.curNumberHasExpDigits=this.curNumberHasExp}return i},e.prototype.transform=function(h){return Object.create(this,{parse:{value:function(i,p){p===void 0&&(p=[]);for(var l=0,f=Object.getPrototypeOf(this).parse.call(this,i);l<f.length;l++){var r=f[l],s=h(r);Array.isArray(s)?p.push.apply(p,s):p.push(s)}return p}}})},e}(nr),c=function(t){function e(h){var i=t.call(this)||this;return i.commands=typeof h=="string"?e.parse(h):h,i}return er(e,t),e.prototype.encode=function(){return e.encode(this.commands)},e.prototype.getBounds=function(){var h=d.CALCULATE_BOUNDS();return this.transform(h),h},e.prototype.transform=function(h){for(var i=[],p=0,l=this.commands;p<l.length;p++){var f=h(l[p]);Array.isArray(f)?i.push.apply(i,f):i.push(f)}return this.commands=i,this},e.encode=function(h){return sr(h)},e.parse=function(h){var i=new ur,p=[];return i.parse(h,p),i.finish(p),p},e.CLOSE_PATH=1,e.MOVE_TO=2,e.HORIZ_LINE_TO=4,e.VERT_LINE_TO=8,e.LINE_TO=16,e.CURVE_TO=32,e.SMOOTH_CURVE_TO=64,e.QUAD_TO=128,e.SMOOTH_QUAD_TO=256,e.ARC=512,e.LINE_COMMANDS=e.LINE_TO|e.HORIZ_LINE_TO|e.VERT_LINE_TO,e.DRAWING_COMMANDS=e.HORIZ_LINE_TO|e.VERT_LINE_TO|e.LINE_TO|e.CURVE_TO|e.SMOOTH_CURVE_TO|e.QUAD_TO|e.SMOOTH_QUAD_TO|e.ARC,e}(nr),cr=((L={})[c.MOVE_TO]=2,L[c.LINE_TO]=2,L[c.HORIZ_LINE_TO]=1,L[c.VERT_LINE_TO]=1,L[c.CLOSE_PATH]=0,L[c.QUAD_TO]=4,L[c.SMOOTH_QUAD_TO]=2,L[c.CURVE_TO]=6,L[c.SMOOTH_CURVE_TO]=4,L[c.ARC]=7,L);export{c as _};
