if(i=B.intersect(E,!0),!i){if(!j)returnthis.lineTo(_);thrownewError("Cannot create an arc with the given arguments")}s=f.subtract(i),n=s.getDirectedAngle(_.subtract(i));varF=D.getSide(i);0===F?n=j*o(n):j===F&&(n+=n<0?360:-360)}for(varR=1e-7,q=o(n),V=q>=360?4:Math.ceil((q-R)/90),H=n/V,Z=H*Math.PI/360,U=4/3*Math.sin(Z)/(1+Math.cos(Z)),W=[],G=0;G<=V;G++){varC=_,J=null;if(G<V&&(J=s.rotate(90).multiply(U),a?(C=a._transformPoint(s),J=a._transformPoint(s.add(J)).subtract(C)):C=i.add(s)),G){var$=s.rotate(-90).multiply(U);a&&($=a._transformPoint(s.add($)).subtract(C)),W.push(newT(C,$,J))}elsel.setHandleOut(J);s=s.rotate(H)}this._add(W)},lineBy:function(){vare=c.read(arguments),i=t(this)._point;this.lineTo(i.add(e))},curveBy:function(){vare=c.read(arguments),i=c.read(arguments),n=r.read(arguments),s=t(this)._point;this.curveTo(s.add(e),s.add(i),n)},cubicCurveBy:function(){vare=c.read(arguments),i=c.read(arguments),n=c.read(arguments),r=t(this)._point;this.cubicCurveTo(r.add(e),r.add(i),r.add(n))},quadraticCurveBy:function(){vare=c.read(arguments),i=c.read(arguments),n=t(this)._point;this.quadraticCurveTo(n.add(e),n.add(i))},arcBy:function(){vare=t(this)._point,i=e.add(c.read(arguments)),n=r.pick(r.peek(arguments),!0);"boolean"==typeofn?this.arcTo(i,n):this.arcTo(i,e.add(c.read(arguments)))},closePath:function(t){this.setClosed(!0),this.join(this,t)}}},{_getBounds:function(t,e){vari=e.handle?"getHandleBounds":e.stroke?"getStrokeBounds":"getBounds";returnL[i](this._segments,this._closed,this,t,e)},statics:{getBounds:function(t,e,i,n,r,s){functiona(t){t._transformCoordinates(n,h);for(vare=0;e<2;e++)k._addBounds(u[e],u[e+4],h[e+2],h[e],e,s?s[e]:0,l,c,f);vari=u;u=h,h=i}varo=t[0];if(!o)returnnewg;for(varh=newArray(6),u=o._transformCoordinates(n,newArray(6)),l=u.slice(0,2),c=l.slice(),f=newArray(2),d=1,_=t.length;d<_;d++)a(t[d]);returne&&a(o),newg(l[0],l[1],c[0]-l[0],c[1]-l[1])},getStrokeBounds:function(t,e,i,n,r){functions(t){v=v.include(t)}functiona(t){v=v.unite(x.setCenter(t._point.transform(n)))}functiono(t,e){"round"===e||t.isSmooth()?a(t):L._addBevelJoin(t,e,p,w,n,f,s)}functionh(t,e){"round"===e?a(t):L._addSquareCap(t,e,p,n,f,s)}varu=i.getStyle(),l=u.hasStroke(),c=u.getStrokeWidth(),f=l&&i._getStrokeMatrix(n,r),_=l&&L._getStrokePadding(c,f),v=L.getBounds(t,e,i,n,r,_);if(!l)returnv;for(varp=c/2,m=u.getStrokeJoin(),y=u.getStrokeCap(),w=u.getMiterLimit(),x=newg(newd(_)),b=t.length-(e?0:1),S=1;S<b;S++)o(t[S],m);returne?o(t[0],m):b>0&&(h(t[0],y),h(t[t.length-1],y)),v},_getStrokePadding:function(t,e){if(!e)return[t,t];vari=newc(t,0).transform(e),n=newc(0,t).transform(e),r=i.getAngleInRadians(),s=i.getLength(),a=n.getLength(),o=Math.sin(r),h=Math.cos(r),u=Math.tan(r),l=Math.atan2(a*u,s),f=Math.atan2(a,u*s);return[Math.abs(s*Math.cos(l)*h+a*Math.sin(l)*o),Math.abs(a*Math.sin(f)*h+s*Math.cos(f)*o)]},_addBevelJoin:function(t,e,i,n,r,s,a,o){varh=t.getCurve(),u=h.getPrevious(),l=h.getPoint1().transform(r),f=u.getNormalAtTime(1).multiply(i).transform(s),d=h.getNormalAtTime(0).multiply(i).transform(s);if(f.getDirectedAngle(d)<0&&(f=f.negate(),d=d.negate()),o&&a(l),a(l.add(f)),"miter"===e){var_=newm(l.add(f),newc((-f.y),f.x),(!0)).intersect(newm(l.add(d),newc((-d.y),d.x),(!0)),!0);_&&l.getDistance(_)<=n*i&&a(_)}a(l.add(d))},_addSquareCap:function(t,e,i,n,r,s,a){varo=t._point.transform(n),h=t.getLocation(),u=h.getNormal().multiply(0===h.getTime()?i:-i).transform(r);"square"===e&&(a&&(s(o.subtract(u)),s(o.add(u))),o=o.add(u.rotate(-90))),s(o.add(u)),s(o.subtract(u))},getHandleBounds:function(t,e,i,n,r){vars,a,o=i.getStyle(),h=r.stroke&&o.hasStroke();if(h){varu=i._getStrokeMatrix(n,r),l=o.getStrokeWidth()/2,c=l;"miter"===o.getStrokeJoin()&&(c=l*o.getMiterLimit()),"square"===o.getStrokeCap()&&(c=Math.max(c,l*Math.SQRT2)),s=L._getStrokePadding(l,u),a=L._getStrokePadding(c,u)}for(varf=newArray(6),d=1/0,_=-d,v=d,p=_,m=0,y=t.length;m<y;m++){varw=t[m];w._transformCoordinates(n,f);for(varx=0;x<6;x+=2){varb=x?s:a,S=b?b[0]:0,C=b?b[1]:0,P=f[x],I=f[x+1],M=P-S,T=P+S,z=I-C,k=I+C;M<d&&(d=M),T>_&&(_=T),z<v&&
returnr.serialize([this._stops,this._radial],t,!0,e)})},_changed:function(){for(vart=0,e=this._owners&&this._owners.length;t<e;t++)this._owners[t]._changed()},_addOwner:function(t){this._owners||(this._owners=[]),this._owners.push(t)},_removeOwner:function(t){vari=this._owners?this._owners.indexOf(t):-1;i!=-1&&(this._owners.splice(i,1),this._owners.length||(this._owners=e))},clone:function(){for(vart=[],e=0,i=this._stops.length;e<i;e++)t[e]=this._stops[e].clone();returnnewR(t,this._radial)},getStops:function(){returnthis._stops},setStops:function(t){if(t.length<2)thrownewError("Gradient stop list needs to contain at least two stops.");vari=this._stops;if(i)for(varn=0,r=i.length;n<r;n++)i[n]._owner=e;i=this._stops=q.readList(t,0,{clone:!0});for(varn=0,r=i.length;n<r;n++)i[n]._owner=this;this._changed()},getRadial:function(){returnthis._radial},setRadial:function(t){this._radial=t,this._changed()},equals:function(t){if(t===this)return!0;if(t&&this._class===t._class){vare=this._stops,i=t._stops,n=e.length;if(n===i.length){for(varr=0;r<n;r++)if(!e[r].equals(i[r]))return!1;return!0}}return!1}}),q=r.extend({_class:"GradientStop",initialize:function(t,i){varn=t,r=i;"object"==typeoft&&i===e&&(Array.isArray(t)&&"number"!=typeoft[0]?(n=t[0],r=t[1]):("color"int||"offset"int||"rampPoint"int)&&(n=t.color,r=t.offset||t.rampPoint||0)),this.setColor(n),this.setOffset(r)},clone:function(){returnnewq(this._color.clone(),this._offset)},_serialize:function(t,e){vari=this._color,n=this._offset;returnr.serialize(null==n?[i]:[i,n],t,!0,e)},_changed:function(){this._owner&&this._owner._changed(65)},getOffset:function(){returnthis._offset},setOffset:function(t){this._offset=t,this._changed()},getRampPoint:"#getOffset",setRampPoint:"#setOffset",getColor:function(){returnthis._color},setColor:function(){vart=F.read(arguments,0,{clone:!0});t&&(t._owner=this),this._color=t,this._changed()},equals:function(t){returnt===this||t&&this._class===t._class&&this._color.equals(t._color)&&this._offset==t._offset||!1}}),V=r.extend(newfunction(){vart={fillColor:null,fillRule:"nonzero",strokeColor:null,strokeWidth:1,strokeCap:"butt",strokeJoin:"miter",strokeScaling:!0,miterLimit:10,dashOffset:0,dashArray:[],shadowColor:null,shadowBlur:0,shadowOffset:newc,selectedColor:null},i=r.set({},t,{fontFamily:"sans-serif",fontWeight:"normal",fontSize:12,leading:null,justification:"left"}),n=r.set({},i,{fillColor:newF}),s={strokeWidth:97,strokeCap:97,strokeJoin:97,strokeScaling:105,miterLimit:97,fontFamily:9,fontWeight:9,fontSize:9,font:9,leading:9,justification:9},a={beans:!0},o={_class:"Style",beans:!0,initialize:function(e,r,s){this._values={},this._owner=r,this._project=r&&r._project||s||paper.project,this._defaults=!r||rinstanceofx?i:rinstanceofD?n:t,e&&this.set(e)}};returnr.each(i,function(t,i){varn=/Color$/.test(i),h="shadowOffset"===i,u=r.capitalize(i),l=s[i],f="set"+u,d="get"+u;o[f]=function(t){varr=this._owner,s=r&&r._children;if(s&&s.length>0&&!(rinstanceofN))for(vara=0,o=s.length;a<o;a++)s[a]._style[f](t);elseif(iinthis._defaults){varh=this._values[i];h!==t&&(n&&(h&&h._owner!==e&&(h._owner=e,h._canvasStyle=null),t&&t.constructor===F&&(t._owner&&(t=t.clone()),t._owner=r)),this._values[i]=t,r&&r._changed(l||65))}},o[d]=function(t){vars,a=this._owner,o=a&&a._children;if(iinthis._defaults&&(!o||!o.length||t||ainstanceofN)){vars=this._values[i];if(s===e)s=this._defaults[i],s&&s.clone&&(s=s.clone());else{varu=n?F:h?c:null;!u||s&&s.constructor===u||(this._values[i]=s=u.read([s],0,{readNull:!0,clone:!0}),s&&n&&(s._owner=a))}}elseif(o)for(varl=0,f=o.length;l<f;l++){var_=o[l]._style[d]();if(l){if(!r.equals(s,_))returne}elses=_}returns},a[d]=function(t){returnthis._style[d](t)},a[f]=function(t){this._style[f](t)}}),r.each({Font:"FontFamily",WindingRule:"FillRule"},function(t,e){vari="get"+e,n="set"+e;o[i]=a[i]="#get"+t,o[n]=a[n]="#set"+t}),w.inject(a),o},{set:function(t){vare=tinstanceofV,i=e?t._values:t;if(i)for(varnini)if(ninthis._defaults){varr=i[n];this[n]=r&&e&&r.clone?r.clone():r}},equals:functi