diff --git a/lib/index.min.js b/lib/index.min.js index 6a80609b..1771b8a4 100644 --- a/lib/index.min.js +++ b/lib/index.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-hooks-svgdrawing"]=e(require("react")):t["react-hooks-svgdrawing"]=e(t.react)}(window,(function(t){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=5)}([function(e,i){e.exports=t},function(t,e,i){"use strict";(function(t,r){var n,s,a;window.Two=function(e){var n="undefined"!=typeof window?window:void 0!==t?t:null,s=Object.prototype.toString,a={_indexAmount:0,natural:{slice:Array.prototype.slice,indexOf:Array.prototype.indexOf,keys:Object.keys,bind:Function.prototype.bind,create:Object.create},identity:function(t){return t},isArguments:function(t){return"[object Arguments]"===s.call(t)},isFunction:function(t){return"[object Function]"===s.call(t)},isString:function(t){return"[object String]"===s.call(t)},isNumber:function(t){return"[object Number]"===s.call(t)},isDate:function(t){return"[object Date]"===s.call(t)},isRegExp:function(t){return"[object RegExp]"===s.call(t)},isError:function(t){return"[object Error]"===s.call(t)},isFinite:function(t){return isFinite(t)&&!isNaN(parseFloat(t))},isNaN:function(t){return a.isNumber(t)&&t!==+t},isBoolean:function(t){return!0===t||!1===t||"[object Boolean]"===s.call(t)},isNull:function(t){return null===t},isUndefined:function(t){return void 0===t},isEmpty:function(t){return null==t||(x&&(a.isArray(t)||a.isString(t)||a.isArguments(t))?0===t.length:0===a.keys(t).length)},isElement:function(t){return!(!t||1!==t.nodeType)},isArray:Array.isArray||function(t){return"[object Array]"===s.call(t)},isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},toArray:function(t){return t?a.isArray(t)?m.call(t):x(t)?a.map(t,a.identity):a.values(t):[]},range:function(t,e,i){null==e&&(e=t||0,t=0),i=i||1;for(var r=Math.max(Math.ceil((e-t)/i),0),n=Array(r),s=0;s=0&&i<=y},b={temp:n.document?n.document.createElement("div"):{},hasEventListeners:a.isFunction(n.addEventListener),bind:function(t,e,i,r){return this.hasEventListeners?t.addEventListener(e,i,!!r):t.attachEvent("on"+e,i),b},unbind:function(t,e,i,r){return b.hasEventListeners?t.removeEventListeners(e,i,!!r):t.detachEvent("on"+e,i),b},getRequestAnimationFrame:function(){var t,e=0,i=["ms","moz","webkit","o"],r=n.requestAnimationFrame;if(!r){for(var s=0;s0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null;if(a.isNull(u))break;var _=w.Utils.decomposeMatrix(u);e.translation.set(_.translateX,_.translateY),e.rotation=_.rotation,e.scale=new w.Vector(_.scaleX,_.scaleY);var g=parseFloat((h.x+"").replace("px")),p=parseFloat((h.y+"").replace("px"));g&&(e.translation.x=g),p&&(e.translation.y=p);break;case"viewBox":w.Utils.applySvgViewBox.call(this,e,o);break;case"visible":e.visible=o;break;case"stroke-linecap":e.cap=o;break;case"stroke-linejoin":e.join=o;break;case"stroke-miterlimit":e.miter=o;break;case"stroke-width":e.linewidth=parseFloat(o);break;case"opacity":case"stroke-opacity":case"fill-opacity":e instanceof w.Group||(e.opacity=parseFloat(o));break;case"fill":case"stroke":/url\(\#.*\)/i.test(o)?e[s]=this.getById(o.replace(/url\(\#(.*)\)/i,"$1")):e[s]=/none/i.test(o)?"transparent":o;break;case"id":e.id=o;break;case"class":case"className":e.classList=o.split(" ")}return h},read:{svg:function(t){var e=w.Utils.read.g.call(this,t);t.getAttribute("viewBox");return e},g:function(t){var e,i=new w.Group;e=w.Utils.getSvgStyles.call(this,t);for(var r=0,n=t.childNodes.length;r1&&(d=1);break;case"m":case"l":case"t":_.length>2&&(d=2);break;case"s":case"q":_.length>4&&(d=4);break;case"c":_.length>6&&(d=6);break;case"a":_.length>7&&(d=7)}if(d){for(a=0,l=_.length,c=0;a0)switch(f){case"m":o="l";break;case"M":o="L"}g.push(o+_.slice(a,a+d).join(" ")),c++}h=Array.prototype.concat.apply(h,g)}else h.push(t)}));var d=[];if(a.each(h,(function(t,e){var n,h,f,_,g,p,m,v,y,x,b,k,S=t[0],E=S.toLowerCase();switch(r=(r=(r=t.slice(1).trim()).replace(/(-?\d+(?:\.\d*)?)[eE]([+\-]?\d+)/g,(function(t,e,i){return parseFloat(e)*u(10,i)}))).split(/[\s,]+|(?=\s?[+\-])/),l=S===E,E){case"z":if(e>=c)o=!0;else{h=s.x,f=s.y,n=new w.Anchor(h,f,void 0,void 0,void 0,void 0,w.Commands.close);for(e=d.length-1;e>=0;e--){var A=d[e];if(/m/i.test(A.command)){s=A;break}}}break;case"m":case"l":i=void 0,h=parseFloat(r[0]),f=parseFloat(r[1]),n=new w.Anchor(h,f,void 0,void 0,void 0,void 0,/m/i.test(E)?w.Commands.move:w.Commands.line),l&&n.addSelf(s),s=n;break;case"h":case"v":var C=/h/i.test(E)?"x":"y",R=/x/i.test(C)?"y":"x";(n=new w.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,w.Commands.line))[C]=parseFloat(r[0]),n[R]=s[R],l&&(n[C]+=s[C]),s=n;break;case"c":case"s":_=s.x,g=s.y,i||(i=new w.Vector),/c/i.test(E)?(p=parseFloat(r[0]),m=parseFloat(r[1]),v=parseFloat(r[2]),y=parseFloat(r[3]),x=parseFloat(r[4]),b=parseFloat(r[5])):(p=(k=M(s,i,l)).x,m=k.y,v=parseFloat(r[0]),y=parseFloat(r[1]),x=parseFloat(r[2]),b=parseFloat(r[3])),l&&(p+=_,m+=g,v+=_,y+=g,x+=_,b+=g),a.isObject(s.controls)||w.Anchor.AppendCurveProperties(s),s.controls.right.set(p-s.x,m-s.y),n=new w.Anchor(x,b,v-x,y-b,void 0,void 0,w.Commands.curve),s=n,i=n.controls.left;break;case"t":case"q":_=s.x,g=s.y,i||(i=new w.Vector),i.isZero()?(p=_,m=g):(p=i.x,m=i.y),/q/i.test(E)?(v=parseFloat(r[0]),y=parseFloat(r[1]),x=parseFloat(r[2]),b=parseFloat(r[3])):(v=(k=M(s,i,l)).x,y=k.y,x=parseFloat(r[0]),b=parseFloat(r[1])),l&&(p+=_,m+=g,v+=_,y+=g,x+=_,b+=g),a.isObject(s.controls)||w.Anchor.AppendCurveProperties(s),s.controls.right.set(p-s.x,m-s.y),n=new w.Anchor(x,b,v-x,y-b,void 0,void 0,w.Commands.curve),s=n,i=n.controls.left;break;case"a":_=s.x,g=s.y;var F=parseFloat(r[0]),O=parseFloat(r[1]),P=parseFloat(r[2]),U=parseFloat(r[3]),T=parseFloat(r[4]);x=parseFloat(r[5]),b=parseFloat(r[6]),l&&(x+=_,b+=g);var L=new w.Anchor(x,b);L.command=w.Commands.arc,L.rx=F,L.ry=O,L.xAxisRotation=P,L.largeArcFlag=U,L.sweepFlag=T,n=L,s=L,i=void 0}n&&(a.isArray(n)?d=d.concat(n):d.push(n))})),!(d.length<=1)){(n=new w.Path(d,o,void 0,!0).noStroke()).fill="black";var f=n.getBoundingClientRect(!0);return f.centroid={x:f.left+f.width/2,y:f.top+f.height/2},a.each(n.vertices,(function(t){t.subSelf(f.centroid)})),n.translation.addSelf(f.centroid),w.Utils.applySvgAttributes.call(this,t,n,e),n}},circle:function(t,e){var i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),n=parseFloat(t.getAttribute("r")),s=new w.Circle(i,r,n).noStroke();return s.fill="black",w.Utils.applySvgAttributes.call(this,t,s,e),s},ellipse:function(t,e){var i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),n=parseFloat(t.getAttribute("rx")),s=parseFloat(t.getAttribute("ry")),a=new w.Ellipse(i,r,n,s).noStroke();return a.fill="black",w.Utils.applySvgAttributes.call(this,t,a,e),a},rect:function(t,e){var i=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!a.isNaN(i)||!a.isNaN(r))return w.Utils.read["rounded-rect"](t);var n=parseFloat(t.getAttribute("x"))||0,s=parseFloat(t.getAttribute("y"))||0,o=parseFloat(t.getAttribute("width")),l=parseFloat(t.getAttribute("height")),h=o/2,c=l/2,d=new w.Rectangle(n+h,s+c,o,l).noStroke();return d.fill="black",w.Utils.applySvgAttributes.call(this,t,d,e),d},"rounded-rect":function(t,e){var i=parseFloat(t.getAttribute("x"))||0,r=parseFloat(t.getAttribute("y"))||0,n=parseFloat(t.getAttribute("rx"))||0,s=parseFloat(t.getAttribute("ry"))||0,a=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height")),l=a/2,h=o/2,c=new w.Vector(n,s),d=new w.RoundedRectangle(i+l,r+h,a,o,c).noStroke();return d.fill="black",w.Utils.applySvgAttributes.call(this,t,d,e),d},line:function(t,e){var i=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),n=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),a=new w.Line(i,r,n,s).noFill();return w.Utils.applySvgAttributes.call(this,t,a,e),a},lineargradient:function(t,e){for(var i=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),n=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),o=(n+i)/2,l=(s+r)/2,h=[],c=0;c1?d[1]:void 0;if(a.isNull(g))g=(d=!!p&&p.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&d.length>1?parseFloat(d[1]):1;h.push(new w.Gradient.Stop(u,_,g))}var m=new w.LinearGradient(i-o,r-l,n-o,s-l,h);return w.Utils.applySvgAttributes.call(this,t,m,e),m},radialgradient:function(t,e){var i=parseFloat(t.getAttribute("cx"))||0,r=parseFloat(t.getAttribute("cy"))||0,n=parseFloat(t.getAttribute("r")),s=parseFloat(t.getAttribute("fx")),o=parseFloat(t.getAttribute("fy"));a.isNaN(s)&&(s=i),a.isNaN(o)&&(o=r);for(var l=c(i+s)/2,h=c(r+o)/2,d=[],f=0;f1?u[1]:void 0;if(a.isNull(m))m=(u=!!v&&v.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&u.length>1?parseFloat(u[1]):1;d.push(new w.Gradient.Stop(g,p,m))}var y=new w.RadialGradient(i-l,r-h,n,d,s-l,o-h);return w.Utils.applySvgAttributes.call(this,t,y,e),y}},subdivide:function(t,e,i,r,n,s,a,o,l){var h=(l=l||w.Utils.Curve.RecursionLimit)+1;if(c(t-a)<.001&&c(e-o)<.001)return[new w.Anchor(a,o)];for(var d=[],f=0;f>1,c=1&r?s[l++]*t(o):0;l1?Array.prototype.push.apply(this,arguments):arguments[0]&&Array.isArray(arguments[0])&&Array.prototype.push.apply(this,arguments[0])},Error:function(t){this.name="two.js",this.message=t},Events:{on:function(t,e){return this._events||(this._events={}),(this._events[t]||(this._events[t]=[])).push(e),this},off:function(t,e){if(!this._events)return this;if(!t&&!e)return this._events={},this;for(var i=t?[t]:a.keys(this._events),r=0,n=i.length;r2&&(t=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(w.Events.insert,t),this.trigger(w.Events.order)),e},sort:function(){return Array.prototype.sort.apply(this,arguments),this.trigger(w.Events.order),this},reverse:function(){return Array.prototype.reverse.apply(this,arguments),this.trigger(w.Events.order),this}});w.Utils.getAnchorsFromArcData;var S=w.Utils.getControlPoints,E=(w.Utils.getCurveFromPoints,w.Utils.solveSegmentIntersection,w.Utils.decoupleShapes,w.Utils.mod),A=w.Utils.getBackingStoreRatio,C=w.Utils.getComponentOnCubicBezier,R=(w.Utils.getCurveLength,w.Utils.integrate),M=w.Utils.getReflection;function F(){var t=document.body.getBoundingClientRect(),e=this.width=t.width,i=this.height=t.height;this.renderer.setSize(e,i,this.ratio)}function O(t,e){this.width=t,this.height=e,this.trigger(w.Events.resize,t,e)}a.extend(w.prototype,w.Utils.Events,{constructor:w,appendTo:function(t){return t.appendChild(this.renderer.domElement),this},play:function(){return w.Utils.setPlaying.call(this,!0),P.init(),this.trigger(w.Events.play)},pause:function(){return this.playing=!1,this.trigger(w.Events.pause)},update:function(){var t=!!this._lastFrame,e=v.now();t&&(this.timeDelta=parseFloat((e-this._lastFrame).toFixed(3))),this._lastFrame=e;var i=this.width,r=this.height,n=this.renderer;return i===n.width&&r===n.height||n.setSize(i,r,this.ratio),this.trigger(w.Events.update,this.frameCount,this.timeDelta),this.render()},render:function(){return this.renderer.render(),this.trigger(w.Events.render,this.frameCount++)},add:function(t){var e=t;return e instanceof Array||(e=a.toArray(arguments)),this.scene.add(e),this},remove:function(t){var e=t;return e instanceof Array||(e=a.toArray(arguments)),this.scene.remove(e),this},clear:function(){return this.scene.remove(this.scene.children),this},makeLine:function(t,e,i,r){var n=new w.Line(t,e,i,r);return this.scene.add(n),n},makeRectangle:function(t,e,i,r){var n=new w.Rectangle(t,e,i,r);return this.scene.add(n),n},makeRoundedRectangle:function(t,e,i,r,n){var s=new w.RoundedRectangle(t,e,i,r,n);return this.scene.add(s),s},makeCircle:function(t,e,i){var r=new w.Circle(t,e,i);return this.scene.add(r),r},makeEllipse:function(t,e,i,r){var n=new w.Ellipse(t,e,i,r);return this.scene.add(n),n},makeStar:function(t,e,i,r,n){var s=new w.Star(t,e,i,r,n);return this.scene.add(s),s},makeCurve:function(t){var e=arguments.length,i=t;if(!a.isArray(t)){i=[];for(var r=0;r=4?(i=arguments[0]-arguments[2],r=arguments[1]-arguments[3],Math.atan2(r,i)):(i=t.x-e.x,r=t.y-e.y,Math.atan2(r,i))},distanceBetween:function(t,e){return Math.sqrt(i.distanceBetweenSquared(t,e))},distanceBetweenSquared:function(t,e){var i=t.x-e.x,r=t.y-e.y;return i*i+r*r},MakeObservable:function(i){i.bind=i.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,"x",n),Object.defineProperty(this,"y",s),e.extend(this,r),this._bound=!0),t.Utils.Events.bind.apply(this,arguments),this}}}),e.extend(i.prototype,t.Utils.Events,{constructor:i,set:function(t,e){return this.x=t,this.y=e,this},copy:function(t){return this.x=t.x,this.y=t.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new i(this.x,this.y)},add:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x+=t,this.y+=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x+=t.x,this.y+=t.y):(this.x+=t,this.y+=i)),this},addSelf:function(t){return this.add.apply(this,arguments)},sub:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x-=t,this.y-=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x-=t.x,this.y-=t.y):(this.x-=t,this.y-=i)),this},subtract:function(){return this.sub.apply(this,arguments)},subSelf:function(t){return this.sub.apply(this,arguments)},subtractSelf:function(t){return this.sub.apply(this,arguments)},multiply:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x*=t,this.y*=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x*=t.x,this.y*=t.y):(this.x*=t,this.y*=i)),this},multiplySelf:function(t){return this.multiply.apply(this,arguments)},multiplyScalar:function(t){return this.multiply(t)},divide:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x/=t,this.y/=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x/=t.x,this.y/=t.y):(this.x/=t,this.y/=i),e.isNaN(this.x)&&(this.x=0),e.isNaN(this.y)&&(this.y=0)),this},divideSelf:function(t){return this.divide.apply(this,arguments)},divideScalar:function(t){return this.divide(t)},negate:function(){return this.multiply(-1)},dot:function(t){return this.x*t.x+this.y*t.y},length:function(){return Math.sqrt(this.lengthSquared())},lengthSquared:function(){return this.x*this.x+this.y*this.y},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,e){return e=void 0===e?1e-4:e,this.distanceTo(t)0&&this.set(l)};n.extend(o,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(e,i,r){if(i.length<=3){var n=e,s=i[0]||0,a=i[1]||0,o=i[2]||0;return{x:n[0]*s+n[1]*a+n[2]*o,y:n[3]*s+n[4]*a+n[5]*o,z:n[6]*s+n[7]*a+n[8]*o}}var l=e[0],h=e[1],c=e[2],d=e[3],f=e[4],u=e[5],_=e[6],g=e[7],p=e[8],m=i[0],v=i[1],y=i[2],x=i[3],b=i[4],w=i[5],k=i[6],S=i[7],E=i[8];return(r=r||new t.Array(9))[0]=l*m+h*x+c*k,r[1]=l*v+h*b+c*S,r[2]=l*y+h*w+c*E,r[3]=d*m+f*x+u*k,r[4]=d*v+f*b+u*S,r[5]=d*y+f*w+u*E,r[6]=_*m+g*x+p*k,r[7]=_*v+g*b+p*S,r[8]=_*y+g*w+p*E,r}}),n.extend(o.prototype,t.Utils.Events,{constructor:o,manual:!1,set:function(e){var i=e;return arguments.length>1&&(i=n.toArray(arguments)),this.elements[0]=i[0],this.elements[1]=i[1],this.elements[2]=i[2],this.elements[3]=i[3],this.elements[4]=i[4],this.elements[5]=i[5],this.elements[6]=i[6],this.elements[7]=i[7],this.elements[8]=i[8],this.trigger(t.Events.change)},identity:function(){return this.elements[0]=o.Identity[0],this.elements[1]=o.Identity[1],this.elements[2]=o.Identity[2],this.elements[3]=o.Identity[3],this.elements[4]=o.Identity[4],this.elements[5]=o.Identity[5],this.elements[6]=o.Identity[6],this.elements[7]=o.Identity[7],this.elements[8]=o.Identity[8],this.trigger(t.Events.change)},multiply:function(e,i,r,n,s,a,o,l,h){var c=arguments,d=c.length;if(d<=1)return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(t.Events.change);if(d<=3)return e=e||0,i=i||0,r=r||0,{x:(s=this.elements)[0]*e+s[1]*i+s[2]*r,y:s[3]*e+s[4]*i+s[5]*r,z:s[6]*e+s[7]*i+s[8]*r};var f=this.elements,u=c,_=f[0],g=f[1],p=f[2],m=f[3],v=f[4],y=f[5],x=f[6],b=f[7],w=f[8],k=u[0],S=u[1],E=u[2],A=u[3],C=u[4],R=u[5],M=u[6],F=u[7],O=u[8];return this.elements[0]=_*k+g*A+p*M,this.elements[1]=_*S+g*C+p*F,this.elements[2]=_*E+g*R+p*O,this.elements[3]=m*k+v*A+y*M,this.elements[4]=m*S+v*C+y*F,this.elements[5]=m*E+v*R+y*O,this.elements[6]=x*k+b*A+w*M,this.elements[7]=x*S+b*C+w*F,this.elements[8]=x*E+b*R+w*O,this.trigger(t.Events.change)},inverse:function(e){var i=this.elements;e=e||new t.Matrix;var r=i[0],n=i[1],s=i[2],a=i[3],o=i[4],l=i[5],h=i[6],c=i[7],d=i[8],f=d*o-l*c,u=-d*a+l*h,_=c*a-o*h,g=r*f+n*u+s*_;return g?(g=1/g,e.elements[0]=f*g,e.elements[1]=(-d*n+s*c)*g,e.elements[2]=(l*n-s*o)*g,e.elements[3]=u*g,e.elements[4]=(d*r-s*h)*g,e.elements[5]=(-l*r+s*a)*g,e.elements[6]=_*g,e.elements[7]=(-c*r+n*h)*g,e.elements[8]=(o*r-n*a)*g,e):null},scale:function(t,e){var i=arguments.length;return i<=1&&(e=t),this.multiply(t,0,0,0,e,0,0,0,1)},rotate:function(t){var r=e(t),n=i(t);return this.multiply(r,-n,0,n,r,0,0,0,1)},translate:function(t,e){return this.multiply(1,0,t,0,1,e,0,0,1)},skewX:function(t){var e=r(t);return this.multiply(1,e,0,0,1,0,0,0,1)},skewY:function(t){var e=r(t);return this.multiply(1,0,0,e,1,0,0,0,1)},toString:function(t){return a.length=0,this.toArray(t,a),a.join(" ")},toArray:function(t,e){var i=this.elements,r=!!e,n=s(i[0]),a=s(i[1]),o=s(i[2]),l=s(i[3]),h=s(i[4]),c=s(i[5]);if(t){var d=s(i[6]),f=s(i[7]),u=s(i[8]);return r?(e[0]=n,e[1]=l,e[2]=d,e[3]=a,e[4]=h,e[5]=f,e[6]=o,e[7]=c,void(e[8]=u)):[n,l,d,a,h,f,o,c,u]}return r?(e[0]=n,e[1]=l,e[2]=a,e[3]=h,e[4]=o,void(e[5]=c)):[n,l,a,h,o,c]},clone:function(){var e,i,r,n,s,a,o,l,h;e=this.elements[0],i=this.elements[1],r=this.elements[2],n=this.elements[3],s=this.elements[4],a=this.elements[5],o=this.elements[6],l=this.elements[7],h=this.elements[8];var c=new t.Matrix(e,i,r,n,s,a,o,l,h);return c.manual=this.manual,c}})}((void 0!==t?t:window).Two),function(t){var e=t.Utils.mod,i=t.Utils.toFixed,r=t.Utils,n={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},createElement:function(t,e){var i=t,s=document.createElementNS(n.ns,i);return"svg"===i&&(e=r.defaults(e||{},{version:n.version})),r.isEmpty(e)||n.setAttributes(s,e),s},setAttributes:function(t,e){for(var i=Object.keys(e),r=0;r=o&&n&&(S.command===t.Commands.curve&&(R=s,m=S.controls&&S.controls.right||S,v=R.controls&&R.controls.left||R,S.relative?(d=i(m.x+S.x),f=i(m.y+S.y)):(d=i(m.x),f=i(m.y)),R.relative?(u=i(v.x+R.x),_=i(v.y+R.y)):(u=i(v.x),_=i(v.y)),c+=" C "+d+" "+f+" "+u+" "+_+" "+(M=i(R.x))+" "+(F=i(R.y))),S.command!==t.Commands.close&&(c+=" Z")),l+=c+" "}return l},getClip:function(t){var e=t._renderer.clip;if(!e){for(var i=t;i.parent;)i=i.parent;e=t._renderer.clip=n.createElement("clipPath"),i.defs.appendChild(e)}return e},group:{appendChild:function(t){var e=t._renderer.elem;if(e){var i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||t._clip||this.elem.appendChild(e)}},removeChild:function(t){var e=t._renderer.elem;e&&e.parentNode==this.elem&&(e.nodeName&&(t._clip||this.elem.removeChild(e)))},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){n[t._renderer.type].render.call(t,this)},render:function(t){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;this._renderer.elem||(this._renderer.elem=n.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));var e=this._matrix.manual||this._flagMatrix,i={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(var r=0;r0&&(e["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?n.setAttributes(this._renderer.elem,e):(e.id=this.id,this._renderer.elem=n.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){var r=n.getClip(this),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}return this.flagReset()}},text:{render:function(t){this._update();var e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=n.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["alignment-baseline"]=e["dominant-baseline"]=this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),n[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),n[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(e["stroke-width"]=this._linewidth),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this._className),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?n.setAttributes(this._renderer.elem,e):(e.id=this.id,this._renderer.elem=n.createElement("text",e),t.defs.appendChild(this._renderer.elem)),this._flagClip){var i=n.getClip(this),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),i.setAttribute("id",this.id),i.appendChild(r)):(i.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){e||this._update();var i={};if(this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._renderer.elem?n.setAttributes(this._renderer.elem,i):(i.id=this.id,i.gradientUnits="userSpaceOnUse",this._renderer.elem=n.createElement("linearGradient",i),t.defs.appendChild(this._renderer.elem)),this._flagStops){var r=this._renderer.elem.childNodes.length!==this.stops.length;r&&(this._renderer.elem.childNodes.length=0);for(var s=0;s0&&(s.x*=-1),s.y>0&&(s.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(s.width=0,s.height=0,o)){switch(a.width=s.width=o.width,a.height=s.height=o.height,this._repeat){case"no-repeat":s.width+=1,s.height+=1}this._scale instanceof t.Vector?(s.width*=this._scale.x,s.height*=this._scale.y):(s.width*=this._scale,s.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?r.isEmpty(a)||n.setAttributes(this._renderer.image,a):this._renderer.image=n.createElement("image",a)),this._renderer.elem?r.isEmpty(s)||n.setAttributes(this._renderer.elem,s):(s.id=this.id,s.patternUnits="userSpaceOnUse",this._renderer.elem=n.createElement("pattern",s),e.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},s=t[t.Types.svg]=function(e){this.domElement=e.domElement||n.createElement("svg"),this.scene=new t.Group,this.scene.parent=this,this.defs=n.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"};r.extend(s,{Utils:n}),r.extend(s.prototype,t.Utils.Events,{constructor:s,setSize:function(e,i){return this.width=e,this.height=i,n.setAttributes(this.domElement,{width:e,height:i}),this.trigger(t.Events.resize,e,i)},render:function(){return n.group.render.call(this.scene,this.domElement),this}})}((void 0!==t?t:window).Two),function(t){var e=t.Utils.mod,i=t.Utils.toFixed,r=t.Utils.getRatio,n=t.Utils,s=[],a=2*Math.PI,o=Math.max,l=Math.min,h=Math.abs,c=Math.sin,d=Math.cos,f=Math.acos,u=Math.sqrt,_=function(t){return 1==t[0]&&0==t[3]&&0==t[1]&&1==t[4]&&0==t[2]&&0==t[5]},g={isHidden:/(none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(t){return this[t]},t.setAttribute=function(t,e){return this[t]=e,this},t},group:{renderChild:function(t){g[t._renderer.type].render.call(t,this.ctx,!0,this.clip)},render:function(t){this._update();var e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);var r=_(e),n=this._mask;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,r||(t.save(),t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),n&&g[n._renderer.type].render.call(n,t,!0),this.opacity>0&&0!==this.scale)for(var s=0;s0&&r.setLineDash(z),r.beginPath();for(var H=0;H=k&&x&&(R=M,N=C.controls&&C.controls.right||t.Vector.zero,j=R.controls&&R.controls.left||t.Vector.zero,C._relative?(P=N.x+i(C.x),U=N.y+i(C.y)):(P=i(N.x),U=i(N.y)),R._relative?(F=j.x+i(R.x),O=j.y+i(R.y)):(F=i(j.x),O=i(j.y)),V=i(R.x),B=i(R.y),r.bezierCurveTo(P,U,F,O,V,B));break;case t.Commands.line:r.lineTo(V,B);break;case t.Commands.move:M=C,r.moveTo(V,B)}return x&&r.closePath(),z&&z.length>0&&r.setLineDash(s),I||l||(g.isHidden.test(f)||((D=f._renderer&&f._renderer.offset)&&(r.save(),r.translate(-f._renderer.offset.x,-f._renderer.offset.y),r.scale(f._renderer.scale.x,f._renderer.scale.y)),r.fill(),D&&r.restore()),g.isHidden.test(c)||((D=c._renderer&&c._renderer.offset)&&(r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(c._renderer.scale.x,c._renderer.scale.y),r.lineWidth=d/c._renderer.scale.x),r.stroke(),D&&r.restore())),G||r.restore(),I&&!l&&r.clip(),this.flagReset()}},text:{render:function(t,e,r){this._update();var s,a,o,l,h,c,d,f=this._matrix.elements,u=this._stroke,p=this._linewidth,m=this._fill,v=this._opacity*this.parent._renderer.opacity,y=this._visible,x=_(f),b=m._renderer&&m._renderer.offset&&u._renderer&&u._renderer.offset,w=this.dashes,k=this._clip;return e||y&&!k?(x||(t.save(),t.transform(f[0],f[3],f[1],f[4],f[2],f[5])),b||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=g.alignments[this._alignment]||this._alignment,t.textBaseline=this._baseline,m&&(n.isString(m)?t.fillStyle=m:(g[m._renderer.type].render.call(m,t),t.fillStyle=m._renderer.effect)),u&&(n.isString(u)?t.strokeStyle=u:(g[u._renderer.type].render.call(u,t),t.strokeStyle=u._renderer.effect)),p&&(t.lineWidth=p),n.isNumber(v)&&(t.globalAlpha=v),w&&w.length>0&&t.setLineDash(w),k||r||(g.isHidden.test(m)||(m._renderer&&m._renderer.offset?(c=i(m._renderer.scale.x),d=i(m._renderer.scale.y),t.save(),t.translate(-i(m._renderer.offset.x),-i(m._renderer.offset.y)),t.scale(c,d),s=this._size/m._renderer.scale.y,a=this._leading/m._renderer.scale.y,t.font=[this._style,this._weight,i(s)+"px/",i(a)+"px",this._family].join(" "),o=m._renderer.offset.x/m._renderer.scale.x,l=m._renderer.offset.y/m._renderer.scale.y,t.fillText(this.value,i(o),i(l)),t.restore()):t.fillText(this.value,0,0)),g.isHidden.test(u)||(u._renderer&&u._renderer.offset?(c=i(u._renderer.scale.x),d=i(u._renderer.scale.y),t.save(),t.translate(-i(u._renderer.offset.x),-i(u._renderer.offset.y)),t.scale(c,d),s=this._size/u._renderer.scale.y,a=this._leading/u._renderer.scale.y,t.font=[this._style,this._weight,i(s)+"px/",i(a)+"px",this._family].join(" "),o=u._renderer.offset.x/u._renderer.scale.x,l=u._renderer.offset.y/u._renderer.scale.y,h=p/u._renderer.scale.x,t.lineWidth=i(h),t.strokeText(this.value,i(o),i(l)),t.restore()):t.strokeText(this.value,0,0))),x||t.restore(),k&&!r&&t.clip(),this.flagReset()):this}},"linear-gradient":{render:function(t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var e=0;e1){var R=u(C);k=(s*=R)*s,S=(l*=R)*l}var M=k*A+S*E,F=u(o(0,(k*S-M)/M));f===_&&(F=-F);var O=F*s*w/l,P=-F*l*b/s,U=d(g)*O-c(g)*P+(r+p)/2,T=c(g)*O+d(g)*P+(n+v)/2,L=m(1,0,(b-O)/s,(w-P)/l);!function(i,r,n,s,o,l,h,c,d){var f=t.Utils.Curve.Tolerance.epsilon,u=h-l,_=Math.abs(u)0&&S.setLineDash(T),S.save(),S.scale(E,E),S.translate(B,I),S.beginPath();for(var G=0;G=N&&U&&(a=j,m=D.controls&&D.controls.right||t.Vector.zero,v=a.controls&&a.controls.left||t.Vector.zero,D._relative?(u=o(m.x+D.x),_=o(m.y+D.y)):(u=o(m.x),_=o(m.y)),a._relative?(d=o(v.x+a.x),f=o(v.y+a.y)):(d=o(v.x),f=o(v.y)),y=o(a.x),x=o(a.y),S.bezierCurveTo(u,_,d,f,y,x));break;case t.Commands.line:S.lineTo(y,x);break;case t.Commands.move:j=D,S.moveTo(y,x)}}U&&S.closePath(),c.isHidden.test(R)||((b=R._renderer&&R._renderer.offset)&&(S.save(),S.translate(-R._renderer.offset.x,-R._renderer.offset.y),S.scale(R._renderer.scale.x,R._renderer.scale.y)),S.fill(),b&&S.restore()),c.isHidden.test(A)||((b=A._renderer&&A._renderer.offset)&&(S.save(),S.translate(-A._renderer.offset.x,-A._renderer.offset.y),S.scale(A._renderer.scale.x,A._renderer.scale.y),S.lineWidth=C/A._renderer.scale.x),S.stroke(),b&&S.restore()),S.restore()},getBoundingClientRect:function(t,e,i){var r,n,s=1/0,a=-1/0,o=1/0,l=-1/0;t.forEach((function(t){var e,i,r,n,h,c,d=t.x,f=t.y,u=t.controls;o=Math.min(f,o),s=Math.min(d,s),a=Math.max(d,a),l=Math.max(f,l),t.controls&&(h=u.left,c=u.right,h&&c&&(e=t._relative?h.x+d:h.x,i=t._relative?h.y+f:h.y,r=t._relative?c.x+d:c.x,n=t._relative?c.y+f:c.y,e&&i&&r&&n&&(o=Math.min(i,n,o),s=Math.min(e,r,s),a=Math.max(e,r,a),l=Math.max(i,n,l))))})),h.isNumber(e)&&(o-=e,s-=e,a+=e,l+=e),r=a-s,n=l-o,i.top=o,i.left=s,i.right=a,i.bottom=l,i.width=r,i.height=n,i.centroid||(i.centroid={}),i.centroid.x=-s,i.centroid.y=-o},render:function(e,r,n){if(!this._visible||!this._opacity)return this;this._update();var a=this.parent,o=a._matrix.manual||a._flagMatrix,l=this._matrix.manual||this._flagMatrix,d=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof t.Texture&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||a._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;return(o||l)&&(this._renderer.matrix||(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,s),i(s,a._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*a._renderer.scale),d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*a._renderer.opacity,c.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),c.getTriangles(this._renderer.rect,this._renderer.triangles),c.updateBuffer.call(c,e,this,r),c.updateTexture.call(c,e,this)):(h.isString(this._fill)||this._fill._update(),h.isString(this._stroke)||this._stroke._update()),!this._clip||n?(e.bindBuffer(e.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),e.vertexAttribPointer(r.textureCoords,2,e.FLOAT,!1,0,0),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.buffer),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),this.flagReset()):void 0}},text:{updateCanvas:function(t){var e=this.canvas,i=this.ctx,r=t._renderer.scale,n=t._stroke,s=t._linewidth*r,a=t._fill,l=t._renderer.opacity||t._opacity,d=t.dashes;e.width=Math.max(Math.ceil(t._renderer.rect.width*r),1),e.height=Math.max(Math.ceil(t._renderer.rect.height*r),1);var f,u,_,g,p,m,v,y=t._renderer.rect.centroid,x=y.x,b=y.y,w=a._renderer&&a._renderer.offset&&n._renderer&&n._renderer.offset;i.clearRect(0,0,e.width,e.height),w||(i.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),i.textAlign="center",i.textBaseline="middle",a&&(h.isString(a)?i.fillStyle=a:(c[a._renderer.type].render.call(a,i,t),i.fillStyle=a._renderer.effect)),n&&(h.isString(n)?i.strokeStyle=n:(c[n._renderer.type].render.call(n,i,t),i.strokeStyle=n._renderer.effect)),s&&(i.lineWidth=s),h.isNumber(l)&&(i.globalAlpha=l),d&&d.length>0&&i.setLineDash(d),i.save(),i.scale(r,r),i.translate(x,b),c.isHidden.test(a)||(a._renderer&&a._renderer.offset?(m=o(a._renderer.scale.x),v=o(a._renderer.scale.y),i.save(),i.translate(-o(a._renderer.offset.x),-o(a._renderer.offset.y)),i.scale(m,v),f=t._size/a._renderer.scale.y,u=t._leading/a._renderer.scale.y,i.font=[t._style,t._weight,o(f)+"px/",o(u)+"px",t._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,g=a._renderer.offset.y/a._renderer.scale.y,i.fillText(t.value,o(_),o(g)),i.restore()):i.fillText(t.value,0,0)),c.isHidden.test(n)||(n._renderer&&n._renderer.offset?(m=o(n._renderer.scale.x),v=o(n._renderer.scale.y),i.save(),i.translate(-o(n._renderer.offset.x),-o(n._renderer.offset.y)),i.scale(m,v),f=t._size/n._renderer.scale.y,u=t._leading/n._renderer.scale.y,i.font=[t._style,t._weight,o(f)+"px/",o(u)+"px",t._family].join(" "),_=n._renderer.offset.x/n._renderer.scale.x,g=n._renderer.offset.y/n._renderer.scale.y,p=s/n._renderer.scale.x,i.lineWidth=o(p),i.strokeText(t.value,o(_),o(g)),i.restore()):i.strokeText(t.value,0,0)),i.restore()},getBoundingClientRect:function(t,e){var i=c.ctx;i.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),i.textAlign="center",i.textBaseline=t._baseline;var r=i.measureText(t._value).width,n=Math.max(t._size||t._leading);this._linewidth&&!c.isHidden.test(this._stroke)&&(n+=this._linewidth);var s=r/2,a=n/2;switch(c.alignments[t._alignment]||t._alignment){case c.alignments.left:e.left=0,e.right=r;break;case c.alignments.right:e.left=-r,e.right=0;break;default:e.left=-s,e.right=s}switch(t._baseline){case"bottom":e.top=-n,e.bottom=0;break;case"top":e.top=0,e.bottom=n;break;default:e.top=-a,e.bottom=a}e.width=r,e.height=n,e.centroid||(e.centroid={}),e.centroid.x=s,e.centroid.y=a},render:function(e,r,n){if(!this._visible||!this._opacity)return this;this._update();var a=this.parent,o=a._matrix.manual||a._flagMatrix,l=this._matrix.manual||this._flagMatrix,d=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof t.Texture&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||a._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;return(o||l)&&(this._renderer.matrix||(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,s),i(s,a._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*a._renderer.scale),d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*a._renderer.opacity,c.text.getBoundingClientRect(this,this._renderer.rect),c.getTriangles(this._renderer.rect,this._renderer.triangles),c.updateBuffer.call(c,e,this,r),c.updateTexture.call(c,e,this)):(h.isString(this._fill)||this._fill._update(),h.isString(this._stroke)||this._stroke._update()),!this._clip||n?(e.bindBuffer(e.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),e.vertexAttribPointer(r.textureCoords,2,e.FLOAT,!1,0,0),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.buffer),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),this.flagReset()):void 0}},"linear-gradient":{render:function(t,e){if(t.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var i=0;i=i)return i-r>=0;r+=s}return!1}function c(t,e){var i=t._length;if(e<=0)return 0;if(e>=i)return t._lengths.length-1;for(var r=0,n=0;r=e)return e-=n,Math.max(r-1,0)+e/t._lengths[r];n+=t._lengths[r]}return-1}function d(e,i,r){var n,s,a,o,l,h,c,d,f=i.controls&&i.controls.right,u=e.controls&&e.controls.left;return n=i.x,l=i.y,s=(f||i).x,h=(f||i).y,a=(u||e).x,c=(u||e).y,o=e.x,d=e.y,f&&i._relative&&(s+=i.x,h+=i.y),u&&e._relative&&(a+=e.x,c+=e.y),t.Utils.getCurveLength(n,l,s,h,a,c,o,d,r)}function f(e,i,r){var n,s,a,o,l,h,c,d,f=i.controls&&i.controls.right,u=e.controls&&e.controls.left;return n=i.x,l=i.y,s=(f||i).x,h=(f||i).y,a=(u||e).x,c=(u||e).y,o=e.x,d=e.y,f&&i._relative&&(s+=i.x,h+=i.y),u&&e._relative&&(a+=e.x,c+=e.y),t.Utils.subdivide(n,l,s,h,a,c,o,d,r)}o.extend(l,{Properties:["fill","stroke","linewidth","opacity","className","visible","cap","join","miter","closed","curved","automatic","beginning","ending"],Utils:{getCurveLength:d},FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)},BindVertices:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){t.Shape.MakeObservable(e),o.each(l.Properties.slice(2,9),t.Utils.defineProperty,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"length",{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(e,"closed",{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}}),Object.defineProperty(e,"curved",{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}}),Object.defineProperty(e,"automatic",{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t!==this._automatic){this._automatic=!!t;var e=this._automatic?"ignore":"listen";o.each(this.vertices,(function(t){t[e]()}))}}}),Object.defineProperty(e,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}}),Object.defineProperty(e,"ending",{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}}),Object.defineProperty(e,"vertices",{enumerable:!0,get:function(){return this._collection},set:function(e){this._renderer.flagVertices;var i=this._renderer.bindVertices,r=this._renderer.unbindVertices;this._collection&&this._collection.unbind(t.Events.insert,i).unbind(t.Events.remove,r),e instanceof t.Utils.Collection?this._collection=e:this._collection=new t.Utils.Collection(e||[]),this._collection.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._collection)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),o.extend(l.prototype,t.Shape.prototype,{_flagVertices:!0,_flagLength:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagClassName:!0,_flagCap:!0,_flagJoin:!0,_flagMiter:!0,_flagClip:!1,_length:0,_fill:"#fff",_stroke:"#000",_linewidth:1,_opacity:1,_className:"",_visible:!0,_cap:"round",_join:"round",_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_clip:!1,constructor:l,clone:function(t){var e=new l;e.vertices=this.vertices;for(var i=0;i=y){this._closed?(r=t.Utils.mod(S,x),n=t.Utils.mod(S-1,x),0===S&&(r=n,n=S)):(r=S,n=Math.min(Math.max(S-1,0),b)),w=this.vertices[r],k=this.vertices[n],y-=A,e=0!==this._lengths[S]?y/this._lengths[S]:0;break}A+=this._lengths[S]}if(o.isNull(w)||o.isNull(k))return null;if(!w)return k;if(!k)return w;v=k.controls&&k.controls.right,m=w.controls&&w.controls.left,l=k.x,u=k.y,h=(v||k).x,_=(v||k).y,c=(m||w).x,g=(m||w).y,d=w.x,p=w.y,v&&k.relative&&(h+=k.x,_+=k.y),m&&w.relative&&(c+=w.x,g+=w.y),a=t.Utils.getComponentOnCubicBezier(e,l,h,c,d),f=t.Utils.getComponentOnCubicBezier(e,u,_,g,p);var C=t.Utils.lerp(l,h,e),R=t.Utils.lerp(u,_,e),M=t.Utils.lerp(h,c,e),F=t.Utils.lerp(_,g,e),O=t.Utils.lerp(c,d,e),P=t.Utils.lerp(g,p,e),U=t.Utils.lerp(C,M,e),T=t.Utils.lerp(R,F,e),L=t.Utils.lerp(M,O,e),N=t.Utils.lerp(F,P,e);return o.isObject(i)?(i.x=a,i.y=f,o.isObject(i.controls)||t.Anchor.AppendCurveProperties(i),i.controls.left.x=U,i.controls.left.y=T,i.controls.right.x=L,i.controls.right.y=N,o.isBoolean(i.relative)&&!i.relative||(i.controls.left.x-=a,i.controls.left.y-=f,i.controls.right.x-=a,i.controls.right.y-=f),i.t=e,i):((s=new t.Anchor(a,f,U-a,T-f,L-a,N-f,this._curved?t.Commands.curve:t.Commands.line)).t=e,s)},plot:function(){if(this.curved)return t.Utils.getCurveFromPoints(this._collection,this.closed),this;for(var e=0;e0&&(s[s.length-1].command=t.Commands.line),void(r=a);var h=f(a,r,e);s=s.concat(h),o.each(h,(function(e,i){i<=0&&r.command===t.Commands.move?e.command=t.Commands.move:e.command=t.Commands.line})),l>=i&&(this._closed&&this._automatic?(h=f(a,r=a,e),s=s.concat(h),o.each(h,(function(e,i){i<=0&&r.command===t.Commands.move?e.command=t.Commands.move:e.command=t.Commands.line}))):n&&s.push(new t.Anchor(a.x,a.y)),s[s.length-1].command=n?t.Commands.close:t.Commands.line),r=a}}),this),this._automatic=!1,this._curved=!1,this.vertices=s,this},_updateLength:function(e,i){i||this._update();var r=this.vertices.length,n=r-1,s=this.vertices[n],a=0;return o.isUndefined(this._lengths)&&(this._lengths=[]),o.each(this.vertices,(function(i,r){if(r<=0||i.command===t.Commands.move)return s=i,void(this._lengths[r]=0);this._lengths[r]=d(i,s,e),this._lengths[r]=t.Utils.toFixed(this._lengths[r]),a+=this._lengths[r],s=i}),this),this._length=a,this._flagLength=!1,this},_update:function(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);var e,i,s,a,o,l=this._collection.length,d=this._closed,f=Math.min(this._beginning,this._ending),u=Math.max(this._beginning,this._ending),_=c(this,f*this._length),g=c(this,u*this._length),p=r(_),m=n(g);this._renderer.vertices.length=0;for(var v=0;vm&&!i?((o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(u,o),o.command=this._renderer.collection[v].command,this._renderer.vertices.push(o),i=o,(s=this._collection[v-1])&&s.controls&&(o.controls.right.clear(),this._renderer.collection[v-1].controls.right.clear().lerp(s.controls.right,o.t))):v>=p&&v<=m&&(o=this._renderer.collection[v].copy(this._collection[v]),this._renderer.vertices.push(o),v===m&&h(this,u)?(i=o,!d&&i.controls&&i.controls.right.clear()):v===p&&h(this,f)&&((e=o).command=t.Commands.move,!d&&e.controls&&e.controls.left.clear()));p>0&&!e&&(v=p-1,(o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(f,o),o.command=t.Commands.move,this._renderer.vertices.unshift(o),e=o,(a=this._collection[v+1])&&a.controls&&(o.controls.left.clear(),this._renderer.collection[v+1].controls.left.copy(a.controls.left).lerp(t.Vector.zero,o.t)))}return t.Shape.prototype._update.apply(this,arguments),this},flagReset:function(){return this._flagVertices=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClassName=this._flagClip=!1,t.Shape.prototype.flagReset.call(this),this}}),l.MakeObservable(l.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=t.Utils,r=t.Line=function(i,r,n,s){e.call(this,[new t.Anchor(i,r),new t.Anchor(n,s)]),this.vertices[0].command=t.Commands.move,this.vertices[1].command=t.Commands.line,this.automatic=!1};i.extend(r.prototype,e.prototype),r.prototype.constructor=r,e.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=t.Utils,r=t.Rectangle=function(i,r,n,s){e.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0,!1,!0),this.width=n,this.height=s,this.origin=new t.Vector,this.translation.set(i,r),this._update()};i.extend(r,{Properties:["width","height"],MakeObservable:function(n){e.MakeObservable(n),i.each(r.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,"origin",{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(t.Events.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(t.Events.change,this._renderer.flagVertices),this._renderer.flagVertices()}})}}),i.extend(r.prototype,e.prototype,{_width:0,_height:0,_flagWidth:0,_flagHeight:0,_origin:null,constructor:r,_update:function(){if(this._flagWidth||this._flagHeight){var i=this._width/2,r=this._height/2;this.vertices[0].set(-i,-r).add(this._origin).command=t.Commands.move,this.vertices[1].set(i,-r).add(this._origin).command=t.Commands.line,this.vertices[2].set(i,r).add(this._origin).command=t.Commands.line,this.vertices[3].set(-i,r).add(this._origin).command=t.Commands.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).add(this._origin).command=t.Commands.line)}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,e.prototype.flagReset.call(this),this},clone:function(e){var n=new r(0,0,this.width,this.height);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,i.each(t.Path.Properties,(function(t){n[t]=this[t]}),this),e&&e.add(n),n}}),r.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=2*Math.PI,r=Math.PI/2,n=Math.cos,s=Math.sin,a=t.Utils,o=4/3*Math.tan(Math.PI/8),l=t.Ellipse=function(i,r,n,s,o){a.isNumber(s)||(s=n);var l=o||5,h=a.map(a.range(l),(function(e){return new t.Anchor}),this);e.call(this,h,!0,!0,!0),this.width=2*n,this.height=2*s,this._update(),this.translation.set(i,r)};a.extend(l,{Properties:["width","height"],MakeObservable:function(i){e.MakeObservable(i),a.each(l.Properties,t.Utils.defineProperty,i)}}),a.extend(l.prototype,e.prototype,{_width:0,_height:0,_flagWidth:!1,_flagHeight:!1,constructor:l,_update:function(){if(this._flagWidth||this._flagHeight)for(var a=0,l=this.vertices.length,h=l-1;as&&(this.vertices.splice(s-1,o-s),o=s);for(var l=0;l=o?this.vertices.push(new t.Anchor(c,d)):this.vertices[l].set(c,d),this.vertices[l].command=0===l?t.Commands.move:t.Commands.line}}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,e.prototype.flagReset.call(this),this},clone:function(e){var i=new a(0,0,this.radius,this.sides);return i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,s.each(t.Path.Properties,(function(t){i[t]=this[t]}),this),e&&e.add(i),i}}),a.MakeObservable(a.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=(Math.PI,2*Math.PI),r=Math.PI/2,n=(Math.cos,Math.sin,Math.abs,t.Utils),s=t.ArcSegment=function(i,r,s,a,o,l,h){var c=h||3*t.Resolution,d=n.map(n.range(c),(function(){return new t.Anchor}));e.call(this,d,!0,!1,!0),this.innerRadius=s,this.outerRadius=a,this.startAngle=o,this.endAngle=l,this._update(),this.translation.set(i,r)};function a(t,e){for(;t<0;)t+=e;return t%e}n.extend(s,{Properties:["startAngle","endAngle","innerRadius","outerRadius"],MakeObservable:function(i){e.MakeObservable(i),n.each(s.Properties,t.Utils.defineProperty,i)}}),n.extend(s.prototype,e.prototype,{_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:i,_innerRadius:0,_outerRadius:0,constructor:s,_update:function(){if(this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var n,s=this._startAngle,o=this._endAngle,l=this._innerRadius,h=this._outerRadius,c=a(s,i)===a(o,i),d=l>0,f=this.vertices,u=d?f.length/2:f.length,_=0;c?u--:d||(u-=2);for(var g=0,p=u-1;gs&&(this.vertices.splice(s-1,o-s),o=s);for(var l=0;l=o?this.vertices.push(new t.Anchor(d,f)):this.vertices[l].set(d,f),this.vertices[l].command=0===l?t.Commands.move:t.Commands.line}}return e.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,e.prototype.flagReset.call(this),this},clone:function(e){var i=this.innerRadius,r=this.outerRadius,n=this.sides,o=new a(0,0,i,r,n);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,s.each(t.Path.Properties,(function(t){o[t]=this[t]}),this),e&&e.add(o),o}}),a.MakeObservable(a.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=t.Utils,r=t.RoundedRectangle=function(n,s,a,o,l){i.isUndefined(l)&&(l=Math.floor(Math.min(a,o)/12));var h=i.map(i.range(10),(function(e){return new t.Anchor(0,0,0,0,0,0,0===e?t.Commands.move:t.Commands.curve)}));e.call(this,h),this.closed=!0,this.automatic=!1,this._renderer.flagRadius=i.bind(r.FlagRadius,this),this.width=a,this.height=o,this.radius=l,this._update(),this.translation.set(n,s)};i.extend(r,{Properties:["width","height"],FlagRadius:function(){this._flagRadius=!0},MakeObservable:function(n){e.MakeObservable(n),i.each(r.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,"radius",{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius instanceof t.Vector&&this._radius.unbind(t.Events.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof t.Vector&&this._radius.bind(t.Events.change,this._renderer.flagRadius),this._flagRadius=!0}})}}),i.extend(r.prototype,e.prototype,{_width:0,_height:0,_radius:0,_flagWidth:!1,_flagHeight:!1,_flagRadius:!1,constructor:r,_update:function(){if(this._flagWidth||this._flagHeight||this._flagRadius){var i,r,n,s=this._width,a=this._height;this._radius instanceof t.Vector?(i=this._radius.x,r=this._radius.y):(i=this._radius,r=this._radius);var o=s/2,l=a/2;(n=this.vertices[0]).x=-(o-i),n.y=-l,(n=this.vertices[1]).x=o-i,n.y=-l,n.controls.left.clear(),n.controls.right.x=i,n.controls.right.y=0,(n=this.vertices[2]).x=o,n.y=-(l-r),n.controls.right.clear(),n.controls.left.clear(),(n=this.vertices[3]).x=o,n.y=l-r,n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=r,(n=this.vertices[4]).x=o-i,n.y=l,n.controls.right.clear(),n.controls.left.clear(),(n=this.vertices[5]).x=-(o-i),n.y=l,n.controls.left.clear(),n.controls.right.x=-i,n.controls.right.y=0,(n=this.vertices[6]).x=-o,n.y=l-r,n.controls.left.clear(),n.controls.right.clear(),(n=this.vertices[7]).x=-o,n.y=-(l-r),n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=-r,(n=this.vertices[8]).x=-(o-i),n.y=-l,n.controls.left.clear(),n.controls.right.clear(),(n=this.vertices[9]).copy(this.vertices[8])}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,e.prototype.flagReset.call(this),this},clone:function(e){var n=this.width,s=this.height,a=this.radius,o=new r(0,0,n,s,a);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,i.each(t.Path.Properties,(function(t){o[t]=this[t]}),this),e&&e.add(o),o}}),r.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.root,i=t.Utils.getComputedMatrix,r=t.Utils,n=((e.document?e.document.createElement("canvas"):(console.warn("Two.js: Unable to create canvas for Two.Text measurements."),{getContext:r.identity})).getContext("2d"),t.Text=function(e,i,n,s){if(t.Shape.call(this),this._renderer.type="text",this._renderer.flagFill=r.bind(t.Text.FlagFill,this),this._renderer.flagStroke=r.bind(t.Text.FlagStroke,this),this.value=e,r.isNumber(i)&&(this.translation.x=i),r.isNumber(n)&&(this.translation.y=n),this.dashes=[],!r.isObject(s))return this;r.each(t.Text.Properties,(function(t){t in s&&(this[t]=s[t])}),this)});r.extend(t.Text,{Ratio:.6,Properties:["value","family","size","leading","alignment","linewidth","style","className","weight","decoration","baseline","opacity","visible","fill","stroke"],FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){t.Shape.MakeObservable(e),r.each(t.Text.Properties.slice(0,13),t.Utils.defineProperty,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),r.extend(t.Text.prototype,t.Shape.prototype,{_flagValue:!0,_flagFamily:!0,_flagSize:!0,_flagLeading:!0,_flagAlignment:!0,_flagBaseline:!0,_flagStyle:!0,_flagWeight:!0,_flagDecoration:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagClassName:!0,_flagVisible:!0,_flagClip:!1,_value:"",_family:"sans-serif",_size:13,_leading:17,_alignment:"center",_baseline:"middle",_style:"normal",_weight:500,_decoration:"none",_fill:"#000",_stroke:"transparent",_linewidth:1,_opacity:1,_className:"",_visible:!0,_clip:!1,constructor:t.Text,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(e){var i=new t.Text(this.value);return i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,r.each(t.Text.Properties,(function(t){i[t]=this[t]}),this),e&&e.add(i),i._update()},toObject:function(){var e={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return r.each(t.Text.Properties,(function(t){e[t]=this[t]}),this),e},noStroke:function(){return this.stroke="transparent",this},noFill:function(){return this.fill="transparent",this},getBoundingClientRect:function(t){var e,r,s,a,o,l;this._update(!0),e=t?this._matrix:i(this);var h=this.leading,c=this.value.length*this.size*n.Ratio;switch(this.alignment){case"left":s=0,a=c;break;case"right":s=-c,a=0;break;default:s=-c/2,a=c/2}switch(this.baseline){case"top":o=0,l=h;break;case"bottom":o=-h,l=0;break;default:o=-h/2,l=h/2}return{top:o=(r=e.multiply(s,o,1)).y,left:s=r.x,right:a=(r=e.multiply(a,l,1)).x,bottom:l=r.y,width:a-s,height:l-o}},flagReset:function(){return this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=!1,t.Shape.prototype.flagReset.call(this),this}}),t.Text.MakeObservable(t.Text.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.Stop=function(t,r,n){this._renderer={},this._renderer.type="stop",this.offset=e.isNumber(t)?t:i.Index<=0?0:1,this.opacity=e.isNumber(n)?n:1,this.color=e.isString(r)?r:i.Index<=0?"#fff":"#000",i.Index=(i.Index+1)%2};e.extend(i,{Index:0,Properties:["offset","opacity","color"],MakeObservable:function(t){e.each(i.Properties,(function(t){var e="_"+t,i="_flag"+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(this,t,{enumerable:!0,get:function(){return this[e]},set:function(t){this[e]=t,this[i]=!0,this.parent&&(this.parent._flagStops=!0)}})}),t)}}),e.extend(i.prototype,t.Utils.Events,{constructor:i,clone:function(){var t=new i;return e.each(i.Properties,(function(e){t[e]=this[e]}),this),t},toObject:function(){var t={};return e.each(i.Properties,(function(e){t[e]=this[e]}),this),t},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),i.MakeObservable(i.prototype),i.prototype.constructor=i;var r=t.Gradient=function(i){this._renderer={},this._renderer.type="gradient",this.id=t.Identifier+t.uniqueId(),this.classList=[],this._renderer.flagStops=e.bind(r.FlagStops,this),this._renderer.bindStops=e.bind(r.BindStops,this),this._renderer.unbindStops=e.bind(r.UnbindStops,this),this.spread="pad",this.stops=i};e.extend(r,{Stop:i,Properties:["spread"],MakeObservable:function(i){e.each(r.Properties,t.Utils.defineProperty,i),Object.defineProperty(i,"stops",{enumerable:!0,get:function(){return this._stops},set:function(e){this._renderer.flagStops;var i=this._renderer.bindStops,r=this._renderer.unbindStops;this._stops&&this._stops.unbind(t.Events.insert,i).unbind(t.Events.remove,r),this._stops=new t.Utils.Collection((e||[]).slice(0)),this._stops.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._stops)}})},FlagStops:function(){this._flagStops=!0},BindStops:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagStops),e[i].parent=this;this._renderer.flagStops()},UnbindStops:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagStops),delete e[i].parent;this._renderer.flagStops()}}),e.extend(r.prototype,t.Utils.Events,{_flagStops:!1,_flagSpread:!1,clone:function(i){var n=e.map(this.stops,(function(t){return t.clone()})),s=new r(n);return e.each(t.Gradient.Properties,(function(t){s[t]=this[t]}),this),i&&i.add(s),s},toObject:function(){var t={stops:e.map(this.stops,(function(t){return t.toObject()}))};return e.each(r.Properties,(function(e){t[e]=this[e]}),this),t},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),r.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.LinearGradient=function(r,n,s,a,o){t.Gradient.call(this,o),this._renderer.type="linear-gradient";var l=e.bind(i.FlagEndPoints,this);this.left=(new t.Vector).bind(t.Events.change,l),this.right=(new t.Vector).bind(t.Events.change,l),e.isNumber(r)&&(this.left.x=r),e.isNumber(n)&&(this.left.y=n),e.isNumber(s)&&(this.right.x=s),e.isNumber(a)&&(this.right.y=a)};e.extend(i,{Stop:t.Gradient.Stop,MakeObservable:function(e){t.Gradient.MakeObservable(e)},FlagEndPoints:function(){this._flagEndPoints=!0}}),e.extend(i.prototype,t.Gradient.prototype,{_flagEndPoints:!1,constructor:i,clone:function(r){var n=e.map(this.stops,(function(t){return t.clone()})),s=new i(this.left._x,this.left._y,this.right._x,this.right._y,n);return e.each(t.Gradient.Properties,(function(t){s[t]=this[t]}),this),r&&r.add(s),s},toObject:function(){var e=t.Gradient.prototype.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagEndPoints=!1,t.Gradient.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.RadialGradient=function(i,r,n,s,a,o){t.Gradient.call(this,s),this._renderer.type="radial-gradient",this.center=(new t.Vector).bind(t.Events.change,e.bind((function(){this._flagCenter=!0}),this)),this.radius=e.isNumber(n)?n:20,this.focal=(new t.Vector).bind(t.Events.change,e.bind((function(){this._flagFocal=!0}),this)),e.isNumber(i)&&(this.center.x=i),e.isNumber(r)&&(this.center.y=r),this.focal.copy(this.center),e.isNumber(a)&&(this.focal.x=a),e.isNumber(o)&&(this.focal.y=o)};e.extend(i,{Stop:t.Gradient.Stop,Properties:["radius"],MakeObservable:function(r){t.Gradient.MakeObservable(r),e.each(i.Properties,t.Utils.defineProperty,r)}}),e.extend(i.prototype,t.Gradient.prototype,{_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,constructor:i,clone:function(r){var n=e.map(this.stops,(function(t){return t.clone()})),s=new i(this.center._x,this.center._y,this._radius,n,this.focal._x,this.focal._y);return e.each(t.Gradient.Properties.concat(i.Properties),(function(t){s[t]=this[t]}),this),r&&r.add(s),s},toObject:function(){var r=t.Gradient.prototype.toObject.call(this);return e.each(i.Properties,(function(t){r[t]=this[t]}),this),r.center=this.center.toObject(),r.focal=this.focal.toObject(),r},_update:function(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,t.Gradient.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==t?t:window).Two),function(t){var e,i=t.root,r=t.Utils,n={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff)$/i,effect:/texture|gradient/i};i.document&&(e=document.createElement("a"));var s=t.Texture=function(e,i){if(this._renderer={},this._renderer.type="texture",this._renderer.flagOffset=r.bind(s.FlagOffset,this),this._renderer.flagScale=r.bind(s.FlagScale,this),this.id=t.Identifier+t.uniqueId(),this.classList=[],this.offset=new t.Vector,r.isFunction(i)){var n=r.bind((function(){this.unbind(t.Events.load,n),r.isFunction(i)&&i()}),this);this.bind(t.Events.load,n)}r.isString(e)?this.src=e:r.isElement(e)&&(this.image=e),this._update()};r.extend(s,{Properties:["src","loaded","repeat"],RegularExpressions:n,ImageRegistry:new t.Registry,getAbsoluteURL:function(t){return e?(e.href=t,e.href):t},loadHeadlessBuffer:new Function("texture","loaded",['var fs = require("fs");',"var buffer = fs.readFileSync(texture.src);","texture.image.src = buffer;","loaded();"].join("\n")),getImage:function(e){var r,a=s.getAbsoluteURL(e);return s.ImageRegistry.contains(a)?s.ImageRegistry.get(a):(t.Utils.Image?(r=new t.Utils.Image,t.CanvasRenderer.Utils.shim(r,"img")):i.document?r=n.video.test(a)?document.createElement("video"):document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r)},Register:{canvas:function(t,e){t._src="#"+t.id,s.ImageRegistry.add(t.src,t.image),r.isFunction(e)&&e()},img:function(e,i){var n=function(t){r.isFunction(e.image.removeEventListener)&&(e.image.removeEventListener("load",n,!1),e.image.removeEventListener("error",a,!1)),r.isFunction(i)&&i()},a=function(i){throw r.isFunction(e.image.removeEventListener)&&(e.image.removeEventListener("load",n,!1),e.image.removeEventListener("error",a,!1)),new t.Utils.Error("unable to load "+e.src)};r.isNumber(e.image.width)&&e.image.width>0&&r.isNumber(e.image.height)&&e.image.height>0?n():r.isFunction(e.image.addEventListener)&&(e.image.addEventListener("load",n,!1),e.image.addEventListener("error",a,!1)),e._src=s.getAbsoluteURL(e._src),e.image&&e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),s.ImageRegistry.add(e.src,e.image),t.Utils.isHeadless?s.loadHeadlessBuffer(e,n):e.image.src=e.src)},video:function(e,i){var n=function(t){e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",a,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,e.image.play(),r.isFunction(i)&&i()},a=function(i){throw e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",a,!1),new t.Utils.Error("unable to load "+e.src)};if(e._src=s.getAbsoluteURL(e._src),e.image.addEventListener("canplaythrough",n,!1),e.image.addEventListener("error",a,!1),!e.image||!e.image.getAttribute("two-src")){if(t.Utils.isHeadless)throw new t.Utils.Error("video textures are not implemented in headless environments.");e.image.setAttribute("two-src",e.src),s.ImageRegistry.add(e.src,e.image),e.image.src=e.src,e.image.loop=!0,e.image.load()}}},load:function(t,e){t.src;var i=t.image,r=i&&i.nodeName.toLowerCase();t._flagImage&&(/canvas/i.test(r)?s.Register.canvas(t,e):(t._src=i.getAttribute("two-src")||i.src,s.Register[r](t,e))),t._flagSrc&&(i||(t.image=s.getImage(t.src)),r=t.image.nodeName.toLowerCase(),s.Register[r](t,e))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(e){r.each(s.Properties,t.Utils.defineProperty,e),Object.defineProperty(e,"image",{enumerable:!0,get:function(){return this._image},set:function(t){var e;switch(t&&t.nodeName.toLowerCase()){case"canvas":e="#"+t.id;break;default:e=t.src}s.ImageRegistry.contains(e)?this._image=s.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(t.Events.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(t.Events.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(e,"scale",{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagScale),this._scale=e,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagScale),this._flagScale=!0}})}}),r.extend(s.prototype,t.Utils.Events,t.Shape.prototype,{_flagSrc:!1,_flagImage:!1,_flagVideo:!1,_flagLoaded:!1,_flagRepeat:!1,_flagOffset:!1,_flagScale:!1,_src:"",_image:null,_loaded:!1,_repeat:"no-repeat",_scale:1,_offset:null,constructor:s,clone:function(){return new s(this.src)},toObject:function(){return{src:this.src,image:this.image}},_update:function(){return(this._flagSrc||this._flagImage)&&(this.trigger(t.Events.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,s.load(this,r.bind((function(){this.loaded=!0,this.trigger(t.Events.change).trigger(t.Events.load)}),this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this},flagReset:function(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagVideo=this._flagScale=this._flagOffset=!1,this}}),s.MakeObservable(s.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.Path,r=t.Rectangle,n=t.Sprite=function(r,n,s,a,o,l){i.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.noStroke(),this.noFill(),r instanceof t.Texture?this.texture=r:e.isString(r)&&(this.texture=new t.Texture(r)),this.origin=new t.Vector,this._update(),this.translation.set(n||0,s||0),e.isNumber(a)&&(this.columns=a),e.isNumber(o)&&(this.rows=o),e.isNumber(l)&&(this.frameRate=l)};e.extend(n,{Properties:["texture","columns","rows","frameRate","index"],MakeObservable:function(i){r.MakeObservable(i),e.each(n.Properties,t.Utils.defineProperty,i)}}),e.extend(n.prototype,r.prototype,{_flagTexture:!1,_flagColumns:!1,_flagRows:!1,_flagFrameRate:!1,flagIndex:!1,_amount:1,_duration:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_texture:null,_columns:1,_rows:1,_frameRate:0,_index:0,_origin:null,constructor:n,play:function(t,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=e.performance.now(),e.isNumber(t)&&(this._firstFrame=t),e.isNumber(i)&&(this._lastFrame=i),e.isFunction(r)?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){var e=new n(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(e.play(this._firstFrame,this._lastFrame),e._loop=this._loop),t&&t.add(e),e},_update:function(){var t,i,n,s,a,o,l,h,c,d=this._texture,f=this._columns,u=this._rows;if((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=this._texture),this._texture.loaded){t=(l=d.image.width)/f,i=(h=d.image.height)/u,s=this._amount,this.width!==t&&(this.width=t),this.height!==i&&(this.height=i),this._playing&&this._frameRate>0&&(e.isNaN(this._lastFrame)&&(this._lastFrame=s-1),n=e.performance.now()-this._startTime,a=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?n%=a:n=Math.min(n,a),o=e.lerp(this._firstFrame,c,n/a),(o=Math.floor(o))!==this._index&&(this._index=o,o>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var _=-t*(this._index%f)+(l-t)/2,g=-i*Math.floor(this._index/f)+(h-i)/2;_!==d.offset.x&&(d.offset.x=_),g!==d.offset.y&&(d.offset.y=g)}return r.prototype._update.call(this),this},flagReset:function(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.Path,r=t.Rectangle,n=t.ImageSequence=function(r,s,a,o){i.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this._renderer.flagTextures=e.bind(n.FlagTextures,this),this._renderer.bindTextures=e.bind(n.BindTextures,this),this._renderer.unbindTextures=e.bind(n.UnbindTextures,this),this.noStroke(),this.noFill(),this.textures=e.map(r,n.GenerateTexture,this),this.origin=new t.Vector,this._update(),this.translation.set(s||0,a||0),e.isNumber(o)?this.frameRate=o:this.frameRate=n.DefaultFrameRate};e.extend(n,{Properties:["frameRate","index"],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(i){r.MakeObservable(i),e.each(n.Properties,t.Utils.defineProperty,i),Object.defineProperty(i,"textures",{enumerable:!0,get:function(){return this._textures},set:function(e){this._renderer.flagTextures;var i=this._renderer.bindTextures,r=this._renderer.unbindTextures;this._textures&&this._textures.unbind(t.Events.insert,i).unbind(t.Events.remove,r),this._textures=new t.Utils.Collection((e||[]).slice(0)),this._textures.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._textures)}})},GenerateTexture:function(i){return i instanceof t.Texture?i:e.isString(i)?new t.Texture(i):void 0}}),e.extend(n.prototype,r.prototype,{_flagTextures:!1,_flagFrameRate:!1,_flagIndex:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_textures:null,_frameRate:0,_origin:null,constructor:n,play:function(t,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=e.performance.now(),e.isNumber(t)&&(this._firstFrame=t),e.isNumber(i)&&(this._lastFrame=i),e.isFunction(r)?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){var e=new n(this.textures,this.translation.x,this.translation.y,this.frameRate);return e._loop=this._loop,this._playing&&e.play(),t&&t.add(e),e},_update:function(){var i,n,s,a,o,l,h,c,d=this._textures;return this._flagTextures&&(this._amount=d.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,e.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=e.performance.now()-this._startTime,o=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?s%=o:s=Math.min(s,o),h=e.lerp(this._firstFrame,c,s/o),(h=Math.floor(h))!==this._index&&(this._index=h,(l=d[this._index]).loaded&&(i=l.image.width,n=l.image.height,this.width!==i&&(this.width=i),this.height!==n&&(this.height=n),this.fill=l,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!this._flagIndex&&this.fill instanceof t.Texture||((l=d[this._index]).loaded&&(i=l.image.width,n=l.image.height,this.width!==i&&(this.width=i),this.height!==n&&(this.height=n)),this.fill=l),r.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==t?t:window).Two),function(t){var e=Math.min,i=Math.max,r=t.Utils,n=function(){t.Utils.Collection.apply(this,arguments),Object.defineProperty(this,"_events",{value:{},enumerable:!1}),this.ids={},this.on(t.Events.insert,this.attach),this.on(t.Events.remove,this.detach),n.prototype.attach.apply(this,arguments)};n.prototype=new t.Utils.Collection,r.extend(n.prototype,{constructor:n,attach:function(t){for(var e=0;e=0?n.additions.splice(i,1):(n.subtractions.push(t),n._flagSubtractions=!0)),e?(t.parent=e,this.additions.push(t),void(this._flagAdditions=!0)):((i=r.indexOf(this.additions,t))>=0?this.additions.splice(i,1):(this.subtractions.push(t),this._flagSubtractions=!0),void delete t.parent))}r.extend(s,{Children:n,InsertChildren:function(t){for(var e=0;en+h?(l.beginning=1,l.ending=1):an&&sn&&a'+s.innerHTML+"":null},e.prototype.toSvgBase64=function(){var t=this.toSvgXml();return t?"data:image/svg+xml;base64,"+btoa(t):null},e.prototype.clearListner=function(){this.el.removeEventListener("mousedown",this.mouseDown),this.el.removeEventListener("touchstart",this.touchStart)},e.prototype.init=function(){return this.appendTo(this.el),this.el.addEventListener("mousedown",this.mouseDown,a(!1)),this.el.addEventListener("touchstart",this.touchStart,a(!1)),this},e.prototype.drawingStart=function(t){var e=t.x,i=t.y;this.current.set(e,i)},e.prototype.drawingMove=function(t){var e=this,i=t.x,r=t.y,n=this.el.getBoundingClientRect(),a=function(t,e){return new s.a.Vector(t-n.left,e-n.top)};if(this.line){if(this.line.linewidth!==this.penWidth||this.line.stroke!==this.penColor)return void this.drawingEnd();var o=a(i,r);this.line.vertices.push(o)}else{var l=a(this.current.x,this.current.y),h=a(i,r);this.current.set(i,r),this.line=this.makeCurve([l,h],!0),this.line.noFill().stroke=this.penColor,this.line.linewidth=this.penWidth,this.line.cap=this.strokeCap,this.line.join=this.strokeLineJoin,this.line.vertices.map((function(t){e.line&&t.addSelf(e.line.translation)})),this.line.translation.clear()}},e.prototype.drawingEnd=function(){this.line=null},e.prototype.mouseDown=function(t){t.preventDefault(),this.drawingStart({x:t.clientX,y:t.clientY}),this.el.addEventListener("mousemove",this.mouseMove,a(!1)),this.el.addEventListener("mouseup",this.mouseUp,a(!1))},e.prototype.mouseMove=function(t){t.preventDefault(),this.drawingMove({x:t.clientX,y:t.clientY})},e.prototype.mouseUp=function(t){t.preventDefault(),this.el.removeEventListener("mousemove",this.mouseMove),this.el.removeEventListener("mouseup",this.mouseUp),this.drawingEnd()},e.prototype.touchStart=function(t){t.preventDefault();var e=t.touches[0];this.drawingStart({x:e.clientX,y:e.clientY}),this.el.addEventListener("touchmove",this.touchMove,a(!1)),this.el.addEventListener("touchend",this.touchEnd,a(!1))},e.prototype.touchMove=function(t){t.preventDefault();var e=t.touches[0];this.drawingMove({x:e.clientX,y:e.clientY})},e.prototype.touchEnd=function(t){t.preventDefault(),this.el.removeEventListener("touchmove",this.touchMove),this.el.removeEventListener("touchend",this.touchEnd),this.drawingEnd()},e}(s.a),h=function(){return(h=Object.assign||function(t){for(var e,i=1,r=arguments.length;i{const e="string"==typeof t?(new DOMParser).parseFromString(t,"image/svg+xml"):t,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),r=e.querySelector("svg");return r?(["width","height","viewBox"].map(t=>{const e=r.getAttribute(t);e&&i.setAttribute(t,e)}),e.querySelectorAll("path").forEach(t=>{t.removeAttribute("transform"),i.appendChild(t)}),i):i},r=(t=!0)=>{try{const e=()=>null;return window.addEventListener("testPassive",e,{passive:t}),window.removeEventListener("testPassive",e),{passive:t}}catch(t){return!1}},n=(t,e)=>{const i=function(t){return t.children.reduce((t,e)=>{let i,r=0;return e.vertices?(e.vertices.map((t,e)=>{e>0&&(r+=i.distanceTo(t)),i=t}),[...t,r]):t},[])}(t),r=e*i.reduce((t,e)=>t+e,0);let n=0;for(let e=0;e((t,e,i)=>Math.max(Math.min(t,i),e))(((t,e,i,r,n)=>r+(t-e)/(i-e)*(n-r))(t,e,i,r,n),r,n);t.SvgAnimation=class extends e{constructor(t){super(t),this.animationStart=this.animationStart.bind(this),this.shaking=this.shaking.bind(this),this.initSvgXml=this.initSvgXml.bind(this),this.strokeAnimation=this.strokeAnimation.bind(this),this.loadScene=this.loadScene.bind(this),this.loadSvgXml=this.loadSvgXml.bind(this),this.splitEnd=this.splitEnd.bind(this),this.shakingRange=t.shakingRange||2,this.type=t.type||e.Types.canvas,this.el=t.el,this.width=t.width||this.el.clientWidth,this.height=t.height||this.el.clientHeight,this.animationStart()}shaking(){const t=()=>Math.random()*this.shakingRange-this.shakingRange/2,e=(e,i)=>{e%5==0&&this.scene.children.map(e=>{e.vertices&&e.vertices.map(e=>{e.position||(e.position=e.clone()),e.x=e.position.x+t(),e.y=e.position.y+t()})})},i=()=>this.scene.children.map(t=>{const e=t.vertices;e&&e.map(t=>{t.position&&(t.x=t.position.x,t.y=t.position.y,delete t.position)})});return this.bind("update",e).play(),()=>{this.unbind("update",e),i()}}loadScene(t){this.clear(),t.children.map(t=>{this.scene.add(t.clone())}),this.update()}loadSvgXml(t){const e=i(t);if(!e)return;const r=this.interpret(e);this.clear(),document.body.appendChild(e);const n=e.clientWidth;document.body.removeChild(e),this.scene.scale=this.width/n,r.children.map(t=>{this.scene.add(t.clone())}),this.scene.center().translation.set(this.width/2,this.height/2),this.update()}animationStart(){return this.appendTo(this.el),this}initSvgXml(t){this.clear();const e=this.interpret(t);e.subdivide(),this.scene.add(e)}strokeAnimation(){let t=0;const e=()=>{t<.9999?t+=.00625:t=0,n(this.scene,t)};return this.bind("update",e).play(),()=>this.unbind("update",e)}splitEnd(t){n(this.scene,t),this.update()}},t.SvgDrawing=class extends e{constructor(t){super(t),this.clearListner=this.clearListner.bind(this),this.toSvgXml=this.toSvgXml.bind(this),this.toSvgBase64=this.toSvgBase64.bind(this),this.drawingStart=this.drawingStart.bind(this),this.drawingMove=this.drawingMove.bind(this),this.drawingEnd=this.drawingEnd.bind(this),this.mouseUp=this.mouseUp.bind(this),this.mouseMove=this.mouseMove.bind(this),this.mouseDown=this.mouseDown.bind(this),this.touchStart=this.touchStart.bind(this),this.touchMove=this.touchMove.bind(this),this.touchEnd=this.touchEnd.bind(this),this.init.bind(this),this.line=null,this.current=new e.Vector(0,0),this.penColor=t.penColor||"#333",this.penWidth=t.penWidth||10,this.strokeCap=t.strokeCap||"round",this.strokeLineJoin=t.strokeLineJoin||"round",this.type=t.type||e.Types.svg,this.el=t.el,this.width=t.width||this.el.clientWidth,this.height=t.height||this.el.clientHeight,this.init()}toSvgXml(){const t=this.renderer.domElement,e=i(t.outerHTML);return t?''+e.innerHTML+"":null}toSvgBase64(){const t=this.toSvgXml();return t?"data:image/svg+xml;base64,"+btoa(t):null}clearListner(){this.el.removeEventListener("mousedown",this.mouseDown),this.el.removeEventListener("touchstart",this.touchStart)}init(){return this.appendTo(this.el),this.el.addEventListener("mousedown",this.mouseDown,r(!1)),this.el.addEventListener("touchstart",this.touchStart,r(!1)),this}drawingStart({x:t,y:e}){this.current.set(t,e)}drawingMove({x:t,y:i}){const r=this.el.getBoundingClientRect(),n=(t,i)=>new e.Vector(t-r.left,i-r.top);if(this.line){if(this.line.linewidth!==this.penWidth||this.line.stroke!==this.penColor)return void this.drawingEnd();const e=n(t,i);return void this.line.vertices.push(e)}const s=n(this.current.x,this.current.y),a=n(t,i);this.current.set(t,i),this.line=this.makeCurve([s,a],!0),this.line.noFill().stroke=this.penColor,this.line.linewidth=this.penWidth,this.line.cap=this.strokeCap,this.line.join=this.strokeLineJoin,this.line.vertices.map(t=>{this.line&&t.addSelf(this.line.translation)}),this.line.translation.clear()}drawingEnd(){this.line=null}mouseDown(t){t.preventDefault(),this.drawingStart({x:t.clientX,y:t.clientY}),this.el.addEventListener("mousemove",this.mouseMove,r(!1)),this.el.addEventListener("mouseup",this.mouseUp,r(!1))}mouseMove(t){t.preventDefault(),this.drawingMove({x:t.clientX,y:t.clientY})}mouseUp(t){t.preventDefault(),this.el.removeEventListener("mousemove",this.mouseMove),this.el.removeEventListener("mouseup",this.mouseUp),this.drawingEnd()}touchStart(t){t.preventDefault();const e=t.touches[0];this.drawingStart({x:e.clientX,y:e.clientY}),this.el.addEventListener("touchmove",this.touchMove,r(!1)),this.el.addEventListener("touchend",this.touchEnd,r(!1))}touchMove(t){t.preventDefault();const e=t.touches[0];this.drawingMove({x:e.clientX,y:e.clientY})}touchEnd(t){t.preventDefault(),this.el.removeEventListener("touchmove",this.touchMove),this.el.removeEventListener("touchend",this.touchEnd),this.drawingEnd()}},Object.defineProperty(t,"__esModule",{value:!0})}(e,i(2))},function(t,e,i){"use strict";i.r(e),function(t,r){var n,s,a;window.Two=function(e){var n="undefined"!=typeof window?window:void 0!==t?t:null,s=Object.prototype.toString,a={_indexAmount:0,natural:{slice:Array.prototype.slice,indexOf:Array.prototype.indexOf,keys:Object.keys,bind:Function.prototype.bind,create:Object.create},identity:function(t){return t},isArguments:function(t){return"[object Arguments]"===s.call(t)},isFunction:function(t){return"[object Function]"===s.call(t)},isString:function(t){return"[object String]"===s.call(t)},isNumber:function(t){return"[object Number]"===s.call(t)},isDate:function(t){return"[object Date]"===s.call(t)},isRegExp:function(t){return"[object RegExp]"===s.call(t)},isError:function(t){return"[object Error]"===s.call(t)},isFinite:function(t){return isFinite(t)&&!isNaN(parseFloat(t))},isNaN:function(t){return a.isNumber(t)&&t!==+t},isBoolean:function(t){return!0===t||!1===t||"[object Boolean]"===s.call(t)},isNull:function(t){return null===t},isUndefined:function(t){return void 0===t},isEmpty:function(t){return null==t||(x&&(a.isArray(t)||a.isString(t)||a.isArguments(t))?0===t.length:0===a.keys(t).length)},isElement:function(t){return!(!t||1!==t.nodeType)},isArray:Array.isArray||function(t){return"[object Array]"===s.call(t)},isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},toArray:function(t){return t?a.isArray(t)?m.call(t):x(t)?a.map(t,a.identity):a.values(t):[]},range:function(t,e,i){null==e&&(e=t||0,t=0),i=i||1;for(var r=Math.max(Math.ceil((e-t)/i),0),n=Array(r),s=0;s=0&&i<=y},b={temp:n.document?n.document.createElement("div"):{},hasEventListeners:a.isFunction(n.addEventListener),bind:function(t,e,i,r){return this.hasEventListeners?t.addEventListener(e,i,!!r):t.attachEvent("on"+e,i),b},unbind:function(t,e,i,r){return b.hasEventListeners?t.removeEventListeners(e,i,!!r):t.detachEvent("on"+e,i),b},getRequestAnimationFrame:function(){var t,e=0,i=["ms","moz","webkit","o"],r=n.requestAnimationFrame;if(!r){for(var s=0;s0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null;if(a.isNull(u))break;var g=w.Utils.decomposeMatrix(u);e.translation.set(g.translateX,g.translateY),e.rotation=g.rotation,e.scale=new w.Vector(g.scaleX,g.scaleY);var _=parseFloat((l.x+"").replace("px")),p=parseFloat((l.y+"").replace("px"));_&&(e.translation.x=_),p&&(e.translation.y=p);break;case"viewBox":w.Utils.applySvgViewBox.call(this,e,o);break;case"visible":e.visible=o;break;case"stroke-linecap":e.cap=o;break;case"stroke-linejoin":e.join=o;break;case"stroke-miterlimit":e.miter=o;break;case"stroke-width":e.linewidth=parseFloat(o);break;case"opacity":case"stroke-opacity":case"fill-opacity":e instanceof w.Group||(e.opacity=parseFloat(o));break;case"fill":case"stroke":/url\(\#.*\)/i.test(o)?e[s]=this.getById(o.replace(/url\(\#(.*)\)/i,"$1")):e[s]=/none/i.test(o)?"transparent":o;break;case"id":e.id=o;break;case"class":case"className":e.classList=o.split(" ")}return l},read:{svg:function(t){var e=w.Utils.read.g.call(this,t);t.getAttribute("viewBox");return e},g:function(t){var e,i=new w.Group;e=w.Utils.getSvgStyles.call(this,t);for(var r=0,n=t.childNodes.length;r1&&(d=1);break;case"m":case"l":case"t":g.length>2&&(d=2);break;case"s":case"q":g.length>4&&(d=4);break;case"c":g.length>6&&(d=6);break;case"a":g.length>7&&(d=7)}if(d){for(a=0,h=g.length,c=0;a0)switch(f){case"m":o="l";break;case"M":o="L"}_.push(o+g.slice(a,a+d).join(" ")),c++}l=Array.prototype.concat.apply(l,_)}else l.push(t)}));var d=[];if(a.each(l,(function(t,e){var n,l,f,g,_,p,m,v,y,x,b,S,k=t[0],E=k.toLowerCase();switch(r=(r=(r=t.slice(1).trim()).replace(/(-?\d+(?:\.\d*)?)[eE]([+\-]?\d+)/g,(function(t,e,i){return parseFloat(e)*u(10,i)}))).split(/[\s,]+|(?=\s?[+\-])/),h=k===E,E){case"z":if(e>=c)o=!0;else{l=s.x,f=s.y,n=new w.Anchor(l,f,void 0,void 0,void 0,void 0,w.Commands.close);for(e=d.length-1;e>=0;e--){var A=d[e];if(/m/i.test(A.command)){s=A;break}}}break;case"m":case"l":i=void 0,l=parseFloat(r[0]),f=parseFloat(r[1]),n=new w.Anchor(l,f,void 0,void 0,void 0,void 0,/m/i.test(E)?w.Commands.move:w.Commands.line),h&&n.addSelf(s),s=n;break;case"h":case"v":var C=/h/i.test(E)?"x":"y",R=/x/i.test(C)?"y":"x";(n=new w.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,w.Commands.line))[C]=parseFloat(r[0]),n[R]=s[R],h&&(n[C]+=s[C]),s=n;break;case"c":case"s":g=s.x,_=s.y,i||(i=new w.Vector),/c/i.test(E)?(p=parseFloat(r[0]),m=parseFloat(r[1]),v=parseFloat(r[2]),y=parseFloat(r[3]),x=parseFloat(r[4]),b=parseFloat(r[5])):(p=(S=M(s,i,h)).x,m=S.y,v=parseFloat(r[0]),y=parseFloat(r[1]),x=parseFloat(r[2]),b=parseFloat(r[3])),h&&(p+=g,m+=_,v+=g,y+=_,x+=g,b+=_),a.isObject(s.controls)||w.Anchor.AppendCurveProperties(s),s.controls.right.set(p-s.x,m-s.y),n=new w.Anchor(x,b,v-x,y-b,void 0,void 0,w.Commands.curve),s=n,i=n.controls.left;break;case"t":case"q":g=s.x,_=s.y,i||(i=new w.Vector),i.isZero()?(p=g,m=_):(p=i.x,m=i.y),/q/i.test(E)?(v=parseFloat(r[0]),y=parseFloat(r[1]),x=parseFloat(r[2]),b=parseFloat(r[3])):(v=(S=M(s,i,h)).x,y=S.y,x=parseFloat(r[0]),b=parseFloat(r[1])),h&&(p+=g,m+=_,v+=g,y+=_,x+=g,b+=_),a.isObject(s.controls)||w.Anchor.AppendCurveProperties(s),s.controls.right.set(p-s.x,m-s.y),n=new w.Anchor(x,b,v-x,y-b,void 0,void 0,w.Commands.curve),s=n,i=n.controls.left;break;case"a":g=s.x,_=s.y;var F=parseFloat(r[0]),O=parseFloat(r[1]),P=parseFloat(r[2]),U=parseFloat(r[3]),T=parseFloat(r[4]);x=parseFloat(r[5]),b=parseFloat(r[6]),h&&(x+=g,b+=_);var L=new w.Anchor(x,b);L.command=w.Commands.arc,L.rx=F,L.ry=O,L.xAxisRotation=P,L.largeArcFlag=U,L.sweepFlag=T,n=L,s=L,i=void 0}n&&(a.isArray(n)?d=d.concat(n):d.push(n))})),!(d.length<=1)){(n=new w.Path(d,o,void 0,!0).noStroke()).fill="black";var f=n.getBoundingClientRect(!0);return f.centroid={x:f.left+f.width/2,y:f.top+f.height/2},a.each(n.vertices,(function(t){t.subSelf(f.centroid)})),n.translation.addSelf(f.centroid),w.Utils.applySvgAttributes.call(this,t,n,e),n}},circle:function(t,e){var i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),n=parseFloat(t.getAttribute("r")),s=new w.Circle(i,r,n).noStroke();return s.fill="black",w.Utils.applySvgAttributes.call(this,t,s,e),s},ellipse:function(t,e){var i=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),n=parseFloat(t.getAttribute("rx")),s=parseFloat(t.getAttribute("ry")),a=new w.Ellipse(i,r,n,s).noStroke();return a.fill="black",w.Utils.applySvgAttributes.call(this,t,a,e),a},rect:function(t,e){var i=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!a.isNaN(i)||!a.isNaN(r))return w.Utils.read["rounded-rect"](t);var n=parseFloat(t.getAttribute("x"))||0,s=parseFloat(t.getAttribute("y"))||0,o=parseFloat(t.getAttribute("width")),h=parseFloat(t.getAttribute("height")),l=o/2,c=h/2,d=new w.Rectangle(n+l,s+c,o,h).noStroke();return d.fill="black",w.Utils.applySvgAttributes.call(this,t,d,e),d},"rounded-rect":function(t,e){var i=parseFloat(t.getAttribute("x"))||0,r=parseFloat(t.getAttribute("y"))||0,n=parseFloat(t.getAttribute("rx"))||0,s=parseFloat(t.getAttribute("ry"))||0,a=parseFloat(t.getAttribute("width")),o=parseFloat(t.getAttribute("height")),h=a/2,l=o/2,c=new w.Vector(n,s),d=new w.RoundedRectangle(i+h,r+l,a,o,c).noStroke();return d.fill="black",w.Utils.applySvgAttributes.call(this,t,d,e),d},line:function(t,e){var i=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),n=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),a=new w.Line(i,r,n,s).noFill();return w.Utils.applySvgAttributes.call(this,t,a,e),a},lineargradient:function(t,e){for(var i=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),n=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),o=(n+i)/2,h=(s+r)/2,l=[],c=0;c1?d[1]:void 0;if(a.isNull(_))_=(d=!!p&&p.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&d.length>1?parseFloat(d[1]):1;l.push(new w.Gradient.Stop(u,g,_))}var m=new w.LinearGradient(i-o,r-h,n-o,s-h,l);return w.Utils.applySvgAttributes.call(this,t,m,e),m},radialgradient:function(t,e){var i=parseFloat(t.getAttribute("cx"))||0,r=parseFloat(t.getAttribute("cy"))||0,n=parseFloat(t.getAttribute("r")),s=parseFloat(t.getAttribute("fx")),o=parseFloat(t.getAttribute("fy"));a.isNaN(s)&&(s=i),a.isNaN(o)&&(o=r);for(var h=c(i+s)/2,l=c(r+o)/2,d=[],f=0;f1?u[1]:void 0;if(a.isNull(m))m=(u=!!v&&v.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&u.length>1?parseFloat(u[1]):1;d.push(new w.Gradient.Stop(_,p,m))}var y=new w.RadialGradient(i-h,r-l,n,d,s-h,o-l);return w.Utils.applySvgAttributes.call(this,t,y,e),y}},subdivide:function(t,e,i,r,n,s,a,o,h){var l=(h=h||w.Utils.Curve.RecursionLimit)+1;if(c(t-a)<.001&&c(e-o)<.001)return[new w.Anchor(a,o)];for(var d=[],f=0;f>1,c=1&r?s[h++]*t(o):0;h1?Array.prototype.push.apply(this,arguments):arguments[0]&&Array.isArray(arguments[0])&&Array.prototype.push.apply(this,arguments[0])},Error:function(t){this.name="two.js",this.message=t},Events:{on:function(t,e){return this._events||(this._events={}),(this._events[t]||(this._events[t]=[])).push(e),this},off:function(t,e){if(!this._events)return this;if(!t&&!e)return this._events={},this;for(var i=t?[t]:a.keys(this._events),r=0,n=i.length;r2&&(t=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(w.Events.insert,t),this.trigger(w.Events.order)),e},sort:function(){return Array.prototype.sort.apply(this,arguments),this.trigger(w.Events.order),this},reverse:function(){return Array.prototype.reverse.apply(this,arguments),this.trigger(w.Events.order),this}});w.Utils.getAnchorsFromArcData;var k=w.Utils.getControlPoints,E=(w.Utils.getCurveFromPoints,w.Utils.solveSegmentIntersection,w.Utils.decoupleShapes,w.Utils.mod),A=w.Utils.getBackingStoreRatio,C=w.Utils.getComponentOnCubicBezier,R=(w.Utils.getCurveLength,w.Utils.integrate),M=w.Utils.getReflection;function F(){var t=document.body.getBoundingClientRect(),e=this.width=t.width,i=this.height=t.height;this.renderer.setSize(e,i,this.ratio)}function O(t,e){this.width=t,this.height=e,this.trigger(w.Events.resize,t,e)}a.extend(w.prototype,w.Utils.Events,{constructor:w,appendTo:function(t){return t.appendChild(this.renderer.domElement),this},play:function(){return w.Utils.setPlaying.call(this,!0),P.init(),this.trigger(w.Events.play)},pause:function(){return this.playing=!1,this.trigger(w.Events.pause)},update:function(){var t=!!this._lastFrame,e=v.now();t&&(this.timeDelta=parseFloat((e-this._lastFrame).toFixed(3))),this._lastFrame=e;var i=this.width,r=this.height,n=this.renderer;return i===n.width&&r===n.height||n.setSize(i,r,this.ratio),this.trigger(w.Events.update,this.frameCount,this.timeDelta),this.render()},render:function(){return this.renderer.render(),this.trigger(w.Events.render,this.frameCount++)},add:function(t){var e=t;return e instanceof Array||(e=a.toArray(arguments)),this.scene.add(e),this},remove:function(t){var e=t;return e instanceof Array||(e=a.toArray(arguments)),this.scene.remove(e),this},clear:function(){return this.scene.remove(this.scene.children),this},makeLine:function(t,e,i,r){var n=new w.Line(t,e,i,r);return this.scene.add(n),n},makeRectangle:function(t,e,i,r){var n=new w.Rectangle(t,e,i,r);return this.scene.add(n),n},makeRoundedRectangle:function(t,e,i,r,n){var s=new w.RoundedRectangle(t,e,i,r,n);return this.scene.add(s),s},makeCircle:function(t,e,i){var r=new w.Circle(t,e,i);return this.scene.add(r),r},makeEllipse:function(t,e,i,r){var n=new w.Ellipse(t,e,i,r);return this.scene.add(n),n},makeStar:function(t,e,i,r,n){var s=new w.Star(t,e,i,r,n);return this.scene.add(s),s},makeCurve:function(t){var e=arguments.length,i=t;if(!a.isArray(t)){i=[];for(var r=0;r=4?(i=arguments[0]-arguments[2],r=arguments[1]-arguments[3],Math.atan2(r,i)):(i=t.x-e.x,r=t.y-e.y,Math.atan2(r,i))},distanceBetween:function(t,e){return Math.sqrt(i.distanceBetweenSquared(t,e))},distanceBetweenSquared:function(t,e){var i=t.x-e.x,r=t.y-e.y;return i*i+r*r},MakeObservable:function(i){i.bind=i.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,"x",n),Object.defineProperty(this,"y",s),e.extend(this,r),this._bound=!0),t.Utils.Events.bind.apply(this,arguments),this}}}),e.extend(i.prototype,t.Utils.Events,{constructor:i,set:function(t,e){return this.x=t,this.y=e,this},copy:function(t){return this.x=t.x,this.y=t.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new i(this.x,this.y)},add:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x+=t,this.y+=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x+=t.x,this.y+=t.y):(this.x+=t,this.y+=i)),this},addSelf:function(t){return this.add.apply(this,arguments)},sub:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x-=t,this.y-=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x-=t.x,this.y-=t.y):(this.x-=t,this.y-=i)),this},subtract:function(){return this.sub.apply(this,arguments)},subSelf:function(t){return this.sub.apply(this,arguments)},subtractSelf:function(t){return this.sub.apply(this,arguments)},multiply:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x*=t,this.y*=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x*=t.x,this.y*=t.y):(this.x*=t,this.y*=i)),this},multiplySelf:function(t){return this.multiply.apply(this,arguments)},multiplyScalar:function(t){return this.multiply(t)},divide:function(t,i){return arguments.length<=0||(arguments.length<=1?e.isNumber(t)?(this.x/=t,this.y/=t):t&&e.isNumber(t.x)&&e.isNumber(t.y)&&(this.x/=t.x,this.y/=t.y):(this.x/=t,this.y/=i),e.isNaN(this.x)&&(this.x=0),e.isNaN(this.y)&&(this.y=0)),this},divideSelf:function(t){return this.divide.apply(this,arguments)},divideScalar:function(t){return this.divide(t)},negate:function(){return this.multiply(-1)},dot:function(t){return this.x*t.x+this.y*t.y},length:function(){return Math.sqrt(this.lengthSquared())},lengthSquared:function(){return this.x*this.x+this.y*this.y},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,e){return e=void 0===e?1e-4:e,this.distanceTo(t)0&&this.set(h)};n.extend(o,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(e,i,r){if(i.length<=3){var n=e,s=i[0]||0,a=i[1]||0,o=i[2]||0;return{x:n[0]*s+n[1]*a+n[2]*o,y:n[3]*s+n[4]*a+n[5]*o,z:n[6]*s+n[7]*a+n[8]*o}}var h=e[0],l=e[1],c=e[2],d=e[3],f=e[4],u=e[5],g=e[6],_=e[7],p=e[8],m=i[0],v=i[1],y=i[2],x=i[3],b=i[4],w=i[5],S=i[6],k=i[7],E=i[8];return(r=r||new t.Array(9))[0]=h*m+l*x+c*S,r[1]=h*v+l*b+c*k,r[2]=h*y+l*w+c*E,r[3]=d*m+f*x+u*S,r[4]=d*v+f*b+u*k,r[5]=d*y+f*w+u*E,r[6]=g*m+_*x+p*S,r[7]=g*v+_*b+p*k,r[8]=g*y+_*w+p*E,r}}),n.extend(o.prototype,t.Utils.Events,{constructor:o,manual:!1,set:function(e){var i=e;return arguments.length>1&&(i=n.toArray(arguments)),this.elements[0]=i[0],this.elements[1]=i[1],this.elements[2]=i[2],this.elements[3]=i[3],this.elements[4]=i[4],this.elements[5]=i[5],this.elements[6]=i[6],this.elements[7]=i[7],this.elements[8]=i[8],this.trigger(t.Events.change)},identity:function(){return this.elements[0]=o.Identity[0],this.elements[1]=o.Identity[1],this.elements[2]=o.Identity[2],this.elements[3]=o.Identity[3],this.elements[4]=o.Identity[4],this.elements[5]=o.Identity[5],this.elements[6]=o.Identity[6],this.elements[7]=o.Identity[7],this.elements[8]=o.Identity[8],this.trigger(t.Events.change)},multiply:function(e,i,r,n,s,a,o,h,l){var c=arguments,d=c.length;if(d<=1)return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(t.Events.change);if(d<=3)return e=e||0,i=i||0,r=r||0,{x:(s=this.elements)[0]*e+s[1]*i+s[2]*r,y:s[3]*e+s[4]*i+s[5]*r,z:s[6]*e+s[7]*i+s[8]*r};var f=this.elements,u=c,g=f[0],_=f[1],p=f[2],m=f[3],v=f[4],y=f[5],x=f[6],b=f[7],w=f[8],S=u[0],k=u[1],E=u[2],A=u[3],C=u[4],R=u[5],M=u[6],F=u[7],O=u[8];return this.elements[0]=g*S+_*A+p*M,this.elements[1]=g*k+_*C+p*F,this.elements[2]=g*E+_*R+p*O,this.elements[3]=m*S+v*A+y*M,this.elements[4]=m*k+v*C+y*F,this.elements[5]=m*E+v*R+y*O,this.elements[6]=x*S+b*A+w*M,this.elements[7]=x*k+b*C+w*F,this.elements[8]=x*E+b*R+w*O,this.trigger(t.Events.change)},inverse:function(e){var i=this.elements;e=e||new t.Matrix;var r=i[0],n=i[1],s=i[2],a=i[3],o=i[4],h=i[5],l=i[6],c=i[7],d=i[8],f=d*o-h*c,u=-d*a+h*l,g=c*a-o*l,_=r*f+n*u+s*g;return _?(_=1/_,e.elements[0]=f*_,e.elements[1]=(-d*n+s*c)*_,e.elements[2]=(h*n-s*o)*_,e.elements[3]=u*_,e.elements[4]=(d*r-s*l)*_,e.elements[5]=(-h*r+s*a)*_,e.elements[6]=g*_,e.elements[7]=(-c*r+n*l)*_,e.elements[8]=(o*r-n*a)*_,e):null},scale:function(t,e){var i=arguments.length;return i<=1&&(e=t),this.multiply(t,0,0,0,e,0,0,0,1)},rotate:function(t){var r=e(t),n=i(t);return this.multiply(r,-n,0,n,r,0,0,0,1)},translate:function(t,e){return this.multiply(1,0,t,0,1,e,0,0,1)},skewX:function(t){var e=r(t);return this.multiply(1,e,0,0,1,0,0,0,1)},skewY:function(t){var e=r(t);return this.multiply(1,0,0,e,1,0,0,0,1)},toString:function(t){return a.length=0,this.toArray(t,a),a.join(" ")},toArray:function(t,e){var i=this.elements,r=!!e,n=s(i[0]),a=s(i[1]),o=s(i[2]),h=s(i[3]),l=s(i[4]),c=s(i[5]);if(t){var d=s(i[6]),f=s(i[7]),u=s(i[8]);return r?(e[0]=n,e[1]=h,e[2]=d,e[3]=a,e[4]=l,e[5]=f,e[6]=o,e[7]=c,void(e[8]=u)):[n,h,d,a,l,f,o,c,u]}return r?(e[0]=n,e[1]=h,e[2]=a,e[3]=l,e[4]=o,void(e[5]=c)):[n,h,a,l,o,c]},clone:function(){var e,i,r,n,s,a,o,h,l;e=this.elements[0],i=this.elements[1],r=this.elements[2],n=this.elements[3],s=this.elements[4],a=this.elements[5],o=this.elements[6],h=this.elements[7],l=this.elements[8];var c=new t.Matrix(e,i,r,n,s,a,o,h,l);return c.manual=this.manual,c}})}((void 0!==t?t:window).Two),function(t){var e=t.Utils.mod,i=t.Utils.toFixed,r=t.Utils,n={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},createElement:function(t,e){var i=t,s=document.createElementNS(n.ns,i);return"svg"===i&&(e=r.defaults(e||{},{version:n.version})),r.isEmpty(e)||n.setAttributes(s,e),s},setAttributes:function(t,e){for(var i=Object.keys(e),r=0;r=o&&n&&(k.command===t.Commands.curve&&(R=s,m=k.controls&&k.controls.right||k,v=R.controls&&R.controls.left||R,k.relative?(d=i(m.x+k.x),f=i(m.y+k.y)):(d=i(m.x),f=i(m.y)),R.relative?(u=i(v.x+R.x),g=i(v.y+R.y)):(u=i(v.x),g=i(v.y)),c+=" C "+d+" "+f+" "+u+" "+g+" "+(M=i(R.x))+" "+(F=i(R.y))),k.command!==t.Commands.close&&(c+=" Z")),h+=c+" "}return h},getClip:function(t){var e=t._renderer.clip;if(!e){for(var i=t;i.parent;)i=i.parent;e=t._renderer.clip=n.createElement("clipPath"),i.defs.appendChild(e)}return e},group:{appendChild:function(t){var e=t._renderer.elem;if(e){var i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||t._clip||this.elem.appendChild(e)}},removeChild:function(t){var e=t._renderer.elem;e&&e.parentNode==this.elem&&(e.nodeName&&(t._clip||this.elem.removeChild(e)))},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){n[t._renderer.type].render.call(t,this)},render:function(t){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;this._renderer.elem||(this._renderer.elem=n.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));var e=this._matrix.manual||this._flagMatrix,i={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(var r=0;r0&&(e["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?n.setAttributes(this._renderer.elem,e):(e.id=this.id,this._renderer.elem=n.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){var r=n.getClip(this),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}return this.flagReset()}},text:{render:function(t){this._update();var e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=n.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["alignment-baseline"]=e["dominant-baseline"]=this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),n[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),n[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(e["stroke-width"]=this._linewidth),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this._className),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?n.setAttributes(this._renderer.elem,e):(e.id=this.id,this._renderer.elem=n.createElement("text",e),t.defs.appendChild(this._renderer.elem)),this._flagClip){var i=n.getClip(this),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),i.setAttribute("id",this.id),i.appendChild(r)):(i.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){e||this._update();var i={};if(this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._renderer.elem?n.setAttributes(this._renderer.elem,i):(i.id=this.id,i.gradientUnits="userSpaceOnUse",this._renderer.elem=n.createElement("linearGradient",i),t.defs.appendChild(this._renderer.elem)),this._flagStops){var r=this._renderer.elem.childNodes.length!==this.stops.length;r&&(this._renderer.elem.childNodes.length=0);for(var s=0;s0&&(s.x*=-1),s.y>0&&(s.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(s.width=0,s.height=0,o)){switch(a.width=s.width=o.width,a.height=s.height=o.height,this._repeat){case"no-repeat":s.width+=1,s.height+=1}this._scale instanceof t.Vector?(s.width*=this._scale.x,s.height*=this._scale.y):(s.width*=this._scale,s.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?r.isEmpty(a)||n.setAttributes(this._renderer.image,a):this._renderer.image=n.createElement("image",a)),this._renderer.elem?r.isEmpty(s)||n.setAttributes(this._renderer.elem,s):(s.id=this.id,s.patternUnits="userSpaceOnUse",this._renderer.elem=n.createElement("pattern",s),e.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},s=t[t.Types.svg]=function(e){this.domElement=e.domElement||n.createElement("svg"),this.scene=new t.Group,this.scene.parent=this,this.defs=n.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"};r.extend(s,{Utils:n}),r.extend(s.prototype,t.Utils.Events,{constructor:s,setSize:function(e,i){return this.width=e,this.height=i,n.setAttributes(this.domElement,{width:e,height:i}),this.trigger(t.Events.resize,e,i)},render:function(){return n.group.render.call(this.scene,this.domElement),this}})}((void 0!==t?t:window).Two),function(t){var e=t.Utils.mod,i=t.Utils.toFixed,r=t.Utils.getRatio,n=t.Utils,s=[],a=2*Math.PI,o=Math.max,h=Math.min,l=Math.abs,c=Math.sin,d=Math.cos,f=Math.acos,u=Math.sqrt,g=function(t){return 1==t[0]&&0==t[3]&&0==t[1]&&1==t[4]&&0==t[2]&&0==t[5]},_={isHidden:/(none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(t){return this[t]},t.setAttribute=function(t,e){return this[t]=e,this},t},group:{renderChild:function(t){_[t._renderer.type].render.call(t,this.ctx,!0,this.clip)},render:function(t){this._update();var e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);var r=g(e),n=this._mask;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,r||(t.save(),t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),n&&_[n._renderer.type].render.call(n,t,!0),this.opacity>0&&0!==this.scale)for(var s=0;s0&&r.setLineDash(z),r.beginPath();for(var H=0;H=S&&x&&(R=M,N=C.controls&&C.controls.right||t.Vector.zero,j=R.controls&&R.controls.left||t.Vector.zero,C._relative?(P=N.x+i(C.x),U=N.y+i(C.y)):(P=i(N.x),U=i(N.y)),R._relative?(F=j.x+i(R.x),O=j.y+i(R.y)):(F=i(j.x),O=i(j.y)),V=i(R.x),B=i(R.y),r.bezierCurveTo(P,U,F,O,V,B));break;case t.Commands.line:r.lineTo(V,B);break;case t.Commands.move:M=C,r.moveTo(V,B)}return x&&r.closePath(),z&&z.length>0&&r.setLineDash(s),I||h||(_.isHidden.test(f)||((D=f._renderer&&f._renderer.offset)&&(r.save(),r.translate(-f._renderer.offset.x,-f._renderer.offset.y),r.scale(f._renderer.scale.x,f._renderer.scale.y)),r.fill(),D&&r.restore()),_.isHidden.test(c)||((D=c._renderer&&c._renderer.offset)&&(r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(c._renderer.scale.x,c._renderer.scale.y),r.lineWidth=d/c._renderer.scale.x),r.stroke(),D&&r.restore())),G||r.restore(),I&&!h&&r.clip(),this.flagReset()}},text:{render:function(t,e,r){this._update();var s,a,o,h,l,c,d,f=this._matrix.elements,u=this._stroke,p=this._linewidth,m=this._fill,v=this._opacity*this.parent._renderer.opacity,y=this._visible,x=g(f),b=m._renderer&&m._renderer.offset&&u._renderer&&u._renderer.offset,w=this.dashes,S=this._clip;return e||y&&!S?(x||(t.save(),t.transform(f[0],f[3],f[1],f[4],f[2],f[5])),b||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=_.alignments[this._alignment]||this._alignment,t.textBaseline=this._baseline,m&&(n.isString(m)?t.fillStyle=m:(_[m._renderer.type].render.call(m,t),t.fillStyle=m._renderer.effect)),u&&(n.isString(u)?t.strokeStyle=u:(_[u._renderer.type].render.call(u,t),t.strokeStyle=u._renderer.effect)),p&&(t.lineWidth=p),n.isNumber(v)&&(t.globalAlpha=v),w&&w.length>0&&t.setLineDash(w),S||r||(_.isHidden.test(m)||(m._renderer&&m._renderer.offset?(c=i(m._renderer.scale.x),d=i(m._renderer.scale.y),t.save(),t.translate(-i(m._renderer.offset.x),-i(m._renderer.offset.y)),t.scale(c,d),s=this._size/m._renderer.scale.y,a=this._leading/m._renderer.scale.y,t.font=[this._style,this._weight,i(s)+"px/",i(a)+"px",this._family].join(" "),o=m._renderer.offset.x/m._renderer.scale.x,h=m._renderer.offset.y/m._renderer.scale.y,t.fillText(this.value,i(o),i(h)),t.restore()):t.fillText(this.value,0,0)),_.isHidden.test(u)||(u._renderer&&u._renderer.offset?(c=i(u._renderer.scale.x),d=i(u._renderer.scale.y),t.save(),t.translate(-i(u._renderer.offset.x),-i(u._renderer.offset.y)),t.scale(c,d),s=this._size/u._renderer.scale.y,a=this._leading/u._renderer.scale.y,t.font=[this._style,this._weight,i(s)+"px/",i(a)+"px",this._family].join(" "),o=u._renderer.offset.x/u._renderer.scale.x,h=u._renderer.offset.y/u._renderer.scale.y,l=p/u._renderer.scale.x,t.lineWidth=i(l),t.strokeText(this.value,i(o),i(h)),t.restore()):t.strokeText(this.value,0,0))),x||t.restore(),S&&!r&&t.clip(),this.flagReset()):this}},"linear-gradient":{render:function(t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var e=0;e1){var R=u(C);S=(s*=R)*s,k=(h*=R)*h}var M=S*A+k*E,F=u(o(0,(S*k-M)/M));f===g&&(F=-F);var O=F*s*w/h,P=-F*h*b/s,U=d(_)*O-c(_)*P+(r+p)/2,T=c(_)*O+d(_)*P+(n+v)/2,L=m(1,0,(b-O)/s,(w-P)/h);!function(i,r,n,s,o,h,l,c,d){var f=t.Utils.Curve.Tolerance.epsilon,u=l-h,g=Math.abs(u)0&&k.setLineDash(T),k.save(),k.scale(E,E),k.translate(B,I),k.beginPath();for(var G=0;G=N&&U&&(a=j,m=D.controls&&D.controls.right||t.Vector.zero,v=a.controls&&a.controls.left||t.Vector.zero,D._relative?(u=o(m.x+D.x),g=o(m.y+D.y)):(u=o(m.x),g=o(m.y)),a._relative?(d=o(v.x+a.x),f=o(v.y+a.y)):(d=o(v.x),f=o(v.y)),y=o(a.x),x=o(a.y),k.bezierCurveTo(u,g,d,f,y,x));break;case t.Commands.line:k.lineTo(y,x);break;case t.Commands.move:j=D,k.moveTo(y,x)}}U&&k.closePath(),c.isHidden.test(R)||((b=R._renderer&&R._renderer.offset)&&(k.save(),k.translate(-R._renderer.offset.x,-R._renderer.offset.y),k.scale(R._renderer.scale.x,R._renderer.scale.y)),k.fill(),b&&k.restore()),c.isHidden.test(A)||((b=A._renderer&&A._renderer.offset)&&(k.save(),k.translate(-A._renderer.offset.x,-A._renderer.offset.y),k.scale(A._renderer.scale.x,A._renderer.scale.y),k.lineWidth=C/A._renderer.scale.x),k.stroke(),b&&k.restore()),k.restore()},getBoundingClientRect:function(t,e,i){var r,n,s=1/0,a=-1/0,o=1/0,h=-1/0;t.forEach((function(t){var e,i,r,n,l,c,d=t.x,f=t.y,u=t.controls;o=Math.min(f,o),s=Math.min(d,s),a=Math.max(d,a),h=Math.max(f,h),t.controls&&(l=u.left,c=u.right,l&&c&&(e=t._relative?l.x+d:l.x,i=t._relative?l.y+f:l.y,r=t._relative?c.x+d:c.x,n=t._relative?c.y+f:c.y,e&&i&&r&&n&&(o=Math.min(i,n,o),s=Math.min(e,r,s),a=Math.max(e,r,a),h=Math.max(i,n,h))))})),l.isNumber(e)&&(o-=e,s-=e,a+=e,h+=e),r=a-s,n=h-o,i.top=o,i.left=s,i.right=a,i.bottom=h,i.width=r,i.height=n,i.centroid||(i.centroid={}),i.centroid.x=-s,i.centroid.y=-o},render:function(e,r,n){if(!this._visible||!this._opacity)return this;this._update();var a=this.parent,o=a._matrix.manual||a._flagMatrix,h=this._matrix.manual||this._flagMatrix,d=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof t.Texture&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||a._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;return(o||h)&&(this._renderer.matrix||(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,s),i(s,a._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*a._renderer.scale),d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*a._renderer.opacity,c.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),c.getTriangles(this._renderer.rect,this._renderer.triangles),c.updateBuffer.call(c,e,this,r),c.updateTexture.call(c,e,this)):(l.isString(this._fill)||this._fill._update(),l.isString(this._stroke)||this._stroke._update()),!this._clip||n?(e.bindBuffer(e.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),e.vertexAttribPointer(r.textureCoords,2,e.FLOAT,!1,0,0),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.buffer),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),this.flagReset()):void 0}},text:{updateCanvas:function(t){var e=this.canvas,i=this.ctx,r=t._renderer.scale,n=t._stroke,s=t._linewidth*r,a=t._fill,h=t._renderer.opacity||t._opacity,d=t.dashes;e.width=Math.max(Math.ceil(t._renderer.rect.width*r),1),e.height=Math.max(Math.ceil(t._renderer.rect.height*r),1);var f,u,g,_,p,m,v,y=t._renderer.rect.centroid,x=y.x,b=y.y,w=a._renderer&&a._renderer.offset&&n._renderer&&n._renderer.offset;i.clearRect(0,0,e.width,e.height),w||(i.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),i.textAlign="center",i.textBaseline="middle",a&&(l.isString(a)?i.fillStyle=a:(c[a._renderer.type].render.call(a,i,t),i.fillStyle=a._renderer.effect)),n&&(l.isString(n)?i.strokeStyle=n:(c[n._renderer.type].render.call(n,i,t),i.strokeStyle=n._renderer.effect)),s&&(i.lineWidth=s),l.isNumber(h)&&(i.globalAlpha=h),d&&d.length>0&&i.setLineDash(d),i.save(),i.scale(r,r),i.translate(x,b),c.isHidden.test(a)||(a._renderer&&a._renderer.offset?(m=o(a._renderer.scale.x),v=o(a._renderer.scale.y),i.save(),i.translate(-o(a._renderer.offset.x),-o(a._renderer.offset.y)),i.scale(m,v),f=t._size/a._renderer.scale.y,u=t._leading/a._renderer.scale.y,i.font=[t._style,t._weight,o(f)+"px/",o(u)+"px",t._family].join(" "),g=a._renderer.offset.x/a._renderer.scale.x,_=a._renderer.offset.y/a._renderer.scale.y,i.fillText(t.value,o(g),o(_)),i.restore()):i.fillText(t.value,0,0)),c.isHidden.test(n)||(n._renderer&&n._renderer.offset?(m=o(n._renderer.scale.x),v=o(n._renderer.scale.y),i.save(),i.translate(-o(n._renderer.offset.x),-o(n._renderer.offset.y)),i.scale(m,v),f=t._size/n._renderer.scale.y,u=t._leading/n._renderer.scale.y,i.font=[t._style,t._weight,o(f)+"px/",o(u)+"px",t._family].join(" "),g=n._renderer.offset.x/n._renderer.scale.x,_=n._renderer.offset.y/n._renderer.scale.y,p=s/n._renderer.scale.x,i.lineWidth=o(p),i.strokeText(t.value,o(g),o(_)),i.restore()):i.strokeText(t.value,0,0)),i.restore()},getBoundingClientRect:function(t,e){var i=c.ctx;i.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),i.textAlign="center",i.textBaseline=t._baseline;var r=i.measureText(t._value).width,n=Math.max(t._size||t._leading);this._linewidth&&!c.isHidden.test(this._stroke)&&(n+=this._linewidth);var s=r/2,a=n/2;switch(c.alignments[t._alignment]||t._alignment){case c.alignments.left:e.left=0,e.right=r;break;case c.alignments.right:e.left=-r,e.right=0;break;default:e.left=-s,e.right=s}switch(t._baseline){case"bottom":e.top=-n,e.bottom=0;break;case"top":e.top=0,e.bottom=n;break;default:e.top=-a,e.bottom=a}e.width=r,e.height=n,e.centroid||(e.centroid={}),e.centroid.x=s,e.centroid.y=a},render:function(e,r,n){if(!this._visible||!this._opacity)return this;this._update();var a=this.parent,o=a._matrix.manual||a._flagMatrix,h=this._matrix.manual||this._flagMatrix,d=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof t.Texture&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||a._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;return(o||h)&&(this._renderer.matrix||(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,s),i(s,a._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*a._renderer.scale),d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*a._renderer.opacity,c.text.getBoundingClientRect(this,this._renderer.rect),c.getTriangles(this._renderer.rect,this._renderer.triangles),c.updateBuffer.call(c,e,this,r),c.updateTexture.call(c,e,this)):(l.isString(this._fill)||this._fill._update(),l.isString(this._stroke)||this._stroke._update()),!this._clip||n?(e.bindBuffer(e.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),e.vertexAttribPointer(r.textureCoords,2,e.FLOAT,!1,0,0),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.buffer),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),this.flagReset()):void 0}},"linear-gradient":{render:function(t,e){if(t.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var i=0;i=i)return i-r>=0;r+=s}return!1}function c(t,e){var i=t._length;if(e<=0)return 0;if(e>=i)return t._lengths.length-1;for(var r=0,n=0;r=e)return e-=n,Math.max(r-1,0)+e/t._lengths[r];n+=t._lengths[r]}return-1}function d(e,i,r){var n,s,a,o,h,l,c,d,f=i.controls&&i.controls.right,u=e.controls&&e.controls.left;return n=i.x,h=i.y,s=(f||i).x,l=(f||i).y,a=(u||e).x,c=(u||e).y,o=e.x,d=e.y,f&&i._relative&&(s+=i.x,l+=i.y),u&&e._relative&&(a+=e.x,c+=e.y),t.Utils.getCurveLength(n,h,s,l,a,c,o,d,r)}function f(e,i,r){var n,s,a,o,h,l,c,d,f=i.controls&&i.controls.right,u=e.controls&&e.controls.left;return n=i.x,h=i.y,s=(f||i).x,l=(f||i).y,a=(u||e).x,c=(u||e).y,o=e.x,d=e.y,f&&i._relative&&(s+=i.x,l+=i.y),u&&e._relative&&(a+=e.x,c+=e.y),t.Utils.subdivide(n,h,s,l,a,c,o,d,r)}o.extend(h,{Properties:["fill","stroke","linewidth","opacity","className","visible","cap","join","miter","closed","curved","automatic","beginning","ending"],Utils:{getCurveLength:d},FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)},BindVertices:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){t.Shape.MakeObservable(e),o.each(h.Properties.slice(2,9),t.Utils.defineProperty,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"length",{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(e,"closed",{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}}),Object.defineProperty(e,"curved",{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}}),Object.defineProperty(e,"automatic",{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t!==this._automatic){this._automatic=!!t;var e=this._automatic?"ignore":"listen";o.each(this.vertices,(function(t){t[e]()}))}}}),Object.defineProperty(e,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}}),Object.defineProperty(e,"ending",{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}}),Object.defineProperty(e,"vertices",{enumerable:!0,get:function(){return this._collection},set:function(e){this._renderer.flagVertices;var i=this._renderer.bindVertices,r=this._renderer.unbindVertices;this._collection&&this._collection.unbind(t.Events.insert,i).unbind(t.Events.remove,r),e instanceof t.Utils.Collection?this._collection=e:this._collection=new t.Utils.Collection(e||[]),this._collection.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._collection)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),o.extend(h.prototype,t.Shape.prototype,{_flagVertices:!0,_flagLength:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagClassName:!0,_flagCap:!0,_flagJoin:!0,_flagMiter:!0,_flagClip:!1,_length:0,_fill:"#fff",_stroke:"#000",_linewidth:1,_opacity:1,_className:"",_visible:!0,_cap:"round",_join:"round",_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_clip:!1,constructor:h,clone:function(t){var e=new h;e.vertices=this.vertices;for(var i=0;i=y){this._closed?(r=t.Utils.mod(k,x),n=t.Utils.mod(k-1,x),0===k&&(r=n,n=k)):(r=k,n=Math.min(Math.max(k-1,0),b)),w=this.vertices[r],S=this.vertices[n],y-=A,e=0!==this._lengths[k]?y/this._lengths[k]:0;break}A+=this._lengths[k]}if(o.isNull(w)||o.isNull(S))return null;if(!w)return S;if(!S)return w;v=S.controls&&S.controls.right,m=w.controls&&w.controls.left,h=S.x,u=S.y,l=(v||S).x,g=(v||S).y,c=(m||w).x,_=(m||w).y,d=w.x,p=w.y,v&&S.relative&&(l+=S.x,g+=S.y),m&&w.relative&&(c+=w.x,_+=w.y),a=t.Utils.getComponentOnCubicBezier(e,h,l,c,d),f=t.Utils.getComponentOnCubicBezier(e,u,g,_,p);var C=t.Utils.lerp(h,l,e),R=t.Utils.lerp(u,g,e),M=t.Utils.lerp(l,c,e),F=t.Utils.lerp(g,_,e),O=t.Utils.lerp(c,d,e),P=t.Utils.lerp(_,p,e),U=t.Utils.lerp(C,M,e),T=t.Utils.lerp(R,F,e),L=t.Utils.lerp(M,O,e),N=t.Utils.lerp(F,P,e);return o.isObject(i)?(i.x=a,i.y=f,o.isObject(i.controls)||t.Anchor.AppendCurveProperties(i),i.controls.left.x=U,i.controls.left.y=T,i.controls.right.x=L,i.controls.right.y=N,o.isBoolean(i.relative)&&!i.relative||(i.controls.left.x-=a,i.controls.left.y-=f,i.controls.right.x-=a,i.controls.right.y-=f),i.t=e,i):((s=new t.Anchor(a,f,U-a,T-f,L-a,N-f,this._curved?t.Commands.curve:t.Commands.line)).t=e,s)},plot:function(){if(this.curved)return t.Utils.getCurveFromPoints(this._collection,this.closed),this;for(var e=0;e0&&(s[s.length-1].command=t.Commands.line),void(r=a);var l=f(a,r,e);s=s.concat(l),o.each(l,(function(e,i){i<=0&&r.command===t.Commands.move?e.command=t.Commands.move:e.command=t.Commands.line})),h>=i&&(this._closed&&this._automatic?(l=f(a,r=a,e),s=s.concat(l),o.each(l,(function(e,i){i<=0&&r.command===t.Commands.move?e.command=t.Commands.move:e.command=t.Commands.line}))):n&&s.push(new t.Anchor(a.x,a.y)),s[s.length-1].command=n?t.Commands.close:t.Commands.line),r=a}}),this),this._automatic=!1,this._curved=!1,this.vertices=s,this},_updateLength:function(e,i){i||this._update();var r=this.vertices.length,n=r-1,s=this.vertices[n],a=0;return o.isUndefined(this._lengths)&&(this._lengths=[]),o.each(this.vertices,(function(i,r){if(r<=0||i.command===t.Commands.move)return s=i,void(this._lengths[r]=0);this._lengths[r]=d(i,s,e),this._lengths[r]=t.Utils.toFixed(this._lengths[r]),a+=this._lengths[r],s=i}),this),this._length=a,this._flagLength=!1,this},_update:function(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);var e,i,s,a,o,h=this._collection.length,d=this._closed,f=Math.min(this._beginning,this._ending),u=Math.max(this._beginning,this._ending),g=c(this,f*this._length),_=c(this,u*this._length),p=r(g),m=n(_);this._renderer.vertices.length=0;for(var v=0;vm&&!i?((o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(u,o),o.command=this._renderer.collection[v].command,this._renderer.vertices.push(o),i=o,(s=this._collection[v-1])&&s.controls&&(o.controls.right.clear(),this._renderer.collection[v-1].controls.right.clear().lerp(s.controls.right,o.t))):v>=p&&v<=m&&(o=this._renderer.collection[v].copy(this._collection[v]),this._renderer.vertices.push(o),v===m&&l(this,u)?(i=o,!d&&i.controls&&i.controls.right.clear()):v===p&&l(this,f)&&((e=o).command=t.Commands.move,!d&&e.controls&&e.controls.left.clear()));p>0&&!e&&(v=p-1,(o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(f,o),o.command=t.Commands.move,this._renderer.vertices.unshift(o),e=o,(a=this._collection[v+1])&&a.controls&&(o.controls.left.clear(),this._renderer.collection[v+1].controls.left.copy(a.controls.left).lerp(t.Vector.zero,o.t)))}return t.Shape.prototype._update.apply(this,arguments),this},flagReset:function(){return this._flagVertices=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClassName=this._flagClip=!1,t.Shape.prototype.flagReset.call(this),this}}),h.MakeObservable(h.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=t.Utils,r=t.Line=function(i,r,n,s){e.call(this,[new t.Anchor(i,r),new t.Anchor(n,s)]),this.vertices[0].command=t.Commands.move,this.vertices[1].command=t.Commands.line,this.automatic=!1};i.extend(r.prototype,e.prototype),r.prototype.constructor=r,e.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=t.Utils,r=t.Rectangle=function(i,r,n,s){e.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0,!1,!0),this.width=n,this.height=s,this.origin=new t.Vector,this.translation.set(i,r),this._update()};i.extend(r,{Properties:["width","height"],MakeObservable:function(n){e.MakeObservable(n),i.each(r.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,"origin",{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(t.Events.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(t.Events.change,this._renderer.flagVertices),this._renderer.flagVertices()}})}}),i.extend(r.prototype,e.prototype,{_width:0,_height:0,_flagWidth:0,_flagHeight:0,_origin:null,constructor:r,_update:function(){if(this._flagWidth||this._flagHeight){var i=this._width/2,r=this._height/2;this.vertices[0].set(-i,-r).add(this._origin).command=t.Commands.move,this.vertices[1].set(i,-r).add(this._origin).command=t.Commands.line,this.vertices[2].set(i,r).add(this._origin).command=t.Commands.line,this.vertices[3].set(-i,r).add(this._origin).command=t.Commands.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).add(this._origin).command=t.Commands.line)}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,e.prototype.flagReset.call(this),this},clone:function(e){var n=new r(0,0,this.width,this.height);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,i.each(t.Path.Properties,(function(t){n[t]=this[t]}),this),e&&e.add(n),n}}),r.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=2*Math.PI,r=Math.PI/2,n=Math.cos,s=Math.sin,a=t.Utils,o=4/3*Math.tan(Math.PI/8),h=t.Ellipse=function(i,r,n,s,o){a.isNumber(s)||(s=n);var h=o||5,l=a.map(a.range(h),(function(e){return new t.Anchor}),this);e.call(this,l,!0,!0,!0),this.width=2*n,this.height=2*s,this._update(),this.translation.set(i,r)};a.extend(h,{Properties:["width","height"],MakeObservable:function(i){e.MakeObservable(i),a.each(h.Properties,t.Utils.defineProperty,i)}}),a.extend(h.prototype,e.prototype,{_width:0,_height:0,_flagWidth:!1,_flagHeight:!1,constructor:h,_update:function(){if(this._flagWidth||this._flagHeight)for(var a=0,h=this.vertices.length,l=h-1;as&&(this.vertices.splice(s-1,o-s),o=s);for(var h=0;h=o?this.vertices.push(new t.Anchor(c,d)):this.vertices[h].set(c,d),this.vertices[h].command=0===h?t.Commands.move:t.Commands.line}}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,e.prototype.flagReset.call(this),this},clone:function(e){var i=new a(0,0,this.radius,this.sides);return i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,s.each(t.Path.Properties,(function(t){i[t]=this[t]}),this),e&&e.add(i),i}}),a.MakeObservable(a.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=(Math.PI,2*Math.PI),r=Math.PI/2,n=(Math.cos,Math.sin,Math.abs,t.Utils),s=t.ArcSegment=function(i,r,s,a,o,h,l){var c=l||3*t.Resolution,d=n.map(n.range(c),(function(){return new t.Anchor}));e.call(this,d,!0,!1,!0),this.innerRadius=s,this.outerRadius=a,this.startAngle=o,this.endAngle=h,this._update(),this.translation.set(i,r)};function a(t,e){for(;t<0;)t+=e;return t%e}n.extend(s,{Properties:["startAngle","endAngle","innerRadius","outerRadius"],MakeObservable:function(i){e.MakeObservable(i),n.each(s.Properties,t.Utils.defineProperty,i)}}),n.extend(s.prototype,e.prototype,{_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:i,_innerRadius:0,_outerRadius:0,constructor:s,_update:function(){if(this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var n,s=this._startAngle,o=this._endAngle,h=this._innerRadius,l=this._outerRadius,c=a(s,i)===a(o,i),d=h>0,f=this.vertices,u=d?f.length/2:f.length,g=0;c?u--:d||(u-=2);for(var _=0,p=u-1;_s&&(this.vertices.splice(s-1,o-s),o=s);for(var h=0;h=o?this.vertices.push(new t.Anchor(d,f)):this.vertices[h].set(d,f),this.vertices[h].command=0===h?t.Commands.move:t.Commands.line}}return e.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,e.prototype.flagReset.call(this),this},clone:function(e){var i=this.innerRadius,r=this.outerRadius,n=this.sides,o=new a(0,0,i,r,n);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,s.each(t.Path.Properties,(function(t){o[t]=this[t]}),this),e&&e.add(o),o}}),a.MakeObservable(a.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Path,i=t.Utils,r=t.RoundedRectangle=function(n,s,a,o,h){i.isUndefined(h)&&(h=Math.floor(Math.min(a,o)/12));var l=i.map(i.range(10),(function(e){return new t.Anchor(0,0,0,0,0,0,0===e?t.Commands.move:t.Commands.curve)}));e.call(this,l),this.closed=!0,this.automatic=!1,this._renderer.flagRadius=i.bind(r.FlagRadius,this),this.width=a,this.height=o,this.radius=h,this._update(),this.translation.set(n,s)};i.extend(r,{Properties:["width","height"],FlagRadius:function(){this._flagRadius=!0},MakeObservable:function(n){e.MakeObservable(n),i.each(r.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,"radius",{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius instanceof t.Vector&&this._radius.unbind(t.Events.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof t.Vector&&this._radius.bind(t.Events.change,this._renderer.flagRadius),this._flagRadius=!0}})}}),i.extend(r.prototype,e.prototype,{_width:0,_height:0,_radius:0,_flagWidth:!1,_flagHeight:!1,_flagRadius:!1,constructor:r,_update:function(){if(this._flagWidth||this._flagHeight||this._flagRadius){var i,r,n,s=this._width,a=this._height;this._radius instanceof t.Vector?(i=this._radius.x,r=this._radius.y):(i=this._radius,r=this._radius);var o=s/2,h=a/2;(n=this.vertices[0]).x=-(o-i),n.y=-h,(n=this.vertices[1]).x=o-i,n.y=-h,n.controls.left.clear(),n.controls.right.x=i,n.controls.right.y=0,(n=this.vertices[2]).x=o,n.y=-(h-r),n.controls.right.clear(),n.controls.left.clear(),(n=this.vertices[3]).x=o,n.y=h-r,n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=r,(n=this.vertices[4]).x=o-i,n.y=h,n.controls.right.clear(),n.controls.left.clear(),(n=this.vertices[5]).x=-(o-i),n.y=h,n.controls.left.clear(),n.controls.right.x=-i,n.controls.right.y=0,(n=this.vertices[6]).x=-o,n.y=h-r,n.controls.left.clear(),n.controls.right.clear(),(n=this.vertices[7]).x=-o,n.y=-(h-r),n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=-r,(n=this.vertices[8]).x=-(o-i),n.y=-h,n.controls.left.clear(),n.controls.right.clear(),(n=this.vertices[9]).copy(this.vertices[8])}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,e.prototype.flagReset.call(this),this},clone:function(e){var n=this.width,s=this.height,a=this.radius,o=new r(0,0,n,s,a);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,i.each(t.Path.Properties,(function(t){o[t]=this[t]}),this),e&&e.add(o),o}}),r.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.root,i=t.Utils.getComputedMatrix,r=t.Utils,n=((e.document?e.document.createElement("canvas"):(console.warn("Two.js: Unable to create canvas for Two.Text measurements."),{getContext:r.identity})).getContext("2d"),t.Text=function(e,i,n,s){if(t.Shape.call(this),this._renderer.type="text",this._renderer.flagFill=r.bind(t.Text.FlagFill,this),this._renderer.flagStroke=r.bind(t.Text.FlagStroke,this),this.value=e,r.isNumber(i)&&(this.translation.x=i),r.isNumber(n)&&(this.translation.y=n),this.dashes=[],!r.isObject(s))return this;r.each(t.Text.Properties,(function(t){t in s&&(this[t]=s[t])}),this)});r.extend(t.Text,{Ratio:.6,Properties:["value","family","size","leading","alignment","linewidth","style","className","weight","decoration","baseline","opacity","visible","fill","stroke"],FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){t.Shape.MakeObservable(e),r.each(t.Text.Properties.slice(0,13),t.Utils.defineProperty,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),r.extend(t.Text.prototype,t.Shape.prototype,{_flagValue:!0,_flagFamily:!0,_flagSize:!0,_flagLeading:!0,_flagAlignment:!0,_flagBaseline:!0,_flagStyle:!0,_flagWeight:!0,_flagDecoration:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagClassName:!0,_flagVisible:!0,_flagClip:!1,_value:"",_family:"sans-serif",_size:13,_leading:17,_alignment:"center",_baseline:"middle",_style:"normal",_weight:500,_decoration:"none",_fill:"#000",_stroke:"transparent",_linewidth:1,_opacity:1,_className:"",_visible:!0,_clip:!1,constructor:t.Text,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(e){var i=new t.Text(this.value);return i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,r.each(t.Text.Properties,(function(t){i[t]=this[t]}),this),e&&e.add(i),i._update()},toObject:function(){var e={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return r.each(t.Text.Properties,(function(t){e[t]=this[t]}),this),e},noStroke:function(){return this.stroke="transparent",this},noFill:function(){return this.fill="transparent",this},getBoundingClientRect:function(t){var e,r,s,a,o,h;this._update(!0),e=t?this._matrix:i(this);var l=this.leading,c=this.value.length*this.size*n.Ratio;switch(this.alignment){case"left":s=0,a=c;break;case"right":s=-c,a=0;break;default:s=-c/2,a=c/2}switch(this.baseline){case"top":o=0,h=l;break;case"bottom":o=-l,h=0;break;default:o=-l/2,h=l/2}return{top:o=(r=e.multiply(s,o,1)).y,left:s=r.x,right:a=(r=e.multiply(a,h,1)).x,bottom:h=r.y,width:a-s,height:h-o}},flagReset:function(){return this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=!1,t.Shape.prototype.flagReset.call(this),this}}),t.Text.MakeObservable(t.Text.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.Stop=function(t,r,n){this._renderer={},this._renderer.type="stop",this.offset=e.isNumber(t)?t:i.Index<=0?0:1,this.opacity=e.isNumber(n)?n:1,this.color=e.isString(r)?r:i.Index<=0?"#fff":"#000",i.Index=(i.Index+1)%2};e.extend(i,{Index:0,Properties:["offset","opacity","color"],MakeObservable:function(t){e.each(i.Properties,(function(t){var e="_"+t,i="_flag"+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(this,t,{enumerable:!0,get:function(){return this[e]},set:function(t){this[e]=t,this[i]=!0,this.parent&&(this.parent._flagStops=!0)}})}),t)}}),e.extend(i.prototype,t.Utils.Events,{constructor:i,clone:function(){var t=new i;return e.each(i.Properties,(function(e){t[e]=this[e]}),this),t},toObject:function(){var t={};return e.each(i.Properties,(function(e){t[e]=this[e]}),this),t},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),i.MakeObservable(i.prototype),i.prototype.constructor=i;var r=t.Gradient=function(i){this._renderer={},this._renderer.type="gradient",this.id=t.Identifier+t.uniqueId(),this.classList=[],this._renderer.flagStops=e.bind(r.FlagStops,this),this._renderer.bindStops=e.bind(r.BindStops,this),this._renderer.unbindStops=e.bind(r.UnbindStops,this),this.spread="pad",this.stops=i};e.extend(r,{Stop:i,Properties:["spread"],MakeObservable:function(i){e.each(r.Properties,t.Utils.defineProperty,i),Object.defineProperty(i,"stops",{enumerable:!0,get:function(){return this._stops},set:function(e){this._renderer.flagStops;var i=this._renderer.bindStops,r=this._renderer.unbindStops;this._stops&&this._stops.unbind(t.Events.insert,i).unbind(t.Events.remove,r),this._stops=new t.Utils.Collection((e||[]).slice(0)),this._stops.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._stops)}})},FlagStops:function(){this._flagStops=!0},BindStops:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagStops),e[i].parent=this;this._renderer.flagStops()},UnbindStops:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagStops),delete e[i].parent;this._renderer.flagStops()}}),e.extend(r.prototype,t.Utils.Events,{_flagStops:!1,_flagSpread:!1,clone:function(i){var n=e.map(this.stops,(function(t){return t.clone()})),s=new r(n);return e.each(t.Gradient.Properties,(function(t){s[t]=this[t]}),this),i&&i.add(s),s},toObject:function(){var t={stops:e.map(this.stops,(function(t){return t.toObject()}))};return e.each(r.Properties,(function(e){t[e]=this[e]}),this),t},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),r.MakeObservable(r.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.LinearGradient=function(r,n,s,a,o){t.Gradient.call(this,o),this._renderer.type="linear-gradient";var h=e.bind(i.FlagEndPoints,this);this.left=(new t.Vector).bind(t.Events.change,h),this.right=(new t.Vector).bind(t.Events.change,h),e.isNumber(r)&&(this.left.x=r),e.isNumber(n)&&(this.left.y=n),e.isNumber(s)&&(this.right.x=s),e.isNumber(a)&&(this.right.y=a)};e.extend(i,{Stop:t.Gradient.Stop,MakeObservable:function(e){t.Gradient.MakeObservable(e)},FlagEndPoints:function(){this._flagEndPoints=!0}}),e.extend(i.prototype,t.Gradient.prototype,{_flagEndPoints:!1,constructor:i,clone:function(r){var n=e.map(this.stops,(function(t){return t.clone()})),s=new i(this.left._x,this.left._y,this.right._x,this.right._y,n);return e.each(t.Gradient.Properties,(function(t){s[t]=this[t]}),this),r&&r.add(s),s},toObject:function(){var e=t.Gradient.prototype.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagEndPoints=!1,t.Gradient.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.RadialGradient=function(i,r,n,s,a,o){t.Gradient.call(this,s),this._renderer.type="radial-gradient",this.center=(new t.Vector).bind(t.Events.change,e.bind((function(){this._flagCenter=!0}),this)),this.radius=e.isNumber(n)?n:20,this.focal=(new t.Vector).bind(t.Events.change,e.bind((function(){this._flagFocal=!0}),this)),e.isNumber(i)&&(this.center.x=i),e.isNumber(r)&&(this.center.y=r),this.focal.copy(this.center),e.isNumber(a)&&(this.focal.x=a),e.isNumber(o)&&(this.focal.y=o)};e.extend(i,{Stop:t.Gradient.Stop,Properties:["radius"],MakeObservable:function(r){t.Gradient.MakeObservable(r),e.each(i.Properties,t.Utils.defineProperty,r)}}),e.extend(i.prototype,t.Gradient.prototype,{_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,constructor:i,clone:function(r){var n=e.map(this.stops,(function(t){return t.clone()})),s=new i(this.center._x,this.center._y,this._radius,n,this.focal._x,this.focal._y);return e.each(t.Gradient.Properties.concat(i.Properties),(function(t){s[t]=this[t]}),this),r&&r.add(s),s},toObject:function(){var r=t.Gradient.prototype.toObject.call(this);return e.each(i.Properties,(function(t){r[t]=this[t]}),this),r.center=this.center.toObject(),r.focal=this.focal.toObject(),r},_update:function(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,t.Gradient.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==t?t:window).Two),function(t){var e,i=t.root,r=t.Utils,n={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff)$/i,effect:/texture|gradient/i};i.document&&(e=document.createElement("a"));var s=t.Texture=function(e,i){if(this._renderer={},this._renderer.type="texture",this._renderer.flagOffset=r.bind(s.FlagOffset,this),this._renderer.flagScale=r.bind(s.FlagScale,this),this.id=t.Identifier+t.uniqueId(),this.classList=[],this.offset=new t.Vector,r.isFunction(i)){var n=r.bind((function(){this.unbind(t.Events.load,n),r.isFunction(i)&&i()}),this);this.bind(t.Events.load,n)}r.isString(e)?this.src=e:r.isElement(e)&&(this.image=e),this._update()};r.extend(s,{Properties:["src","loaded","repeat"],RegularExpressions:n,ImageRegistry:new t.Registry,getAbsoluteURL:function(t){return e?(e.href=t,e.href):t},loadHeadlessBuffer:new Function("texture","loaded",['var fs = require("fs");',"var buffer = fs.readFileSync(texture.src);","texture.image.src = buffer;","loaded();"].join("\n")),getImage:function(e){var r,a=s.getAbsoluteURL(e);return s.ImageRegistry.contains(a)?s.ImageRegistry.get(a):(t.Utils.Image?(r=new t.Utils.Image,t.CanvasRenderer.Utils.shim(r,"img")):i.document?r=n.video.test(a)?document.createElement("video"):document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r)},Register:{canvas:function(t,e){t._src="#"+t.id,s.ImageRegistry.add(t.src,t.image),r.isFunction(e)&&e()},img:function(e,i){var n=function(t){r.isFunction(e.image.removeEventListener)&&(e.image.removeEventListener("load",n,!1),e.image.removeEventListener("error",a,!1)),r.isFunction(i)&&i()},a=function(i){throw r.isFunction(e.image.removeEventListener)&&(e.image.removeEventListener("load",n,!1),e.image.removeEventListener("error",a,!1)),new t.Utils.Error("unable to load "+e.src)};r.isNumber(e.image.width)&&e.image.width>0&&r.isNumber(e.image.height)&&e.image.height>0?n():r.isFunction(e.image.addEventListener)&&(e.image.addEventListener("load",n,!1),e.image.addEventListener("error",a,!1)),e._src=s.getAbsoluteURL(e._src),e.image&&e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),s.ImageRegistry.add(e.src,e.image),t.Utils.isHeadless?s.loadHeadlessBuffer(e,n):e.image.src=e.src)},video:function(e,i){var n=function(t){e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",a,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,e.image.play(),r.isFunction(i)&&i()},a=function(i){throw e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",a,!1),new t.Utils.Error("unable to load "+e.src)};if(e._src=s.getAbsoluteURL(e._src),e.image.addEventListener("canplaythrough",n,!1),e.image.addEventListener("error",a,!1),!e.image||!e.image.getAttribute("two-src")){if(t.Utils.isHeadless)throw new t.Utils.Error("video textures are not implemented in headless environments.");e.image.setAttribute("two-src",e.src),s.ImageRegistry.add(e.src,e.image),e.image.src=e.src,e.image.loop=!0,e.image.load()}}},load:function(t,e){t.src;var i=t.image,r=i&&i.nodeName.toLowerCase();t._flagImage&&(/canvas/i.test(r)?s.Register.canvas(t,e):(t._src=i.getAttribute("two-src")||i.src,s.Register[r](t,e))),t._flagSrc&&(i||(t.image=s.getImage(t.src)),r=t.image.nodeName.toLowerCase(),s.Register[r](t,e))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(e){r.each(s.Properties,t.Utils.defineProperty,e),Object.defineProperty(e,"image",{enumerable:!0,get:function(){return this._image},set:function(t){var e;switch(t&&t.nodeName.toLowerCase()){case"canvas":e="#"+t.id;break;default:e=t.src}s.ImageRegistry.contains(e)?this._image=s.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(t.Events.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(t.Events.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(e,"scale",{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagScale),this._scale=e,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagScale),this._flagScale=!0}})}}),r.extend(s.prototype,t.Utils.Events,t.Shape.prototype,{_flagSrc:!1,_flagImage:!1,_flagVideo:!1,_flagLoaded:!1,_flagRepeat:!1,_flagOffset:!1,_flagScale:!1,_src:"",_image:null,_loaded:!1,_repeat:"no-repeat",_scale:1,_offset:null,constructor:s,clone:function(){return new s(this.src)},toObject:function(){return{src:this.src,image:this.image}},_update:function(){return(this._flagSrc||this._flagImage)&&(this.trigger(t.Events.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,s.load(this,r.bind((function(){this.loaded=!0,this.trigger(t.Events.change).trigger(t.Events.load)}),this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this},flagReset:function(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagVideo=this._flagScale=this._flagOffset=!1,this}}),s.MakeObservable(s.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.Path,r=t.Rectangle,n=t.Sprite=function(r,n,s,a,o,h){i.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.noStroke(),this.noFill(),r instanceof t.Texture?this.texture=r:e.isString(r)&&(this.texture=new t.Texture(r)),this.origin=new t.Vector,this._update(),this.translation.set(n||0,s||0),e.isNumber(a)&&(this.columns=a),e.isNumber(o)&&(this.rows=o),e.isNumber(h)&&(this.frameRate=h)};e.extend(n,{Properties:["texture","columns","rows","frameRate","index"],MakeObservable:function(i){r.MakeObservable(i),e.each(n.Properties,t.Utils.defineProperty,i)}}),e.extend(n.prototype,r.prototype,{_flagTexture:!1,_flagColumns:!1,_flagRows:!1,_flagFrameRate:!1,flagIndex:!1,_amount:1,_duration:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_texture:null,_columns:1,_rows:1,_frameRate:0,_index:0,_origin:null,constructor:n,play:function(t,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=e.performance.now(),e.isNumber(t)&&(this._firstFrame=t),e.isNumber(i)&&(this._lastFrame=i),e.isFunction(r)?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){var e=new n(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(e.play(this._firstFrame,this._lastFrame),e._loop=this._loop),t&&t.add(e),e},_update:function(){var t,i,n,s,a,o,h,l,c,d=this._texture,f=this._columns,u=this._rows;if((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=this._texture),this._texture.loaded){t=(h=d.image.width)/f,i=(l=d.image.height)/u,s=this._amount,this.width!==t&&(this.width=t),this.height!==i&&(this.height=i),this._playing&&this._frameRate>0&&(e.isNaN(this._lastFrame)&&(this._lastFrame=s-1),n=e.performance.now()-this._startTime,a=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?n%=a:n=Math.min(n,a),o=e.lerp(this._firstFrame,c,n/a),(o=Math.floor(o))!==this._index&&(this._index=o,o>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var g=-t*(this._index%f)+(h-t)/2,_=-i*Math.floor(this._index/f)+(l-i)/2;g!==d.offset.x&&(d.offset.x=g),_!==d.offset.y&&(d.offset.y=_)}return r.prototype._update.call(this),this},flagReset:function(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==t?t:window).Two),function(t){var e=t.Utils,i=t.Path,r=t.Rectangle,n=t.ImageSequence=function(r,s,a,o){i.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this._renderer.flagTextures=e.bind(n.FlagTextures,this),this._renderer.bindTextures=e.bind(n.BindTextures,this),this._renderer.unbindTextures=e.bind(n.UnbindTextures,this),this.noStroke(),this.noFill(),this.textures=e.map(r,n.GenerateTexture,this),this.origin=new t.Vector,this._update(),this.translation.set(s||0,a||0),e.isNumber(o)?this.frameRate=o:this.frameRate=n.DefaultFrameRate};e.extend(n,{Properties:["frameRate","index"],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(i){r.MakeObservable(i),e.each(n.Properties,t.Utils.defineProperty,i),Object.defineProperty(i,"textures",{enumerable:!0,get:function(){return this._textures},set:function(e){this._renderer.flagTextures;var i=this._renderer.bindTextures,r=this._renderer.unbindTextures;this._textures&&this._textures.unbind(t.Events.insert,i).unbind(t.Events.remove,r),this._textures=new t.Utils.Collection((e||[]).slice(0)),this._textures.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._textures)}})},GenerateTexture:function(i){return i instanceof t.Texture?i:e.isString(i)?new t.Texture(i):void 0}}),e.extend(n.prototype,r.prototype,{_flagTextures:!1,_flagFrameRate:!1,_flagIndex:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_textures:null,_frameRate:0,_origin:null,constructor:n,play:function(t,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=e.performance.now(),e.isNumber(t)&&(this._firstFrame=t),e.isNumber(i)&&(this._lastFrame=i),e.isFunction(r)?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){var e=new n(this.textures,this.translation.x,this.translation.y,this.frameRate);return e._loop=this._loop,this._playing&&e.play(),t&&t.add(e),e},_update:function(){var i,n,s,a,o,h,l,c,d=this._textures;return this._flagTextures&&(this._amount=d.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,e.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=e.performance.now()-this._startTime,o=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?s%=o:s=Math.min(s,o),l=e.lerp(this._firstFrame,c,s/o),(l=Math.floor(l))!==this._index&&(this._index=l,(h=d[this._index]).loaded&&(i=h.image.width,n=h.image.height,this.width!==i&&(this.width=i),this.height!==n&&(this.height=n),this.fill=h,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!this._flagIndex&&this.fill instanceof t.Texture||((h=d[this._index]).loaded&&(i=h.image.width,n=h.image.height,this.width!==i&&(this.width=i),this.height!==n&&(this.height=n)),this.fill=h),r.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==t?t:window).Two),function(t){var e=Math.min,i=Math.max,r=t.Utils,n=function(){t.Utils.Collection.apply(this,arguments),Object.defineProperty(this,"_events",{value:{},enumerable:!1}),this.ids={},this.on(t.Events.insert,this.attach),this.on(t.Events.remove,this.detach),n.prototype.attach.apply(this,arguments)};n.prototype=new t.Utils.Collection,r.extend(n.prototype,{constructor:n,attach:function(t){for(var e=0;e=0?n.additions.splice(i,1):(n.subtractions.push(t),n._flagSubtractions=!0)),e?(t.parent=e,this.additions.push(t),void(this._flagAdditions=!0)):((i=r.indexOf(this.additions,t))>=0?this.additions.splice(i,1):(this.subtractions.push(t),this._flagSubtractions=!0),void delete t.parent))}r.extend(s,{Children:n,InsertChildren:function(t){for(var e=0;en+l?(h.beginning=1,h.ending=1):an&&sn&&a void; diff --git a/lib/useDrawing.js b/lib/useDrawing.js index e1c9e18e..0775f5f2 100644 --- a/lib/useDrawing.js +++ b/lib/useDrawing.js @@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () { return __assign.apply(this, arguments); }; import { useRef, useEffect, useCallback } from 'react'; -import { SvgDrawing } from 'svg-drawing/lib/SvgDrawing'; +import { SvgDrawing } from 'svg-drawing'; import { downloadBlob } from './utils/downloadBlob'; export var useSvgDrawing = function (option) { var renderRef = useRef(null); diff --git a/package.json b/package.json index c7c528ec..94a177ea 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "release": "release-it" }, "dependencies": { - "svg-drawing": "1.6.1", + "svg-drawing": "1.8.6", "two.js": "0.7.0-beta.3" }, "peerDependencies": { diff --git a/src/useDrawing.ts b/src/useDrawing.ts index 6dcf4868..727be7b6 100644 --- a/src/useDrawing.ts +++ b/src/useDrawing.ts @@ -1,6 +1,6 @@ import React, { useRef, useEffect, useCallback, MutableRefObject } from 'react' import Two from 'two.js' -import { SvgDrawing, DrawingOption } from 'svg-drawing/lib/SvgDrawing' +import { SvgDrawing, DrawingOption } from 'svg-drawing' import { downloadBlob } from './utils/downloadBlob' interface UseSvgDrawing { diff --git a/yarn.lock b/yarn.lock index 87a82567..c8506aac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9013,12 +9013,10 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -svg-drawing@1.6.1: - version "1.6.1" - resolved "https://registry.npmjs.org/svg-drawing/-/svg-drawing-1.6.1.tgz#cd311a035e0292e40becf0759e89b20417657fe0" - integrity sha512-Re/7HdNYKoDwtTqOYv9rpr+Qw23ajOisanyzSm7yK2sy+rlLhAl3rf909GTx8uaT1PzANjszqALmtm1XOKGGIw== - dependencies: - two.js "0.7.0-beta.3" +svg-drawing@1.8.6: + version "1.8.6" + resolved "https://registry.npmjs.org/svg-drawing/-/svg-drawing-1.8.6.tgz#62446806105cee0a5b1a7b98bf5f70639dee539c" + integrity sha512-Vx8RWUk6ilgu67+XDh0QnH2gUPbvab6NCU+bxS3oHCaquSuMl5tY1C75PBFNjgUSs4OwBHVk+cHbu1ljTeHKKw== symbol-tree@^3.2.2: version "3.2.2"