/*! * Paper.js v0.12.11-develop - The Swiss Army Knife of Vector Graphics Scripting. * http://paperjs.org/ * * Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey * http://juerglehni.com/ & https://puckey.studio/ * * Distributed under the MIT license. See LICENSE file for details. * * All rights reserved. * * Date: Fri Mar 12 23:11:10 2021 +0100 * *** * * Straps.js - Class inheritance library with support for bean-style accessors * * Copyright (c) 2006 - 2020 Jürg Lehni * http://juerglehni.com/ * * Distributed under the MIT license. * *** * * Acorn.js * https://marijnhaverbeke.nl/acorn/ * * Acorn is a tiny, fast JavaScript parser written in JavaScript, * created by Marijn Haverbeke and released under an MIT license. * */ var paper=function(u,F){var T=(u=u||require("./node/self.js")).window,f=u.document,D=new function(){function n(t,e,n){var i;return t&&((i=d(t,"length"))&&"number"==typeof i.value?s:function(t,e){for(var n in this)this.hasOwnProperty(n)&&t.call(e,this[n],n,this)}).call(t,e,n=n||t),n}var r=/^(statics|enumerable|beans|preserve)$/,t=[],i=t.slice,a=Object.create,d=Object.getOwnPropertyDescriptor,f=Object.defineProperty,s=t.forEach||function(t,e){for(var n=0,i=this.length;nt.length&&(n=t.length);for(var a=0;a>>1;a[t[s]][e]=O[d]-n&&M<=O[f]+n)&&(x&&z&&C.push(s?T:T-o),b&&k&&p[T].push(w))}}x&&(t===e&&C.push(m),p[m]=C),v.length?(y=u(v,c,y[c]),v.splice(y+1,0,m)):v.push(m)}for(g=0;g>1,l=1&i?s[h++]*t(o):0;hm(r/o)&&(h=((u=-r/o)-i)/o)}}g=q.solveQuadratic(e,h,u,t,s,a),_=null==s;return isFinite(o)&&(0===g||0=this.x&&t>=this.y&&e<=this.x+this.width&&t<=this.y+this.height},_containsRectangle:function(t){var e=t.x,n=t.y;return e>=this.x&&n>=this.y&&e+t.width<=this.x+this.width&&n+t.height<=this.y+this.height},intersects:function(){var t=b.read(arguments),e=D.read(arguments)||0;return t.x+t.width>this.x-e&&t.y+t.height>this.y-e&&t.xs[h]&&(s[h]=o)}return(e=e||new b)._set(r[0],r[1],s[0]-r[0],s[1]-r[1],n)},inverseTransform:function(){return this._inverseTransform(L.read(arguments))},_inverseTransform:function(t,e,n){var i=this._a,r=this._b,s=this._c,a=this._d,o=this._tx,h=this._ty,u=i*a-r*s,l=null;return u&&!isNaN(u)&&isFinite(o)&&isFinite(h)&&(h=t.x-this._tx,t=t.y-this._ty,l=(e=e||new L)._set((h*a-t*s)/u,(t*i-h*r)/u,n)),l},decompose:function(){var t,e,n,i,r=this._a,s=this._b,a=this._c,o=this._d,h=r*o-s*a,u=Math.sqrt,l=Math.atan2,c=180/Math.PI;return i=0!==r||0!==s?(t=u(r*r+s*s),e=Math.acos(r/t)*(0o[r]&&(o[r]=e)}var l=a[r]+(s/=2),c=o[r]-s;if(t(t||0)},isCollinear:function(t){return t&&this.isStraight()&&t.isStraight()&&this.getLine().isCollinear(t.getLine())},isHorizontal:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).y)<1e-8},isVertical:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).x)<1e-8}}),{beans:!1,getLocationAt:function(t,e){return this.getLocationAtTime(e?t:this.getTimeAt(t))},getLocationAtTime:function(t){return null!=t&&0<=t&&t<=1?new U(this,t):null},getTimeAt:function(t,e){return Z.getTimeAt(this.getValues(),t,e)},getParameterAt:"#getTimeAt",getTimesWithTangent:function(){var t=L.read(arguments);return t.isZero()?[]:Z.getTimesWithTangent(this.getValues(),t)},getOffsetAtTime:function(t){return this.getPartLength(0,t)},getLocationOf:function(){return this.getLocationAtTime(this.getTimeOf(L.read(arguments)))},getOffsetOf:function(){var t=this.getLocationOf.apply(this,arguments);return t?t.getOffset():null},getTimeOf:function(){return Z.getTimeOf(this.getValues(),L.read(arguments))},getParameterOf:"#getTimeOf",getNearestLocation:function(){var t=L.read(arguments),e=this.getValues(),n=Z.getNearestTime(e,t),e=Z.getPoint(e,n);return new U(this,n,e,null,t.getDistance(e))},getNearestPoint:function(){var t=this.getNearestLocation.apply(this,arguments);return t&&t.getPoint()}},new function(){var t=["getPoint","getTangent","getNormal","getWeightedTangent","getWeightedNormal","getCurvature"];return D.each(t,function(i){this[i+"At"]=function(t,e){var n=this.getValues();return Z[i](n,e?t:Z.getTimeAt(n,t))},this[i+"AtTime"]=function(t){return Z[i](this.getValues(),t)}},{statics:{_evaluateMethods:t}})},new function(){function l(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],t=t[7],h=9*(i-s)+3*(o-e),u=6*(e+s)-12*i,l=3*(i-e),c=9*(r-a)+3*(t-n),d=6*(n+a)-12*r,f=3*(r-n);return function(t){var e=(h*t+u)*t+l,t=(c*t+d)*t+f;return Math.sqrt(e*e+t*t)}}function c(t,e){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(e-t))))}function n(t,e,n,i){if(null==e||e<0||1i?r(e,!1,i):t[0][0]}function r(t,e,n){for(var i=t[0][0],r=t[0][1],s=1,a=t.length;so(e[0],e[2],e[4],e[6])&&o(t[0],t[2],t[4],t[6])-ao(e[1],e[3],e[5],e[7])&&o(t[1],t[3],t[5],t[7])-a>1,v=1&l,p=6*g,m=6*v,p=new L(t[p],t[1+p]),m=new L(e[m],e[1+m]);p.isClose(m,a)&&k(r,s,n,g,i,v)}}}return r}function b(t,e,n,i){t=Z.classify(t);return"loop"===t.type&&k(n,i,e,(t=t.roots)[0],e,t[1]),n}function w(t,e){function n(t){var e=t[6]-t[0],t=t[7]-t[1];return e*e+t*t}var i=Math.abs,r=N.getDistance,s=1e-7,a=Z.isStraight(t),o=Z.isStraight(e),h=a&&o,u=n(t)>1,y=Z.getTimeOf(g[m],new L(g[y][w?6:0],g[y][w?7:1]));if(null!=y&&(w=m?[w,y]:[y,w],(!v.length||1e-8s||i(e[3]-t[3])>s||i(e[4]-t[4])>s||i(e[5]-t[5])>s)&&(v=null)),v}return{getIntersections:function(t){var e=this.getValues(),n=t&&t!==this&&t.getValues();return n?x(e,n,this,t,[]):b(e,this,[])},statics:{getOverlaps:w,getIntersections:function(t,e,n,i,r,s){for(var a=!e,o=t.length,h=(e=a?t:e).length,u=new Array(o),l=a?u:new Array(h),c=[],d=0;d>>1,u=r[h];if(t&&(o=s.equals(u)?u:i(h,-1)||i(h,1)))return s._overlap&&(o._overlap=o._intersection._overlap=!0),o;var l=s.getPath(),c=u.getPath();(l!==c?l._id-c._id:s.getIndex()+s.getTime()-(u.getIndex()+u.getTime()))<0?n=h-1:e=1+h}return r.splice(e,0,s),s}return{statics:{insert:i,expand:function(t){for(var e=t.slice(),n=t.length-1;0<=n;n--)i(e,t[n]._intersection,!1);return e}}}}),m=V.extend({_class:"PathItem",_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function(){},statics:{create:function(t){var e,n,i;return D.isPlainObject(t)?(n=t.segments,e=t.pathData):Array.isArray(t)?n=t:"string"==typeof t&&(e=t),n?i=(i=n[0])&&Array.isArray(i[0]):e&&(i=1<(e.match(/m/gi)||[]).length||/z\s*\S+/i.test(e)),new(i?G:W)(t)}},_asPathItem:function(){return this},isClockwise:function(){return 0<=this.getArea()},setClockwise:function(t){this.isClockwise()!=(t=!!t)&&this.reverse()},setPathData:function(t){var e,n,i=t&&t.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),r=!1,s=new L,a=new L;function o(t,e){t=+c[t];return r&&(t+=s[e]),t}function h(t){return new L(o(t,"x"),o(t+1,"y"))}this.clear();for(var u=0,l=i&&i.length;u=s?0:a]||i[a].getValues(),o=0),!h)return _[0]===a&&_[1]===o;continue}}break}return!1},_hitTestSelf:function(n,r,t,i){var s,a,o,h,e,u,l=this,c=this.getStyle(),d=this._segments,f=d.length,_=this._closed,g=r._tolerancePadding,v=g,p=r.stroke&&c.hasStroke(),m=r.fill&&c.hasFill(),y=r.curves,w=p?c.getStrokeWidth()/2:m&&0=A(e,n,i,r))for(var s,e=t[_+0],n=t[_+2],i=t[_+4],r=t[_+6],a=y>L(e,n,i,r)||wL(e,n))){var i=t[_+0],r=t[_+2],s=t[_+4],a=t[_+6];if(e!==n){var o=p===e?0:p!==n&&!(y>L(i,r,s,a)||wO[g+6]?1:-1,n=O[_+6];return p!==e?(hu.quality&&(u=m);break}c-=g}for(d=s.length-1;0<=d;d--)s[d].segment._winding=u}function j(t,e){var h,n=[];function u(t){return!(!t||t._visited||e&&(!e[(t=t._winding||{}).winding]||e.unite&&2===t.winding&&t.windingL&&t.windingR))}function l(t){if(t)for(var e=0,n=h.length;e=A(h,u,l,c)&&n<=L(h,u,l,c))for(var d=Z.getMonoCurves(o),f=0,_=d.length;f<_;f++){var g=d[f],v=g[1],p=g[7];v!==p&&(v<=n&&n<=p||p<=n&&n<=v)&&(g=n===v?g[0]:n===p?g[6]:1===Z.solveCubic(g,1,n,r,0,1)?Z.getPoint(g,r[0]).x:(g[0]+g[6])/2,i.push(g))}}1=t){var a=n[(this.index=e)-1],o=a&&a.index===s.index?a.time:0,a=a?a.offset:0;return{index:s.index,time:o+(s.time-o)*(t-a)/(s.offset-a)}}}return{index:n[i-1].index,time:1}},drawPart:function(t,e,n){for(var i=this._get(e),r=this._get(n),s=i.index,a=r.index;s<=a;s++){var o=Z.getPart(this.curves[s],s===i.index?i.time:0,s===r.index?r.time:1);s===i.index&&t.moveTo(o[0],o[1]),t.bezierCurveTo.apply(t,o.slice(2))}}},D.each(Z._evaluateMethods,function(e){this[e+"At"]=function(t){t=this._get(t);return Z[e](this.curves[t.index],t.time)}},{})),h=D.extend({initialize:function(t){for(var e,n=this.points=[],i=t._segments,t=t._closed,r=0,s=i.length;r=u)break;l=this.reparameterize(n,i,h,d),u=f.error}var _=a[o-1].subtract(a[o+1]);this.fitCubic(t,e,n,o,r,_),this.fitCubic(t,e,o,i,_.negate(),s)}else{var g=a[n],_=a[i],a=g.getDistance(_)/3;this.addCurve(t,[g,g.add(r.normalize(a)),_.add(s.normalize(a)),_])}},addCurve:function(t,e){t[t.length-1].setHandleOut(e[1].subtract(e[0])),t.push(new H(e[3],e[2].subtract(e[3])))},generateBezier:function(t,e,n,i,r){for(var s=Math.abs,a=this.points,o=a[t],h=a[e],u=[[0,0],[0,0]],l=[0,0],c=0,d=e-t+1;cs*s&&(y=w=s/3,x=b=null)),[o,o.add(x||i.normalize(y)),h.add(b||r.normalize(w)),h]},reparameterize:function(t,e,n,i){for(var r=t;r<=e;r++)n[r-t]=this.findRoot(i,this.points[r],n[r-t]);for(var r=1,s=n.length;ru&&(i=D.slice(i,0,u))}else if("string"===o){u=function(t){var e=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),n="rgb";if(e)for(var i=e[4]?4:3,r=new Array(i),s=0;se&&(i=a.add(r.normalize(e-.1))),t.createRadialGradient((i=i||a).x,i.y,0,a.x,a.y,e)):t.createLinearGradient(a.x,a.y,o.x,o.y);for(var h=0,u=s.length;hthis._maxDistance&&(this._maxDistance=t)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(t){this._maxDistance=t,null!=this._minDistance&&null!=t&&tr[n]?(r[e]=(r[e]-r[n])*i/(r[s]-r[n]),r[s]=i):r[e]=r[s]=0,r[n]=0,b=r[0],C=r[1],S=r[2]}var P={multiply:function(){b=m*_/255,C=y*g/255,S=w*v/255},screen:function(){b=m+_-m*_/255,C=y+g-y*g/255,S=w+v-w*v/255},overlay:function(){b=m<128?2*m*_/255:255-2*(255-m)*(255-_)/255,C=y<128?2*y*g/255:255-2*(255-y)*(255-g)/255,S=w<128?2*w*v/255:255-2*(255-w)*(255-v)/255},"soft-light":function(){var t=_*m/255;b=t+m*(255-(255-m)*(255-_)/255-t)/255,C=(t=g*y/255)+y*(255-(255-y)*(255-g)/255-t)/255,S=(t=v*w/255)+w*(255-(255-w)*(255-v)/255-t)/255},"hard-light":function(){b=_<128?2*_*m/255:255-2*(255-_)*(255-m)/255,C=g<128?2*g*y/255:255-2*(255-g)*(255-y)/255,S=v<128?2*v*w/255:255-2*(255-v)*(255-w)/255},"color-dodge":function(){b=0===m?0:255===_?255:a(255,255*m/(255-_)),C=0===y?0:255===g?255:a(255,255*y/(255-g)),S=0===w?0:255===v?255:a(255,255*w/(255-v))},"color-burn":function(){b=255===m?255:0===_?0:o(0,255-255*(255-m)/_),C=255===y?255:0===g?0:o(0,255-255*(255-y)/g),S=255===w?255:0===v?0:o(0,255-255*(255-w)/v)},darken:function(){b=m<_?m:_,C=y