From 9b295eaa99c275bd061921230a41cb7d8cdf1f99 Mon Sep 17 00:00:00 2001 From: kmkzt Date: Thu, 30 May 2019 01:12:18 +0900 Subject: [PATCH] build: update build --- docs/main.bundle.js | 10 +++++----- docs/main.bundle.js.map | 2 +- lib/SvgAnimation.d.ts | 2 ++ lib/SvgAnimation.js | 28 ++++++++++++++++++++++++++++ lib/index.min.js | 2 +- lib/utils/svgFormatting.d.ts | 2 +- lib/utils/svgFormatting.js | 7 ++++--- 7 files changed, 42 insertions(+), 11 deletions(-) diff --git a/docs/main.bundle.js b/docs/main.bundle.js index f961c383a..7b1e86314 100644 --- a/docs/main.bundle.js +++ b/docs/main.bundle.js @@ -1,9 +1,9 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t,n){"use strict";e.exports=n(6)},function(e,t,n){"use strict";(function(e,r){var i,a,s;window.Two=function(t){var i="undefined"!=typeof window?window:void 0!==e?e:null,a=Object.prototype.toString,s={_indexAmount:0,natural:{slice:Array.prototype.slice,indexOf:Array.prototype.indexOf,keys:Object.keys,bind:Function.prototype.bind,create:Object.create},identity:function(e){return e},isArguments:function(e){return"[object Arguments]"===a.call(e)},isFunction:function(e){return"[object Function]"===a.call(e)},isString:function(e){return"[object String]"===a.call(e)},isNumber:function(e){return"[object Number]"===a.call(e)},isDate:function(e){return"[object Date]"===a.call(e)},isRegExp:function(e){return"[object RegExp]"===a.call(e)},isError:function(e){return"[object Error]"===a.call(e)},isFinite:function(e){return isFinite(e)&&!isNaN(parseFloat(e))},isNaN:function(e){return s.isNumber(e)&&e!==+e},isBoolean:function(e){return!0===e||!1===e||"[object Boolean]"===a.call(e)},isNull:function(e){return null===e},isUndefined:function(e){return void 0===e},isEmpty:function(e){return null==e||(b&&(s.isArray(e)||s.isString(e)||s.isArguments(e))?0===e.length:0===s.keys(e).length)},isElement:function(e){return!(!e||1!==e.nodeType)},isArray:Array.isArray||function(e){return"[object Array]"===a.call(e)},isObject:function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},toArray:function(e){return e?s.isArray(e)?_.call(e):b(e)?s.map(e,s.identity):s.values(e):[]},range:function(e,t,n){null==t&&(t=e||0,e=0),n=n||1;for(var r=Math.max(Math.ceil((t-e)/n),0),i=Array(r),a=0;a=0&&n<=y},x={temp:i.document?i.document.createElement("div"):{},hasEventListeners:s.isFunction(i.addEventListener),bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),x},unbind:function(e,t,n,r){return x.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),x},getRequestAnimationFrame:function(){var e,t=0,n=["ms","moz","webkit","o"],r=i.requestAnimationFrame;if(!r){for(var a=0;a0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null;if(s.isNull(d))break;var p=w.Utils.decomposeMatrix(d);t.translation.set(p.translateX,p.translateY),t.rotation=p.rotation,t.scale=new w.Vector(p.scaleX,p.scaleY);var g=parseFloat((u.x+"").replace("px")),m=parseFloat((u.y+"").replace("px"));g&&(t.translation.x=g),m&&(t.translation.y=m);break;case"viewBox":w.Utils.applySvgViewBox.call(this,t,o);break;case"visible":t.visible=o;break;case"stroke-linecap":t.cap=o;break;case"stroke-linejoin":t.join=o;break;case"stroke-miterlimit":t.miter=o;break;case"stroke-width":t.linewidth=parseFloat(o);break;case"opacity":case"stroke-opacity":case"fill-opacity":t instanceof w.Group||(t.opacity=parseFloat(o));break;case"fill":case"stroke":/url\(\#.*\)/i.test(o)?t[a]=this.getById(o.replace(/url\(\#(.*)\)/i,"$1")):t[a]=/none/i.test(o)?"transparent":o;break;case"id":t.id=o;break;case"class":case"className":t.classList=o.split(" ")}return u},read:{svg:function(e){var t=w.Utils.read.g.call(this,e);e.getAttribute("viewBox");return t},g:function(e){var t,n=new w.Group;t=w.Utils.getSvgStyles.call(this,e);for(var r=0,i=e.childNodes.length;r1&&(h=1);break;case"m":case"l":case"t":p.length>2&&(h=2);break;case"s":case"q":p.length>4&&(h=4);break;case"c":p.length>6&&(h=6);break;case"a":p.length>7&&(h=7)}if(h){for(s=0,l=p.length,c=0;s0)switch(f){case"m":o="l";break;case"M":o="L"}g.push(o+p.slice(s,s+h).join(" ")),c++}u=Array.prototype.concat.apply(u,g)}else u.push(e)});var h=[];if(s.each(u,function(e,t){var i,u,f,p,g,m,_,v,y,b,x,k,S=e[0],E=S.toLowerCase();switch(r=(r=(r=e.slice(1).trim()).replace(/(-?\d+(?:\.\d*)?)[eE]([+\-]?\d+)/g,function(e,t,n){return parseFloat(t)*d(10,n)})).split(/[\s,]+|(?=\s?[+\-])/),l=S===E,E){case"z":if(t>=c)o=!0;else{u=a.x,f=a.y,i=new w.Anchor(u,f,void 0,void 0,void 0,void 0,w.Commands.close);for(t=h.length-1;t>=0;t--){var C=h[t];if(/m/i.test(C.command)){a=C;break}}}break;case"m":case"l":n=void 0,u=parseFloat(r[0]),f=parseFloat(r[1]),i=new w.Anchor(u,f,void 0,void 0,void 0,void 0,/m/i.test(E)?w.Commands.move:w.Commands.line),l&&i.addSelf(a),a=i;break;case"h":case"v":var T=/h/i.test(E)?"x":"y",P=/x/i.test(T)?"y":"x";(i=new w.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,w.Commands.line))[T]=parseFloat(r[0]),i[P]=a[P],l&&(i[T]+=a[T]),a=i;break;case"c":case"s":p=a.x,g=a.y,n||(n=new w.Vector),/c/i.test(E)?(m=parseFloat(r[0]),_=parseFloat(r[1]),v=parseFloat(r[2]),y=parseFloat(r[3]),b=parseFloat(r[4]),x=parseFloat(r[5])):(m=(k=R(a,n,l)).x,_=k.y,v=parseFloat(r[0]),y=parseFloat(r[1]),b=parseFloat(r[2]),x=parseFloat(r[3])),l&&(m+=p,_+=g,v+=p,y+=g,b+=p,x+=g),s.isObject(a.controls)||w.Anchor.AppendCurveProperties(a),a.controls.right.set(m-a.x,_-a.y),i=new w.Anchor(b,x,v-b,y-x,void 0,void 0,w.Commands.curve),a=i,n=i.controls.left;break;case"t":case"q":p=a.x,g=a.y,n||(n=new w.Vector),n.isZero()?(m=p,_=g):(m=n.x,_=n.y),/q/i.test(E)?(v=parseFloat(r[0]),y=parseFloat(r[1]),b=parseFloat(r[2]),x=parseFloat(r[3])):(v=(k=R(a,n,l)).x,y=k.y,b=parseFloat(r[0]),x=parseFloat(r[1])),l&&(m+=p,_+=g,v+=p,y+=g,b+=p,x+=g),s.isObject(a.controls)||w.Anchor.AppendCurveProperties(a),a.controls.right.set(m-a.x,_-a.y),i=new w.Anchor(b,x,v-b,y-x,void 0,void 0,w.Commands.curve),a=i,n=i.controls.left;break;case"a":p=a.x,g=a.y;var A=parseFloat(r[0]),O=parseFloat(r[1]),M=parseFloat(r[2]),F=parseFloat(r[3]),N=parseFloat(r[4]);b=parseFloat(r[5]),x=parseFloat(r[6]),l&&(b+=p,x+=g);var U=new w.Anchor(b,x);U.command=w.Commands.arc,U.rx=A,U.ry=O,U.xAxisRotation=M,U.largeArcFlag=F,U.sweepFlag=N,i=U,a=U,n=void 0}i&&(s.isArray(i)?h=h.concat(i):h.push(i))}),!(h.length<=1)){(i=new w.Path(h,o,void 0,!0).noStroke()).fill="black";var f=i.getBoundingClientRect(!0);return f.centroid={x:f.left+f.width/2,y:f.top+f.height/2},s.each(i.vertices,function(e){e.subSelf(f.centroid)}),i.translation.addSelf(f.centroid),w.Utils.applySvgAttributes.call(this,e,i,t),i}},circle:function(e,t){var n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),i=parseFloat(e.getAttribute("r")),a=new w.Circle(n,r,i).noStroke();return a.fill="black",w.Utils.applySvgAttributes.call(this,e,a,t),a},ellipse:function(e,t){var n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),i=parseFloat(e.getAttribute("rx")),a=parseFloat(e.getAttribute("ry")),s=new w.Ellipse(n,r,i,a).noStroke();return s.fill="black",w.Utils.applySvgAttributes.call(this,e,s,t),s},rect:function(e,t){var n=parseFloat(e.getAttribute("rx")),r=parseFloat(e.getAttribute("ry"));if(!s.isNaN(n)||!s.isNaN(r))return w.Utils.read["rounded-rect"](e);var i=parseFloat(e.getAttribute("x"))||0,a=parseFloat(e.getAttribute("y"))||0,o=parseFloat(e.getAttribute("width")),l=parseFloat(e.getAttribute("height")),u=o/2,c=l/2,h=new w.Rectangle(i+u,a+c,o,l).noStroke();return h.fill="black",w.Utils.applySvgAttributes.call(this,e,h,t),h},"rounded-rect":function(e,t){var n=parseFloat(e.getAttribute("x"))||0,r=parseFloat(e.getAttribute("y"))||0,i=parseFloat(e.getAttribute("rx"))||0,a=parseFloat(e.getAttribute("ry"))||0,s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),l=s/2,u=o/2,c=new w.Vector(i,a),h=new w.RoundedRectangle(n+l,r+u,s,o,c).noStroke();return h.fill="black",w.Utils.applySvgAttributes.call(this,e,h,t),h},line:function(e,t){var n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),i=parseFloat(e.getAttribute("x2")),a=parseFloat(e.getAttribute("y2")),s=new w.Line(n,r,i,a).noFill();return w.Utils.applySvgAttributes.call(this,e,s,t),s},lineargradient:function(e,t){for(var n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),i=parseFloat(e.getAttribute("x2")),a=parseFloat(e.getAttribute("y2")),o=(i+n)/2,l=(a+r)/2,u=[],c=0;c1?h[1]:void 0;if(s.isNull(g))g=(h=!!m&&m.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&h.length>1?parseFloat(h[1]):1;u.push(new w.Gradient.Stop(d,p,g))}var _=new w.LinearGradient(n-o,r-l,i-o,a-l,u);return w.Utils.applySvgAttributes.call(this,e,_,t),_},radialgradient:function(e,t){var n=parseFloat(e.getAttribute("cx"))||0,r=parseFloat(e.getAttribute("cy"))||0,i=parseFloat(e.getAttribute("r")),a=parseFloat(e.getAttribute("fx")),o=parseFloat(e.getAttribute("fy"));s.isNaN(a)&&(a=n),s.isNaN(o)&&(o=r);for(var l=c(n+a)/2,u=c(r+o)/2,h=[],f=0;f1?d[1]:void 0;if(s.isNull(_))_=(d=!!v&&v.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&d.length>1?parseFloat(d[1]):1;h.push(new w.Gradient.Stop(g,m,_))}var y=new w.RadialGradient(n-l,r-u,i,h,a-l,o-u);return w.Utils.applySvgAttributes.call(this,e,y,t),y}},subdivide:function(e,t,n,r,i,a,s,o,l){var u=(l=l||w.Utils.Curve.RecursionLimit)+1;if(c(e-s)<.001&&c(t-o)<.001)return[new w.Anchor(s,o)];for(var h=[],f=0;f>1,c=1&r?a[l++]*e(o):0;l1?Array.prototype.push.apply(this,arguments):arguments[0]&&Array.isArray(arguments[0])&&Array.prototype.push.apply(this,arguments[0])},Error:function(e){this.name="two.js",this.message=e},Events:{on:function(e,t){return this._events||(this._events={}),(this._events[e]||(this._events[e]=[])).push(t),this},off:function(e,t){if(!this._events)return this;if(!e&&!t)return this._events={},this;for(var n=e?[e]:s.keys(this._events),r=0,i=n.length;r2&&(e=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(w.Events.insert,e),this.trigger(w.Events.order)),t},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),C=w.Utils.getBackingStoreRatio,T=w.Utils.getComponentOnCubicBezier,P=(w.Utils.getCurveLength,w.Utils.integrate),R=w.Utils.getReflection;function A(){var e=document.body.getBoundingClientRect(),t=this.width=e.width,n=this.height=e.height;this.renderer.setSize(t,n,this.ratio)}function O(e,t){this.width=e,this.height=t,this.trigger(w.Events.resize,e,t)}s.extend(w.prototype,w.Utils.Events,{constructor:w,appendTo:function(e){return e.appendChild(this.renderer.domElement),this},play:function(){return w.Utils.setPlaying.call(this,!0),M.init(),this.trigger(w.Events.play)},pause:function(){return this.playing=!1,this.trigger(w.Events.pause)},update:function(){var e=!!this._lastFrame,t=v.now();e&&(this.timeDelta=parseFloat((t-this._lastFrame).toFixed(3))),this._lastFrame=t;var n=this.width,r=this.height,i=this.renderer;return n===i.width&&r===i.height||i.setSize(n,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(e){var t=e;return t instanceof Array||(t=s.toArray(arguments)),this.scene.add(t),this},remove:function(e){var t=e;return t instanceof Array||(t=s.toArray(arguments)),this.scene.remove(t),this},clear:function(){return this.scene.remove(this.scene.children),this},makeLine:function(e,t,n,r){var i=new w.Line(e,t,n,r);return this.scene.add(i),i},makeRectangle:function(e,t,n,r){var i=new w.Rectangle(e,t,n,r);return this.scene.add(i),i},makeRoundedRectangle:function(e,t,n,r,i){var a=new w.RoundedRectangle(e,t,n,r,i);return this.scene.add(a),a},makeCircle:function(e,t,n){var r=new w.Circle(e,t,n);return this.scene.add(r),r},makeEllipse:function(e,t,n,r){var i=new w.Ellipse(e,t,n,r);return this.scene.add(i),i},makeStar:function(e,t,n,r,i){var a=new w.Star(e,t,n,r,i);return this.scene.add(a),a},makeCurve:function(e){var t=arguments.length,n=e;if(!s.isArray(e)){n=[];for(var r=0;r=4?(n=arguments[0]-arguments[2],r=arguments[1]-arguments[3],Math.atan2(r,n)):(n=e.x-t.x,r=e.y-t.y,Math.atan2(r,n))},distanceBetween:function(e,t){return Math.sqrt(n.distanceBetweenSquared(e,t))},distanceBetweenSquared:function(e,t){var n=e.x-t.x,r=e.y-t.y;return n*n+r*r},MakeObservable:function(n){n.bind=n.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,"x",i),Object.defineProperty(this,"y",a),t.extend(this,r),this._bound=!0),e.Utils.Events.bind.apply(this,arguments),this}}}),t.extend(n.prototype,e.Utils.Events,{constructor:n,set:function(e,t){return this.x=e,this.y=t,this},copy:function(e){return this.x=e.x,this.y=e.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new n(this.x,this.y)},add:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x+=e,this.y+=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=n),this)},addSelf:function(e){return this.add.apply(this,arguments)},sub:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x-=e,this.y-=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=n),this)},subtract:function(){return this.sub.apply(this,arguments)},subSelf:function(e){return this.sub.apply(this,arguments)},subtractSelf:function(e){return this.sub.apply(this,arguments)},multiply:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x*=e,this.y*=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=n),this)},multiplySelf:function(e){return this.multiply.apply(this,arguments)},multiplyScalar:function(e){return this.multiply(e)},divide:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x/=e,this.y/=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=n),t.isNaN(this.x)&&(this.x=0),t.isNaN(this.y)&&(this.y=0),this)},divideSelf:function(e){return this.divide.apply(this,arguments)},divideScalar:function(e){return this.divide(e)},negate:function(){return this.multiply(-1)},dot:function(e){return this.x*e.x+this.y*e.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(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},setLength:function(e){return this.normalize().multiplyScalar(e)},equals:function(e,t){return t=void 0===t?1e-4:t,this.distanceTo(e)0&&this.set(l)};i.extend(o,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(t,n,r){if(n.length<=3){var i=t,a=n[0]||0,s=n[1]||0,o=n[2]||0;return{x:i[0]*a+i[1]*s+i[2]*o,y:i[3]*a+i[4]*s+i[5]*o,z:i[6]*a+i[7]*s+i[8]*o}}var l=t[0],u=t[1],c=t[2],h=t[3],f=t[4],d=t[5],p=t[6],g=t[7],m=t[8],_=n[0],v=n[1],y=n[2],b=n[3],x=n[4],w=n[5],k=n[6],S=n[7],E=n[8];return(r=r||new e.Array(9))[0]=l*_+u*b+c*k,r[1]=l*v+u*x+c*S,r[2]=l*y+u*w+c*E,r[3]=h*_+f*b+d*k,r[4]=h*v+f*x+d*S,r[5]=h*y+f*w+d*E,r[6]=p*_+g*b+m*k,r[7]=p*v+g*x+m*S,r[8]=p*y+g*w+m*E,r}}),i.extend(o.prototype,e.Utils.Events,{constructor:o,manual:!1,set:function(t){var n=t;return arguments.length>1&&(n=i.toArray(arguments)),this.elements[0]=n[0],this.elements[1]=n[1],this.elements[2]=n[2],this.elements[3]=n[3],this.elements[4]=n[4],this.elements[5]=n[5],this.elements[6]=n[6],this.elements[7]=n[7],this.elements[8]=n[8],this.trigger(e.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(e.Events.change)},multiply:function(t,n,r,i,a,s,o,l,u){var c=arguments,h=c.length;if(h<=1)return this.elements[0]*=t,this.elements[1]*=t,this.elements[2]*=t,this.elements[3]*=t,this.elements[4]*=t,this.elements[5]*=t,this.elements[6]*=t,this.elements[7]*=t,this.elements[8]*=t,this.trigger(e.Events.change);if(h<=3)return t=t||0,n=n||0,r=r||0,{x:(a=this.elements)[0]*t+a[1]*n+a[2]*r,y:a[3]*t+a[4]*n+a[5]*r,z:a[6]*t+a[7]*n+a[8]*r};var f=this.elements,d=c,p=f[0],g=f[1],m=f[2],_=f[3],v=f[4],y=f[5],b=f[6],x=f[7],w=f[8],k=d[0],S=d[1],E=d[2],C=d[3],T=d[4],P=d[5],R=d[6],A=d[7],O=d[8];return this.elements[0]=p*k+g*C+m*R,this.elements[1]=p*S+g*T+m*A,this.elements[2]=p*E+g*P+m*O,this.elements[3]=_*k+v*C+y*R,this.elements[4]=_*S+v*T+y*A,this.elements[5]=_*E+v*P+y*O,this.elements[6]=b*k+x*C+w*R,this.elements[7]=b*S+x*T+w*A,this.elements[8]=b*E+x*P+w*O,this.trigger(e.Events.change)},inverse:function(t){var n=this.elements;t=t||new e.Matrix;var r=n[0],i=n[1],a=n[2],s=n[3],o=n[4],l=n[5],u=n[6],c=n[7],h=n[8],f=h*o-l*c,d=-h*s+l*u,p=c*s-o*u,g=r*f+i*d+a*p;return g?(g=1/g,t.elements[0]=f*g,t.elements[1]=(-h*i+a*c)*g,t.elements[2]=(l*i-a*o)*g,t.elements[3]=d*g,t.elements[4]=(h*r-a*u)*g,t.elements[5]=(-l*r+a*s)*g,t.elements[6]=p*g,t.elements[7]=(-c*r+i*u)*g,t.elements[8]=(o*r-i*s)*g,t):null},scale:function(e,t){return arguments.length<=1&&(t=e),this.multiply(e,0,0,0,t,0,0,0,1)},rotate:function(e){var r=t(e),i=n(e);return this.multiply(r,-i,0,i,r,0,0,0,1)},translate:function(e,t){return this.multiply(1,0,e,0,1,t,0,0,1)},skewX:function(e){var t=r(e);return this.multiply(1,t,0,0,1,0,0,0,1)},skewY:function(e){var t=r(e);return this.multiply(1,0,0,t,1,0,0,0,1)},toString:function(e){return s.length=0,this.toArray(e,s),s.join(" ")},toArray:function(e,t){var n=this.elements,r=!!t,i=a(n[0]),s=a(n[1]),o=a(n[2]),l=a(n[3]),u=a(n[4]),c=a(n[5]);if(e){var h=a(n[6]),f=a(n[7]),d=a(n[8]);return r?(t[0]=i,t[1]=l,t[2]=h,t[3]=s,t[4]=u,t[5]=f,t[6]=o,t[7]=c,void(t[8]=d)):[i,l,h,s,u,f,o,c,d]}return r?(t[0]=i,t[1]=l,t[2]=s,t[3]=u,t[4]=o,void(t[5]=c)):[i,l,s,u,o,c]},clone:function(){var t,n,r,i,a,s,o,l,u;t=this.elements[0],n=this.elements[1],r=this.elements[2],i=this.elements[3],a=this.elements[4],s=this.elements[5],o=this.elements[6],l=this.elements[7],u=this.elements[8];var c=new e.Matrix(t,n,r,i,a,s,o,l,u);return c.manual=this.manual,c}})}((void 0!==e?e:window).Two),function(e){var t=e.Utils.mod,n=e.Utils.toFixed,r=e.Utils,i={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(e,t){var n=e,a=document.createElementNS(i.ns,n);return"svg"===n&&(t=r.defaults(t||{},{version:i.version})),r.isEmpty(t)||i.setAttributes(a,t),a},setAttributes:function(e,t){for(var n=Object.keys(t),r=0;r=o&&i&&(S.command===e.Commands.curve&&(P=a,_=S.controls&&S.controls.right||S,v=P.controls&&P.controls.left||P,S.relative?(h=n(_.x+S.x),f=n(_.y+S.y)):(h=n(_.x),f=n(_.y)),P.relative?(d=n(v.x+P.x),p=n(v.y+P.y)):(d=n(v.x),p=n(v.y)),c+=" C "+h+" "+f+" "+d+" "+p+" "+(R=n(P.x))+" "+(A=n(P.y))),S.command!==e.Commands.close&&(c+=" Z")),l+=c+" "}return l},getClip:function(e){var t=e._renderer.clip;if(!t){for(var n=e;n.parent;)n=n.parent;t=e._renderer.clip=i.createElement("clipPath"),n.defs.appendChild(t)}return t},group:{appendChild:function(e){var t=e._renderer.elem;if(t){var n=t.nodeName;!n||/(radial|linear)gradient/i.test(n)||e._clip||this.elem.appendChild(t)}},removeChild:function(e){var t=e._renderer.elem;t&&t.parentNode==this.elem&&(t.nodeName&&(e._clip||this.elem.removeChild(t)))},orderChild:function(e){this.elem.appendChild(e._renderer.elem)},renderChild:function(e){i[e._renderer.type].render.call(e,this)},render:function(e){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;this._renderer.elem||(this._renderer.elem=i.createElement("g",{id:this.id}),e.appendChild(this._renderer.elem));var t=this._matrix.manual||this._flagMatrix,n={domElement:e,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(var r=0;r0&&(t["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?i.setAttributes(this._renderer.elem,t):(t.id=this.id,this._renderer.elem=i.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){var r=i.getClip(this),a=this._renderer.elem;this._clip?(a.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(a)):(r.removeAttribute("id"),a.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(a))}return this.flagReset()}},text:{render:function(e){this._update();var t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=i.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["alignment-baseline"]=t["dominant-baseline"]=this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),i[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),i[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this._className),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?i.setAttributes(this._renderer.elem,t):(t.id=this.id,this._renderer.elem=i.createElement("text",t),e.defs.appendChild(this._renderer.elem)),this._flagClip){var n=i.getClip(this),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),n.setAttribute("id",this.id),n.appendChild(r)):(n.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(e,t){t||this._update();var n={};if(this._flagEndPoints&&(n.x1=this.left._x,n.y1=this.left._y,n.x2=this.right._x,n.y2=this.right._y),this._flagSpread&&(n.spreadMethod=this._spread),this._renderer.elem?i.setAttributes(this._renderer.elem,n):(n.id=this.id,n.gradientUnits="userSpaceOnUse",this._renderer.elem=i.createElement("linearGradient",n),e.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 a=0;a0&&(a.x*=-1),a.y>0&&(a.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(a.width=0,a.height=0,o)){switch(s.width=a.width=o.width,s.height=a.height=o.height,this._repeat){case"no-repeat":a.width+=1,a.height+=1}this._scale instanceof e.Vector?(a.width*=this._scale.x,a.height*=this._scale.y):(a.width*=this._scale,a.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?r.isEmpty(s)||i.setAttributes(this._renderer.image,s):this._renderer.image=i.createElement("image",s)),this._renderer.elem?r.isEmpty(a)||i.setAttributes(this._renderer.elem,a):(a.id=this.id,a.patternUnits="userSpaceOnUse",this._renderer.elem=i.createElement("pattern",a),t.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()}}},a=e[e.Types.svg]=function(t){this.domElement=t.domElement||i.createElement("svg"),this.scene=new e.Group,this.scene.parent=this,this.defs=i.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"};r.extend(a,{Utils:i}),r.extend(a.prototype,e.Utils.Events,{constructor:a,setSize:function(t,n){return this.width=t,this.height=n,i.setAttributes(this.domElement,{width:t,height:n}),this.trigger(e.Events.resize,t,n)},render:function(){return i.group.render.call(this.scene,this.domElement),this}})}((void 0!==e?e:window).Two),function(e){var t=e.Utils.mod,n=e.Utils.toFixed,r=e.Utils.getRatio,i=e.Utils,a=[],s=2*Math.PI,o=Math.max,l=Math.min,u=Math.abs,c=Math.sin,h=Math.cos,f=Math.acos,d=Math.sqrt,p=function(e){return 1==e[0]&&0==e[3]&&0==e[1]&&1==e[4]&&0==e[2]&&0==e[5]},g={isHidden:/(none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(e){return this[e]},e.setAttribute=function(e,t){return this[e]=t,this},e},group:{renderChild:function(e){g[e._renderer.type].render.call(e,this.ctx,!0,this.clip)},render:function(e){this._update();var t=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);var r=p(t),i=this._mask;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,r||(e.save(),e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),i&&g[i._renderer.type].render.call(i,e,!0),this.opacity>0&&0!==this.scale)for(var a=0;a0&&r.setLineDash(W),r.beginPath();for(var G=0;G=k&&b&&(P=R,L=T.controls&&T.controls.right||e.Vector.zero,j=P.controls&&P.controls.left||e.Vector.zero,T._relative?(M=L.x+n(T.x),F=L.y+n(T.y)):(M=n(L.x),F=n(L.y)),P._relative?(A=j.x+n(P.x),O=j.y+n(P.y)):(A=n(j.x),O=n(j.y)),I=n(P.x),D=n(P.y),r.bezierCurveTo(M,F,A,O,I,D));break;case e.Commands.line:r.lineTo(I,D);break;case e.Commands.move:R=T,r.moveTo(I,D)}return b&&r.closePath(),W&&W.length>0&&r.setLineDash(a),z||l||(g.isHidden.test(f)||((B=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(),B&&r.restore()),g.isHidden.test(c)||((B=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=h/c._renderer.scale.x),r.stroke(),B&&r.restore())),V||r.restore(),z&&!l&&r.clip(),this.flagReset()}},text:{render:function(e,t,r){this._update();var a,s,o,l,u,c,h,f=this._matrix.elements,d=this._stroke,m=this._linewidth,_=this._fill,v=this._opacity*this.parent._renderer.opacity,y=this._visible,b=p(f),x=_._renderer&&_._renderer.offset&&d._renderer&&d._renderer.offset,w=this.dashes,k=this._clip;return t||y&&!k?(b||(e.save(),e.transform(f[0],f[3],f[1],f[4],f[2],f[5])),x||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=g.alignments[this._alignment]||this._alignment,e.textBaseline=this._baseline,_&&(i.isString(_)?e.fillStyle=_:(g[_._renderer.type].render.call(_,e),e.fillStyle=_._renderer.effect)),d&&(i.isString(d)?e.strokeStyle=d:(g[d._renderer.type].render.call(d,e),e.strokeStyle=d._renderer.effect)),m&&(e.lineWidth=m),i.isNumber(v)&&(e.globalAlpha=v),w&&w.length>0&&e.setLineDash(w),k||r||(g.isHidden.test(_)||(_._renderer&&_._renderer.offset?(c=n(_._renderer.scale.x),h=n(_._renderer.scale.y),e.save(),e.translate(-n(_._renderer.offset.x),-n(_._renderer.offset.y)),e.scale(c,h),a=this._size/_._renderer.scale.y,s=this._leading/_._renderer.scale.y,e.font=[this._style,this._weight,n(a)+"px/",n(s)+"px",this._family].join(" "),o=_._renderer.offset.x/_._renderer.scale.x,l=_._renderer.offset.y/_._renderer.scale.y,e.fillText(this.value,n(o),n(l)),e.restore()):e.fillText(this.value,0,0)),g.isHidden.test(d)||(d._renderer&&d._renderer.offset?(c=n(d._renderer.scale.x),h=n(d._renderer.scale.y),e.save(),e.translate(-n(d._renderer.offset.x),-n(d._renderer.offset.y)),e.scale(c,h),a=this._size/d._renderer.scale.y,s=this._leading/d._renderer.scale.y,e.font=[this._style,this._weight,n(a)+"px/",n(s)+"px",this._family].join(" "),o=d._renderer.offset.x/d._renderer.scale.x,l=d._renderer.offset.y/d._renderer.scale.y,u=m/d._renderer.scale.x,e.lineWidth=n(u),e.strokeText(this.value,n(o),n(l)),e.restore()):e.strokeText(this.value,0,0))),b||e.restore(),k&&!r&&e.clip(),this.flagReset()):this}},"linear-gradient":{render:function(e){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=e.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var t=0;t1){var P=d(T);k=(a*=P)*a,S=(l*=P)*l}var R=k*C+S*E,A=d(o(0,(k*S-R)/R));f===p&&(A=-A);var O=A*a*w/l,M=-A*l*x/a,F=h(g)*O-c(g)*M+(r+m)/2,N=c(g)*O+h(g)*M+(i+v)/2,U=_(1,0,(x-O)/a,(w-M)/l);!function(n,r,i,a,o,l,u,c,h){var f=e.Utils.Curve.Tolerance.epsilon,d=u-l,p=Math.abs(d)0&&S.setLineDash(N),S.save(),S.scale(E,E),S.translate(D,z),S.beginPath();for(var V=0;V=L&&F&&(s=j,_=B.controls&&B.controls.right||e.Vector.zero,v=s.controls&&s.controls.left||e.Vector.zero,B._relative?(d=o(_.x+B.x),p=o(_.y+B.y)):(d=o(_.x),p=o(_.y)),s._relative?(h=o(v.x+s.x),f=o(v.y+s.y)):(h=o(v.x),f=o(v.y)),y=o(s.x),b=o(s.y),S.bezierCurveTo(d,p,h,f,y,b));break;case e.Commands.line:S.lineTo(y,b);break;case e.Commands.move:j=B,S.moveTo(y,b)}}F&&S.closePath(),c.isHidden.test(P)||((x=P._renderer&&P._renderer.offset)&&(S.save(),S.translate(-P._renderer.offset.x,-P._renderer.offset.y),S.scale(P._renderer.scale.x,P._renderer.scale.y)),S.fill(),x&&S.restore()),c.isHidden.test(C)||((x=C._renderer&&C._renderer.offset)&&(S.save(),S.translate(-C._renderer.offset.x,-C._renderer.offset.y),S.scale(C._renderer.scale.x,C._renderer.scale.y),S.lineWidth=T/C._renderer.scale.x),S.stroke(),x&&S.restore()),S.restore()},getBoundingClientRect:function(e,t,n){var r,i,a=1/0,s=-1/0,o=1/0,l=-1/0;e.forEach(function(e){var t,n,r,i,u,c,h=e.x,f=e.y,d=e.controls;o=Math.min(f,o),a=Math.min(h,a),s=Math.max(h,s),l=Math.max(f,l),e.controls&&(u=d.left,c=d.right,u&&c&&(t=e._relative?u.x+h:u.x,n=e._relative?u.y+f:u.y,r=e._relative?c.x+h:c.x,i=e._relative?c.y+f:c.y,t&&n&&r&&i&&(o=Math.min(n,i,o),a=Math.min(t,r,a),s=Math.max(t,r,s),l=Math.max(n,i,l))))}),u.isNumber(t)&&(o-=t,a-=t,s+=t,l+=t),r=s-a,i=l-o,n.top=o,n.left=a,n.right=s,n.bottom=l,n.width=r,n.height=i,n.centroid||(n.centroid={}),n.centroid.x=-a,n.centroid.y=-o},render:function(t,r,i){if(!this._visible||!this._opacity)return this;this._update();var s=this.parent,o=s._matrix.manual||s._flagMatrix,l=this._matrix.manual||this._flagMatrix,h=this._flagVertices||this._flagFill||this._fill instanceof e.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof e.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof e.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 e.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof e.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof e.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||s._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 e.Array(9)),this._matrix.toArray(!0,a),n(a,s._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*s._renderer.scale),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new e.Array(12)),this._renderer.opacity=this._opacity*s._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,t,this,r),c.updateTexture.call(c,t,this)):(u.isString(this._fill)||this._fill._update(),u.isString(this._stroke)||this._stroke._update()),!this._clip||i?(t.bindBuffer(t.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),t.vertexAttribPointer(r.textureCoords,2,t.FLOAT,!1,0,0),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.buffer),t.vertexAttribPointer(r.position,2,t.FLOAT,!1,0,0),t.drawArrays(t.TRIANGLES,0,6),this.flagReset()):void 0}},text:{updateCanvas:function(e){var t=this.canvas,n=this.ctx,r=e._renderer.scale,i=e._stroke,a=e._linewidth*r,s=e._fill,l=e._renderer.opacity||e._opacity,h=e.dashes;t.width=Math.max(Math.ceil(e._renderer.rect.width*r),1),t.height=Math.max(Math.ceil(e._renderer.rect.height*r),1);var f,d,p,g,m,_,v,y=e._renderer.rect.centroid,b=y.x,x=y.y,w=s._renderer&&s._renderer.offset&&i._renderer&&i._renderer.offset;n.clearRect(0,0,t.width,t.height),w||(n.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),n.textAlign="center",n.textBaseline="middle",s&&(u.isString(s)?n.fillStyle=s:(c[s._renderer.type].render.call(s,n,e),n.fillStyle=s._renderer.effect)),i&&(u.isString(i)?n.strokeStyle=i:(c[i._renderer.type].render.call(i,n,e),n.strokeStyle=i._renderer.effect)),a&&(n.lineWidth=a),u.isNumber(l)&&(n.globalAlpha=l),h&&h.length>0&&n.setLineDash(h),n.save(),n.scale(r,r),n.translate(b,x),c.isHidden.test(s)||(s._renderer&&s._renderer.offset?(_=o(s._renderer.scale.x),v=o(s._renderer.scale.y),n.save(),n.translate(-o(s._renderer.offset.x),-o(s._renderer.offset.y)),n.scale(_,v),f=e._size/s._renderer.scale.y,d=e._leading/s._renderer.scale.y,n.font=[e._style,e._weight,o(f)+"px/",o(d)+"px",e._family].join(" "),p=s._renderer.offset.x/s._renderer.scale.x,g=s._renderer.offset.y/s._renderer.scale.y,n.fillText(e.value,o(p),o(g)),n.restore()):n.fillText(e.value,0,0)),c.isHidden.test(i)||(i._renderer&&i._renderer.offset?(_=o(i._renderer.scale.x),v=o(i._renderer.scale.y),n.save(),n.translate(-o(i._renderer.offset.x),-o(i._renderer.offset.y)),n.scale(_,v),f=e._size/i._renderer.scale.y,d=e._leading/i._renderer.scale.y,n.font=[e._style,e._weight,o(f)+"px/",o(d)+"px",e._family].join(" "),p=i._renderer.offset.x/i._renderer.scale.x,g=i._renderer.offset.y/i._renderer.scale.y,m=a/i._renderer.scale.x,n.lineWidth=o(m),n.strokeText(e.value,o(p),o(g)),n.restore()):n.strokeText(e.value,0,0)),n.restore()},getBoundingClientRect:function(e,t){var n=c.ctx;n.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" "),n.textAlign="center",n.textBaseline=e._baseline;var r=n.measureText(e._value).width,i=Math.max(e._size||e._leading);this._linewidth&&!c.isHidden.test(this._stroke)&&(i+=this._linewidth);var a=r/2,s=i/2;switch(c.alignments[e._alignment]||e._alignment){case c.alignments.left:t.left=0,t.right=r;break;case c.alignments.right:t.left=-r,t.right=0;break;default:t.left=-a,t.right=a}switch(e._baseline){case"bottom":t.top=-i,t.bottom=0;break;case"top":t.top=0,t.bottom=i;break;default:t.top=-s,t.bottom=s}t.width=r,t.height=i,t.centroid||(t.centroid={}),t.centroid.x=a,t.centroid.y=s},render:function(t,r,i){if(!this._visible||!this._opacity)return this;this._update();var s=this.parent,o=s._matrix.manual||s._flagMatrix,l=this._matrix.manual||this._flagMatrix,h=this._flagVertices||this._flagFill||this._fill instanceof e.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof e.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof e.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 e.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof e.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof e.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||s._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 e.Array(9)),this._matrix.toArray(!0,a),n(a,s._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*s._renderer.scale),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new e.Array(12)),this._renderer.opacity=this._opacity*s._renderer.opacity,c.text.getBoundingClientRect(this,this._renderer.rect),c.getTriangles(this._renderer.rect,this._renderer.triangles),c.updateBuffer.call(c,t,this,r),c.updateTexture.call(c,t,this)):(u.isString(this._fill)||this._fill._update(),u.isString(this._stroke)||this._stroke._update()),!this._clip||i?(t.bindBuffer(t.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),t.vertexAttribPointer(r.textureCoords,2,t.FLOAT,!1,0,0),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.buffer),t.vertexAttribPointer(r.position,2,t.FLOAT,!1,0,0),t.drawArrays(t.TRIANGLES,0,6),this.flagReset()):void 0}},"linear-gradient":{render:function(e,t){if(e.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=e.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var n=0;n=n)return n-r>=0;r+=a}return!1}function c(e,t){var n=e._length;if(t<=0)return 0;if(t>=n)return e._lengths.length-1;for(var r=0,i=0;r=t)return t-=i,Math.max(r-1,0)+t/e._lengths[r];i+=e._lengths[r]}return-1}function h(t,n,r){var i,a,s,o,l,u,c,h,f=n.controls&&n.controls.right,d=t.controls&&t.controls.left;return i=n.x,l=n.y,a=(f||n).x,u=(f||n).y,s=(d||t).x,c=(d||t).y,o=t.x,h=t.y,f&&n._relative&&(a+=n.x,u+=n.y),d&&t._relative&&(s+=t.x,c+=t.y),e.Utils.getCurveLength(i,l,a,u,s,c,o,h,r)}function f(t,n,r){var i,a,s,o,l,u,c,h,f=n.controls&&n.controls.right,d=t.controls&&t.controls.left;return i=n.x,l=n.y,a=(f||n).x,u=(f||n).y,s=(d||t).x,c=(d||t).y,o=t.x,h=t.y,f&&n._relative&&(a+=n.x,u+=n.y),d&&t._relative&&(s+=t.x,c+=t.y),e.Utils.subdivide(i,l,a,u,s,c,o,h,r)}o.extend(l,{Properties:["fill","stroke","linewidth","opacity","className","visible","cap","join","miter","closed","curved","automatic","beginning","ending"],Utils:{getCurveLength:h},FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)},BindVertices:function(t){for(var n=t.length;n--;)t[n].bind(e.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(t){for(var n=t.length;n--;)t[n].unbind(e.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(t){e.Shape.MakeObservable(t),o.each(l.Properties.slice(2,9),e.Utils.defineProperty,t),Object.defineProperty(t,"fill",{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.unbind(e.Events.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.bind(e.Events.change,this._renderer.flagFill)}}),Object.defineProperty(t,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.unbind(e.Events.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.bind(e.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(t,"length",{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(t,"closed",{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=!!e,this._flagVertices=!0}}),Object.defineProperty(t,"curved",{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}}),Object.defineProperty(t,"automatic",{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e!==this._automatic){this._automatic=!!e;var t=this._automatic?"ignore":"listen";o.each(this.vertices,function(e){e[t]()})}}}),Object.defineProperty(t,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}}),Object.defineProperty(t,"ending",{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}}),Object.defineProperty(t,"vertices",{enumerable:!0,get:function(){return this._collection},set:function(t){this._renderer.flagVertices;var n=this._renderer.bindVertices,r=this._renderer.unbindVertices;this._collection&&this._collection.unbind(e.Events.insert,n).unbind(e.Events.remove,r),t instanceof e.Utils.Collection?this._collection=t:this._collection=new e.Utils.Collection(t||[]),this._collection.bind(e.Events.insert,n).bind(e.Events.remove,r),n(this._collection)}}),Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}})}}),o.extend(l.prototype,e.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(e){var t=new l;t.vertices=this.vertices;for(var n=0;n=y){this._closed?(r=e.Utils.mod(S,b),i=e.Utils.mod(S-1,b),0===S&&(r=i,i=S)):(r=S,i=Math.min(Math.max(S-1,0),x)),w=this.vertices[r],k=this.vertices[i],y-=C,t=0!==this._lengths[S]?y/this._lengths[S]:0;break}C+=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,_=w.controls&&w.controls.left,l=k.x,d=k.y,u=(v||k).x,p=(v||k).y,c=(_||w).x,g=(_||w).y,h=w.x,m=w.y,v&&k.relative&&(u+=k.x,p+=k.y),_&&w.relative&&(c+=w.x,g+=w.y),s=e.Utils.getComponentOnCubicBezier(t,l,u,c,h),f=e.Utils.getComponentOnCubicBezier(t,d,p,g,m);var T=e.Utils.lerp(l,u,t),P=e.Utils.lerp(d,p,t),R=e.Utils.lerp(u,c,t),A=e.Utils.lerp(p,g,t),O=e.Utils.lerp(c,h,t),M=e.Utils.lerp(g,m,t),F=e.Utils.lerp(T,R,t),N=e.Utils.lerp(P,A,t),U=e.Utils.lerp(R,O,t),L=e.Utils.lerp(A,M,t);return o.isObject(n)?(n.x=s,n.y=f,o.isObject(n.controls)||e.Anchor.AppendCurveProperties(n),n.controls.left.x=F,n.controls.left.y=N,n.controls.right.x=U,n.controls.right.y=L,o.isBoolean(n.relative)&&!n.relative||(n.controls.left.x-=s,n.controls.left.y-=f,n.controls.right.x-=s,n.controls.right.y-=f),n.t=t,n):((a=new e.Anchor(s,f,F-s,N-f,U-s,L-f,this._curved?e.Commands.curve:e.Commands.line)).t=t,a)},plot:function(){if(this.curved)return e.Utils.getCurveFromPoints(this._collection,this.closed),this;for(var t=0;t0&&(a[a.length-1].command=e.Commands.line),void(r=s);var u=f(s,r,t);a=a.concat(u),o.each(u,function(t,n){n<=0&&r.command===e.Commands.move?t.command=e.Commands.move:t.command=e.Commands.line}),l>=n&&(this._closed&&this._automatic?(u=f(s,r=s,t),a=a.concat(u),o.each(u,function(t,n){n<=0&&r.command===e.Commands.move?t.command=e.Commands.move:t.command=e.Commands.line})):i&&a.push(new e.Anchor(s.x,s.y)),a[a.length-1].command=i?e.Commands.close:e.Commands.line),r=s}},this),this._automatic=!1,this._curved=!1,this.vertices=a,this},_updateLength:function(t,n){n||this._update();var r=this.vertices.length,i=r-1,a=this.vertices[i],s=0;return o.isUndefined(this._lengths)&&(this._lengths=[]),o.each(this.vertices,function(n,r){if(r<=0||n.command===e.Commands.move)return a=n,void(this._lengths[r]=0);this._lengths[r]=h(n,a,t),this._lengths[r]=e.Utils.toFixed(this._lengths[r]),s+=this._lengths[r],a=n},this),this._length=s,this._flagLength=!1,this},_update:function(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);var t,n,a,s,o,l=this._collection.length,h=this._closed,f=Math.min(this._beginning,this._ending),d=Math.max(this._beginning,this._ending),p=c(this,f*this._length),g=c(this,d*this._length),m=r(p),_=i(g);this._renderer.vertices.length=0;for(var v=0;v_&&!n?((o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(d,o),o.command=this._renderer.collection[v].command,this._renderer.vertices.push(o),n=o,(a=this._collection[v-1])&&a.controls&&(o.controls.right.clear(),this._renderer.collection[v-1].controls.right.clear().lerp(a.controls.right,o.t))):v>=m&&v<=_&&(o=this._renderer.collection[v].copy(this._collection[v]),this._renderer.vertices.push(o),v===_&&u(this,d)?(n=o,!h&&n.controls&&n.controls.right.clear()):v===m&&u(this,f)&&((t=o).command=e.Commands.move,!h&&t.controls&&t.controls.left.clear()));m>0&&!t&&(v=m-1,(o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(f,o),o.command=e.Commands.move,this._renderer.vertices.unshift(o),t=o,(s=this._collection[v+1])&&s.controls&&(o.controls.left.clear(),this._renderer.collection[v+1].controls.left.copy(s.controls.left).lerp(e.Vector.zero,o.t)))}return e.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,e.Shape.prototype.flagReset.call(this),this}}),l.MakeObservable(l.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=e.Utils,r=e.Line=function(n,r,i,a){t.call(this,[new e.Anchor(n,r),new e.Anchor(i,a)]),this.vertices[0].command=e.Commands.move,this.vertices[1].command=e.Commands.line,this.automatic=!1};n.extend(r.prototype,t.prototype),r.prototype.constructor=r,t.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=e.Utils,r=e.Rectangle=function(n,r,i,a){t.call(this,[new e.Anchor,new e.Anchor,new e.Anchor,new e.Anchor],!0,!1,!0),this.width=i,this.height=a,this.origin=new e.Vector,this.translation.set(n,r),this._update()};n.extend(r,{Properties:["width","height"],MakeObservable:function(i){t.MakeObservable(i),n.each(r.Properties,e.Utils.defineProperty,i),Object.defineProperty(i,"origin",{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(e.Events.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(e.Events.change,this._renderer.flagVertices),this._renderer.flagVertices()}})}}),n.extend(r.prototype,t.prototype,{_width:0,_height:0,_flagWidth:0,_flagHeight:0,_origin:null,constructor:r,_update:function(){if(this._flagWidth||this._flagHeight){var n=this._width/2,r=this._height/2;this.vertices[0].set(-n,-r).add(this._origin).command=e.Commands.move,this.vertices[1].set(n,-r).add(this._origin).command=e.Commands.line,this.vertices[2].set(n,r).add(this._origin).command=e.Commands.line,this.vertices[3].set(-n,r).add(this._origin).command=e.Commands.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).add(this._origin).command=e.Commands.line)}return t.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,t.prototype.flagReset.call(this),this},clone:function(t){var i=new r(0,0,this.width,this.height);return i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,n.each(e.Path.Properties,function(e){i[e]=this[e]},this),t&&t.add(i),i}}),r.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=2*Math.PI,r=Math.PI/2,i=Math.cos,a=Math.sin,s=e.Utils,o=4/3*Math.tan(Math.PI/8),l=e.Ellipse=function(n,r,i,a,o){s.isNumber(a)||(a=i);var l=o||5,u=s.map(s.range(l),function(t){return new e.Anchor},this);t.call(this,u,!0,!0,!0),this.width=2*i,this.height=2*a,this._update(),this.translation.set(n,r)};s.extend(l,{Properties:["width","height"],MakeObservable:function(n){t.MakeObservable(n),s.each(l.Properties,e.Utils.defineProperty,n)}}),s.extend(l.prototype,t.prototype,{_width:0,_height:0,_flagWidth:!1,_flagHeight:!1,constructor:l,_update:function(){if(this._flagWidth||this._flagHeight)for(var s=0,l=this.vertices.length,u=l-1;sa&&(this.vertices.splice(a-1,o-a),o=a);for(var l=0;l=o?this.vertices.push(new e.Anchor(c,h)):this.vertices[l].set(c,h),this.vertices[l].command=0===l?e.Commands.move:e.Commands.line}}return t.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,t.prototype.flagReset.call(this),this},clone:function(t){var n=new s(0,0,this.radius,this.sides);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,a.each(e.Path.Properties,function(e){n[e]=this[e]},this),t&&t.add(n),n}}),s.MakeObservable(s.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=(Math.PI,2*Math.PI),r=Math.PI/2,i=(Math.cos,Math.sin,Math.abs,e.Utils),a=e.ArcSegment=function(n,r,a,s,o,l,u){var c=u||3*e.Resolution,h=i.map(i.range(c),function(){return new e.Anchor});t.call(this,h,!0,!1,!0),this.innerRadius=a,this.outerRadius=s,this.startAngle=o,this.endAngle=l,this._update(),this.translation.set(n,r)};function s(e,t){for(;e<0;)e+=t;return e%t}i.extend(a,{Properties:["startAngle","endAngle","innerRadius","outerRadius"],MakeObservable:function(n){t.MakeObservable(n),i.each(a.Properties,e.Utils.defineProperty,n)}}),i.extend(a.prototype,t.prototype,{_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:n,_innerRadius:0,_outerRadius:0,constructor:a,_update:function(){if(this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var i,a=this._startAngle,o=this._endAngle,l=this._innerRadius,u=this._outerRadius,c=s(a,n)===s(o,n),h=l>0,f=this.vertices,d=h?f.length/2:f.length,p=0;c?d--:h||(d-=2);for(var g=0,m=d-1;ga&&(this.vertices.splice(a-1,o-a),o=a);for(var l=0;l=o?this.vertices.push(new e.Anchor(h,f)):this.vertices[l].set(h,f),this.vertices[l].command=0===l?e.Commands.move:e.Commands.line}}return t.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,t.prototype.flagReset.call(this),this},clone:function(t){var n=this.innerRadius,r=this.outerRadius,i=this.sides,o=new s(0,0,n,r,i);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,a.each(e.Path.Properties,function(e){o[e]=this[e]},this),t&&t.add(o),o}}),s.MakeObservable(s.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=e.Utils,r=e.RoundedRectangle=function(i,a,s,o,l){n.isUndefined(l)&&(l=Math.floor(Math.min(s,o)/12));var u=n.map(n.range(10),function(t){return new e.Anchor(0,0,0,0,0,0,0===t?e.Commands.move:e.Commands.curve)});t.call(this,u),this.closed=!0,this.automatic=!1,this._renderer.flagRadius=n.bind(r.FlagRadius,this),this.width=s,this.height=o,this.radius=l,this._update(),this.translation.set(i,a)};n.extend(r,{Properties:["width","height"],FlagRadius:function(){this._flagRadius=!0},MakeObservable:function(i){t.MakeObservable(i),n.each(r.Properties,e.Utils.defineProperty,i),Object.defineProperty(i,"radius",{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof e.Vector&&this._radius.unbind(e.Events.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof e.Vector&&this._radius.bind(e.Events.change,this._renderer.flagRadius),this._flagRadius=!0}})}}),n.extend(r.prototype,t.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 n,r,i,a=this._width,s=this._height;this._radius instanceof e.Vector?(n=this._radius.x,r=this._radius.y):(n=this._radius,r=this._radius);var o=a/2,l=s/2;(i=this.vertices[0]).x=-(o-n),i.y=-l,(i=this.vertices[1]).x=o-n,i.y=-l,i.controls.left.clear(),i.controls.right.x=n,i.controls.right.y=0,(i=this.vertices[2]).x=o,i.y=-(l-r),i.controls.right.clear(),i.controls.left.clear(),(i=this.vertices[3]).x=o,i.y=l-r,i.controls.left.clear(),i.controls.right.x=0,i.controls.right.y=r,(i=this.vertices[4]).x=o-n,i.y=l,i.controls.right.clear(),i.controls.left.clear(),(i=this.vertices[5]).x=-(o-n),i.y=l,i.controls.left.clear(),i.controls.right.x=-n,i.controls.right.y=0,(i=this.vertices[6]).x=-o,i.y=l-r,i.controls.left.clear(),i.controls.right.clear(),(i=this.vertices[7]).x=-o,i.y=-(l-r),i.controls.left.clear(),i.controls.right.x=0,i.controls.right.y=-r,(i=this.vertices[8]).x=-(o-n),i.y=-l,i.controls.left.clear(),i.controls.right.clear(),(i=this.vertices[9]).copy(this.vertices[8])}return t.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,t.prototype.flagReset.call(this),this},clone:function(t){var i=this.width,a=this.height,s=this.radius,o=new r(0,0,i,a,s);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,n.each(e.Path.Properties,function(e){o[e]=this[e]},this),t&&t.add(o),o}}),r.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.root,n=e.Utils.getComputedMatrix,r=e.Utils,i=((t.document?t.document.createElement("canvas"):(console.warn("Two.js: Unable to create canvas for Two.Text measurements."),{getContext:r.identity})).getContext("2d"),e.Text=function(t,n,i,a){if(e.Shape.call(this),this._renderer.type="text",this._renderer.flagFill=r.bind(e.Text.FlagFill,this),this._renderer.flagStroke=r.bind(e.Text.FlagStroke,this),this.value=t,r.isNumber(n)&&(this.translation.x=n),r.isNumber(i)&&(this.translation.y=i),this.dashes=[],!r.isObject(a))return this;r.each(e.Text.Properties,function(e){e in a&&(this[e]=a[e])},this)});r.extend(e.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(t){e.Shape.MakeObservable(t),r.each(e.Text.Properties.slice(0,13),e.Utils.defineProperty,t),Object.defineProperty(t,"fill",{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.unbind(e.Events.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.bind(e.Events.change,this._renderer.flagFill)}}),Object.defineProperty(t,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.unbind(e.Events.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.bind(e.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}})}}),r.extend(e.Text.prototype,e.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:e.Text,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(t){var n=new e.Text(this.value);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,r.each(e.Text.Properties,function(e){n[e]=this[e]},this),t&&t.add(n),n._update()},toObject:function(){var t={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return r.each(e.Text.Properties,function(e){t[e]=this[e]},this),t},noStroke:function(){return this.stroke="transparent",this},noFill:function(){return this.fill="transparent",this},getBoundingClientRect:function(e){var t,r,a,s,o,l;this._update(!0),t=e?this._matrix:n(this);var u=this.leading,c=this.value.length*this.size*i.Ratio;switch(this.alignment){case"left":a=0,s=c;break;case"right":a=-c,s=0;break;default:a=-c/2,s=c/2}switch(this.baseline){case"top":o=0,l=u;break;case"bottom":o=-u,l=0;break;default:o=-u/2,l=u/2}return{top:o=(r=t.multiply(a,o,1)).y,left:a=r.x,right:s=(r=t.multiply(s,l,1)).x,bottom:l=r.y,width:s-a,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,e.Shape.prototype.flagReset.call(this),this}}),e.Text.MakeObservable(e.Text.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.Stop=function(e,r,i){this._renderer={},this._renderer.type="stop",this.offset=t.isNumber(e)?e:n.Index<=0?0:1,this.opacity=t.isNumber(i)?i:1,this.color=t.isString(r)?r:n.Index<=0?"#fff":"#000",n.Index=(n.Index+1)%2};t.extend(n,{Index:0,Properties:["offset","opacity","color"],MakeObservable:function(e){t.each(n.Properties,function(e){var t="_"+e,n="_flag"+e.charAt(0).toUpperCase()+e.slice(1);Object.defineProperty(this,e,{enumerable:!0,get:function(){return this[t]},set:function(e){this[t]=e,this[n]=!0,this.parent&&(this.parent._flagStops=!0)}})},e)}}),t.extend(n.prototype,e.Utils.Events,{constructor:n,clone:function(){var e=new n;return t.each(n.Properties,function(t){e[t]=this[t]},this),e},toObject:function(){var e={};return t.each(n.Properties,function(t){e[t]=this[t]},this),e},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),n.MakeObservable(n.prototype),n.prototype.constructor=n;var r=e.Gradient=function(n){this._renderer={},this._renderer.type="gradient",this.id=e.Identifier+e.uniqueId(),this.classList=[],this._renderer.flagStops=t.bind(r.FlagStops,this),this._renderer.bindStops=t.bind(r.BindStops,this),this._renderer.unbindStops=t.bind(r.UnbindStops,this),this.spread="pad",this.stops=n};t.extend(r,{Stop:n,Properties:["spread"],MakeObservable:function(n){t.each(r.Properties,e.Utils.defineProperty,n),Object.defineProperty(n,"stops",{enumerable:!0,get:function(){return this._stops},set:function(t){this._renderer.flagStops;var n=this._renderer.bindStops,r=this._renderer.unbindStops;this._stops&&this._stops.unbind(e.Events.insert,n).unbind(e.Events.remove,r),this._stops=new e.Utils.Collection((t||[]).slice(0)),this._stops.bind(e.Events.insert,n).bind(e.Events.remove,r),n(this._stops)}})},FlagStops:function(){this._flagStops=!0},BindStops:function(t){for(var n=t.length;n--;)t[n].bind(e.Events.change,this._renderer.flagStops),t[n].parent=this;this._renderer.flagStops()},UnbindStops:function(t){for(var n=t.length;n--;)t[n].unbind(e.Events.change,this._renderer.flagStops),delete t[n].parent;this._renderer.flagStops()}}),t.extend(r.prototype,e.Utils.Events,{_flagStops:!1,_flagSpread:!1,clone:function(n){var i=t.map(this.stops,function(e){return e.clone()}),a=new r(i);return t.each(e.Gradient.Properties,function(e){a[e]=this[e]},this),n&&n.add(a),a},toObject:function(){var e={stops:t.map(this.stops,function(e){return e.toObject()})};return t.each(r.Properties,function(t){e[t]=this[t]},this),e},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(e.Events.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),r.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.LinearGradient=function(r,i,a,s,o){e.Gradient.call(this,o),this._renderer.type="linear-gradient";var l=t.bind(n.FlagEndPoints,this);this.left=(new e.Vector).bind(e.Events.change,l),this.right=(new e.Vector).bind(e.Events.change,l),t.isNumber(r)&&(this.left.x=r),t.isNumber(i)&&(this.left.y=i),t.isNumber(a)&&(this.right.x=a),t.isNumber(s)&&(this.right.y=s)};t.extend(n,{Stop:e.Gradient.Stop,MakeObservable:function(t){e.Gradient.MakeObservable(t)},FlagEndPoints:function(){this._flagEndPoints=!0}}),t.extend(n.prototype,e.Gradient.prototype,{_flagEndPoints:!1,constructor:n,clone:function(r){var i=t.map(this.stops,function(e){return e.clone()}),a=new n(this.left._x,this.left._y,this.right._x,this.right._y,i);return t.each(e.Gradient.Properties,function(e){a[e]=this[e]},this),r&&r.add(a),a},toObject:function(){var t=e.Gradient.prototype.toObject.call(this);return t.left=this.left.toObject(),t.right=this.right.toObject(),t},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(e.Events.change),this},flagReset:function(){return this._flagEndPoints=!1,e.Gradient.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.RadialGradient=function(n,r,i,a,s,o){e.Gradient.call(this,a),this._renderer.type="radial-gradient",this.center=(new e.Vector).bind(e.Events.change,t.bind(function(){this._flagCenter=!0},this)),this.radius=t.isNumber(i)?i:20,this.focal=(new e.Vector).bind(e.Events.change,t.bind(function(){this._flagFocal=!0},this)),t.isNumber(n)&&(this.center.x=n),t.isNumber(r)&&(this.center.y=r),this.focal.copy(this.center),t.isNumber(s)&&(this.focal.x=s),t.isNumber(o)&&(this.focal.y=o)};t.extend(n,{Stop:e.Gradient.Stop,Properties:["radius"],MakeObservable:function(r){e.Gradient.MakeObservable(r),t.each(n.Properties,e.Utils.defineProperty,r)}}),t.extend(n.prototype,e.Gradient.prototype,{_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,constructor:n,clone:function(r){var i=t.map(this.stops,function(e){return e.clone()}),a=new n(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return t.each(e.Gradient.Properties.concat(n.Properties),function(e){a[e]=this[e]},this),r&&r.add(a),a},toObject:function(){var r=e.Gradient.prototype.toObject.call(this);return t.each(n.Properties,function(e){r[e]=this[e]},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(e.Events.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,e.Gradient.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==e?e:window).Two),function(e){var t,n=e.root,r=e.Utils,i={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff)$/i,effect:/texture|gradient/i};n.document&&(t=document.createElement("a"));var a=e.Texture=function(t,n){if(this._renderer={},this._renderer.type="texture",this._renderer.flagOffset=r.bind(a.FlagOffset,this),this._renderer.flagScale=r.bind(a.FlagScale,this),this.id=e.Identifier+e.uniqueId(),this.classList=[],this.offset=new e.Vector,r.isFunction(n)){var i=r.bind(function(){this.unbind(e.Events.load,i),r.isFunction(n)&&n()},this);this.bind(e.Events.load,i)}r.isString(t)?this.src=t:r.isElement(t)&&(this.image=t),this._update()};r.extend(a,{Properties:["src","loaded","repeat"],RegularExpressions:i,ImageRegistry:new e.Registry,getAbsoluteURL:function(e){return t?(t.href=e,t.href):e},loadHeadlessBuffer:new Function("texture","loaded",['var fs = require("fs");',"var buffer = fs.readFileSync(texture.src);","texture.image.src = buffer;","loaded();"].join("\n")),getImage:function(t){var r,s=a.getAbsoluteURL(t);return a.ImageRegistry.contains(s)?a.ImageRegistry.get(s):(e.Utils.Image?(r=new e.Utils.Image,e.CanvasRenderer.Utils.shim(r,"img")):n.document?r=i.video.test(s)?document.createElement("video"):document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r)},Register:{canvas:function(e,t){e._src="#"+e.id,a.ImageRegistry.add(e.src,e.image),r.isFunction(t)&&t()},img:function(t,n){var i=function(e){r.isFunction(t.image.removeEventListener)&&(t.image.removeEventListener("load",i,!1),t.image.removeEventListener("error",s,!1)),r.isFunction(n)&&n()},s=function(n){throw r.isFunction(t.image.removeEventListener)&&(t.image.removeEventListener("load",i,!1),t.image.removeEventListener("error",s,!1)),new e.Utils.Error("unable to load "+t.src)};r.isNumber(t.image.width)&&t.image.width>0&&r.isNumber(t.image.height)&&t.image.height>0?i():r.isFunction(t.image.addEventListener)&&(t.image.addEventListener("load",i,!1),t.image.addEventListener("error",s,!1)),t._src=a.getAbsoluteURL(t._src),t.image&&t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),a.ImageRegistry.add(t.src,t.image),e.Utils.isHeadless?a.loadHeadlessBuffer(t,i):t.image.src=t.src)},video:function(t,n){var i=function(e){t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",s,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,t.image.play(),r.isFunction(n)&&n()},s=function(n){throw t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",s,!1),new e.Utils.Error("unable to load "+t.src)};if(t._src=a.getAbsoluteURL(t._src),t.image.addEventListener("canplaythrough",i,!1),t.image.addEventListener("error",s,!1),!t.image||!t.image.getAttribute("two-src")){if(e.Utils.isHeadless)throw new e.Utils.Error("video textures are not implemented in headless environments.");t.image.setAttribute("two-src",t.src),a.ImageRegistry.add(t.src,t.image),t.image.src=t.src,t.image.loop=!0,t.image.load()}}},load:function(e,t){e.src;var n=e.image,r=n&&n.nodeName.toLowerCase();e._flagImage&&(/canvas/i.test(r)?a.Register.canvas(e,t):(e._src=n.getAttribute("two-src")||n.src,a.Register[r](e,t))),e._flagSrc&&(n||(e.image=a.getImage(e.src)),r=e.image.nodeName.toLowerCase(),a.Register[r](e,t))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(t){r.each(a.Properties,e.Utils.defineProperty,t),Object.defineProperty(t,"image",{enumerable:!0,get:function(){return this._image},set:function(e){var t;switch(e&&e.nodeName.toLowerCase()){case"canvas":t="#"+e.id;break;default:t=e.src}a.ImageRegistry.contains(t)?this._image=a.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(e.Events.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(e.Events.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(t,"scale",{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof e.Vector&&this._scale.unbind(e.Events.change,this._renderer.flagScale),this._scale=t,this._scale instanceof e.Vector&&this._scale.bind(e.Events.change,this._renderer.flagScale),this._flagScale=!0}})}}),r.extend(a.prototype,e.Utils.Events,e.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:a,clone:function(){return new a(this.src)},toObject:function(){return{src:this.src,image:this.image}},_update:function(){return(this._flagSrc||this._flagImage)&&(this.trigger(e.Events.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,a.load(this,r.bind(function(){this.loaded=!0,this.trigger(e.Events.change).trigger(e.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}}),a.MakeObservable(a.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.Path,r=e.Rectangle,i=e.Sprite=function(r,i,a,s,o,l){n.call(this,[new e.Anchor,new e.Anchor,new e.Anchor,new e.Anchor],!0),this.noStroke(),this.noFill(),r instanceof e.Texture?this.texture=r:t.isString(r)&&(this.texture=new e.Texture(r)),this.origin=new e.Vector,this._update(),this.translation.set(i||0,a||0),t.isNumber(s)&&(this.columns=s),t.isNumber(o)&&(this.rows=o),t.isNumber(l)&&(this.frameRate=l)};t.extend(i,{Properties:["texture","columns","rows","frameRate","index"],MakeObservable:function(n){r.MakeObservable(n),t.each(i.Properties,e.Utils.defineProperty,n)}}),t.extend(i.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:i,play:function(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=t.performance.now(),t.isNumber(e)&&(this._firstFrame=e),t.isNumber(n)&&(this._lastFrame=n),t.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(e){var t=new i(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(t.play(this._firstFrame,this._lastFrame),t._loop=this._loop),e&&e.add(t),t},_update:function(){var e,n,i,a,s,o,l,u,c,h=this._texture,f=this._columns,d=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){e=(l=h.image.width)/f,n=(u=h.image.height)/d,a=this._amount,this.width!==e&&(this.width=e),this.height!==n&&(this.height=n),this._playing&&this._frameRate>0&&(t.isNaN(this._lastFrame)&&(this._lastFrame=a-1),i=t.performance.now()-this._startTime,s=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?i%=s:i=Math.min(i,s),o=t.lerp(this._firstFrame,c,i/s),(o=Math.floor(o))!==this._index&&(this._index=o,o>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var p=-e*(this._index%f)+(l-e)/2,g=-n*Math.floor(this._index/f)+(u-n)/2;p!==h.offset.x&&(h.offset.x=p),g!==h.offset.y&&(h.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}}),i.MakeObservable(i.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.Path,r=e.Rectangle,i=e.ImageSequence=function(r,a,s,o){n.call(this,[new e.Anchor,new e.Anchor,new e.Anchor,new e.Anchor],!0),this._renderer.flagTextures=t.bind(i.FlagTextures,this),this._renderer.bindTextures=t.bind(i.BindTextures,this),this._renderer.unbindTextures=t.bind(i.UnbindTextures,this),this.noStroke(),this.noFill(),this.textures=t.map(r,i.GenerateTexture,this),this.origin=new e.Vector,this._update(),this.translation.set(a||0,s||0),t.isNumber(o)?this.frameRate=o:this.frameRate=i.DefaultFrameRate};t.extend(i,{Properties:["frameRate","index"],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(t){for(var n=t.length;n--;)t[n].bind(e.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(t){for(var n=t.length;n--;)t[n].unbind(e.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(n){r.MakeObservable(n),t.each(i.Properties,e.Utils.defineProperty,n),Object.defineProperty(n,"textures",{enumerable:!0,get:function(){return this._textures},set:function(t){this._renderer.flagTextures;var n=this._renderer.bindTextures,r=this._renderer.unbindTextures;this._textures&&this._textures.unbind(e.Events.insert,n).unbind(e.Events.remove,r),this._textures=new e.Utils.Collection((t||[]).slice(0)),this._textures.bind(e.Events.insert,n).bind(e.Events.remove,r),n(this._textures)}})},GenerateTexture:function(n){return n instanceof e.Texture?n:t.isString(n)?new e.Texture(n):void 0}}),t.extend(i.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:i,play:function(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=t.performance.now(),t.isNumber(e)&&(this._firstFrame=e),t.isNumber(n)&&(this._lastFrame=n),t.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(e){var t=new i(this.textures,this.translation.x,this.translation.y,this.frameRate);return t._loop=this._loop,this._playing&&t.play(),e&&e.add(t),t},_update:function(){var n,i,a,s,o,l,u,c,h=this._textures;return this._flagTextures&&(this._amount=h.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,t.isNaN(this._lastFrame)&&(this._lastFrame=s-1),a=t.performance.now()-this._startTime,o=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?a%=o:a=Math.min(a,o),u=t.lerp(this._firstFrame,c,a/o),(u=Math.floor(u))!==this._index&&(this._index=u,(l=h[this._index]).loaded&&(n=l.image.width,i=l.image.height,this.width!==n&&(this.width=n),this.height!==i&&(this.height=i),this.fill=l,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!this._flagIndex&&this.fill instanceof e.Texture||((l=h[this._index]).loaded&&(n=l.image.width,i=l.image.height,this.width!==n&&(this.width=n),this.height!==i&&(this.height=i)),this.fill=l),r.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==e?e:window).Two),function(e){var t=Math.min,n=Math.max,r=e.Utils,i=function(){e.Utils.Collection.apply(this,arguments),Object.defineProperty(this,"_events",{value:{},enumerable:!1}),this.ids={},this.on(e.Events.insert,this.attach),this.on(e.Events.remove,this.detach),i.prototype.attach.apply(this,arguments)};i.prototype=new e.Utils.Collection,r.extend(i.prototype,{constructor:i,attach:function(e){for(var t=0;t=0?i.additions.splice(n,1):(i.subtractions.push(e),i._flagSubtractions=!0)),t?(e.parent=t,this.additions.push(e),void(this._flagAdditions=!0)):((n=r.indexOf(this.additions,e))>=0?this.additions.splice(n,1):(this.subtractions.push(e),this._flagSubtractions=!0),void delete e.parent))}r.extend(a,{Children:i,InsertChildren:function(e){for(var t=0;ti+u?(l.beginning=1,l.ending=1):si&&ai&&s=0&&n<=y},x={temp:i.document?i.document.createElement("div"):{},hasEventListeners:s.isFunction(i.addEventListener),bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),x},unbind:function(e,t,n,r){return x.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),x},getRequestAnimationFrame:function(){var e,t=0,n=["ms","moz","webkit","o"],r=i.requestAnimationFrame;if(!r){for(var a=0;a0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null;if(s.isNull(f))break;var p=w.Utils.decomposeMatrix(f);t.translation.set(p.translateX,p.translateY),t.rotation=p.rotation,t.scale=new w.Vector(p.scaleX,p.scaleY);var g=parseFloat((u.x+"").replace("px")),m=parseFloat((u.y+"").replace("px"));g&&(t.translation.x=g),m&&(t.translation.y=m);break;case"viewBox":w.Utils.applySvgViewBox.call(this,t,o);break;case"visible":t.visible=o;break;case"stroke-linecap":t.cap=o;break;case"stroke-linejoin":t.join=o;break;case"stroke-miterlimit":t.miter=o;break;case"stroke-width":t.linewidth=parseFloat(o);break;case"opacity":case"stroke-opacity":case"fill-opacity":t instanceof w.Group||(t.opacity=parseFloat(o));break;case"fill":case"stroke":/url\(\#.*\)/i.test(o)?t[a]=this.getById(o.replace(/url\(\#(.*)\)/i,"$1")):t[a]=/none/i.test(o)?"transparent":o;break;case"id":t.id=o;break;case"class":case"className":t.classList=o.split(" ")}return u},read:{svg:function(e){var t=w.Utils.read.g.call(this,e);e.getAttribute("viewBox");return t},g:function(e){var t,n=new w.Group;t=w.Utils.getSvgStyles.call(this,e);for(var r=0,i=e.childNodes.length;r1&&(h=1);break;case"m":case"l":case"t":p.length>2&&(h=2);break;case"s":case"q":p.length>4&&(h=4);break;case"c":p.length>6&&(h=6);break;case"a":p.length>7&&(h=7)}if(h){for(s=0,l=p.length,c=0;s0)switch(d){case"m":o="l";break;case"M":o="L"}g.push(o+p.slice(s,s+h).join(" ")),c++}u=Array.prototype.concat.apply(u,g)}else u.push(e)});var h=[];if(s.each(u,function(e,t){var i,u,d,p,g,m,_,v,y,b,x,k,S=e[0],E=S.toLowerCase();switch(r=(r=(r=e.slice(1).trim()).replace(/(-?\d+(?:\.\d*)?)[eE]([+\-]?\d+)/g,function(e,t,n){return parseFloat(t)*f(10,n)})).split(/[\s,]+|(?=\s?[+\-])/),l=S===E,E){case"z":if(t>=c)o=!0;else{u=a.x,d=a.y,i=new w.Anchor(u,d,void 0,void 0,void 0,void 0,w.Commands.close);for(t=h.length-1;t>=0;t--){var C=h[t];if(/m/i.test(C.command)){a=C;break}}}break;case"m":case"l":n=void 0,u=parseFloat(r[0]),d=parseFloat(r[1]),i=new w.Anchor(u,d,void 0,void 0,void 0,void 0,/m/i.test(E)?w.Commands.move:w.Commands.line),l&&i.addSelf(a),a=i;break;case"h":case"v":var T=/h/i.test(E)?"x":"y",P=/x/i.test(T)?"y":"x";(i=new w.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,w.Commands.line))[T]=parseFloat(r[0]),i[P]=a[P],l&&(i[T]+=a[T]),a=i;break;case"c":case"s":p=a.x,g=a.y,n||(n=new w.Vector),/c/i.test(E)?(m=parseFloat(r[0]),_=parseFloat(r[1]),v=parseFloat(r[2]),y=parseFloat(r[3]),b=parseFloat(r[4]),x=parseFloat(r[5])):(m=(k=R(a,n,l)).x,_=k.y,v=parseFloat(r[0]),y=parseFloat(r[1]),b=parseFloat(r[2]),x=parseFloat(r[3])),l&&(m+=p,_+=g,v+=p,y+=g,b+=p,x+=g),s.isObject(a.controls)||w.Anchor.AppendCurveProperties(a),a.controls.right.set(m-a.x,_-a.y),i=new w.Anchor(b,x,v-b,y-x,void 0,void 0,w.Commands.curve),a=i,n=i.controls.left;break;case"t":case"q":p=a.x,g=a.y,n||(n=new w.Vector),n.isZero()?(m=p,_=g):(m=n.x,_=n.y),/q/i.test(E)?(v=parseFloat(r[0]),y=parseFloat(r[1]),b=parseFloat(r[2]),x=parseFloat(r[3])):(v=(k=R(a,n,l)).x,y=k.y,b=parseFloat(r[0]),x=parseFloat(r[1])),l&&(m+=p,_+=g,v+=p,y+=g,b+=p,x+=g),s.isObject(a.controls)||w.Anchor.AppendCurveProperties(a),a.controls.right.set(m-a.x,_-a.y),i=new w.Anchor(b,x,v-b,y-x,void 0,void 0,w.Commands.curve),a=i,n=i.controls.left;break;case"a":p=a.x,g=a.y;var A=parseFloat(r[0]),O=parseFloat(r[1]),M=parseFloat(r[2]),F=parseFloat(r[3]),N=parseFloat(r[4]);b=parseFloat(r[5]),x=parseFloat(r[6]),l&&(b+=p,x+=g);var U=new w.Anchor(b,x);U.command=w.Commands.arc,U.rx=A,U.ry=O,U.xAxisRotation=M,U.largeArcFlag=F,U.sweepFlag=N,i=U,a=U,n=void 0}i&&(s.isArray(i)?h=h.concat(i):h.push(i))}),!(h.length<=1)){(i=new w.Path(h,o,void 0,!0).noStroke()).fill="black";var d=i.getBoundingClientRect(!0);return d.centroid={x:d.left+d.width/2,y:d.top+d.height/2},s.each(i.vertices,function(e){e.subSelf(d.centroid)}),i.translation.addSelf(d.centroid),w.Utils.applySvgAttributes.call(this,e,i,t),i}},circle:function(e,t){var n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),i=parseFloat(e.getAttribute("r")),a=new w.Circle(n,r,i).noStroke();return a.fill="black",w.Utils.applySvgAttributes.call(this,e,a,t),a},ellipse:function(e,t){var n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),i=parseFloat(e.getAttribute("rx")),a=parseFloat(e.getAttribute("ry")),s=new w.Ellipse(n,r,i,a).noStroke();return s.fill="black",w.Utils.applySvgAttributes.call(this,e,s,t),s},rect:function(e,t){var n=parseFloat(e.getAttribute("rx")),r=parseFloat(e.getAttribute("ry"));if(!s.isNaN(n)||!s.isNaN(r))return w.Utils.read["rounded-rect"](e);var i=parseFloat(e.getAttribute("x"))||0,a=parseFloat(e.getAttribute("y"))||0,o=parseFloat(e.getAttribute("width")),l=parseFloat(e.getAttribute("height")),u=o/2,c=l/2,h=new w.Rectangle(i+u,a+c,o,l).noStroke();return h.fill="black",w.Utils.applySvgAttributes.call(this,e,h,t),h},"rounded-rect":function(e,t){var n=parseFloat(e.getAttribute("x"))||0,r=parseFloat(e.getAttribute("y"))||0,i=parseFloat(e.getAttribute("rx"))||0,a=parseFloat(e.getAttribute("ry"))||0,s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),l=s/2,u=o/2,c=new w.Vector(i,a),h=new w.RoundedRectangle(n+l,r+u,s,o,c).noStroke();return h.fill="black",w.Utils.applySvgAttributes.call(this,e,h,t),h},line:function(e,t){var n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),i=parseFloat(e.getAttribute("x2")),a=parseFloat(e.getAttribute("y2")),s=new w.Line(n,r,i,a).noFill();return w.Utils.applySvgAttributes.call(this,e,s,t),s},lineargradient:function(e,t){for(var n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),i=parseFloat(e.getAttribute("x2")),a=parseFloat(e.getAttribute("y2")),o=(i+n)/2,l=(a+r)/2,u=[],c=0;c1?h[1]:void 0;if(s.isNull(g))g=(h=!!m&&m.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&h.length>1?parseFloat(h[1]):1;u.push(new w.Gradient.Stop(f,p,g))}var _=new w.LinearGradient(n-o,r-l,i-o,a-l,u);return w.Utils.applySvgAttributes.call(this,e,_,t),_},radialgradient:function(e,t){var n=parseFloat(e.getAttribute("cx"))||0,r=parseFloat(e.getAttribute("cy"))||0,i=parseFloat(e.getAttribute("r")),a=parseFloat(e.getAttribute("fx")),o=parseFloat(e.getAttribute("fy"));s.isNaN(a)&&(a=n),s.isNaN(o)&&(o=r);for(var l=c(n+a)/2,u=c(r+o)/2,h=[],d=0;d1?f[1]:void 0;if(s.isNull(_))_=(f=!!v&&v.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&f.length>1?parseFloat(f[1]):1;h.push(new w.Gradient.Stop(g,m,_))}var y=new w.RadialGradient(n-l,r-u,i,h,a-l,o-u);return w.Utils.applySvgAttributes.call(this,e,y,t),y}},subdivide:function(e,t,n,r,i,a,s,o,l){var u=(l=l||w.Utils.Curve.RecursionLimit)+1;if(c(e-s)<.001&&c(t-o)<.001)return[new w.Anchor(s,o)];for(var h=[],d=0;d>1,c=1&r?a[l++]*e(o):0;l1?Array.prototype.push.apply(this,arguments):arguments[0]&&Array.isArray(arguments[0])&&Array.prototype.push.apply(this,arguments[0])},Error:function(e){this.name="two.js",this.message=e},Events:{on:function(e,t){return this._events||(this._events={}),(this._events[e]||(this._events[e]=[])).push(t),this},off:function(e,t){if(!this._events)return this;if(!e&&!t)return this._events={},this;for(var n=e?[e]:s.keys(this._events),r=0,i=n.length;r2&&(e=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(w.Events.insert,e),this.trigger(w.Events.order)),t},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),C=w.Utils.getBackingStoreRatio,T=w.Utils.getComponentOnCubicBezier,P=(w.Utils.getCurveLength,w.Utils.integrate),R=w.Utils.getReflection;function A(){var e=document.body.getBoundingClientRect(),t=this.width=e.width,n=this.height=e.height;this.renderer.setSize(t,n,this.ratio)}function O(e,t){this.width=e,this.height=t,this.trigger(w.Events.resize,e,t)}s.extend(w.prototype,w.Utils.Events,{constructor:w,appendTo:function(e){return e.appendChild(this.renderer.domElement),this},play:function(){return w.Utils.setPlaying.call(this,!0),M.init(),this.trigger(w.Events.play)},pause:function(){return this.playing=!1,this.trigger(w.Events.pause)},update:function(){var e=!!this._lastFrame,t=v.now();e&&(this.timeDelta=parseFloat((t-this._lastFrame).toFixed(3))),this._lastFrame=t;var n=this.width,r=this.height,i=this.renderer;return n===i.width&&r===i.height||i.setSize(n,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(e){var t=e;return t instanceof Array||(t=s.toArray(arguments)),this.scene.add(t),this},remove:function(e){var t=e;return t instanceof Array||(t=s.toArray(arguments)),this.scene.remove(t),this},clear:function(){return this.scene.remove(this.scene.children),this},makeLine:function(e,t,n,r){var i=new w.Line(e,t,n,r);return this.scene.add(i),i},makeRectangle:function(e,t,n,r){var i=new w.Rectangle(e,t,n,r);return this.scene.add(i),i},makeRoundedRectangle:function(e,t,n,r,i){var a=new w.RoundedRectangle(e,t,n,r,i);return this.scene.add(a),a},makeCircle:function(e,t,n){var r=new w.Circle(e,t,n);return this.scene.add(r),r},makeEllipse:function(e,t,n,r){var i=new w.Ellipse(e,t,n,r);return this.scene.add(i),i},makeStar:function(e,t,n,r,i){var a=new w.Star(e,t,n,r,i);return this.scene.add(a),a},makeCurve:function(e){var t=arguments.length,n=e;if(!s.isArray(e)){n=[];for(var r=0;r=4?(n=arguments[0]-arguments[2],r=arguments[1]-arguments[3],Math.atan2(r,n)):(n=e.x-t.x,r=e.y-t.y,Math.atan2(r,n))},distanceBetween:function(e,t){return Math.sqrt(n.distanceBetweenSquared(e,t))},distanceBetweenSquared:function(e,t){var n=e.x-t.x,r=e.y-t.y;return n*n+r*r},MakeObservable:function(n){n.bind=n.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,"x",i),Object.defineProperty(this,"y",a),t.extend(this,r),this._bound=!0),e.Utils.Events.bind.apply(this,arguments),this}}}),t.extend(n.prototype,e.Utils.Events,{constructor:n,set:function(e,t){return this.x=e,this.y=t,this},copy:function(e){return this.x=e.x,this.y=e.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new n(this.x,this.y)},add:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x+=e,this.y+=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=n),this)},addSelf:function(e){return this.add.apply(this,arguments)},sub:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x-=e,this.y-=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=n),this)},subtract:function(){return this.sub.apply(this,arguments)},subSelf:function(e){return this.sub.apply(this,arguments)},subtractSelf:function(e){return this.sub.apply(this,arguments)},multiply:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x*=e,this.y*=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=n),this)},multiplySelf:function(e){return this.multiply.apply(this,arguments)},multiplyScalar:function(e){return this.multiply(e)},divide:function(e,n){return arguments.length<=0?this:(arguments.length<=1?t.isNumber(e)?(this.x/=e,this.y/=e):e&&t.isNumber(e.x)&&t.isNumber(e.y)&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=n),t.isNaN(this.x)&&(this.x=0),t.isNaN(this.y)&&(this.y=0),this)},divideSelf:function(e){return this.divide.apply(this,arguments)},divideScalar:function(e){return this.divide(e)},negate:function(){return this.multiply(-1)},dot:function(e){return this.x*e.x+this.y*e.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(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},setLength:function(e){return this.normalize().multiplyScalar(e)},equals:function(e,t){return t=void 0===t?1e-4:t,this.distanceTo(e)0&&this.set(l)};i.extend(o,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(t,n,r){if(n.length<=3){var i=t,a=n[0]||0,s=n[1]||0,o=n[2]||0;return{x:i[0]*a+i[1]*s+i[2]*o,y:i[3]*a+i[4]*s+i[5]*o,z:i[6]*a+i[7]*s+i[8]*o}}var l=t[0],u=t[1],c=t[2],h=t[3],d=t[4],f=t[5],p=t[6],g=t[7],m=t[8],_=n[0],v=n[1],y=n[2],b=n[3],x=n[4],w=n[5],k=n[6],S=n[7],E=n[8];return(r=r||new e.Array(9))[0]=l*_+u*b+c*k,r[1]=l*v+u*x+c*S,r[2]=l*y+u*w+c*E,r[3]=h*_+d*b+f*k,r[4]=h*v+d*x+f*S,r[5]=h*y+d*w+f*E,r[6]=p*_+g*b+m*k,r[7]=p*v+g*x+m*S,r[8]=p*y+g*w+m*E,r}}),i.extend(o.prototype,e.Utils.Events,{constructor:o,manual:!1,set:function(t){var n=t;return arguments.length>1&&(n=i.toArray(arguments)),this.elements[0]=n[0],this.elements[1]=n[1],this.elements[2]=n[2],this.elements[3]=n[3],this.elements[4]=n[4],this.elements[5]=n[5],this.elements[6]=n[6],this.elements[7]=n[7],this.elements[8]=n[8],this.trigger(e.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(e.Events.change)},multiply:function(t,n,r,i,a,s,o,l,u){var c=arguments,h=c.length;if(h<=1)return this.elements[0]*=t,this.elements[1]*=t,this.elements[2]*=t,this.elements[3]*=t,this.elements[4]*=t,this.elements[5]*=t,this.elements[6]*=t,this.elements[7]*=t,this.elements[8]*=t,this.trigger(e.Events.change);if(h<=3)return t=t||0,n=n||0,r=r||0,{x:(a=this.elements)[0]*t+a[1]*n+a[2]*r,y:a[3]*t+a[4]*n+a[5]*r,z:a[6]*t+a[7]*n+a[8]*r};var d=this.elements,f=c,p=d[0],g=d[1],m=d[2],_=d[3],v=d[4],y=d[5],b=d[6],x=d[7],w=d[8],k=f[0],S=f[1],E=f[2],C=f[3],T=f[4],P=f[5],R=f[6],A=f[7],O=f[8];return this.elements[0]=p*k+g*C+m*R,this.elements[1]=p*S+g*T+m*A,this.elements[2]=p*E+g*P+m*O,this.elements[3]=_*k+v*C+y*R,this.elements[4]=_*S+v*T+y*A,this.elements[5]=_*E+v*P+y*O,this.elements[6]=b*k+x*C+w*R,this.elements[7]=b*S+x*T+w*A,this.elements[8]=b*E+x*P+w*O,this.trigger(e.Events.change)},inverse:function(t){var n=this.elements;t=t||new e.Matrix;var r=n[0],i=n[1],a=n[2],s=n[3],o=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=h*o-l*c,f=-h*s+l*u,p=c*s-o*u,g=r*d+i*f+a*p;return g?(g=1/g,t.elements[0]=d*g,t.elements[1]=(-h*i+a*c)*g,t.elements[2]=(l*i-a*o)*g,t.elements[3]=f*g,t.elements[4]=(h*r-a*u)*g,t.elements[5]=(-l*r+a*s)*g,t.elements[6]=p*g,t.elements[7]=(-c*r+i*u)*g,t.elements[8]=(o*r-i*s)*g,t):null},scale:function(e,t){return arguments.length<=1&&(t=e),this.multiply(e,0,0,0,t,0,0,0,1)},rotate:function(e){var r=t(e),i=n(e);return this.multiply(r,-i,0,i,r,0,0,0,1)},translate:function(e,t){return this.multiply(1,0,e,0,1,t,0,0,1)},skewX:function(e){var t=r(e);return this.multiply(1,t,0,0,1,0,0,0,1)},skewY:function(e){var t=r(e);return this.multiply(1,0,0,t,1,0,0,0,1)},toString:function(e){return s.length=0,this.toArray(e,s),s.join(" ")},toArray:function(e,t){var n=this.elements,r=!!t,i=a(n[0]),s=a(n[1]),o=a(n[2]),l=a(n[3]),u=a(n[4]),c=a(n[5]);if(e){var h=a(n[6]),d=a(n[7]),f=a(n[8]);return r?(t[0]=i,t[1]=l,t[2]=h,t[3]=s,t[4]=u,t[5]=d,t[6]=o,t[7]=c,void(t[8]=f)):[i,l,h,s,u,d,o,c,f]}return r?(t[0]=i,t[1]=l,t[2]=s,t[3]=u,t[4]=o,void(t[5]=c)):[i,l,s,u,o,c]},clone:function(){var t,n,r,i,a,s,o,l,u;t=this.elements[0],n=this.elements[1],r=this.elements[2],i=this.elements[3],a=this.elements[4],s=this.elements[5],o=this.elements[6],l=this.elements[7],u=this.elements[8];var c=new e.Matrix(t,n,r,i,a,s,o,l,u);return c.manual=this.manual,c}})}((void 0!==e?e:window).Two),function(e){var t=e.Utils.mod,n=e.Utils.toFixed,r=e.Utils,i={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(e,t){var n=e,a=document.createElementNS(i.ns,n);return"svg"===n&&(t=r.defaults(t||{},{version:i.version})),r.isEmpty(t)||i.setAttributes(a,t),a},setAttributes:function(e,t){for(var n=Object.keys(t),r=0;r=o&&i&&(S.command===e.Commands.curve&&(P=a,_=S.controls&&S.controls.right||S,v=P.controls&&P.controls.left||P,S.relative?(h=n(_.x+S.x),d=n(_.y+S.y)):(h=n(_.x),d=n(_.y)),P.relative?(f=n(v.x+P.x),p=n(v.y+P.y)):(f=n(v.x),p=n(v.y)),c+=" C "+h+" "+d+" "+f+" "+p+" "+(R=n(P.x))+" "+(A=n(P.y))),S.command!==e.Commands.close&&(c+=" Z")),l+=c+" "}return l},getClip:function(e){var t=e._renderer.clip;if(!t){for(var n=e;n.parent;)n=n.parent;t=e._renderer.clip=i.createElement("clipPath"),n.defs.appendChild(t)}return t},group:{appendChild:function(e){var t=e._renderer.elem;if(t){var n=t.nodeName;!n||/(radial|linear)gradient/i.test(n)||e._clip||this.elem.appendChild(t)}},removeChild:function(e){var t=e._renderer.elem;t&&t.parentNode==this.elem&&(t.nodeName&&(e._clip||this.elem.removeChild(t)))},orderChild:function(e){this.elem.appendChild(e._renderer.elem)},renderChild:function(e){i[e._renderer.type].render.call(e,this)},render:function(e){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;this._renderer.elem||(this._renderer.elem=i.createElement("g",{id:this.id}),e.appendChild(this._renderer.elem));var t=this._matrix.manual||this._flagMatrix,n={domElement:e,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(var r=0;r0&&(t["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?i.setAttributes(this._renderer.elem,t):(t.id=this.id,this._renderer.elem=i.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){var r=i.getClip(this),a=this._renderer.elem;this._clip?(a.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(a)):(r.removeAttribute("id"),a.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(a))}return this.flagReset()}},text:{render:function(e){this._update();var t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=i.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["alignment-baseline"]=t["dominant-baseline"]=this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),i[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),i[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this._className),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" ")),this._renderer.elem?i.setAttributes(this._renderer.elem,t):(t.id=this.id,this._renderer.elem=i.createElement("text",t),e.defs.appendChild(this._renderer.elem)),this._flagClip){var n=i.getClip(this),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),n.setAttribute("id",this.id),n.appendChild(r)):(n.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(e,t){t||this._update();var n={};if(this._flagEndPoints&&(n.x1=this.left._x,n.y1=this.left._y,n.x2=this.right._x,n.y2=this.right._y),this._flagSpread&&(n.spreadMethod=this._spread),this._renderer.elem?i.setAttributes(this._renderer.elem,n):(n.id=this.id,n.gradientUnits="userSpaceOnUse",this._renderer.elem=i.createElement("linearGradient",n),e.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 a=0;a0&&(a.x*=-1),a.y>0&&(a.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(a.width=0,a.height=0,o)){switch(s.width=a.width=o.width,s.height=a.height=o.height,this._repeat){case"no-repeat":a.width+=1,a.height+=1}this._scale instanceof e.Vector?(a.width*=this._scale.x,a.height*=this._scale.y):(a.width*=this._scale,a.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?r.isEmpty(s)||i.setAttributes(this._renderer.image,s):this._renderer.image=i.createElement("image",s)),this._renderer.elem?r.isEmpty(a)||i.setAttributes(this._renderer.elem,a):(a.id=this.id,a.patternUnits="userSpaceOnUse",this._renderer.elem=i.createElement("pattern",a),t.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()}}},a=e[e.Types.svg]=function(t){this.domElement=t.domElement||i.createElement("svg"),this.scene=new e.Group,this.scene.parent=this,this.defs=i.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"};r.extend(a,{Utils:i}),r.extend(a.prototype,e.Utils.Events,{constructor:a,setSize:function(t,n){return this.width=t,this.height=n,i.setAttributes(this.domElement,{width:t,height:n}),this.trigger(e.Events.resize,t,n)},render:function(){return i.group.render.call(this.scene,this.domElement),this}})}((void 0!==e?e:window).Two),function(e){var t=e.Utils.mod,n=e.Utils.toFixed,r=e.Utils.getRatio,i=e.Utils,a=[],s=2*Math.PI,o=Math.max,l=Math.min,u=Math.abs,c=Math.sin,h=Math.cos,d=Math.acos,f=Math.sqrt,p=function(e){return 1==e[0]&&0==e[3]&&0==e[1]&&1==e[4]&&0==e[2]&&0==e[5]},g={isHidden:/(none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(e){return this[e]},e.setAttribute=function(e,t){return this[e]=t,this},e},group:{renderChild:function(e){g[e._renderer.type].render.call(e,this.ctx,!0,this.clip)},render:function(e){this._update();var t=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);var r=p(t),i=this._mask;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,r||(e.save(),e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),i&&g[i._renderer.type].render.call(i,e,!0),this.opacity>0&&0!==this.scale)for(var a=0;a0&&r.setLineDash(W),r.beginPath();for(var G=0;G=k&&b&&(P=R,L=T.controls&&T.controls.right||e.Vector.zero,j=P.controls&&P.controls.left||e.Vector.zero,T._relative?(M=L.x+n(T.x),F=L.y+n(T.y)):(M=n(L.x),F=n(L.y)),P._relative?(A=j.x+n(P.x),O=j.y+n(P.y)):(A=n(j.x),O=n(j.y)),I=n(P.x),D=n(P.y),r.bezierCurveTo(M,F,A,O,I,D));break;case e.Commands.line:r.lineTo(I,D);break;case e.Commands.move:R=T,r.moveTo(I,D)}return b&&r.closePath(),W&&W.length>0&&r.setLineDash(a),z||l||(g.isHidden.test(d)||((B=d._renderer&&d._renderer.offset)&&(r.save(),r.translate(-d._renderer.offset.x,-d._renderer.offset.y),r.scale(d._renderer.scale.x,d._renderer.scale.y)),r.fill(),B&&r.restore()),g.isHidden.test(c)||((B=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=h/c._renderer.scale.x),r.stroke(),B&&r.restore())),V||r.restore(),z&&!l&&r.clip(),this.flagReset()}},text:{render:function(e,t,r){this._update();var a,s,o,l,u,c,h,d=this._matrix.elements,f=this._stroke,m=this._linewidth,_=this._fill,v=this._opacity*this.parent._renderer.opacity,y=this._visible,b=p(d),x=_._renderer&&_._renderer.offset&&f._renderer&&f._renderer.offset,w=this.dashes,k=this._clip;return t||y&&!k?(b||(e.save(),e.transform(d[0],d[3],d[1],d[4],d[2],d[5])),x||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=g.alignments[this._alignment]||this._alignment,e.textBaseline=this._baseline,_&&(i.isString(_)?e.fillStyle=_:(g[_._renderer.type].render.call(_,e),e.fillStyle=_._renderer.effect)),f&&(i.isString(f)?e.strokeStyle=f:(g[f._renderer.type].render.call(f,e),e.strokeStyle=f._renderer.effect)),m&&(e.lineWidth=m),i.isNumber(v)&&(e.globalAlpha=v),w&&w.length>0&&e.setLineDash(w),k||r||(g.isHidden.test(_)||(_._renderer&&_._renderer.offset?(c=n(_._renderer.scale.x),h=n(_._renderer.scale.y),e.save(),e.translate(-n(_._renderer.offset.x),-n(_._renderer.offset.y)),e.scale(c,h),a=this._size/_._renderer.scale.y,s=this._leading/_._renderer.scale.y,e.font=[this._style,this._weight,n(a)+"px/",n(s)+"px",this._family].join(" "),o=_._renderer.offset.x/_._renderer.scale.x,l=_._renderer.offset.y/_._renderer.scale.y,e.fillText(this.value,n(o),n(l)),e.restore()):e.fillText(this.value,0,0)),g.isHidden.test(f)||(f._renderer&&f._renderer.offset?(c=n(f._renderer.scale.x),h=n(f._renderer.scale.y),e.save(),e.translate(-n(f._renderer.offset.x),-n(f._renderer.offset.y)),e.scale(c,h),a=this._size/f._renderer.scale.y,s=this._leading/f._renderer.scale.y,e.font=[this._style,this._weight,n(a)+"px/",n(s)+"px",this._family].join(" "),o=f._renderer.offset.x/f._renderer.scale.x,l=f._renderer.offset.y/f._renderer.scale.y,u=m/f._renderer.scale.x,e.lineWidth=n(u),e.strokeText(this.value,n(o),n(l)),e.restore()):e.strokeText(this.value,0,0))),b||e.restore(),k&&!r&&e.clip(),this.flagReset()):this}},"linear-gradient":{render:function(e){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=e.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var t=0;t1){var P=f(T);k=(a*=P)*a,S=(l*=P)*l}var R=k*C+S*E,A=f(o(0,(k*S-R)/R));d===p&&(A=-A);var O=A*a*w/l,M=-A*l*x/a,F=h(g)*O-c(g)*M+(r+m)/2,N=c(g)*O+h(g)*M+(i+v)/2,U=_(1,0,(x-O)/a,(w-M)/l);!function(n,r,i,a,o,l,u,c,h){var d=e.Utils.Curve.Tolerance.epsilon,f=u-l,p=Math.abs(f)0&&S.setLineDash(N),S.save(),S.scale(E,E),S.translate(D,z),S.beginPath();for(var V=0;V=L&&F&&(s=j,_=B.controls&&B.controls.right||e.Vector.zero,v=s.controls&&s.controls.left||e.Vector.zero,B._relative?(f=o(_.x+B.x),p=o(_.y+B.y)):(f=o(_.x),p=o(_.y)),s._relative?(h=o(v.x+s.x),d=o(v.y+s.y)):(h=o(v.x),d=o(v.y)),y=o(s.x),b=o(s.y),S.bezierCurveTo(f,p,h,d,y,b));break;case e.Commands.line:S.lineTo(y,b);break;case e.Commands.move:j=B,S.moveTo(y,b)}}F&&S.closePath(),c.isHidden.test(P)||((x=P._renderer&&P._renderer.offset)&&(S.save(),S.translate(-P._renderer.offset.x,-P._renderer.offset.y),S.scale(P._renderer.scale.x,P._renderer.scale.y)),S.fill(),x&&S.restore()),c.isHidden.test(C)||((x=C._renderer&&C._renderer.offset)&&(S.save(),S.translate(-C._renderer.offset.x,-C._renderer.offset.y),S.scale(C._renderer.scale.x,C._renderer.scale.y),S.lineWidth=T/C._renderer.scale.x),S.stroke(),x&&S.restore()),S.restore()},getBoundingClientRect:function(e,t,n){var r,i,a=1/0,s=-1/0,o=1/0,l=-1/0;e.forEach(function(e){var t,n,r,i,u,c,h=e.x,d=e.y,f=e.controls;o=Math.min(d,o),a=Math.min(h,a),s=Math.max(h,s),l=Math.max(d,l),e.controls&&(u=f.left,c=f.right,u&&c&&(t=e._relative?u.x+h:u.x,n=e._relative?u.y+d:u.y,r=e._relative?c.x+h:c.x,i=e._relative?c.y+d:c.y,t&&n&&r&&i&&(o=Math.min(n,i,o),a=Math.min(t,r,a),s=Math.max(t,r,s),l=Math.max(n,i,l))))}),u.isNumber(t)&&(o-=t,a-=t,s+=t,l+=t),r=s-a,i=l-o,n.top=o,n.left=a,n.right=s,n.bottom=l,n.width=r,n.height=i,n.centroid||(n.centroid={}),n.centroid.x=-a,n.centroid.y=-o},render:function(t,r,i){if(!this._visible||!this._opacity)return this;this._update();var s=this.parent,o=s._matrix.manual||s._flagMatrix,l=this._matrix.manual||this._flagMatrix,h=this._flagVertices||this._flagFill||this._fill instanceof e.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof e.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof e.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 e.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof e.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof e.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||s._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 e.Array(9)),this._matrix.toArray(!0,a),n(a,s._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*s._renderer.scale),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new e.Array(12)),this._renderer.opacity=this._opacity*s._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,t,this,r),c.updateTexture.call(c,t,this)):(u.isString(this._fill)||this._fill._update(),u.isString(this._stroke)||this._stroke._update()),!this._clip||i?(t.bindBuffer(t.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),t.vertexAttribPointer(r.textureCoords,2,t.FLOAT,!1,0,0),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.buffer),t.vertexAttribPointer(r.position,2,t.FLOAT,!1,0,0),t.drawArrays(t.TRIANGLES,0,6),this.flagReset()):void 0}},text:{updateCanvas:function(e){var t=this.canvas,n=this.ctx,r=e._renderer.scale,i=e._stroke,a=e._linewidth*r,s=e._fill,l=e._renderer.opacity||e._opacity,h=e.dashes;t.width=Math.max(Math.ceil(e._renderer.rect.width*r),1),t.height=Math.max(Math.ceil(e._renderer.rect.height*r),1);var d,f,p,g,m,_,v,y=e._renderer.rect.centroid,b=y.x,x=y.y,w=s._renderer&&s._renderer.offset&&i._renderer&&i._renderer.offset;n.clearRect(0,0,t.width,t.height),w||(n.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),n.textAlign="center",n.textBaseline="middle",s&&(u.isString(s)?n.fillStyle=s:(c[s._renderer.type].render.call(s,n,e),n.fillStyle=s._renderer.effect)),i&&(u.isString(i)?n.strokeStyle=i:(c[i._renderer.type].render.call(i,n,e),n.strokeStyle=i._renderer.effect)),a&&(n.lineWidth=a),u.isNumber(l)&&(n.globalAlpha=l),h&&h.length>0&&n.setLineDash(h),n.save(),n.scale(r,r),n.translate(b,x),c.isHidden.test(s)||(s._renderer&&s._renderer.offset?(_=o(s._renderer.scale.x),v=o(s._renderer.scale.y),n.save(),n.translate(-o(s._renderer.offset.x),-o(s._renderer.offset.y)),n.scale(_,v),d=e._size/s._renderer.scale.y,f=e._leading/s._renderer.scale.y,n.font=[e._style,e._weight,o(d)+"px/",o(f)+"px",e._family].join(" "),p=s._renderer.offset.x/s._renderer.scale.x,g=s._renderer.offset.y/s._renderer.scale.y,n.fillText(e.value,o(p),o(g)),n.restore()):n.fillText(e.value,0,0)),c.isHidden.test(i)||(i._renderer&&i._renderer.offset?(_=o(i._renderer.scale.x),v=o(i._renderer.scale.y),n.save(),n.translate(-o(i._renderer.offset.x),-o(i._renderer.offset.y)),n.scale(_,v),d=e._size/i._renderer.scale.y,f=e._leading/i._renderer.scale.y,n.font=[e._style,e._weight,o(d)+"px/",o(f)+"px",e._family].join(" "),p=i._renderer.offset.x/i._renderer.scale.x,g=i._renderer.offset.y/i._renderer.scale.y,m=a/i._renderer.scale.x,n.lineWidth=o(m),n.strokeText(e.value,o(p),o(g)),n.restore()):n.strokeText(e.value,0,0)),n.restore()},getBoundingClientRect:function(e,t){var n=c.ctx;n.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" "),n.textAlign="center",n.textBaseline=e._baseline;var r=n.measureText(e._value).width,i=Math.max(e._size||e._leading);this._linewidth&&!c.isHidden.test(this._stroke)&&(i+=this._linewidth);var a=r/2,s=i/2;switch(c.alignments[e._alignment]||e._alignment){case c.alignments.left:t.left=0,t.right=r;break;case c.alignments.right:t.left=-r,t.right=0;break;default:t.left=-a,t.right=a}switch(e._baseline){case"bottom":t.top=-i,t.bottom=0;break;case"top":t.top=0,t.bottom=i;break;default:t.top=-s,t.bottom=s}t.width=r,t.height=i,t.centroid||(t.centroid={}),t.centroid.x=a,t.centroid.y=s},render:function(t,r,i){if(!this._visible||!this._opacity)return this;this._update();var s=this.parent,o=s._matrix.manual||s._flagMatrix,l=this._matrix.manual||this._flagMatrix,h=this._flagVertices||this._flagFill||this._fill instanceof e.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof e.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof e.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 e.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof e.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof e.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||s._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 e.Array(9)),this._matrix.toArray(!0,a),n(a,s._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*s._renderer.scale),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new e.Array(12)),this._renderer.opacity=this._opacity*s._renderer.opacity,c.text.getBoundingClientRect(this,this._renderer.rect),c.getTriangles(this._renderer.rect,this._renderer.triangles),c.updateBuffer.call(c,t,this,r),c.updateTexture.call(c,t,this)):(u.isString(this._fill)||this._fill._update(),u.isString(this._stroke)||this._stroke._update()),!this._clip||i?(t.bindBuffer(t.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),t.vertexAttribPointer(r.textureCoords,2,t.FLOAT,!1,0,0),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.buffer),t.vertexAttribPointer(r.position,2,t.FLOAT,!1,0,0),t.drawArrays(t.TRIANGLES,0,6),this.flagReset()):void 0}},"linear-gradient":{render:function(e,t){if(e.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=e.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var n=0;n=n)return n-r>=0;r+=a}return!1}function c(e,t){var n=e._length;if(t<=0)return 0;if(t>=n)return e._lengths.length-1;for(var r=0,i=0;r=t)return t-=i,Math.max(r-1,0)+t/e._lengths[r];i+=e._lengths[r]}return-1}function h(t,n,r){var i,a,s,o,l,u,c,h,d=n.controls&&n.controls.right,f=t.controls&&t.controls.left;return i=n.x,l=n.y,a=(d||n).x,u=(d||n).y,s=(f||t).x,c=(f||t).y,o=t.x,h=t.y,d&&n._relative&&(a+=n.x,u+=n.y),f&&t._relative&&(s+=t.x,c+=t.y),e.Utils.getCurveLength(i,l,a,u,s,c,o,h,r)}function d(t,n,r){var i,a,s,o,l,u,c,h,d=n.controls&&n.controls.right,f=t.controls&&t.controls.left;return i=n.x,l=n.y,a=(d||n).x,u=(d||n).y,s=(f||t).x,c=(f||t).y,o=t.x,h=t.y,d&&n._relative&&(a+=n.x,u+=n.y),f&&t._relative&&(s+=t.x,c+=t.y),e.Utils.subdivide(i,l,a,u,s,c,o,h,r)}o.extend(l,{Properties:["fill","stroke","linewidth","opacity","className","visible","cap","join","miter","closed","curved","automatic","beginning","ending"],Utils:{getCurveLength:h},FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)},BindVertices:function(t){for(var n=t.length;n--;)t[n].bind(e.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(t){for(var n=t.length;n--;)t[n].unbind(e.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(t){e.Shape.MakeObservable(t),o.each(l.Properties.slice(2,9),e.Utils.defineProperty,t),Object.defineProperty(t,"fill",{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.unbind(e.Events.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.bind(e.Events.change,this._renderer.flagFill)}}),Object.defineProperty(t,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.unbind(e.Events.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.bind(e.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(t,"length",{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(t,"closed",{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=!!e,this._flagVertices=!0}}),Object.defineProperty(t,"curved",{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}}),Object.defineProperty(t,"automatic",{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e!==this._automatic){this._automatic=!!e;var t=this._automatic?"ignore":"listen";o.each(this.vertices,function(e){e[t]()})}}}),Object.defineProperty(t,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}}),Object.defineProperty(t,"ending",{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}}),Object.defineProperty(t,"vertices",{enumerable:!0,get:function(){return this._collection},set:function(t){this._renderer.flagVertices;var n=this._renderer.bindVertices,r=this._renderer.unbindVertices;this._collection&&this._collection.unbind(e.Events.insert,n).unbind(e.Events.remove,r),t instanceof e.Utils.Collection?this._collection=t:this._collection=new e.Utils.Collection(t||[]),this._collection.bind(e.Events.insert,n).bind(e.Events.remove,r),n(this._collection)}}),Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}})}}),o.extend(l.prototype,e.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(e){var t=new l;t.vertices=this.vertices;for(var n=0;n=y){this._closed?(r=e.Utils.mod(S,b),i=e.Utils.mod(S-1,b),0===S&&(r=i,i=S)):(r=S,i=Math.min(Math.max(S-1,0),x)),w=this.vertices[r],k=this.vertices[i],y-=C,t=0!==this._lengths[S]?y/this._lengths[S]:0;break}C+=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,_=w.controls&&w.controls.left,l=k.x,f=k.y,u=(v||k).x,p=(v||k).y,c=(_||w).x,g=(_||w).y,h=w.x,m=w.y,v&&k.relative&&(u+=k.x,p+=k.y),_&&w.relative&&(c+=w.x,g+=w.y),s=e.Utils.getComponentOnCubicBezier(t,l,u,c,h),d=e.Utils.getComponentOnCubicBezier(t,f,p,g,m);var T=e.Utils.lerp(l,u,t),P=e.Utils.lerp(f,p,t),R=e.Utils.lerp(u,c,t),A=e.Utils.lerp(p,g,t),O=e.Utils.lerp(c,h,t),M=e.Utils.lerp(g,m,t),F=e.Utils.lerp(T,R,t),N=e.Utils.lerp(P,A,t),U=e.Utils.lerp(R,O,t),L=e.Utils.lerp(A,M,t);return o.isObject(n)?(n.x=s,n.y=d,o.isObject(n.controls)||e.Anchor.AppendCurveProperties(n),n.controls.left.x=F,n.controls.left.y=N,n.controls.right.x=U,n.controls.right.y=L,o.isBoolean(n.relative)&&!n.relative||(n.controls.left.x-=s,n.controls.left.y-=d,n.controls.right.x-=s,n.controls.right.y-=d),n.t=t,n):((a=new e.Anchor(s,d,F-s,N-d,U-s,L-d,this._curved?e.Commands.curve:e.Commands.line)).t=t,a)},plot:function(){if(this.curved)return e.Utils.getCurveFromPoints(this._collection,this.closed),this;for(var t=0;t0&&(a[a.length-1].command=e.Commands.line),void(r=s);var u=d(s,r,t);a=a.concat(u),o.each(u,function(t,n){n<=0&&r.command===e.Commands.move?t.command=e.Commands.move:t.command=e.Commands.line}),l>=n&&(this._closed&&this._automatic?(u=d(s,r=s,t),a=a.concat(u),o.each(u,function(t,n){n<=0&&r.command===e.Commands.move?t.command=e.Commands.move:t.command=e.Commands.line})):i&&a.push(new e.Anchor(s.x,s.y)),a[a.length-1].command=i?e.Commands.close:e.Commands.line),r=s}},this),this._automatic=!1,this._curved=!1,this.vertices=a,this},_updateLength:function(t,n){n||this._update();var r=this.vertices.length,i=r-1,a=this.vertices[i],s=0;return o.isUndefined(this._lengths)&&(this._lengths=[]),o.each(this.vertices,function(n,r){if(r<=0||n.command===e.Commands.move)return a=n,void(this._lengths[r]=0);this._lengths[r]=h(n,a,t),this._lengths[r]=e.Utils.toFixed(this._lengths[r]),s+=this._lengths[r],a=n},this),this._length=s,this._flagLength=!1,this},_update:function(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);var t,n,a,s,o,l=this._collection.length,h=this._closed,d=Math.min(this._beginning,this._ending),f=Math.max(this._beginning,this._ending),p=c(this,d*this._length),g=c(this,f*this._length),m=r(p),_=i(g);this._renderer.vertices.length=0;for(var v=0;v_&&!n?((o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(f,o),o.command=this._renderer.collection[v].command,this._renderer.vertices.push(o),n=o,(a=this._collection[v-1])&&a.controls&&(o.controls.right.clear(),this._renderer.collection[v-1].controls.right.clear().lerp(a.controls.right,o.t))):v>=m&&v<=_&&(o=this._renderer.collection[v].copy(this._collection[v]),this._renderer.vertices.push(o),v===_&&u(this,f)?(n=o,!h&&n.controls&&n.controls.right.clear()):v===m&&u(this,d)&&((t=o).command=e.Commands.move,!h&&t.controls&&t.controls.left.clear()));m>0&&!t&&(v=m-1,(o=this._renderer.collection[v]).copy(this._collection[v]),this.getPointAt(d,o),o.command=e.Commands.move,this._renderer.vertices.unshift(o),t=o,(s=this._collection[v+1])&&s.controls&&(o.controls.left.clear(),this._renderer.collection[v+1].controls.left.copy(s.controls.left).lerp(e.Vector.zero,o.t)))}return e.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,e.Shape.prototype.flagReset.call(this),this}}),l.MakeObservable(l.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=e.Utils,r=e.Line=function(n,r,i,a){t.call(this,[new e.Anchor(n,r),new e.Anchor(i,a)]),this.vertices[0].command=e.Commands.move,this.vertices[1].command=e.Commands.line,this.automatic=!1};n.extend(r.prototype,t.prototype),r.prototype.constructor=r,t.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=e.Utils,r=e.Rectangle=function(n,r,i,a){t.call(this,[new e.Anchor,new e.Anchor,new e.Anchor,new e.Anchor],!0,!1,!0),this.width=i,this.height=a,this.origin=new e.Vector,this.translation.set(n,r),this._update()};n.extend(r,{Properties:["width","height"],MakeObservable:function(i){t.MakeObservable(i),n.each(r.Properties,e.Utils.defineProperty,i),Object.defineProperty(i,"origin",{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(e.Events.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(e.Events.change,this._renderer.flagVertices),this._renderer.flagVertices()}})}}),n.extend(r.prototype,t.prototype,{_width:0,_height:0,_flagWidth:0,_flagHeight:0,_origin:null,constructor:r,_update:function(){if(this._flagWidth||this._flagHeight){var n=this._width/2,r=this._height/2;this.vertices[0].set(-n,-r).add(this._origin).command=e.Commands.move,this.vertices[1].set(n,-r).add(this._origin).command=e.Commands.line,this.vertices[2].set(n,r).add(this._origin).command=e.Commands.line,this.vertices[3].set(-n,r).add(this._origin).command=e.Commands.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).add(this._origin).command=e.Commands.line)}return t.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,t.prototype.flagReset.call(this),this},clone:function(t){var i=new r(0,0,this.width,this.height);return i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,n.each(e.Path.Properties,function(e){i[e]=this[e]},this),t&&t.add(i),i}}),r.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=2*Math.PI,r=Math.PI/2,i=Math.cos,a=Math.sin,s=e.Utils,o=4/3*Math.tan(Math.PI/8),l=e.Ellipse=function(n,r,i,a,o){s.isNumber(a)||(a=i);var l=o||5,u=s.map(s.range(l),function(t){return new e.Anchor},this);t.call(this,u,!0,!0,!0),this.width=2*i,this.height=2*a,this._update(),this.translation.set(n,r)};s.extend(l,{Properties:["width","height"],MakeObservable:function(n){t.MakeObservable(n),s.each(l.Properties,e.Utils.defineProperty,n)}}),s.extend(l.prototype,t.prototype,{_width:0,_height:0,_flagWidth:!1,_flagHeight:!1,constructor:l,_update:function(){if(this._flagWidth||this._flagHeight)for(var s=0,l=this.vertices.length,u=l-1;sa&&(this.vertices.splice(a-1,o-a),o=a);for(var l=0;l=o?this.vertices.push(new e.Anchor(c,h)):this.vertices[l].set(c,h),this.vertices[l].command=0===l?e.Commands.move:e.Commands.line}}return t.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,t.prototype.flagReset.call(this),this},clone:function(t){var n=new s(0,0,this.radius,this.sides);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,a.each(e.Path.Properties,function(e){n[e]=this[e]},this),t&&t.add(n),n}}),s.MakeObservable(s.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=(Math.PI,2*Math.PI),r=Math.PI/2,i=(Math.cos,Math.sin,Math.abs,e.Utils),a=e.ArcSegment=function(n,r,a,s,o,l,u){var c=u||3*e.Resolution,h=i.map(i.range(c),function(){return new e.Anchor});t.call(this,h,!0,!1,!0),this.innerRadius=a,this.outerRadius=s,this.startAngle=o,this.endAngle=l,this._update(),this.translation.set(n,r)};function s(e,t){for(;e<0;)e+=t;return e%t}i.extend(a,{Properties:["startAngle","endAngle","innerRadius","outerRadius"],MakeObservable:function(n){t.MakeObservable(n),i.each(a.Properties,e.Utils.defineProperty,n)}}),i.extend(a.prototype,t.prototype,{_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:n,_innerRadius:0,_outerRadius:0,constructor:a,_update:function(){if(this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var i,a=this._startAngle,o=this._endAngle,l=this._innerRadius,u=this._outerRadius,c=s(a,n)===s(o,n),h=l>0,d=this.vertices,f=h?d.length/2:d.length,p=0;c?f--:h||(f-=2);for(var g=0,m=f-1;ga&&(this.vertices.splice(a-1,o-a),o=a);for(var l=0;l=o?this.vertices.push(new e.Anchor(h,d)):this.vertices[l].set(h,d),this.vertices[l].command=0===l?e.Commands.move:e.Commands.line}}return t.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,t.prototype.flagReset.call(this),this},clone:function(t){var n=this.innerRadius,r=this.outerRadius,i=this.sides,o=new s(0,0,n,r,i);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,a.each(e.Path.Properties,function(e){o[e]=this[e]},this),t&&t.add(o),o}}),s.MakeObservable(s.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Path,n=e.Utils,r=e.RoundedRectangle=function(i,a,s,o,l){n.isUndefined(l)&&(l=Math.floor(Math.min(s,o)/12));var u=n.map(n.range(10),function(t){return new e.Anchor(0,0,0,0,0,0,0===t?e.Commands.move:e.Commands.curve)});t.call(this,u),this.closed=!0,this.automatic=!1,this._renderer.flagRadius=n.bind(r.FlagRadius,this),this.width=s,this.height=o,this.radius=l,this._update(),this.translation.set(i,a)};n.extend(r,{Properties:["width","height"],FlagRadius:function(){this._flagRadius=!0},MakeObservable:function(i){t.MakeObservable(i),n.each(r.Properties,e.Utils.defineProperty,i),Object.defineProperty(i,"radius",{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof e.Vector&&this._radius.unbind(e.Events.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof e.Vector&&this._radius.bind(e.Events.change,this._renderer.flagRadius),this._flagRadius=!0}})}}),n.extend(r.prototype,t.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 n,r,i,a=this._width,s=this._height;this._radius instanceof e.Vector?(n=this._radius.x,r=this._radius.y):(n=this._radius,r=this._radius);var o=a/2,l=s/2;(i=this.vertices[0]).x=-(o-n),i.y=-l,(i=this.vertices[1]).x=o-n,i.y=-l,i.controls.left.clear(),i.controls.right.x=n,i.controls.right.y=0,(i=this.vertices[2]).x=o,i.y=-(l-r),i.controls.right.clear(),i.controls.left.clear(),(i=this.vertices[3]).x=o,i.y=l-r,i.controls.left.clear(),i.controls.right.x=0,i.controls.right.y=r,(i=this.vertices[4]).x=o-n,i.y=l,i.controls.right.clear(),i.controls.left.clear(),(i=this.vertices[5]).x=-(o-n),i.y=l,i.controls.left.clear(),i.controls.right.x=-n,i.controls.right.y=0,(i=this.vertices[6]).x=-o,i.y=l-r,i.controls.left.clear(),i.controls.right.clear(),(i=this.vertices[7]).x=-o,i.y=-(l-r),i.controls.left.clear(),i.controls.right.x=0,i.controls.right.y=-r,(i=this.vertices[8]).x=-(o-n),i.y=-l,i.controls.left.clear(),i.controls.right.clear(),(i=this.vertices[9]).copy(this.vertices[8])}return t.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,t.prototype.flagReset.call(this),this},clone:function(t){var i=this.width,a=this.height,s=this.radius,o=new r(0,0,i,a,s);return o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,n.each(e.Path.Properties,function(e){o[e]=this[e]},this),t&&t.add(o),o}}),r.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.root,n=e.Utils.getComputedMatrix,r=e.Utils,i=((t.document?t.document.createElement("canvas"):(console.warn("Two.js: Unable to create canvas for Two.Text measurements."),{getContext:r.identity})).getContext("2d"),e.Text=function(t,n,i,a){if(e.Shape.call(this),this._renderer.type="text",this._renderer.flagFill=r.bind(e.Text.FlagFill,this),this._renderer.flagStroke=r.bind(e.Text.FlagStroke,this),this.value=t,r.isNumber(n)&&(this.translation.x=n),r.isNumber(i)&&(this.translation.y=i),this.dashes=[],!r.isObject(a))return this;r.each(e.Text.Properties,function(e){e in a&&(this[e]=a[e])},this)});r.extend(e.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(t){e.Shape.MakeObservable(t),r.each(e.Text.Properties.slice(0,13),e.Utils.defineProperty,t),Object.defineProperty(t,"fill",{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.unbind(e.Events.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof e.Gradient||this._fill instanceof e.LinearGradient||this._fill instanceof e.RadialGradient||this._fill instanceof e.Texture)&&this._fill.bind(e.Events.change,this._renderer.flagFill)}}),Object.defineProperty(t,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.unbind(e.Events.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof e.Gradient||this._stroke instanceof e.LinearGradient||this._stroke instanceof e.RadialGradient||this._stroke instanceof e.Texture)&&this._stroke.bind(e.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(t,"clip",{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}})}}),r.extend(e.Text.prototype,e.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:e.Text,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(t){var n=new e.Text(this.value);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,r.each(e.Text.Properties,function(e){n[e]=this[e]},this),t&&t.add(n),n._update()},toObject:function(){var t={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return r.each(e.Text.Properties,function(e){t[e]=this[e]},this),t},noStroke:function(){return this.stroke="transparent",this},noFill:function(){return this.fill="transparent",this},getBoundingClientRect:function(e){var t,r,a,s,o,l;this._update(!0),t=e?this._matrix:n(this);var u=this.leading,c=this.value.length*this.size*i.Ratio;switch(this.alignment){case"left":a=0,s=c;break;case"right":a=-c,s=0;break;default:a=-c/2,s=c/2}switch(this.baseline){case"top":o=0,l=u;break;case"bottom":o=-u,l=0;break;default:o=-u/2,l=u/2}return{top:o=(r=t.multiply(a,o,1)).y,left:a=r.x,right:s=(r=t.multiply(s,l,1)).x,bottom:l=r.y,width:s-a,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,e.Shape.prototype.flagReset.call(this),this}}),e.Text.MakeObservable(e.Text.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.Stop=function(e,r,i){this._renderer={},this._renderer.type="stop",this.offset=t.isNumber(e)?e:n.Index<=0?0:1,this.opacity=t.isNumber(i)?i:1,this.color=t.isString(r)?r:n.Index<=0?"#fff":"#000",n.Index=(n.Index+1)%2};t.extend(n,{Index:0,Properties:["offset","opacity","color"],MakeObservable:function(e){t.each(n.Properties,function(e){var t="_"+e,n="_flag"+e.charAt(0).toUpperCase()+e.slice(1);Object.defineProperty(this,e,{enumerable:!0,get:function(){return this[t]},set:function(e){this[t]=e,this[n]=!0,this.parent&&(this.parent._flagStops=!0)}})},e)}}),t.extend(n.prototype,e.Utils.Events,{constructor:n,clone:function(){var e=new n;return t.each(n.Properties,function(t){e[t]=this[t]},this),e},toObject:function(){var e={};return t.each(n.Properties,function(t){e[t]=this[t]},this),e},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),n.MakeObservable(n.prototype),n.prototype.constructor=n;var r=e.Gradient=function(n){this._renderer={},this._renderer.type="gradient",this.id=e.Identifier+e.uniqueId(),this.classList=[],this._renderer.flagStops=t.bind(r.FlagStops,this),this._renderer.bindStops=t.bind(r.BindStops,this),this._renderer.unbindStops=t.bind(r.UnbindStops,this),this.spread="pad",this.stops=n};t.extend(r,{Stop:n,Properties:["spread"],MakeObservable:function(n){t.each(r.Properties,e.Utils.defineProperty,n),Object.defineProperty(n,"stops",{enumerable:!0,get:function(){return this._stops},set:function(t){this._renderer.flagStops;var n=this._renderer.bindStops,r=this._renderer.unbindStops;this._stops&&this._stops.unbind(e.Events.insert,n).unbind(e.Events.remove,r),this._stops=new e.Utils.Collection((t||[]).slice(0)),this._stops.bind(e.Events.insert,n).bind(e.Events.remove,r),n(this._stops)}})},FlagStops:function(){this._flagStops=!0},BindStops:function(t){for(var n=t.length;n--;)t[n].bind(e.Events.change,this._renderer.flagStops),t[n].parent=this;this._renderer.flagStops()},UnbindStops:function(t){for(var n=t.length;n--;)t[n].unbind(e.Events.change,this._renderer.flagStops),delete t[n].parent;this._renderer.flagStops()}}),t.extend(r.prototype,e.Utils.Events,{_flagStops:!1,_flagSpread:!1,clone:function(n){var i=t.map(this.stops,function(e){return e.clone()}),a=new r(i);return t.each(e.Gradient.Properties,function(e){a[e]=this[e]},this),n&&n.add(a),a},toObject:function(){var e={stops:t.map(this.stops,function(e){return e.toObject()})};return t.each(r.Properties,function(t){e[t]=this[t]},this),e},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(e.Events.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),r.MakeObservable(r.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.LinearGradient=function(r,i,a,s,o){e.Gradient.call(this,o),this._renderer.type="linear-gradient";var l=t.bind(n.FlagEndPoints,this);this.left=(new e.Vector).bind(e.Events.change,l),this.right=(new e.Vector).bind(e.Events.change,l),t.isNumber(r)&&(this.left.x=r),t.isNumber(i)&&(this.left.y=i),t.isNumber(a)&&(this.right.x=a),t.isNumber(s)&&(this.right.y=s)};t.extend(n,{Stop:e.Gradient.Stop,MakeObservable:function(t){e.Gradient.MakeObservable(t)},FlagEndPoints:function(){this._flagEndPoints=!0}}),t.extend(n.prototype,e.Gradient.prototype,{_flagEndPoints:!1,constructor:n,clone:function(r){var i=t.map(this.stops,function(e){return e.clone()}),a=new n(this.left._x,this.left._y,this.right._x,this.right._y,i);return t.each(e.Gradient.Properties,function(e){a[e]=this[e]},this),r&&r.add(a),a},toObject:function(){var t=e.Gradient.prototype.toObject.call(this);return t.left=this.left.toObject(),t.right=this.right.toObject(),t},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(e.Events.change),this},flagReset:function(){return this._flagEndPoints=!1,e.Gradient.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.RadialGradient=function(n,r,i,a,s,o){e.Gradient.call(this,a),this._renderer.type="radial-gradient",this.center=(new e.Vector).bind(e.Events.change,t.bind(function(){this._flagCenter=!0},this)),this.radius=t.isNumber(i)?i:20,this.focal=(new e.Vector).bind(e.Events.change,t.bind(function(){this._flagFocal=!0},this)),t.isNumber(n)&&(this.center.x=n),t.isNumber(r)&&(this.center.y=r),this.focal.copy(this.center),t.isNumber(s)&&(this.focal.x=s),t.isNumber(o)&&(this.focal.y=o)};t.extend(n,{Stop:e.Gradient.Stop,Properties:["radius"],MakeObservable:function(r){e.Gradient.MakeObservable(r),t.each(n.Properties,e.Utils.defineProperty,r)}}),t.extend(n.prototype,e.Gradient.prototype,{_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,constructor:n,clone:function(r){var i=t.map(this.stops,function(e){return e.clone()}),a=new n(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return t.each(e.Gradient.Properties.concat(n.Properties),function(e){a[e]=this[e]},this),r&&r.add(a),a},toObject:function(){var r=e.Gradient.prototype.toObject.call(this);return t.each(n.Properties,function(e){r[e]=this[e]},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(e.Events.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,e.Gradient.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==e?e:window).Two),function(e){var t,n=e.root,r=e.Utils,i={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff)$/i,effect:/texture|gradient/i};n.document&&(t=document.createElement("a"));var a=e.Texture=function(t,n){if(this._renderer={},this._renderer.type="texture",this._renderer.flagOffset=r.bind(a.FlagOffset,this),this._renderer.flagScale=r.bind(a.FlagScale,this),this.id=e.Identifier+e.uniqueId(),this.classList=[],this.offset=new e.Vector,r.isFunction(n)){var i=r.bind(function(){this.unbind(e.Events.load,i),r.isFunction(n)&&n()},this);this.bind(e.Events.load,i)}r.isString(t)?this.src=t:r.isElement(t)&&(this.image=t),this._update()};r.extend(a,{Properties:["src","loaded","repeat"],RegularExpressions:i,ImageRegistry:new e.Registry,getAbsoluteURL:function(e){return t?(t.href=e,t.href):e},loadHeadlessBuffer:new Function("texture","loaded",['var fs = require("fs");',"var buffer = fs.readFileSync(texture.src);","texture.image.src = buffer;","loaded();"].join("\n")),getImage:function(t){var r,s=a.getAbsoluteURL(t);return a.ImageRegistry.contains(s)?a.ImageRegistry.get(s):(e.Utils.Image?(r=new e.Utils.Image,e.CanvasRenderer.Utils.shim(r,"img")):n.document?r=i.video.test(s)?document.createElement("video"):document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r)},Register:{canvas:function(e,t){e._src="#"+e.id,a.ImageRegistry.add(e.src,e.image),r.isFunction(t)&&t()},img:function(t,n){var i=function(e){r.isFunction(t.image.removeEventListener)&&(t.image.removeEventListener("load",i,!1),t.image.removeEventListener("error",s,!1)),r.isFunction(n)&&n()},s=function(n){throw r.isFunction(t.image.removeEventListener)&&(t.image.removeEventListener("load",i,!1),t.image.removeEventListener("error",s,!1)),new e.Utils.Error("unable to load "+t.src)};r.isNumber(t.image.width)&&t.image.width>0&&r.isNumber(t.image.height)&&t.image.height>0?i():r.isFunction(t.image.addEventListener)&&(t.image.addEventListener("load",i,!1),t.image.addEventListener("error",s,!1)),t._src=a.getAbsoluteURL(t._src),t.image&&t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),a.ImageRegistry.add(t.src,t.image),e.Utils.isHeadless?a.loadHeadlessBuffer(t,i):t.image.src=t.src)},video:function(t,n){var i=function(e){t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",s,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,t.image.play(),r.isFunction(n)&&n()},s=function(n){throw t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",s,!1),new e.Utils.Error("unable to load "+t.src)};if(t._src=a.getAbsoluteURL(t._src),t.image.addEventListener("canplaythrough",i,!1),t.image.addEventListener("error",s,!1),!t.image||!t.image.getAttribute("two-src")){if(e.Utils.isHeadless)throw new e.Utils.Error("video textures are not implemented in headless environments.");t.image.setAttribute("two-src",t.src),a.ImageRegistry.add(t.src,t.image),t.image.src=t.src,t.image.loop=!0,t.image.load()}}},load:function(e,t){e.src;var n=e.image,r=n&&n.nodeName.toLowerCase();e._flagImage&&(/canvas/i.test(r)?a.Register.canvas(e,t):(e._src=n.getAttribute("two-src")||n.src,a.Register[r](e,t))),e._flagSrc&&(n||(e.image=a.getImage(e.src)),r=e.image.nodeName.toLowerCase(),a.Register[r](e,t))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(t){r.each(a.Properties,e.Utils.defineProperty,t),Object.defineProperty(t,"image",{enumerable:!0,get:function(){return this._image},set:function(e){var t;switch(e&&e.nodeName.toLowerCase()){case"canvas":t="#"+e.id;break;default:t=e.src}a.ImageRegistry.contains(t)?this._image=a.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(e.Events.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(e.Events.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(t,"scale",{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof e.Vector&&this._scale.unbind(e.Events.change,this._renderer.flagScale),this._scale=t,this._scale instanceof e.Vector&&this._scale.bind(e.Events.change,this._renderer.flagScale),this._flagScale=!0}})}}),r.extend(a.prototype,e.Utils.Events,e.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:a,clone:function(){return new a(this.src)},toObject:function(){return{src:this.src,image:this.image}},_update:function(){return(this._flagSrc||this._flagImage)&&(this.trigger(e.Events.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,a.load(this,r.bind(function(){this.loaded=!0,this.trigger(e.Events.change).trigger(e.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}}),a.MakeObservable(a.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.Path,r=e.Rectangle,i=e.Sprite=function(r,i,a,s,o,l){n.call(this,[new e.Anchor,new e.Anchor,new e.Anchor,new e.Anchor],!0),this.noStroke(),this.noFill(),r instanceof e.Texture?this.texture=r:t.isString(r)&&(this.texture=new e.Texture(r)),this.origin=new e.Vector,this._update(),this.translation.set(i||0,a||0),t.isNumber(s)&&(this.columns=s),t.isNumber(o)&&(this.rows=o),t.isNumber(l)&&(this.frameRate=l)};t.extend(i,{Properties:["texture","columns","rows","frameRate","index"],MakeObservable:function(n){r.MakeObservable(n),t.each(i.Properties,e.Utils.defineProperty,n)}}),t.extend(i.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:i,play:function(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=t.performance.now(),t.isNumber(e)&&(this._firstFrame=e),t.isNumber(n)&&(this._lastFrame=n),t.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(e){var t=new i(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(t.play(this._firstFrame,this._lastFrame),t._loop=this._loop),e&&e.add(t),t},_update:function(){var e,n,i,a,s,o,l,u,c,h=this._texture,d=this._columns,f=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){e=(l=h.image.width)/d,n=(u=h.image.height)/f,a=this._amount,this.width!==e&&(this.width=e),this.height!==n&&(this.height=n),this._playing&&this._frameRate>0&&(t.isNaN(this._lastFrame)&&(this._lastFrame=a-1),i=t.performance.now()-this._startTime,s=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?i%=s:i=Math.min(i,s),o=t.lerp(this._firstFrame,c,i/s),(o=Math.floor(o))!==this._index&&(this._index=o,o>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var p=-e*(this._index%d)+(l-e)/2,g=-n*Math.floor(this._index/d)+(u-n)/2;p!==h.offset.x&&(h.offset.x=p),g!==h.offset.y&&(h.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}}),i.MakeObservable(i.prototype)}((void 0!==e?e:window).Two),function(e){var t=e.Utils,n=e.Path,r=e.Rectangle,i=e.ImageSequence=function(r,a,s,o){n.call(this,[new e.Anchor,new e.Anchor,new e.Anchor,new e.Anchor],!0),this._renderer.flagTextures=t.bind(i.FlagTextures,this),this._renderer.bindTextures=t.bind(i.BindTextures,this),this._renderer.unbindTextures=t.bind(i.UnbindTextures,this),this.noStroke(),this.noFill(),this.textures=t.map(r,i.GenerateTexture,this),this.origin=new e.Vector,this._update(),this.translation.set(a||0,s||0),t.isNumber(o)?this.frameRate=o:this.frameRate=i.DefaultFrameRate};t.extend(i,{Properties:["frameRate","index"],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(t){for(var n=t.length;n--;)t[n].bind(e.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(t){for(var n=t.length;n--;)t[n].unbind(e.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(n){r.MakeObservable(n),t.each(i.Properties,e.Utils.defineProperty,n),Object.defineProperty(n,"textures",{enumerable:!0,get:function(){return this._textures},set:function(t){this._renderer.flagTextures;var n=this._renderer.bindTextures,r=this._renderer.unbindTextures;this._textures&&this._textures.unbind(e.Events.insert,n).unbind(e.Events.remove,r),this._textures=new e.Utils.Collection((t||[]).slice(0)),this._textures.bind(e.Events.insert,n).bind(e.Events.remove,r),n(this._textures)}})},GenerateTexture:function(n){return n instanceof e.Texture?n:t.isString(n)?new e.Texture(n):void 0}}),t.extend(i.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:i,play:function(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=t.performance.now(),t.isNumber(e)&&(this._firstFrame=e),t.isNumber(n)&&(this._lastFrame=n),t.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(e){var t=new i(this.textures,this.translation.x,this.translation.y,this.frameRate);return t._loop=this._loop,this._playing&&t.play(),e&&e.add(t),t},_update:function(){var n,i,a,s,o,l,u,c,h=this._textures;return this._flagTextures&&(this._amount=h.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,t.isNaN(this._lastFrame)&&(this._lastFrame=s-1),a=t.performance.now()-this._startTime,o=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?a%=o:a=Math.min(a,o),u=t.lerp(this._firstFrame,c,a/o),(u=Math.floor(u))!==this._index&&(this._index=u,(l=h[this._index]).loaded&&(n=l.image.width,i=l.image.height,this.width!==n&&(this.width=n),this.height!==i&&(this.height=i),this.fill=l,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!this._flagIndex&&this.fill instanceof e.Texture||((l=h[this._index]).loaded&&(n=l.image.width,i=l.image.height,this.width!==n&&(this.width=n),this.height!==i&&(this.height=i)),this.fill=l),r.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==e?e:window).Two),function(e){var t=Math.min,n=Math.max,r=e.Utils,i=function(){e.Utils.Collection.apply(this,arguments),Object.defineProperty(this,"_events",{value:{},enumerable:!1}),this.ids={},this.on(e.Events.insert,this.attach),this.on(e.Events.remove,this.detach),i.prototype.attach.apply(this,arguments)};i.prototype=new e.Utils.Collection,r.extend(i.prototype,{constructor:i,attach:function(e){for(var t=0;t=0?i.additions.splice(n,1):(i.subtractions.push(e),i._flagSubtractions=!0)),t?(e.parent=t,this.additions.push(e),void(this._flagAdditions=!0)):((n=r.indexOf(this.additions,e))>=0?this.additions.splice(n,1):(this.subtractions.push(e),this._flagSubtractions=!0),void delete e.parent))}r.extend(a,{Children:i,InsertChildren:function(e){for(var t=0;ti+u?(l.beginning=1,l.ending=1):si&&ai&&s=.5?this._startDeepPress(t):this._endDeepPress()}},{key:"runPolyfill",value:function(e){this.increment=0===h.get("polyfillSpeedUp",this.options)?1:10/h.get("polyfillSpeedUp",this.options),this.decrement=0===h.get("polyfillSpeedDown",this.options)?1:10/h.get("polyfillSpeedDown",this.options),this.setPressed(!0),this.runClosure("start",e),!1===this.runningPolyfill&&this.loopPolyfillForce(0,e)}},{key:"loopPolyfillForce",value:function(e,t){!1===this.nativeSupport&&(this.isPressed()?(this.runningPolyfill=!0,e=e+this.increment>1?1:e+this.increment,this.runClosure("change",e,t),this.deepPress(e,t),setTimeout(this.loopPolyfillForce.bind(this,e,t),10)):((e=e-this.decrement<0?0:e-this.decrement)<.5&&this.isDeepPressed()&&(this.setDeepPressed(!1),this.runClosure("endDeepPress")),0===e?(this.runningPolyfill=!1,this.setPressed(!0),this._endPress()):(this.runClosure("change",e,t),this.deepPress(e,t),setTimeout(this.loopPolyfillForce.bind(this,e,t),10))))}}]),e}(),l=function(r){function a(t,r,i){return n(this,a),e(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,r,i))}return t(a,r),i(a,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){!1===this.isPressed()&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this._changePress(this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(p(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),a}(o),u=function(r){function a(t,r,i){return n(this,a),e(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,r,i))}return t(a,r),i(a,[{key:"bindEvents",value:function(){y?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.support.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacy.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this.touch=this.selectTouch(e),this.touch&&this._changePress(this.touch.force,e))}},{key:"support",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.runKey;!1===this.isPressed()&&(e<=6?(e++,setTimeout(this.support.bind(this,e,t,n),10)):this.fail(t,n))}},{key:"startLegacy",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacy(0,e,this.runKey,this.initialForce)}},{key:"supportLegacy",value:function(e,t,n,r){r!==this.initialForce?(this._startPress(t),this.loopForce(t)):e<=6?(e++,setTimeout(this.supportLegacy.bind(this,e,t,n,r),10)):this.fail(t,n)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this._changePress(this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t1?this.fail(e,this.runKey):(this._startPress(e),this._changePress(e.pressure,e)))}},{key:"change",value:function(e){this.isPressed()&&e.pressure>0&&.5!==e.pressure&&(this._changePress(e.pressure,e),this.deepPress(e.pressure,e))}}]),a}(o),h={polyfill:!0,polyfillSpeedUp:1e3,polyfillSpeedDown:0,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},f=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof e||e instanceof String)for(var r=document.querySelectorAll(e),i=0;i=.5?this._startDeepPress(t):this._endDeepPress()}},{key:"runPolyfill",value:function(e){this.increment=0===h.get("polyfillSpeedUp",this.options)?1:10/h.get("polyfillSpeedUp",this.options),this.decrement=0===h.get("polyfillSpeedDown",this.options)?1:10/h.get("polyfillSpeedDown",this.options),this.setPressed(!0),this.runClosure("start",e),!1===this.runningPolyfill&&this.loopPolyfillForce(0,e)}},{key:"loopPolyfillForce",value:function(e,t){!1===this.nativeSupport&&(this.isPressed()?(this.runningPolyfill=!0,e=e+this.increment>1?1:e+this.increment,this.runClosure("change",e,t),this.deepPress(e,t),setTimeout(this.loopPolyfillForce.bind(this,e,t),10)):((e=e-this.decrement<0?0:e-this.decrement)<.5&&this.isDeepPressed()&&(this.setDeepPressed(!1),this.runClosure("endDeepPress")),0===e?(this.runningPolyfill=!1,this.setPressed(!0),this._endPress()):(this.runClosure("change",e,t),this.deepPress(e,t),setTimeout(this.loopPolyfillForce.bind(this,e,t),10))))}}]),e}(),l=function(r){function a(t,r,i){return n(this,a),e(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,r,i))}return t(a,r),i(a,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){!1===this.isPressed()&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this._changePress(this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(p(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),a}(o),u=function(r){function a(t,r,i){return n(this,a),e(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,r,i))}return t(a,r),i(a,[{key:"bindEvents",value:function(){y?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.support.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacy.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this.touch=this.selectTouch(e),this.touch&&this._changePress(this.touch.force,e))}},{key:"support",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.runKey;!1===this.isPressed()&&(e<=6?(e++,setTimeout(this.support.bind(this,e,t,n),10)):this.fail(t,n))}},{key:"startLegacy",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacy(0,e,this.runKey,this.initialForce)}},{key:"supportLegacy",value:function(e,t,n,r){r!==this.initialForce?(this._startPress(t),this.loopForce(t)):e<=6?(e++,setTimeout(this.supportLegacy.bind(this,e,t,n,r),10)):this.fail(t,n)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this._changePress(this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t1?this.fail(e,this.runKey):(this._startPress(e),this._changePress(e.pressure,e)))}},{key:"change",value:function(e){this.isPressed()&&e.pressure>0&&.5!==e.pressure&&(this._changePress(e.pressure,e),this.deepPress(e.pressure,e))}}]),a}(o),h={polyfill:!0,polyfillSpeedUp:1e3,polyfillSpeedDown:0,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},d=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof e||e instanceof String)for(var r=document.querySelectorAll(e),i=0;iM.length&&M.push(e)}function U(e,t,n){return null==e?0:function e(t,n,r,i){var o=typeof t;"undefined"!==o&&"boolean"!==o||(t=null);var l=!1;if(null===t)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case a:case s:l=!0}}if(l)return r(i,t,""===n?"."+L(t,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(t))for(var u=0;uM.length&&M.push(e)}function U(e,t,n){return null==e?0:function e(t,n,r,i){var o=typeof t;"undefined"!==o&&"boolean"!==o||(t=null);var l=!1;if(null===t)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case a:case s:l=!0}}if(l)return r(i,t,""===n?"."+L(t,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(t))for(var u=0;uthis.eventPool.length&&this.eventPool.push(e)}function he(e){e.eventPool=[],e.getPooled=ue,e.release=ce}i(le.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=se)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=se)},persist:function(){this.isPersistent=se},isPersistent:oe,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=oe,this._dispatchInstances=this._dispatchListeners=null}}),le.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},le.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var a=new t;return i(a,n.prototype),n.prototype=a,n.prototype.constructor=n,n.Interface=i({},r.Interface,e),n.extend=r.extend,he(n),n},he(le);var fe=le.extend({data:null}),de=le.extend({data:null}),pe=[9,13,27,32],ge=H&&"CompositionEvent"in window,me=null;H&&"documentMode"in document&&(me=document.documentMode);var _e=H&&"TextEvent"in window&&!me,ve=H&&(!ge||me&&8=me),ye=String.fromCharCode(32),be={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},xe=!1;function we(e,t){switch(e){case"keyup":return-1!==pe.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function ke(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Se=!1;var Ee={eventTypes:be,extractEvents:function(e,t,n,r){var i=void 0,a=void 0;if(ge)e:{switch(e){case"compositionstart":i=be.compositionStart;break e;case"compositionend":i=be.compositionEnd;break e;case"compositionupdate":i=be.compositionUpdate;break e}i=void 0}else Se?we(e,n)&&(i=be.compositionEnd):"keydown"===e&&229===n.keyCode&&(i=be.compositionStart);return i?(ve&&"ko"!==n.locale&&(Se||i!==be.compositionStart?i===be.compositionEnd&&Se&&(a=ae()):(re="value"in(ne=r)?ne.value:ne.textContent,Se=!0)),i=fe.getPooled(i,t,n,r),a?i.data=a:null!==(a=ke(n))&&(i.data=a),G(i),a=i):a=null,(e=_e?function(e,t){switch(e){case"compositionend":return ke(t);case"keypress":return 32!==t.which?null:(xe=!0,ye);case"textInput":return(e=t.data)===ye&&xe?null:e;default:return null}}(e,n):function(e,t){if(Se)return"compositionend"===e||!ge&&we(e,t)?(e=ae(),ie=re=ne=null,Se=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1