vari=n[t];if(i){for(varrini){vars=i[r];for(varainn){varo=n[a];o&&o!=i&&deleteo[s._id]}s.remove()}n[t]=null}}returnthis.responds(t)&&this.emit(t,newX(this,t,e))},_handleEvent:function(t,e,n){paper=this._scope;vari=!1;switch(t){case"mousedown":this._updateEvent(t,e,null,null,!0,!1,!1),i=this._fireEvent(t,n);break;case"mousedrag":for(varr=!1,s=!1;this._updateEvent(t,e,this.minDistance,this.maxDistance,!1,r,s);)i=this._fireEvent(t,n)||i,r=!0,s=!0;break;case"mouseup":!e.equals(this._point)&&this._updateEvent("mousedrag",e,this.minDistance,this.maxDistance,!1,!1,!1)&&(i=this._fireEvent("mousedrag",n)),this._updateEvent(t,e,null,this.maxDistance,!1,!1,!1),i=this._fireEvent(t,n)||i,this._updateEvent(t,e,null,null,!0,!1,!1),this._firstMove=!0;break;case"mousemove":for(;this._updateEvent(t,e,this.minDistance,this.maxDistance,this._firstMove,!0,!1);)i=this._fireEvent(t,n)||i,this._firstMove=!1}returni&&n.preventDefault(),i}}),Y={request:function(t,e,n){vari=new(window.ActiveXObject||XMLHttpRequest)("Microsoft.XMLHTTP");returni.open(t.toUpperCase(),e,!0),"overrideMimeType"ini&&i.overrideMimeType("text/plain"),i.onreadystatechange=function(){if(4===i.readyState){vart=i.status;if(0!==t&&200!==t)throwError("Could not load "+e+" (Error "+t+")");n.call(i,i.responseText)}},i.send(null)}},K={canvases:[],getCanvas:function(t,e){varn,i=!0;"object"==typeoft&&(e=t.height,t=t.width),n=this.canvases.length?this.canvases.pop():document.createElement("canvas");varr=n.getContext("2d");returnn.width===t&&n.height===e?i&&r.clearRect(0,0,t+1,e+1):(n.width=t,n.height=e),r.save(),n},getContext:function(t,e){returnthis.getCanvas(t,e).getContext("2d")},release:function(t){vare=t.canvas?t.canvas:t;e.getContext("2d").restore(),this.canvases.push(e)}},Q=newfunction(){functiont(t,e,n){return.2989*t+.587*e+.114*n}functionn(e,n,i,r){vars=r-t(e,n,i);f=e+s,_=n+s,g=i+s;varr=t(f,_,g),a=p(f,_,g),o=v(f,_,g);if(0>a){varh=r-a;f=r+(f-r)*r/h,_=r+(_-r)*r/h,g=r+(g-r)*r/h}if(o>255){varu=255-r,l=o-r;f=r+(f-r)*u/l,_=r+(_-r)*u/l,g=r+(g-r)*u/l}}functioni(t,e,n){returnv(t,e,n)-p(t,e,n)}functionr(t,e,n,i){varr,s=[t,e,n],a=v(t,e,n),o=p(t,e,n);o=o===t?0:o===e?1:2,a=a===t?0:a===e?1:2,r=0===p(o,a)?1===v(o,a)?2:1:0,s[a]>s[o]?(s[r]=(s[r]-s[o])*i/(s[a]-s[o]),s[a]=i):s[r]=s[a]=0,s[o]=0,f=s[0],_=s[1],g=s[2]}vars,a,o,h,u,l,c,d,f,_,g,p=Math.min,v=Math.max,m=Math.abs,y={multiply:function(){f=u*s/255,_=l*a/255,g=c*o/255},screen:function(){f=u+s-u*s/255,_=l+a-l*a/255,g=c+o-c*o/255},overlay:function(){f=128>u?2*u*s/255:255-2*(255-u)*(255-s)/255,_=128>l?2*l*a/255:255-2*(255-l)*(255-a)/255,g=128>c?2*c*o/255:255-2*(255-c)*(255-o)/255},"soft-light":function(){vart=s*u/255;f=t+u*(255-(255-u)*(255-s)/255-t)/255,t=a*l/255,_=t+l*(255-(255-l)*(255-a)/255-t)/255,t=o*c/255,g=t+c*(255-(255-c)*(255-o)/255-t)/255},"hard-light":function(){f=128>s?2*s*u/255:255-2*(255-s)*(255-u)/255,_=128>a?2*a*l/255:255-2*(255-a)*(255-l)/255,g=128>o?2*o*c/255:255-2*(255-o)*(255-c)/255},"color-dodge":function(){f=0===u?0:255===s?255:p(255,255*u/(255-s)),_=0===l?0:255===a?255:p(255,255*l/(255-a)),g=0===c?0:255===o?255:p(255,255*c/(255-o))},"color-burn":function(){f=255===u?255:0===s?0:v(0,255-255*(255-u)/s),_=255===l?255:0===a?0:v(0,255-255*(255-l)/a),g=255===c?255:0===o?0:v(0,255-255*(255-c)/o)},darken:function(){f=s>u?u:s,_=a>l?l:a,g=o>c?c:o},lighten:function(){f=u>s?u:s,_=l>a?l:a,g=c>o?c:o},difference:function(){f=u-s,0>f&&(f=-f),_=l-a,0>_&&(_=-_),g=c-o,0>g&&(g=-g)},exclusion:function(){f=u+s*(255-u-u)/255,_=l+a*(255-l-l)/255,g=c+o*(255-c-c)/255},hue:function(){r(s,a,o,i(u,l,c)),n(f,_,g,t(u,l,c))},saturation:function(){r(u,l,c,i(s,a,o)),n(f,_,g,t(u,l,c))},luminosity:function(){n(u,l,c,t(s,a,o))},color:function(){n(s,a,o,t(u,l,c))},add:function(){f=p(u+s,255),_=p(l+a,255),g=p(c+o,255)},subtract:function(){f=v(u-s,0),_=v(l-a,0),g=v(c-o,0)},average:function(){f=(u+s)/2,_=(l+a)/2,g=(c+o)/2},negation:function(){f=255-m(255-s-u),_=255-m(255-a-l),g=255-m(255-o-c)}},w=this.nativeModes=e.each(["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-
}returnt}functionJ(t,e){varn=Y(e);if(!t&&be===mn){vari=E(n);for(i.expressions=[n];B(mn);)i.expressions.push(Y(e));returnN(i,"SequenceExpression")}returnn}functionY(t){vare=K(t);if(be.isAssign){varn=E(e);returnn.operator=Ce,n.left=e,z(),n.right=Y(t),V(e),N(n,"AssignmentExpression")}returne}functionK(t){vare=Q(t);if(B(bn)){varn=E(e);returnn.test=e,n.consequent=J(!0),F(wn),n.alternate=J(!0,t),N(n,"ConditionalExpression")}returne}functionQ(t){returnte(ee(),-1,t)}functionte(t,e,n){vari=be.binop;if(null!=i&&(!n||be!==ln)&&i>e){varr=E(t);r.left=t,r.operator=Ce,z(),r.right=te(ee(),i,n);vars=N(r,/&&|\|\|/.test(r.operator)?"LogicalExpression":"BinaryExpression");returnte(s,e,n)}returnt}functionee(){if(be.prefix){vart=L(),e=be.isUpdate;returnt.operator=Ce,t.prefix=!0,Se=!0,z(),t.argument=ee(),e?V(t.argument):Te&&"delete"===t.operator&&"Identifier"===t.argument.type&&n(t.start,"Deleting local variable in strict mode"),N(t,e?"UpdateExpression":"UnaryExpression")}for(vari=ne();be.postfix&&!D();){vart=E(i);t.operator=Ce,t.prefix=!1,t.argument=i,V(i),z(),i=N(t,"UpdateExpression")}returni}functionne(){returnie(re())}functionie(t,e){if(B(xn)){varn=E(t);returnn.object=t,n.property=le(!0),n.computed=!1,ie(N(n,"MemberExpression"),e)}if(B(dn)){varn=E(t);returnn.object=t,n.property=J(),n.computed=!0,F(fn),ie(N(n,"MemberExpression"),e)}if(!e&&B(pn)){varn=E(t);returnn.callee=t,n.arguments=ue(vn,!1),ie(N(n,"CallExpression"),e)}returnt}functionre(){switch(be){casean:vart=L();returnz(),N(t,"ThisExpression");caseBe:returnle();caseEe:caseje:caseNe:vart=L();returnt.value=Ce,t.raw=de.slice(me,ye),z(),N(t,"Literal");caseon:casehn:caseun:vart=L();returnt.value=be.atomValue,t.raw=be.keyword,z(),N(t,"Literal");casepn:vare=we,n=me;z();vari=J();returni.start=n,i.end=ye,ce.locations&&(i.loc.start=e,i.loc.end=xe),ce.ranges&&(i.range=[n,ye]),F(vn),i;casedn:vart=L();returnz(),t.elements=ue(fn,!0,!0),N(t,"ArrayExpression");case_n:returnae();caseXe:vart=L();returnz(),he(t,!1);casesn:returnse();default:q()}}functionse(){vart=L();returnz(),t.callee=ie(re(),!0),t.arguments=B(pn)?ue(vn,!1):Le,N(t,"NewExpression")}functionae(){vart=L(),e=!0,i=!1;for(t.properties=[],z();!B(gn);){if(e)e=!1;elseif(F(mn),ce.allowTrailingCommas&&B(gn))break;varr,s={key:oe()},a=!1;if(B(wn)?(s.value=J(!0),r=s.kind="init"):ce.ecmaVersion>=5&&"Identifier"===s.key.type&&("get"===s.key.name||"set"===s.key.name)?(a=i=!0,r=s.kind=s.key.name,s.key=oe(),be!==pn&&q(),s.value=he(L(),!1)):q(),"Identifier"===s.key.type&&(Te||i))for(varo=0;o<t.properties.length;++o){varh=t.properties[o];if(h.key.name===s.key.name){varu=r==h.kind||a&&"init"===h.kind||"init"===r&&("get"===h.kind||"set"===h.kind);u&&!Te&&"init"===r&&"init"===h.kind&&(u=!1),u&&n(s.key.start,"Redefinition of property")}}t.properties.push(s)}returnN(t,"ObjectExpression")}functionoe(){returnbe===Ee||be===je?re():le(!0)}functionhe(t,e){be===Be?t.id=le():e?q():t.id=null,t.params=[];vari=!0;for(F(pn);!B(vn);)i?i=!1:F(mn),t.params.push(le());varr=Ae,s=Oe;if(Ae=!0,Oe=[],t.body=W(!0),Ae=r,Oe=s,Te||t.body.body.length&&j(t.body.body[0]))for(vara=t.id?-1:0;a<t.params.length;++a){varo=0>a?t.id:t.params[a];if((Vn(o.name)||Zn(o.name))&&n(o.start,"Defining '"+o.name+"' in strict mode"),a>=0)for(varh=0;a>h;++h)o.name===t.params[h].name&&n(o.start,"Argument name clash in strict mode")}returnN(t,e?"FunctionDeclaration":"FunctionExpression")}functionue(t,e,n){for(vari=[],r=!0;!B(t);){if(r)r=!1;elseif(F(mn),e&&ce.allowTrailingCommas&&B(t))break;n&&be===mn?i.push(null):i.push(J(!0))}returni}functionle(t){vare=L();returne.name=be===Be?Ce:t&&!ce.forbidReserved&&be.keyword||q(),Se=!1,z(),N(e,"Identifier")}t.version="0.4.0";varce,de,fe,_e;t.parse=function(t,n){returnde=t+"",fe=de.length,e(n),s(),Z(ce.program)};varge=t.defaultOptions={ecmaVersion:5,strictSemicolons:!1,allowTrailingCommas:!0,forbidReserved:!1,locations:!1,onComment:null,ranges:!1,program:null,sourceFile:null},pe=t.getLineInfo=function(t,e){for(varn=1,i=0;;){Yn.lastIndex=i;varr=Yn.exec(t);if(!(r&&r.inde