-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanvas2d.min.js
executable file
·1 lines (1 loc) · 70.8 KB
/
canvas2d.min.js
1
const Canvas2d={globalId:1,container:{id:0,width:0,height:0,element:null},fakeCtx:null,wn:null,Stage:function(t,e,i){this.enabledEvent=!1!==i||i,this.className="Stage",this.visible=!0,this.date=new Date,this.name="Stage_"+this.date.getTime().toString(),this.indexCount=0,this.container="string"==typeof t?document.getElementById(t):t,"string"==typeof e?(s=(i=document.body).parentNode,i.style.margin=s.style.margin="0",i.style.padding=s.style.padding="0",s.style.height="100%","full"===e?i.style.height="100%":(s=e.replace(/\s/g,"").toLowerCase().split(","),i.style.width=s[0],i.style.height=s[1]),this.size=new Canvas2d.Point([i.clientWidth,i.clientHeight])):this.size=new Canvas2d.Point(e),this.container.style.width=this.size.x+"px",this.container.style.height=this.size.y+"px",this.container.style.position="absolute",this.container.style.margin="0 auto",this.container.onmousedown=function(){},Canvas2d.container.id=t,Canvas2d.container.width=this.size.x,Canvas2d.container.height=this.size.y,Canvas2d.container.element=this.container,this.fakeCanvas=document.createElement("canvas"),this.fakeCanvas.width=this.size.x,this.fakeCanvas.height=this.size.y,this.fakeCtx=this.fakeCanvas.getContext("2d"),Canvas2d.fakeCtx=this.fakeCtx,this.position=new Canvas2d.Point,this.scale=new Canvas2d.Point(1),this.alpha=1,this.rotation=0,this.id=t,this.index=0,this.children=[],this.evtListeners={};var s=navigator.userAgent.toLowerCase();this.agent=s,this.enabledEvent&&("ontouchstart"in window?this._functestmobile():this._functest()),Canvas2d.wn=(new Date).getTime(),this.wn=Canvas2d.wn,window.fire=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},window.cancelFire=window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||function(t){window.clearTimeout(t)},window[Canvas2d.wn+"rqanim"]={time:0,timeInterval:0,startTime:0,lastTime:0,frame:0,animating:!1,loop:[],prId:0,whipe:function(){this.stop(),this.reset(),this.loop=[],window.cancelFire(window.fire)},getLoop:function(){return this.loop},getTime:function(){return this.time},getFps:function(){return 0<this.timeInterval?1e3/this.timeInterval:0},getFrame:function(){return this.frame},getTimeInterval:function(){return this.timeInterval},_animationLoop:function(){if(this.animating){var t=this;this.frame++;var e=(new Date).getTime();this.timeInterval=e-this.lastTime,this.time+=this.timeInterval,this.lastTime=e;for(let t=0;t<this.loop.length;t++){var i=this.loop[t];i.func.apply(i.target,[i.target])}window.fire(function(){t._animationLoop()})}},start:function(){var t;!this.animating&&0<this.loop.length&&(t=new Date,this.startTime=t.getTime(),this.lastTime=this.startTime,this.animating=!0,this._animationLoop())},reset:function(){this.time=0,this.timeInterval=0,this.startTime=0,this.lastTime=0,this.frame=0;var t=new Date;this.startTime=t.getTime(),this.lastTime=this.startTime},stop:function(){this.animating=!1},addLoop:function(t,e){var i=!0;return"DisplayObjects"===t.className?i=t.parent.parent.wn===Canvas2d.wn:"Layer"===t.className?i=t.parent.wn===Canvas2d.wn:"Stage"===t.className&&(i=t.wn===Canvas2d.wn),!this.isChild(t)&&i&&(this.prId++,this.start(),t.PRID=this.prId,this.loop.push({target:t,func:e,id:this.prId})),this.prId},isChild:function(e){var i=!1;for(let t=0;t<this.loop.length;t++)if(this.loop[t].target===e){i=!0;break}return i},removeLoop:function(e){var i=-1;for(let t=0;t<this.loop.length;t++)if(this.loop[t].id===e.PRID){i=t;break}-1<i&&this.loop.splice(i,1),0===this.loop.length&&this.stop()},_init:function(){var t=new Date;this.startTime=t.getTime(),this.lastTime=this.startTime,this.animating=!0,this._animationLoop()}}}};Canvas2d.Stage.prototype={enableEvt:function(){"ontouchstart"in window?this._functestmobile():this._functest(),this.enabledEvent=!0},disableEvt:function(){"ontouchstart"in window?(this.container.removeEventListener("touchmove",this._evtData[0],!1),this.container.removeEventListener("touchstart",this._evtData[0],!1),this.container.removeEventListener("touchend",this._evtData[0],!1)):(this.container.removeEventListener("mousemove",this._evtData[0],!1),this.container.removeEventListener("mousedown",this._evtData[0],!1),this.container.removeEventListener("mouseup",this._evtData[0],!1),this.container.removeEventListener("click",this._evtData[0],!1),this.container.removeEventListener("mouseover",this._evtData[1],!1),this.container.removeEventListener("mouseout",this._evtData[1],!1)),this.enabledEvent=!1},addLoop:function(t,e){window[Canvas2d.wn+"rqanim"].addLoop(t,e)},removeLoop:function(t){window[Canvas2d.wn+"rqanim"].removeLoop(t)},start:function(){window[Canvas2d.wn+"rqanim"].start()},reset:function(){window[Canvas2d.wn+"rqanim"].reset()},stop:function(){window[Canvas2d.wn+"rqanim"].animating=!1},getFrame:function(){return window[Canvas2d.wn+"rqanim"].getFrame()},getTime:function(){return window[Canvas2d.wn+"rqanim"].getTime()},getFps:function(){return window[Canvas2d.wn+"rqanim"].getFps()},getTimeInterval:function(){return window[Canvas2d.wn+"rqanim"].getTimeInterval()},getLoopList:function(){return window[Canvas2d.wn+"rqanim"].loop},isAnimating:function(){return window[Canvas2d.wn+"rqanim"].animating},getDataURL:function(t,e){t=t||"image/jpeg",e=e||5,this.fakeCtx.save(),this.draw(this.fakeCtx),this.fakeCtx.restore(),t=this.fakeCanvas.toDataURL(t,e),this.fakeCtx.clearRect(0,0,this.size.x,this.size.y),e=document.createElement("img");return e.src=t,e},addEvent:function(t,e){t in this.evtListeners?this.evtListeners[t].func.push(e):this.evtListeners[t]={func:[e]}},removeEvent:function(e,i){if(e in this.evtListeners){for(let t=0;t<this.evtListeners[e].func.length;t++)if(this.evtListeners[e].func[t]===i){this.evtListeners[e].func.splice(t,1);break}0===this.evtListeners[e].func.length&&delete this.evtListeners[e]}},add:function(...t){if(1<arguments.length){for(let t=0;t<arguments.length;t++){if(arguments[t].parent||"DisplayObjects"===arguments[t].className)return;arguments[t].parent=this,arguments[t].index=this.indexCount,this._setContainer(arguments[t],this),this.children.push(arguments[t]),this.indexCount++}this._orderCanvases()}else arguments[0].parent||"DisplayObjects"===arguments[0].className||(arguments[0].parent=this,arguments[0].index=this.indexCount,this._setContainer(arguments[0],this),this.children.push(arguments[0]),this.indexCount++,this._orderCanvases())},remove:function(t){if(t.parent===this){t.parent=void 0,this.children.splice(t.index,1),this.container.removeChild(t.canvas),this.indexCount--;for(let t=0;t<this.children.length;t++)this.children[t].index=t;this._orderCanvases()}},zOrder:function(t,e){if(t.parent===this)if("string"==typeof e){var i=this.children.length,s="top"!==e&&"bottom"===e?0:i-1;this.children.splice(t.index,1),this.children.splice(s,0,t);for(let t=0;t<i;t++)this.children[t].index=t;this._orderCanvases()}else if(e in this.children){this.children.splice(t.index,1),this.children.splice(e,0,t);for(let t=0;t<this.children.length;t++)this.children[t].index=t;this._orderCanvases()}},getAlignement:function(t){switch(t){case 0:case"top-left":return[0,0];case 1:case"top-center":return[this.size.x/2,0];case 2:case"top-right":return[this.size.x,0];case 3:case"left":return[0,this.size.y/2];case 4:case"center":return[this.size.x/2,this.size.y/2];case 5:case"right":return[this.size.x,0];case 6:case"bottom-left":return[0,this.size.y];case 7:case"bottom-center":return[this.size.x/2,this.size.y];case 8:case"bottom-right":return[this.size.x,this.size.y]}},_setContainer:function(t,e){t.size.set(e.size),t.stage=e.container,t.canvas.width=e.size.x,t.canvas.height=e.size.y,t.ctx=t.canvas.getContext("2d")},_orderCanvases:function(){var s=this;!function e(i){for(let t=0;t<i.length;t++)"Layer"===i[t].className?s.container.appendChild(i[t].canvas):e(i[t].children)}(this.children)},resize:function(t){this.container.style.width=w+"px",this.container.style.height=h+"px",this.size.set(t);for(let t=0;t<this.children.length;t++)this._setContainer(this.children[t],this)},_functestmobile:function(){this.container.addEventListener("touchmove",t,!1),this.container.addEventListener("touchstart",t,!1),this.container.addEventListener("touchend",t,!1);var o,r,h,l,c,d,u,f,p,g,v,y,m,w,b,x,_,C,L,M,k,z,S,T=this,I=!1,q={touchstart:null,touchend:null,touchmove:null,gestureend:null,dragstop:!1,click:!1};function t(t){if(t.preventDefault(),q.touchend=!1,q.click=!1,q.dragstop=!1,q.gestureend=!1,q.touchmove="touchmove"===t.type,"touchstart"===t.type?q.touchstart=!0:q.touchstart&&"touchend"===t.type&&(q.touchstart=!1,q.touchend=!0,q.click=!0,L=M=b=m=!1,C=1,x=_=0),q.touchmove&&function(t){if("touchend"!==t.type&&2===t.touches.length)return 1;return}(t)?(u&&T._testdetect(t.touches[0],u)&&T._testdetect(t.touches[1],u)?(z=u,S=f):z=S=!1,m=!b,w=!0):q.touchmove&&u&&(L=!M,k=!0),m&&(b=!0),L&&u&&(M=!0),!L&&!M&&k&&q.touchend&&(q.dragstop=!0,k=!1),(S||z)&&(m&&S?P(t,S):b&&S&&O(t,S),m&&z?P(t,z):b&&z&&O(t,z)),m)P(t,T);else if(b)O(t,T);else if(w){var e=F(t),i="gestureend",s=t;if(i in T.evtListeners)for(d=T._parentOffset(e,T),r=0;r<T.evtListeners[i].func.length;r++)T.evtListeners[i].func[r].apply(T,[{target:T,mouse:d,type:i,event:s}])}var n,a;for(a in!m&&!b&&w&&q.touchend&&(q.gestureend=!0,w=!1),L&&f?(e=T._parentOffset(F(t),f.parent),v=e.ox-f.position.x,y=e.oy-f.position.y,A(t,f,e)):M&&f&&E(F(t),f,t,v,y),L&&u?(n=T._parentOffset(F(t),u.parent),p=n.ox-u.position.x,g=n.oy-u.position.y,A(t,u,n)):M&&u&&E(F(t),u,t,p,g),q)if(q[a])switch(a){case"touchend":R(F(t),a,"mouseup",t);break;case"touchstart":R(F(t),a,"mousedown",t);break;case"touchmove":R(F(t),a,"mousemove",t);break;default:R(F(t),a,"none",t)}}function O(t,e){if("gesturechange"in e.evtListeners){var i=e===T?T:e.parent,s=T._parentOffset(t.touches[0],i),i=T._parentOffset(t.touches[1],i),n=Math.sqrt(Math.pow(s.x-i.x,2)+Math.pow(s.y-i.y,2)),a=Math.atan2(s.y-i.y,s.x-i.x),n=C*(n/x),a=a-_;for(s.mouse2=i,s.scale=n,s.angle=a,r=0;r<e.evtListeners.gesturechange.func.length;r++)e.evtListeners.gesturechange.func[r].apply(c,[{target:e,mouse:s,type:"gesturechange",event:t}])}}function P(t,e){var i=e===T?T:e.parent,s=T._parentOffset(t.touches[0],i),i=T._parentOffset(t.touches[1],i);if(x=Math.sqrt(Math.pow(s.x-i.x,2)+Math.pow(s.y-i.y,2)),_=Math.atan2(s.y-i.y,s.x-i.x)-e.rotation,C=(e.scale.x+e.scale.y)/2,"gesturestart"in e.evtListeners)for(s.mouse2=i,s.scale=C,s.angle=_,r=0;r<e.evtListeners.gesturestart.func.length;r++)e.evtListeners.gesturestart.func[r].apply(c,[{target:e,mouse:s,type:"gesturestart",event:t}])}function A(t,e,i){if("dragstart"in e.evtListeners)for(r=0;r<e.evtListeners.dragstart.func.length;r++)e.evtListeners.dragstart.func[r].apply(c,[{target:e,mouse:i,type:"dragstart",event:t}])}function E(t,e,i,s,n){if("drag"in e.evtListeners){var a=T._parentOffset(t,e.parent),t=a.ox-s,s=a.oy-n;for(a.ox=t,a.oy=s,r=0;r<e.evtListeners.drag.func.length;r++)e.evtListeners.drag.func[r].apply(c,[{target:e,mouse:a,type:"drag",event:i}])}}function F(t){var e={pageX:0,pageY:0};return t.touches&&0<t.touches.length?e=t.touches[0]:t.changedTouches&&0<t.changedTouches.length&&(e=t.changedTouches[0]),e}function R(t,e,i,s){for(o=T.children.length-1;-1<o;o--)if((l=T.children[o]).visible&&l.enabledEvent){for(h=l.children.length-1;-1<h;h--){if((c=l.children[h]).visible&&c.enabledEvent){var n=T._testdetect(t,c);if(n){if(e in c.evtListeners)for(r=0;r<c.evtListeners[e].func.length;r++)c.evtListeners[e].func[r].apply(c,[{target:c,mouse:n,type:e,event:s}]);if(i in c.evtListeners)for(r=0;r<c.evtListeners[i].func.length;r++)c.evtListeners[i].func[r].apply(c,[{target:c,mouse:n,type:i,event:s}]);u=c,I=!0;break}}u=I=!1}if(I&&n){var a=T._testdetect(t,l);if(e in l.evtListeners)for(r=0;r<l.evtListeners[e].func.length;r++)l.evtListeners[e].func[r].apply(l,[{target:l,mouse:a,type:e,event:s}]);if(i in l.evtListeners)for(r=0;r<l.evtListeners[i].func.length;r++)l.evtListeners[i].func[r].apply(l,[{target:l,mouse:a,type:i,event:s}]);f=l,n=a=!1;break}f=!1}}this._evtData=[t]},_functest:function(){this.container.addEventListener("mousemove",e,!1),this.container.addEventListener("mousedown",e,!1),this.container.addEventListener("mouseup",e,!1),this.container.addEventListener("click",e,!1),this.container.addEventListener("mouseover",t,!1),this.container.addEventListener("mouseout",t,!1);var o,r,h,l,c,d,u,f,p,g,v,y,m,w,b,x={mouseup:!1,mousedown:!1,mousemove:!1,click:!1,mouseover:!1,mouseout:!1,dragstart:!1,drag:!1,dragstop:!1},_=0,C=0;function t(t){"mouseout"===t.type&&f&&P(t,f),"mouseout"===t.type&&p&&P(t,g),o=r=h=l=c=d=u=f=p=g=v=m=y=!1,x={mouseup:!1,mousedown:!1,mousemove:!1,click:!1,mouseover:!1,mouseout:!1,dragstart:!1,drag:!1,dragstop:!1}}function e(t){t.preventDefault();var e=t;if(e.type in I.evtListeners)for(T=I._parentOffset(e,I),M=0;M<I.evtListeners[e.type].func.length;M++)I.evtListeners[e.type].func[M].apply(I,[{target:I,mouse:T,type:e.type,event:e}]);x.click=!1,x.mouseup=!1,x.dragstop=!1,x.dragstart=!1,x.mousemove="mousemove"===t.type;var i=t,i=(h=!!u,!!f&&f!==u?r||(r=!0,P(i,f),o=!1):h&&!o&&(o=!0,O(i,u),r=!1),f=h?u:f,t);if(v=!!p,!!g&&g!==p?y||(y=!0,P(i,g),m=!1):v&&!m&&(m=!0,O(i,p),y=!1),g=v?p:g,"mousedown"===t.type?x.mousedown=!0:"mouseup"===t.type&&x.mousedown&&(x.mousedown=!1,x.click=!0,x.mouseup=!0,l=c=!1),x.mousemove&&x.mousedown&&u&&(l=!c,d=!0),l&&u&&(c=!0),!l&&!c&&d&&x.mouseup&&(x.dragstop=!0,x.drag=!1,d=!1,x.click=!1),function(t){if(l&&u){var e=I._parentOffset(t,u.parent);_=e.ox-u.position.x,C=e.oy-u.position.y,A(t,u,e)}else{if(!c||!u)return 1;E(t,u,_,C)}return}(t)||function(t){if(l&&p){var e=I._parentOffset(t,p.parent);w=e.ox-p.position.x,b=e.oy-p.position.y,A(t,p,e)}else{if(!c||!p)return 1;E(t,p,w,b)}return}(t))for(var s in x)if(x[s]){a=n=void 0;var n=t,a=s;for(L=I.children.length-1;-1<L;L--)if((z=I.children[L]).visible&&z.enabledEvent){for(k=z.children.length-1;-1<k;k--){if((S=z.children[k]).visible&&S.enabledEvent&&(T=I._testdetect(n,S))){if(a in S.evtListeners)for(M=0;M<S.evtListeners[a].func.length;M++)S.evtListeners[a].func[M].apply(S,[{target:S,mouse:T,type:a,event:n}]);u=S,q=!0;break}u=q=!1}if(q&&T){if(a in z.evtListeners)for(M=0;M<z.evtListeners[a].func.length;M++)z.evtListeners[a].func[M].apply(z,[{target:z,mouse:T,type:a,event:n}]);p=z,T=!1;break}p=!1}}}this._evtData=[e,t];var L,M,k,z,S,T,I=this,q=!1;function O(t,e){if("mouseover"in e.evtListeners)for(T=I._parentOffset(t,e.parent),M=0;M<e.evtListeners.mouseover.func.length;M++)e.evtListeners.mouseover.func[M].apply(S,[{target:e,mouse:T,type:"mouseover",event:t}])}function P(t,e){if(e&&"mouseout"in e.evtListeners)for(T=I._parentOffset(t,e.parent),M=0;M<e.evtListeners.mouseout.func.length;M++)e.evtListeners.mouseout.func[M].apply(S,[{target:e,mouse:T,type:"mouseout",event:t}])}function A(t,e,i){if("dragstart"in e.evtListeners)for(M=0;M<e.evtListeners.dragstart.func.length;M++)e.evtListeners.dragstart.func[M].apply(S,[{target:e,mouse:i,type:"dragstart",event:t}])}function E(t,e,i,s){if("drag"in e.evtListeners){var n=I._parentOffset(t,e.parent),i=n.ox-i,s=n.oy-s;for(n.ox=i,n.oy=s,M=0;M<e.evtListeners.drag.func.length;M++)e.evtListeners.drag.func[M].apply(S,[{target:e,mouse:n,type:"drag",event:t}])}}},_testdetect:function(t,e){var i=this.container.getBoundingClientRect(),s=t.pageX-(Math.floor(i.left)+window.pageXOffset),t=t.pageY-(Math.floor(i.top)+window.pageYOffset),i=e.parent._global(),n="Layer"===e.className?s/i.scaleX:s,a="Layer"===e.className?t/i.scaleY:t,n=Math.sqrt(Math.pow(n-i.x,2)+Math.pow(a-i.y,2)),a=Math.atan2(t-i.y,s-i.x)-i.rotation,o=Math.cos(a)*n,a=Math.sin(a)*n;return this.fakeCtx.save(),this.fakeCtx.translate(i.x,i.y),this.fakeCtx.scale(i.scaleX,i.scaleY),this.fakeCtx.rotate(i.rotation),e.draw(this.fakeCtx,!0),this.fakeCtx.restore(),!!this.fakeCtx.isPointInPath(s,t)&&{x:s,y:t,ox:o,oy:a,gx:i.x,gy:i.y,scaleX:i.scaleX,scaleY:i.scaleY,rotation:i.rotation}},_parentOffset:function(t,e){var i=this.container.getBoundingClientRect(),s=e._global(),n=t.pageX-(Math.floor(i.left)+window.pageXOffset),t=t.pageY-(Math.floor(i.top)+window.pageYOffset),i="Layer"===e.className?n/s.scaleX:n,e="Layer"===e.className?t/s.scaleY:t,i=Math.sqrt(Math.pow(i-s.x,2)+Math.pow(e-s.y,2)),e=Math.atan2(t-s.y,n-s.x)-s.rotation;return{x:n,y:t,ox:Math.cos(e)*i,oy:Math.sin(e)*i,gx:s.x,gy:s.y,scaleX:s.scaleX,scaleY:s.scaleY,rotation:s.rotation}},_global:function(){return{x:this.position.x,y:this.position.y,scaleX:this.scale.x,scaleY:this.scale.y,rotation:this.rotation,alpha:this.alpha,visible:this.visible}},clear:function(){for(let t=0;t<this.children.length;t++)this.children[t].clear()},draw:function(e){for(let t=0;t<this.children.length;t++)this.children[t].draw(e)}},Canvas2d.Layer=function(t,e){this.enabledEvent=!1!==e||e,this.visible=!0,this.name=t||"",this.id="layer_"+(Canvas2d.globalId++).toString()+"_"+this.name;e=Canvas2d.container,this.size=new Canvas2d.Point(e.width,e.height),t=document.createElement("canvas");t.width=this.size.x,t.height=this.size.y,t.id=this.id,t.style.position="absolute",t.style.top="0px",t.style.left="0px",this.canvas=t,this.ctx=t.getContext("2d"),this.stage=e.element,this.className="Layer",this.indexCount=0,this.date=new Date,this.children=[],this.index=0,this.parent=null,this.alpha=1,this.rotation=0,this.evtListeners={},this.position=new Canvas2d.Point,this.scale=new Canvas2d.Point(1),this.blending="source-over"},Canvas2d.Layer.prototype={addEvent:function(t,e){t in this.evtListeners?this.evtListeners[t].func.push(e):this.evtListeners[t]={func:[e]}},removeEvent:function(e,i){if(e in this.evtListeners){for(let t=0;t<this.evtListeners[e].func.length;t++)if(this.evtListeners[e].func[t]===i){this.evtListeners[e].func.splice(t,1);break}0===this.evtListeners[e].func.length&&delete this.evtListeners[e]}},add:function(...t){if(1<arguments.length)for(let t=0;t<arguments.length;t++){if(arguments[t].parent||"DisplayObjects"!==arguments[t].className)return;arguments[t].parent=this,arguments[t].index=this.indexCount,this.indexCount++,this.children.push(arguments[t])}else arguments[0].parent||"DisplayObjects"!==arguments[0].className||(arguments[0].parent=this,arguments[0].index=this.indexCount,this.indexCount++,this.children.push(arguments[0]))},remove:function(t){if(t.parent===this){t.parent=void 0,this.children.splice(t.index,1),this.indexCount--;for(let t=0;t<this.children.length;t++)this.children[t].index=t}},getBound:function(){var e=[],i=[];for(let t=0;t<this.children.length;t++)e.push(this.children[t].position.x+this.children[t].size.x),i.push(this.children[t].position.y+this.children[t].size.y);function t(t,e){return t-e}return e.sort(t),i.sort(t),{width:e[e.length-1],height:i[i.length-1]}},zOrder:function(t){if("string"==typeof t){var e=this.parent.children.length,i="top"!==t&&"bottom"===t?0:e-1;this.parent.children.splice(this.index,1),this.parent.children.splice(i,0,this);for(let t=0;t<e;t++)this.parent.children[t].index=t;this.parent._orderCanvases()}else if(t in this.parent.children){this.parent.children.splice(this.index,1),this.parent.children.splice(t,0,this);for(let t=0;t<this.parent.children.length;t++)this.parent.children[t].index=t;this.parent._orderCanvases()}},clear:function(){this.ctx.clearRect(0,0,this.size.x,this.size.y)},_global:function(){var t,e,i,s=this.parent._global();return i=0!==this.parent.rotation?(t=this.position.angle()+this.parent.rotation,e=(i=this.position.length())*Math.cos(t),i*Math.sin(t)):(e=this.position.x,this.position.y),{x:s.x+e,y:s.y+i,scaleX:s.scaleX*this.scale.x,scaleY:s.scaleY*this.scale.y,rotation:s.rotation+this.rotation,alpha:s.alpha<1?this.alpha*s.alpha:this.alpha,visible:!!s.visible&&this.visible}},clone:function(){var e=new Canvas2d.Layer;for(let t=0;t<this.children.length;t++){var i=this.children[t].clone(this.children[t].name);e.add(i)}return e},draw:function(t){if(this.visible){var e=t||this.ctx,t=(t||this.clear(),this._global());e.save(),e.globalCompositeOperation=this.blending,e.translate(t.x,t.y),e.scale(t.scaleX,t.scaleY),e.rotate(t.rotation),e.globalAlpha=t.alpha;for(let t=0;t<this.children.length;t++)this.children[t].draw(e);e.restore()}else this.clear()},blend:function(t){return this.blending=["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","lighter","copy","xor","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"][t]}},Canvas2d.DisplayObjects=function(t,e){this.enabledEvent=!1!==e||e,this.visible=!0,this.className="DisplayObjects",this.evtListeners={},this.parent=null,this.name=t||"",this.id="displayObjects_"+(Canvas2d.globalId++).toString()+"_"+this.name,this.index=0,this.type="",this.size=new Canvas2d.Point,this.scale=new Canvas2d.Point(1),this.rotation=0,this.alpha=1,this.lineAlpha=1,this.color=null,this.lineColor=null,this.lineWidth=1,this.lineCap="butt",this.lineJoin="miter",this.lineMiter=10,this.backUpImage=null,this.imageData=null,this.imageCrop={dw:-1,dh:-1,dx:0,dy:0},this.doneimage=!1,this.currentFilter=null,this.clr=new Canvas2d.Colors,this.position=null,this.pivot=new Canvas2d.Point},Canvas2d.DisplayObjects.prototype={txt:"",close:!0,fontStyle:null,fontSize:10,fontType:"Verdana",fontWeight:"normal",align:"center",baseLine:"alphabetic",backGround:null,paddingLeft:0,paddingTop:0,source:null,loadComplete:!1,isLoading:!1,image:null,frameList:null,currentFrame:0,shadow:null,lineShadow:null,gradient:null,lineGradient:null,_alignList:{start:"start",end:"end",left:"left",right:"right",center:"center"},_baseList:{top:"top",hanging:"hanging",middle:"middle",alphabetic:"alphabetic",ideographic:"ideographic",bottom:"bottom"},_capList:{butt:"butt",round:"round",square:"square"},_joinList:{bevel:"bevel",round:"round",miter:"miter"},addEvent:function(t,e){t in this.evtListeners?this.evtListeners[t].func.push(e):this.evtListeners[t]={func:[e]}},removeEvent:function(e,i){if(e in this.evtListeners){for(let t=0;t<this.evtListeners[e].func.length;t++)if(this.evtListeners[e].func[t]===i){this.evtListeners[e].func.splice(t,1);break}0===this.evtListeners[e].func.length&&delete this.evtListeners[e]}},zOrder:function(t){if("string"==typeof t){var e=this.parent.children.length,i="top"!==t&&"bottom"===t?0:e-1;this.parent.children.splice(this.index,1),this.parent.children.splice(i,0,this);for(let t=0;t<e;t++)this.parent.children[t].index=t}else if(t in this.parent.children){this.parent.children.splice(this.index,1),this.parent.children.splice(t,0,this);for(let t=0;t<this.parent.children.length;t++)this.parent.children[t].index=t}},setPivot:function(t){switch(t){case 0:case"top-left":this.pivot.set(0);break;case 1:case"top-center":this.pivot.set([-this.size.x/2,0]);break;case 2:case"top-right":this.pivot.set([-this.size.x,0]);break;case 3:case"left":this.pivot.set([0,-this.size.y/2]);break;case 4:case"center":this.pivot.set([-this.size.x/2,-this.size.y/2]);break;case 5:case"right":this.pivot.set([-this.size.x,-this.size.y/2]);break;case 6:case"bottom-left":this.pivot.set([0,-this.size.y]);break;case 7:case"bottom-center":this.pivot.set([-this.size.x/2,-this.size.y]);break;case 8:case"bottom-right":this.pivot.set([-this.size.x,-this.size.y])}},getColor:function(t){return this.clr._parseGetColor(this.color,t)},getLineColor:function(t){return this.clr._parseGetColor(this.lineColor,t)},cacheAsBitmap:function(){var t,e,i,s,n,a;this.type in{polygon:"polygon",shape:"shape",text:"text",rect:"rect",rectround:"rectround",line:"line",circle:"circle"}?(t=document.createElement("canvas"),e=this.position.x,i=this.position.y,s=this.rotation,n=new Image,t.width=this.size.x+2*this.lineWidth,t.height=this.size.y+2*this.lineWidth,a=t.getContext("2d"),"polygon"===this.type||"shape"===this.type?(e=this.position.x-this.size.x/2,i=this.position.y-this.size.y/2,this.position.x=Math.abs(this._coord.x[0])+this.lineWidth,this.position.y=Math.abs(this._coord.y[0])+this.lineWidth):(this.position.x=0,this.position.y=0),this.rotation=0,this.draw(a),a=t.toDataURL("image/png",10),n.src=a,this.img(0,0,n,!0),this.position.x=e,this.position.y=i,this.rotation=s):console.log("wrong type ",this.type)},clone:function(t){var e,i=new Canvas2d.DisplayObjects,s=Object.prototype.toString;for(e in this)if("[object Function]"!==s.call(this[e]))switch(e){case"id":case"parent":case"name":break;default:if("[object Object]"===s.call(this[e])){var n,a={};for(n in this[e])a[n]=this[e][n];i[e]=a}else i[e]=this[e]}if(2===arguments.length){var o,r=arguments[1];for(o in r)i[o]=r[o]}return i},rect:function(t,e,i,s,n){this.type="rect",this.position=new Canvas2d.Point(t),this.size.set(e),this._setStyle(i,s,n)},rectRound:function(t,e,i,s,n,a){this.type="rectround",this.position=new Canvas2d.Point(t),this.size.set(e),this.radius=i||0,this._setStyle(s,n,a)},polygon:function(t,e,i,s,n,a){this.type="polygon",this.close=!1!==a||a,this.position=new Canvas2d.Point(t),this.points=e||[],this._setStyle(i,s,n);let o=by=ax=ay=0;for(let t=0;t<this.points.length;t++)o=o>=this.points[t][0]?this.points[t][0]:o,by=by>=this.points[t][1]?this.points[t][1]:by,ax=ax<=this.points[t][0]?this.points[t][0]:ax,ay=ay<=this.points[t][1]?this.points[t][1]:ay;this.size.set([Math.sqrt(Math.pow(o-ax,2)),Math.sqrt(Math.pow(by-ay,2))])},shape:function(t,e,i,s,n,a){this.type="shape",this.close=!1!==a||a,this.position=new Canvas2d.Point(t),this.obj=e||[],this._setStyle(i,s,n);let o=by=ax=ay=0;for(let t=0;t<this.obj.length;t++)for(var r in this.obj[t]){e=this.obj[t][r];switch(r){case"m":case"moveTo":o=o>=e[0]?e[0]:o,by=by>=e[1]?e[1]:by,ax=ax<=e[0]?e[0]:ax,ay=ay<=e[1]?e[1]:ay;break;case"l":case"lineTo":o=o>=e[0]?e[0]:o,by=by>=e[1]?e[1]:by,ax=ax<=e[0]?e[0]:ax,ay=ay<=e[1]?e[1]:ay;break;case"q":case"quadraticCurveTo":o=o>=e[0]?e[0]:o,by=by>=e[1]?e[1]:by,ax=ax<=e[0]?e[0]:ax,ay=ay<=e[1]?e[1]:ay,o=o>=e[2]?e[2]:o,by=by>=e[3]?e[3]:by,ax=ax<=e[2]?e[2]:ax,ay=ay<=e[3]?e[3]:ay;break;case"c":case"bezierCurveTo":o=o>=e[4]?e[4]:o,by=by>=e[5]?e[5]:by,ax=ax<=e[4]?e[4]:ax,ay=ay<=e[5]?e[5]:ay;break;case"a":case"arcTo":o=o>=e[2]?e[2]:o,by=by>=e[3]?e[3]:by,ax=ax<=e[2]?e[2]:ax,ay=ay<=e[3]?e[3]:ay}}this.size.set([Math.sqrt(Math.pow(o-ax,2)),Math.sqrt(Math.pow(by-ay,2))])},line:function(t,e,i,s,n,a,o,r){this.type="line",this.position=new Canvas2d.Point(t),this.start=new Canvas2d.Point(e),this.end=new Canvas2d.Point(i),this.points=[[this.start.x,this.start.y],[this.end.x,this.end.y]],this.size.set([Math.sqrt(Math.pow(this.start.x-this.end.x,2)),Math.sqrt(Math.pow(this.start.y-this.end.y,2))]),this.len=this.start.distance(this.end),this._setStyle(null,s,n,a,o,r)},circle:function(t,e,i,s,n,a,o){this.type="circle",this.position=new Canvas2d.Point(t),this.size.set(2*e),this.width=e?2*e:0,this.height=e?2*e:0,this.radius=e||0,this.startAngle=i||0,this.endAngle=s||0,this._setStyle(n,a,o)},text:function(t,e,i,s,n,a,o,r,h){this.type="text",this.position=new Canvas2d.Point(e);e=Canvas2d.fakeCtx,this.txt=t||"",this.backGround=o||null,this._setFont(i,s,n,r,h),this._setStyle(a),e.font=this.fontStyle,e.textAlign=this.align,e.textBaseline=this.baseLine,o=e.measureText(t);this.size.set([o.actualBoundingBoxRight+o.actualBoundingBoxLeft,o.actualBoundingBoxAscent+o.actualBoundingBoxDescent]),delete e},img:function(t,e,i,s,n,a,o){this.type="img",this.position=new Canvas2d.Point(t),this.paddingLeft=n||0,this.paddingTop=a||0,this._setStyle(s),this.setCrop(o),this.source=e||null,i&&this.loadImage(this.source,null,null,i)},clip:function(t,e,i,s){this.type="clip",this.position=new Canvas2d.Point(t),this.source=e||null,this.frameList=i||this.frameList,s&&this.loadImage(this.source,null,null,s)},restore:function(){this.doneimage=!1},setCrop:function(t){if(t){for(var e in this.imageCrop)this.imageCrop[e]=t[e]||this.imageCrop[e];this.size.set([this.imageCrop.dw,this.imageCrop.dh]),this.doneimage=!1}},roulette:function(t,e,i,s,n,a){for(var o,r,n=n/360*(2*Math.PI),h=0,l=0,c=[],d=t*s,u=e*s,f=i*s;l<=360/n*e;)"Epicycloid"===a&&(o=(d+u)*Math.cos(h)-u*Math.cos((d+u)/u*h),r=(d+u)*Math.sin(h)-u*Math.sin((d+u)/u*h)),"Epitrochoid"===a&&(o=(d+u)*Math.cos(h)-f*Math.cos((d+u)/u*h),r=(d+u)*Math.sin(h)-f*Math.sin((d+u)/u*h)),"Hypocycloid"===a&&(o=(d-u)*Math.cos(h)+u*Math.cos((d-u)/u*h),r=(d-u)*Math.sin(h)-u*Math.sin((d-u)/u*h)),"Hypotrochoid"===a&&(o=(d-u)*Math.cos(h)+f*Math.cos((d-u)/u*h),r=(d-u)*Math.sin(h)-f*Math.sin((d-u)/u*h)),h+=n,l++,c.push([o,r]);return c},filter:function(t,e){this.backUpImage&&(this.imageData=this.backUpImage);var i=document.createElement("canvas"),s=(i.width=this.size.x,i.height=this.size.y,i.getContext("2d")),n=(s.drawImage(this.imageData,0,0,this.size.x,this.size.y),s.getImageData(0,0,this.size.x,this.size.y));switch(t){case"invert":n=this._filterInvert(n),this.currentFilter="invert";break;case"grayscale":n=this._filterGrayscale(n),this.currentFilter="grayscale";break;case"hsl":n=this._filterHsl(n,e),this.currentFilter="hsl";break;case"pixelated":n=this._filterPixelated(n,e,i),this.currentFilter="pixelated";break;case"cut":var a=e[1];e=4===e.length?e:this.clr._fromStringToArrayRgb(e[0]),n=this._filterCut(n,e,a),this.currentFilter="cut";break;default:this.currentFilter=null}s.putImageData(n,0,0),this.imageData=i,this.parent.draw()},_filterPixelated:function(t,e,i){for(var s=t.data,n=!e||e[0]<2?2:e[0],a=0;a<i.height;a+=n)for(var o=0;o<i.width;o+=n)for(var r=s[4*(i.width*a+o)],h=s[4*(i.width*a+o)+1],l=s[4*(i.width*a+o)+2],c=0;c<n;c++)for(var d=0;d<n;d++)o+d<i.width&&(s[4*(i.width*(a+c)+(o+d))]=r,s[4*(i.width*(a+c)+(o+d))+1]=h,s[4*(i.width*(a+c)+(o+d))+2]=l);return t},_filterGrayscale:function(t){var e=t.data;for(let t=0;t<e.length;t+=4){var i=.34*e[t]+.5*e[t+1]+.16*e[t+2];e[t]=i,e[t+1]=i,e[t+2]=i}return t},_filterInvert:function(t){var e=t.data;for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2];return t},_filterCut:function(t,e,s){var i,n=t.data;function a(t,e,i){return t-e<=i&&i<=t+e?Math.floor(255*Math.abs((t-i)/s)):255}for(let t=0;t<n.length;t+=4)i=a(n[t],s,e[0])+a(n[t+1],s,e[1])+a(n[t+2],s,e[2]),n[t+3]=Math.floor(i/3);return t},_filterHsl:function(t,e){var i=t.data;for(let t=0;t<i.length;t+=4){var s=this.clr._rgbToHsl([i[t],i[t+1],i[t+2]]),n=(s[0]+e[0])%360,a=(s[1]+e[1])%360,s=(s[2]+e[2])%360,n=this.clr._hslToRgb([n,a,s]);i[t]=n[0],i[t+1]=n[1],i[t+2]=n[2]}return t},loadImage:function(t,e,i,s){this._progressEvent=e,this._completeEvent=i,this.source=t||this.source,"object"==typeof this.source?(this.image=this.source,this.size.set([this.image.width,this.image.height]),this.isLoading=!1,this.loadComplete=!0,"clip"===this.type?this._setFrames(s):(this._completeEvent&&this._completeEvent.apply(this,[this]),s&&this.parent&&this.draw(this.parent.ctx))):this._load(s)},_load:function(t){var e=navigator.userAgent.toLowerCase();/msie\s\d+\.\d+/.test(e)?((e=new Image).caller=this,e.show=t,this._loadStart(),e.addEventListener("load",this._loadComplete,!1),e.src=this.source):((e=new XMLHttpRequest).caller=this,e.show=t,e.onloadstart=this._loadStart,e.onprogress=this._loadProgress,e.onload=this._loadComplete,e.open("GET",this.source,!0),e.overrideMimeType("text/plain; charset=x-user-defined"),e.send(null))},_loadStart:function(){this.loadComplete=!1},_loadProgress:function(t){this.caller._progressEvent&&this.caller._progressEvent.apply(this.caller,[t]),this.caller.isLoading=!0,this.caller.loadComplete=!1},_loadComplete:function(t){var e=navigator.userAgent.toLowerCase();/msie\s\d+\.\d+/.test(e)?((this.caller.image=this).caller.width=this.caller.image.width,this.caller.height=this.caller.image.height,this.caller.isLoading=!1,this.caller.loadComplete=!0,"clip"===this.caller.type?this.caller._setFrames(this.show):(this.caller._completeEvent&&this.caller._completeEvent.apply(this.caller,[this.caller]),this.show&&this.caller.parent&&this.caller.draw(this.caller.parent.ctx))):this.caller._base64Encode(this.responseText,this.caller,this.show)},_base64Encode:function(t,i,s){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="",a=0;a<t.length;){var o,r,h=255&t.charCodeAt(a++),l=255&t.charCodeAt(a++),c=255&t.charCodeAt(a++),d=h>>2,h=(3&h)<<4|l>>4;isNaN(l)?o=r=64:(o=(15&l)<<2|c>>6,r=isNaN(c)?64:63&c),n+=e.charAt(d)+e.charAt(h)+e.charAt(o)+e.charAt(r),!function(t){{var e;t&&((e=new Image).onload=function(){i.image=e,i.size.set([i.image.width,i.image.height]),i.isLoading=!1,i.loadComplete=!0,"clip"===i.type?i._setFrames(s):(i._completeEvent&&i._completeEvent.apply(i,[i]),s&&i.parent&&i.draw(i.parent.ctx))},t=i.source.split("."),t="jpg"===t[t.length-1]?"jpeg":t[t.length-1],e.src="data:image/"+t+";base64,"+n)}}(!(a<t.length))}},_setFrames:function(t){if(this.frameList&&"clip"===this.type)for(var e,i=document.createElement("canvas"),s=this,n=0;n<this.frameList.length;n++){i.width=this.frameList[n].map.width,i.height=this.frameList[n].map.height,this.width=this.frameList[n].map.width,this.height=this.frameList[n].map.height,(e=i.getContext("2d")).drawImage(this.image,this.frameList[n].map.x,this.frameList[n].map.y,i.width,i.height,0,0,i.width,i.height);var a=i.toDataURL("image/png"),o=new Image;o.indice=n,o.onload=r,o.src=a,e.clearRect(0,0,i.width,i.height)}function r(){(s.frameList[this.indice].data=this).indice===s.frameList.length-1&&(s._completeEvent&&s._completeEvent.apply(s,[s]),t)&&s.parent&&s.draw(s.parent.ctx)}},_setStyle:function(t,e,i,s,n,a){this.color=this.clr._parseC(t),this.lineColor=this.clr._parseC(e),this.lineCap=this._capList[s]?s:"butt",this.lineJoin=this._joinList[n]?n:"miter",this.lineWidth=i||1,this.lineMiter=parseInt(a)?parseInt(a):10},_setLineStyle:function(t){this.lineGradient?this.lineShadow?(t.save(),t.lineWidth=this.lineWidth,t.lineCap=this.lineCap,t.lineJoin=this.lineJoin,t.miterLimit=this.lineMiter,t.shadowColor=this.clr._parseC(this.lineShadow.color),t.shadowOffsetX=this.lineShadow.offsetX,t.shadowOffsetY=this.lineShadow.offsetY,t.shadowBlur=this.lineShadow.blur,this._setLineGradient(t),t.restore()):(t.lineWidth=this.lineWidth,t.lineCap=this.lineCap,t.lineJoin=this.lineJoin,t.miterLimit=this.lineMiter,this._setLineGradient(t)):this.lineShadow?(t.save(),t.lineWidth=this.lineWidth,t.lineCap=this.lineCap,t.lineJoin=this.lineJoin,t.miterLimit=this.lineMiter,t.shadowColor=this.clr._parseC(this.lineShadow.color),t.shadowOffsetX=this.lineShadow.offsetX,t.shadowOffsetY=this.lineShadow.offsetY,t.shadowBlur=this.lineShadow.blur,this.lineColor&&(t.globalAlpha=this._g.lineAlpha,t.strokeStyle=this.clr._parseC(this.lineColor),t.stroke()),t.restore()):(t.lineWidth=this.lineWidth,t.lineCap=this.lineCap,t.lineJoin=this.lineJoin,t.miterLimit=this.lineMiter,this.lineColor&&(t.globalAlpha=this._g.lineAlpha,t.strokeStyle=this.clr._parseC(this.lineColor),t.stroke()))},_setFillStyle:function(t){this.gradient?this.shadow?(t.save(),t.shadowColor=this.clr._parseC(this.shadow.color),t.shadowOffsetX=this.shadow.offsetX,t.shadowOffsetY=this.shadow.offsetY,t.shadowBlur=this.shadow.blur,this._setGradient(t),t.restore()):this._setGradient(t):this.shadow?(t.save(),t.shadowColor=this.clr._parseC(this.shadow.color),t.shadowOffsetX=this.shadow.offsetX,t.shadowOffsetY=this.shadow.offsetY,t.shadowBlur=this.shadow.blur,this.color&&(t.fillStyle=this.clr._parseC(this.color),t.fill()),t.restore()):this.color&&(t.fillStyle=this.clr._parseC(this.color),t.fill())},_setFont:function(t,e,i,s,n){this.fontWeight=t||this.fontWeight,this.fontStyle=this.fontWeight+" "+e+"px "+i,this.fontType=i,this.fontSize=e,this.align=this._alignList[s]?s:"center",this.baseLine=this._baseList[n]?n:"alphabetic"},_setShadow:function(t){this.shadow&&(t.shadowColor=this.clr._parseC(this.shadow.color),t.shadowOffsetX=this.shadow.offsetX,t.shadowOffsetY=this.shadow.offsetY,t.shadowBlur=this.shadow.blur)},_setLineShadow:function(t){this.lineShadow&&(t.shadowColor=this.clr._parseC(this.lineShadow.color),t.shadowOffsetX=this.lineShadow.offsetX,t.shadowOffsetY=this.lineShadow.offsetY,t.shadowBlur=this.lineShadow.blur)},_setGradient:function(t){var e,i=this.gradient;"linear"===i.type?e=t.createLinearGradient(i.coord[0],i.coord[1],i.coord[2],i.coord[3]):"radial"===i.type&&(e=t.createRadialGradient(i.coord[0],i.coord[1],i.coord[2],i.coord[3],i.coord[4],i.coord[5]));for(let t=0;t<i.color.length;t++)e.addColorStop(i.offset[t],this.clr._parseC(i.color[t]));t.fillStyle=e,t.fill()},_setLineGradient:function(t){var e,i=this.lineGradient;"linear"===i.type?e=t.createLinearGradient(i.coord[0],i.coord[1],i.coord[2],i.coord[3]):"radial"===i.type&&(e=t.createRadialGradient(i.coord[0],i.coord[1],i.coord[2],i.coord[3],i.coord[4],i.coord[5]));for(let t=0;t<i.color.length;t++)e.addColorStop(i.offset[t],this.clr._parseC(i.color[t]));t.stokeStyle=e,t.stroke()},_drawRect:function(t,e){t.save(),t.translate(this.position.x,this.position.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),t.globalAlpha=this._g.alpha,t.beginPath(),t.rect(this.pivot.x,this.pivot.y,this.size.x,this.size.y),t.closePath(),e||(this._setFillStyle(t),this._setLineStyle(t)),t.restore(),this.mask&&t.clip()},_drawRoundRect:function(t,e){t.save(),t.translate(this.position.x,this.position.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),t.globalAlpha=this._g.alpha,t.beginPath(),t.moveTo(this.pivot.x+this.radius,this.pivot.y),t.lineTo(this.pivot.x+(this.size.x-this.radius),this.pivot.y),t.quadraticCurveTo(this.pivot.x+this.size.x,this.pivot.y,this.pivot.x+this.size.x,this.pivot.y+this.radius),t.lineTo(this.pivot.x+this.size.x,this.pivot.y+(this.size.y-this.radius)),t.quadraticCurveTo(this.pivot.x+this.size.x,this.pivot.y+this.size.y,this.pivot.x+(this.size.x-this.radius),this.pivot.y+this.size.y),t.lineTo(this.pivot.x+this.radius,this.pivot.y+this.size.y),t.quadraticCurveTo(this.pivot.x,this.pivot.y+this.size.y,this.pivot.x,this.pivot.y+(this.size.y-this.radius)),t.lineTo(this.pivot.x,this.pivot.y+this.radius),t.quadraticCurveTo(this.pivot.x,this.pivot.y,this.pivot.x+this.radius,this.pivot.y),t.closePath(),e||(this._setFillStyle(t),this._setLineStyle(t)),t.restore(),this.mask&&t.clip()},_drawPolygon:function(e,t){e.save(),e.translate(this.position.x,this.position.y),e.scale(this.scale.x,this.scale.y),e.rotate(this.rotation),e.globalAlpha=this._g.alpha,e.beginPath();let i=by=ax=ay=0;for(let t=0;t<this.points.length;t++)0===t?e.moveTo(this.pivot.x+this.points[t][0],this.pivot.y+this.points[t][1]):e.lineTo(this.points[t][0]+this.pivot.x,this.points[t][1]+this.pivot.y),i=i>=this.points[t][0]?this.points[t][0]:i,by=by>=this.points[t][1]?this.points[t][1]:by,ax=ax<=this.points[t][0]?this.points[t][0]:ax,ay=ay<=this.points[t][1]?this.points[t][1]:ay;this.close&&e.closePath(),t||(this._setFillStyle(e),this._setLineStyle(e),this.size.set([Math.sqrt(Math.pow(i-ax,2)),Math.sqrt(Math.pow(by-ay,2))])),e.restore(),this.mask&&e.clip()},_drawShape:function(e,t){e.save(),e.translate(this.position.x,this.position.y),e.scale(this.scale.x,this.scale.y),e.rotate(this.rotation),e.globalAlpha=this._g.alpha,e.beginPath();let i=by=ax=ay=0;for(let t=0;t<this.obj.length;t++)for(var s in this.obj[t]){var n=this.obj[t][s];switch(s){case"m":case"moveTo":e.moveTo(this.pivot.x+n[0],this.pivot.y+n[1]),i=i>=n[0]?n[0]:i,by=by>=n[1]?n[1]:by,ax=ax<=n[0]?n[0]:ax,ay=ay<=n[1]?n[1]:ay;break;case"l":case"lineTo":e.lineTo(this.pivot.x+n[0],this.pivot.y+n[1]),i=i>=n[0]?n[0]:i,by=by>=n[1]?n[1]:by,ax=ax<=n[0]?n[0]:ax,ay=ay<=n[1]?n[1]:ay;break;case"q":case"quadraticCurveTo":e.quadraticCurveTo(this.pivot.x+n[0],this.pivot.y+n[1],this.pivot.x+n[2],this.pivot.y+n[3]),i=i>=n[0]?n[0]:i,by=by>=n[1]?n[1]:by,ax=ax<=n[0]?n[0]:ax,ay=ay<=n[1]?n[1]:ay,i=i>=n[2]?n[2]:i,by=by>=n[3]?n[3]:by,ax=ax<=n[2]?n[2]:ax,ay=ay<=n[3]?n[3]:ay;break;case"c":case"bezierCurveTo":e.bezierCurveTo(this.pivot.x+n[0],this.pivot.y+n[1],this.pivot.x+n[2],this.pivot.y+n[3],this.pivot.x+n[4],this.pivot.y+n[5]),i=i>=n[4]?n[4]:i,by=by>=n[5]?n[5]:by,ax=ax<=n[4]?n[4]:ax,ay=ay<=n[5]?n[5]:ay;break;case"a":case"arcTo":console.log(s),e.arcTo(this.pivot.x+n[0],this.pivot.y+n[1],this.pivot.x+n[2],this.pivot.y+n[3],n[4]),i=i>=n[2]?n[2]:i,by=by>=n[3]?n[3]:by,ax=ax<=n[2]?n[2]:ax,ay=ay<=n[3]?n[3]:ay}}this.close&&e.closePath(),t||(this._setFillStyle(e),this._setLineStyle(e),this.size.set([Math.sqrt(Math.pow(i-ax,2)),Math.sqrt(Math.pow(by-ay,2))])),e.restore(),this.mask&&e.clip()},_drawLine:function(t,e){t.save(),t.translate(this.position.x,this.position.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),t.globalAlpha=this._g.alpha,t.beginPath(),t.moveTo(this.start.x,this.start.y),t.lineTo(this.end.x,this.end.y),t.closePath(),this._setLineStyle(t),this.size.set([Math.sqrt(Math.pow(this.start.x-this.end.x,2)),Math.sqrt(Math.pow(this.start.y-this.end.y,2))]),this.len=this.start.distance(this.end),t.restore()},_drawCircle:function(t,e){t.save(),t.translate(this.position.x,this.position.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),t.globalAlpha=this._g.alpha,t.beginPath(),t.arc(this.pivot.x,this.pivot.y,this.radius,this.startAngle,this.endAngle,!1),t.closePath(),e||(this._setFillStyle(t),this._setLineStyle(t)),t.restore(),this.mask&&t.clip(),this.size.set(2*this.radius)},_drawText:function(t,e){t.save(),t.translate(this.position.x,this.position.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),t.globalAlpha=this._g.alpha,this.fontStyle=this.fontWeight+" "+this.fontSize+"px "+this.fontType,t.font=this.fontStyle,t.textAlign=this.align,t.textBaseline=this.baseLine;var i=t.measureText(this.txt);this.size.set([i.actualBoundingBoxRight+i.actualBoundingBoxLeft,i.actualBoundingBoxAscent+i.actualBoundingBoxDescent]);let s=0,n=0,a=this.size.y/12;"center"===this.align?s=this.size.divide(2,!0).x:"right"!==this.align&&"end"!==this.align||(s=this.size.x),"hanging"===this.baseLine?n=this.size.y/(2*a):"middle"===this.baseLine?n=this.size.y/2:"alphabetic"===this.baseLine?n=this.size.y-3*a:"ideographic"===this.baseLine?n=this.size.y-a:"bottom"===this.baseLine?n=this.size.y:"top"===this.baseLine&&(n=-a),t.beginPath(),t.rect(this.pivot.x-s-this.paddingLeft,this.pivot.y-n-this.paddingTop,this.size.x+2*this.paddingLeft,this.size.y+2*this.paddingTop),t.closePath(),this.backGround&&(e?t.fill():(this.backGround.color&&(t.fillStyle=this.clr._parseC(this.backGround.color),t.fill()),this.backGround.lineColor&&(t.lineWidth=this.backGround.lineWidth||2,t.strokeStyle=this.clr._parseC(this.backGround.lineColor),t.stroke()))),e||(t.beginPath(),this.color&&(this.gradient?(t.save(),this.shadow&&this._setShadow(t),this._setGradient(t)):(t.save(),this.shadow&&this._setShadow(t),t.fillStyle=this.clr._parseC(this.color)),t.fillText(this.txt,this.pivot.x,this.pivot.y),t.restore()),this.lineColor&&(t.lineWidth=this.lineWidth,t.lineCap=this.lineCap,t.lineJoin=this.lineJoin,t.miterLimit=this.lineMiter,this.lineGradient?(t.save(),this.lineShadow&&this._setLineShadow(t),this._setLineGradient(t)):(t.save(),this.lineShadow&&this._setLineShadow(t),t.strokeStyle=this.clr._parseC(this.lineColor)),t.strokeText(this.txt,this.pivot.x,this.pivot.y),t.restore()),t.closePath()),t.restore(),this.mask&&t.clip()},_drawImage:function(t,e){t.save(),t.translate(this.position.x,this.position.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),t.globalAlpha=this._g.alpha,this.loadComplete&&this.image&&(this.size.x=-1===this.imageCrop.dw?this.size.x:this.imageCrop.dw,this.size.y=-1===this.imageCrop.dh?this.size.y:this.imageCrop.dh,t.beginPath(),t.rect(this.pivot.x-this.paddingLeft,this.pivot.y-this.paddingTop,this.size.x+2*this.paddingLeft,this.size.y+2*this.paddingTop),t.closePath(),e||(this._setFillStyle(t),this._setLineStyle(t),this._setShadow(t),t.beginPath(),this.doneimage||(this.doneimage=!0,this.currentFilter=null,(e=document.createElement("canvas")).width=this.size.x,e.height=this.size.y,e.getContext("2d").drawImage(this.image,this.imageCrop.dx,this.imageCrop.dy,this.size.x,this.size.y,0,0,this.size.x,this.size.y),this.imageData=e,this.backUpImage=e),t.drawImage(this.imageData,this.pivot.x,this.pivot.y,this.size.x,this.size.y),t.closePath())),t.restore()},_drawClip:function(t,e){this.frameList&&(t.save(),t.translate(this.position.x,this.position.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),t.globalAlpha=this._g.alpha,this.loadComplete&&this.image&&this.frameList[this.currentFrame].data&&(t.beginPath(),t.rect(this.pivot.x,this.pivot.y,this.frameList[this.currentFrame].map.width,this.frameList[this.currentFrame].map.height),this.size.set([this.frameList[this.currentFrame].map.width,this.frameList[this.currentFrame].map.height]),t.closePath(),e||(this._setFillStyle(t),this._setLineStyle(t),this._setShadow(t),t.beginPath(),t.drawImage(this.frameList[this.currentFrame].data,this.pivot.x+this.frameList[this.currentFrame].x,this.pivot.y+this.frameList[this.currentFrame].y),t.closePath())),t.restore())},_global:function(){var t=this.parent._global();return{x:this.position.x,y:this.position.y,scaleX:this.scale.x,scaleY:this.scale.y,rotation:t.rotation+this.rotation,alpha:t.alpha<1?this.alpha*t.alpha:this.alpha,lineAlpha:t.alpha<1?this.lineAlpha*t.alpha:this.lineAlpha,visible:!!t.visible&&this.visible}},draw:function(t,e){if(this._g=this._global(),this._g.visible)switch(this.type){case"rect":this._drawRect(t,e);break;case"rectround":this._drawRoundRect(t,e);break;case"polygon":this._drawPolygon(t,e);break;case"shape":this._drawShape(t,e);break;case"line":this._drawLine(t,e);break;case"circle":this._drawCircle(t,e);break;case"text":this._drawText(t,e);break;case"img":this._drawImage(t,e);break;case"clip":this._drawClip(t,e);break;default:console.log("default displayObject")}}},Canvas2d.Point=function(t){return this.x=0,this.y=0,this.isPoint(t)?(this.x=t.x,this.y=t.y):t instanceof Array?(this.x=t[0],this.y=t[1]):"number"==typeof t&&(this.x=t,this.y=t),this},Canvas2d.Point.prototype={setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},set:function(t){return this.isPoint(t)?(this.x=t.x,this.y=t.y):t instanceof Array?(this.x=t[0],this.y=t[1]):"number"==typeof t&&(this.x=t,this.y=t),this},random:function(t,e){return this.x=Math.random()*t,this.y=Math.random()*t,null!==e&&this.round(e),this},getPoint:function(t){return t instanceof Canvas2d.Point?t:new Canvas2d.Point},isPoint:function(t){return t instanceof Canvas2d.Point},isEqual:function(t){return t.x===this.x&&t.y===this.y},add:function(t,e){if(this.isPoint(t)){if(e)return new Canvas2d.Point([this.x+t.x,this.y+t.y]);this.x+=t.x,this.y+=t.y}else if(t instanceof Array){if(e)return new Canvas2d.Point([this.x+t[0],this.y+t[1]]);this.x+=t[0],this.y+=t[1]}else if("number"==typeof t){if(e)return new Canvas2d.Point([this.x+t,this.y+t]);this.x+=t,this.y+=t}return this},subtract:function(t,e){if(this.isPoint(t)){if(e)return new Canvas2d.Point([this.x-t.x,this.y-t.y]);this.x-=t.x,this.y-=t.y}else if(t instanceof Array){if(e)return new Canvas2d.Point([this.x-t[0],this.y-t[1]]);this.x-=t[0],this.y-=t[1]}else if("number"==typeof t){if(e)return new Canvas2d.Point([this.x-t,this.y-t]);this.x-=t,this.y-=t}return this},multiply:function(t,e){if(this.isPoint(t)){if(e)return new Canvas2d.Point([this.x*t.x,this.y*t.y]);this.x*=t.x,this.y*=t.y}else if(t instanceof Array){if(e)return new Canvas2d.Point([this.x*t[0],this.y*t[1]]);this.x*=t[0],this.y*=t[1]}else if("number"==typeof t){if(e)return new Canvas2d.Point([this.x*t,this.y*t]);this.x*=t,this.y*=t}return this},divide:function(t,e){if(this.isPoint(t)){if(e)return new Canvas2d.Point([this.x/t.x,this.y/t.y]);this.x/=t.x,this.y/=t.y}else if(t instanceof Array){if(e)return new Canvas2d.Point([this.x/t[0],this.y/t[1]]);this.x/=t[0],this.y/=t[1]}else if("number"==typeof t){if(e)return new Canvas2d.Point([this.x/t,this.y/t]);this.x/=t,this.y/=t}return this},length:function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},lengthSqrt:function(){return Math.pow(this.x,2)+Math.pow(this.y,2)},normalize:function(){var t=this.length();return 0===t?(this.x=1,this.y=0):this.divide([t,t]),this},angle:function(){return Math.atan2(this.y,this.x)},angleCross:function(t){return Math.atan2(t.y-this.y,t.x-this.x)},distance:function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},dot:function(t){return t.x*this.x+t.y*this.y},cross:function(t){return this.x*t.y-this.y*t.x},abs:function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},getQuadrant:function(){return 0<=this.x?0<=this.y?1:4:0<=this.y?2:3},_precision:[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10],round:function(t){return 0===t?(this.x=Math.ceil(this.x),this.y=Math.ceil(this.y)):(t=this._precision[t=t||2],this.x=(.5+this.x*t<<0)/t,this.y=(.5+this.y*t<<0)/t),this},toRad:function(t){return 180*t/Math.PI},toDeg:function(t){return t/Math.PI*180},rotate:function(t){return this.x=this.x*Math.cos(t)-this.y*Math.sin(t),this.y=this.x*Math.sin(t)+this.y*Math.cos(t),this}},Canvas2d.Tweener=function(){this.className="Tweener",this.children={},this._tempChildren={},this.charList=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," ","0","1","2","3","4","5","6","7","8","9",",",'"',"'",",",":",";","(",")","[","]","{","}","*","@",".","!","?","\\","/","<",">","#","+","-","_","=","^","ì","è","é","ò","à","ù","&","$","£","|","∞","°","ç"],this.clr=new Canvas2d.Colors},Canvas2d.Tweener.prototype={getFrame:function(){return window[Canvas2d.wn+"rqanim"].getFrame()},getTime:function(){return window[Canvas2d.wn+"rqanim"].getTime()},getFps:function(){return window[Canvas2d.wn+"rqanim"].getFps()},getTimeInterval:function(){return window[Canvas2d.wn+"rqanim"].getTimeInterval()},addTweener:function(t,e){if(null===t.parent||void 0===t.parent)console.log(typeof t.parent,"provide a nested object");else{var i,s,n,a,o={},r=["rotation","lineWidth","fontSize","radius","startAngle","endAngle"],h=e.data||null,l=e.delay||0,c=e.ease||"easeNone",d=e.duration||1e3;for(w in e)for(var u=0;u<r.length;u++)w===r[u]&&(a=e[w]>t[w]?e[w]-t[w]:-(t[w]-e[w]),o[w]={ease:c,to:a,ct:0,d:d,from:t[w],prop:w,request:e[w],target:t});if("pivot"in e&&(t.pivot.isPoint(e.pivot)?(a=e.pivot.x,_=e.pivot.y):e.pivot instanceof Array?(a=e.pivot[0],_=e.pivot[1]):"number"==typeof e.pivot&&(a=e.pivot,_=e.pivot),o.point={ease:c,tox:a>t.pivot.x?a-t.pivot.x:-(t.pivot.x-a),toy:_>t.pivot.y?_-t.pivot.y:-(t.pivot.y-_),ct:0,d:d,fromx:t.pivot.x,fromy:t.pivot.y,prop:"pivot",request:"pivot",target:t}),"size"in e&&(t.size.isPoint(e.size)?(a=e.size.x,_=e.size.y):e.size instanceof Array?(a=e.size[0],_=e.size[1]):"number"==typeof e.size&&(a=e.size,_=e.size),o.point={ease:c,tox:a>t.size.x?a-t.size.x:-(t.size.x-a),toy:_>t.size.y?_-t.size.y:-(t.size.y-_),ct:0,d:d,fromx:t.size.x,fromy:t.size.y,prop:"size",request:"size",target:t}),"scale"in e&&(console.log(e),t.scale.isPoint(e.scale)?(a=e.scale.x,_=e.scale.y):e.scale instanceof Array?(a=e.scale[0],_=e.scale[1]):"number"==typeof e.scale&&(a=e.scale,_=e.scale),o.point={ease:c,tox:a>t.scale.x?a-t.scale.x:-(t.scale.x-a),toy:_>t.scale.y?_-t.scale.y:-(t.scale.y-_),ct:0,d:d,fromx:t.scale.x,fromy:t.scale.y,prop:"scale",request:"scale",target:t}),"position"in e&&(t.position.isPoint(e.position)?(a=e.position.x,_=e.position.y):e.position instanceof Array?(a=e.position[0],_=e.position[1]):"number"==typeof e.position&&(a=e.position,_=e.position),o.point={ease:c,tox:a>t.position.x?a-t.position.x:-(t.position.x-a),toy:_>t.position.y?_-t.position.y:-(t.position.y-_),ct:0,d:d,fromx:t.position.x,fromy:t.position.y,prop:"position",request:"position",target:t}),"obj"in e){if(!t.obj)return;for(var f in o.obj={ease:c,to:[],ct:0,d:d,from:[],prop:"obj",subprop:[],index:[],request:[],target:t},e.obj)for(var p in e.obj[f])for(var g=0;g<e.obj[f][p].length;g++)o.obj.index.push(parseInt(f)),o.obj.request.push(e.obj[f][p][g]),o.obj.from.push(t.obj[f][p][g]),a=e.obj[f][p][g]>t.obj[f][p][g]?e.obj[f][p][g]-t.obj[f][p][g]:-(t.obj[f][p][g]-e.obj[f][p][g]),o.obj.to.push(a),o.obj.subprop.push(p)}if("txt"in e){if(""===t.txt)return;e.txt=""!==e.txt?e.txt:"cutFwd";for(var v=[],y=[],m=t.txt,w=0;w<this.charList.length;w++)y.push(this.charList[w]);for(y=this._shuffle(y),w=0;w<m.length;w++)for(a=0;a<y.length;a++)if(m.charAt(w)===y[a]){v.push(a);break}o.txt={ease:c,to:m.length,ct:0,d:d,from:0,prop:"txt",subprop:v,request:"",target:t,text:t.txt,type:e.txt,charlist:y},t._prevTxt=t.txt,t.txt=""}if("shadow"in e){if(!t.shadow)return;for(var f in o.shadow={ease:c,to:[],ct:0,d:d,from:[],prop:"shadow",subprop:[],request:[],target:t},e.shadow)"color"===f?(i=this.clr._fromStringToArrayRgb(e.shadow[f]),n=this.clr._fromStringToArrayRgb(t.shadow[f]),v=i[0]-n[0],m=i[1]-n[1],s=i[2]-n[2],o.shadow.to.push([v,m,s]),o.shadow.from.push([n[0],n[1],n[2]])):(a=e.shadow[f]>t.shadow[f]?e.shadow[f]-t.shadow[f]:-(t.shadow[f]-e.shadow[f]),o.shadow.to.push(a),o.shadow.from.push(t.shadow[f])),o.shadow.subprop.push(f),o.shadow.request.push(e.shadow[f])}if("lineShadow"in e){if(!t.lineShadow)return;for(var b in o.lineShadow={ease:c,to:[],ct:0,d:d,from:[],prop:"lineShadow",subprop:[],request:[],target:t},e.lineShadow)"color"===b?(i=this.clr._fromStringToArrayRgb(e.lineShadow[b]),n=this.clr._fromStringToArrayRgb(t.lineShadow[b]),v=i[0]-n[0],m=i[1]-n[1],s=i[2]-n[2],o.lineShadow.to.push([v,m,s]),o.lineShadow.from.push([n[0],n[1],n[2]])):(a=e.lineShadow[b]>t.lineShadow[b]?e.lineShadow[b]-t.lineShadow[b]:-(t.lineShadow[b]-e.lineShadow[b]),o.lineShadow.to.push(a),o.lineShadow.from.push(t.lineShadow[b])),o.lineShadow.subprop.push(b),o.lineShadow.request.push(e.lineShadow[b])}"color"in e&&(i=this.clr._fromStringToArrayRgb(e.color),n=this.clr._fromStringToArrayRgb(t.color),v=i[0]-n[0],m=i[1]-n[1],s=i[2]-n[2],o.rgb={ease:c,tor:v,tog:m,tob:s,ct:0,d:d,fromr:n[0],fromg:n[1],fromb:n[2],prop:"color",request:i,target:t}),"lineColor"in e&&(i=this.clr._fromStringToArrayRgb(e.lineColor),n=this.clr._fromStringToArrayRgb(t.lineColor),v=i[0]-n[0],m=i[1]-n[1],s=i[2]-n[2],o.rgbl={ease:c,tor:v,tog:m,tob:s,ct:0,d:d,fromr:n[0],fromg:n[1],fromb:n[2],prop:"lineColor",request:i,target:t}),"alpha"in e&&(_=(x=e.alpha)-t.alpha,o.alpha={ease:c,to:_,ct:0,d:d,from:t.alpha,prop:"alpha",request:x,target:t}),"lineAlpha"in e&&(_=(x=1<e.lineAlpha?e.lineAlpha/100:e.lineAlpha)-t.lineAlpha,o.lineAlpha={ease:c,to:_,ct:0,d:d,from:t.lineAlpha,prop:"lineAlpha",request:void 0,target:t});var x=e.onStart||null,_=e.onTween||null,C=e.onEnd||null;o.state={start:!0,tweening:!1,end:!1,onStart:x,onTween:_,onEnd:C,target:t,duration:d,delay:l,data:h},0<l?this._delayFun(this.children,o,t.id,l):this._startFun(this.children,o,t.id)}},_delayFun:function(t,e,i,s){var n=this;setTimeout(function(){n._startFun(t,e,i)},s)},_startFun:function(t,e,i){t[i]=e,window[Canvas2d.wn+"rqanim"].addLoop(this,this._callTween),window[Canvas2d.wn+"rqanim"].start()},removeTweener:function(t){t.id in this._tempChildren&&delete this._tempChildren[t.id],t.id in this.children&&(this.children[t.id].state.end=!0)},_shuffle:function(t){for(var e=t.length-1;0<e;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}return t},_callTween:function(t){var e,i,s,n,a,o={};for(s in t.children){if(t.children[s].state.start)t._states(t.children[s].state),t.children[s].state.start=!1;else{if(t.children[s].state.end){for(e in t.children[s].state.tweening=!1,i=t.children[s].state,delete t.children[s],t._states(i),t.children);t.children[s]||t.children[e]||window[Canvas2d.wn+"rqanim"].removeLoop(t);continue}t.children[s].state.tweening=!0}for(var r in t._states(t.children[s].state),t.children[s])"state"!==r&&(n=window[Canvas2d.wn+"rqanim"].getTimeInterval(),"rgb"===r||"rgbl"===r?(t.children[s][r].ct+=n,t._tweenColor(t.children[s][r],t.children[s].state)):"shadow"===r||"lineShadow"===r?(t.children[s][r].ct+=n,t._tweenS(t.children[s][r],t.children[s].state)):"obj"===r?(t.children[s][r].ct+=n,t._tweenO(t.children[s][r],t.children[s].state)):"txt"===r?(t.children[s][r].ct+=n,t._tweenT(t.children[s][r],t.children[s].state)):"point"===r?(t.children[s][r].ct+=n,t._tweenP(t.children[s][r],t.children[s].state)):(t.children[s][r].ct+=n,t._tween(t.children[s][r],t.children[s].state)));"DisplayObjects"===t.children[s].state.target.className?o[t.children[s].state.target.parent.id]=t.children[s].state.target.parent:o[t.children[s].state.target.id]=t.children[s].state.target}for(a in o)o[a].draw()},_tweenColor:function(t,e){var i,s;1<=t.ct/t.d&&(t.ct=1,t.d=1,e.end=!0),e=this[t.ease](t.ct,t.fromr,t.tor,t.d),i=this[t.ease](t.ct,t.fromg,t.tog,t.d),s=this[t.ease](t.ct,t.fromb,t.tob,t.d),t.target[t.prop]="rgb("+Math.round(e)+","+Math.round(i)+","+Math.round(s)+")"},_tweenP:function(t,e){var i;1<=t.ct/t.d&&(t.ct=1,t.d=1,e.end=!0),e=this[t.ease](t.ct,t.fromx,t.tox,t.d),i=this[t.ease](t.ct,t.fromy,t.toy,t.d),t.target[t.prop].set([e,i])},_tween:function(t,e){1<=t.ct/t.d&&(t.ct=1,t.d=1,e.end=!0),e=this[t.ease](t.ct,t.from,t.to,t.d),t.target[t.prop]=e},_tweenS:function(t,e){1<=t.ct/t.d&&(t.ct=1,t.d=1,e.end=!0);for(var i,s,n,a=0;a<t.to.length;a++)"color"===t.subprop[a]?(n=this[t.ease](t.ct,t.from[a][0],t.to[a][0],t.d),i=this[t.ease](t.ct,t.from[a][1],t.to[a][1],t.d),s=this[t.ease](t.ct,t.from[a][2],t.to[a][2],t.d),t.target[t.prop][t.subprop[a]]="rgb("+Math.round(n)+","+Math.round(i)+","+Math.round(s)+")"):(n=this[t.ease](t.ct,t.from[a],t.to[a],t.d),t.target[t.prop][t.subprop[a]]=n)},_tweenO:function(t,e){1<=t.ct/t.d&&(t.ct=1,t.d=1,e.end=!0);for(var i=0;i<t.to.length;i++){var s=this[t.ease](t.ct,t.from[i],t.to[i],t.d);t.target[t.prop][t.index[i]][t.subprop[i]][i]=s}},_tweenT:function(e,t){var i;switch(1<=e.ct/e.d&&(e.ct=1,e.d=1,t.end=!0),e.type){case"cutFwd":i=Math.floor(this[e.ease](e.ct,e.from,e.to,e.d)),e.target[e.prop]=e.text.substr(0,i);break;case"cutBack":i=Math.floor(this[e.ease](e.ct,e.from,e.to,e.d)),e.target[e.prop]=e.text.substr(0,e.to-i);break;case"matrix":for(let t=0;t<e.subprop.length;t++)i=(i=Math.floor(this[e.ease](e.ct,0,e.subprop[t],e.d)))>this.charList.length-1?i-this.charList.length:i,e.request+=e.charlist[i];e.target[e.prop]=e.text=e.request,e.request=""}},_states:function(t){for(var e in t)switch(e){case"start":!0===t[e]&&t.onStart&&t.onStart.apply(t.target,[t]);break;case"tweening":!0===t[e]&&t.onTween&&t.onTween.apply(t.target,[t]);break;case"end":!0===t[e]&&t.onEnd&&t.onEnd.apply(t.target,[t])}},easeNone:function(t,e,i,s,n){return i*t/s+e},easeSine:function(t,e,i,s,n){return e+i*Math.sin(Math.PI/s*t)},easeInQuad:function(t,e,i,s,n){return i*(t/=s)*t+e},easeOutQuad:function(t,e,i,s,n){return-i*(t/=s)*(t-2)+e},easeInOutQuad:function(t,e,i,s,n){return(t/=s/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeOutInQuad:function(t,e,i,s,n){return t<s/2?this.easeOutQuad(2*t,e,i/2,s,n):this.easeInQuad(2*t-s,e+i/2,i/2,s,n)},easeInCubic:function(t,e,i,s,n){return i*(t/=s)*t*t+e},easeOutCubic:function(t,e,i,s,n){return i*((t=t/s-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,s,n){return(t/=s/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeOutInCubic:function(t,e,i,s,n){return t<s/2?this.easeOutCubic(2*t,e,i/2,s,n):this.easeInCubic(2*t-s,e+i/2,i/2,s,n)},easeInQuart:function(t,e,i,s,n){return i*(t/=s)*t*t*t+e},easeOutQuart:function(t,e,i,s,n){return-i*((t=t/s-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,s,n){return(t/=s/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeOutInQuart:function(t,e,i,s,n){return t<s/2?this.easeOutQuart(2*t,e,i/2,s,n):this.easeInQuart(2*t-s,e+i/2,i/2,s,n)},easeInQuint:function(t,e,i,s,n){return i*(t/=s)*t*t*t*t+e},easeOutQuint:function(t,e,i,s,n){return i*((t=t/s-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,s,n){return(t/=s/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeOutInQuint:function(t,e,i,s,n){return t<s/2?this.easeOutQuint(2*t,e,i/2,s,n):this.easeInQuint(2*t-s,e+i/2,i/2,s,n)},easeInSine:function(t,e,i,s,n){return-i*Math.cos(t/s*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,s,n){return i*Math.sin(t/s*(Math.PI/2))+e},easeInOutSine:function(t,e,i,s,n){return-i/2*(Math.cos(Math.PI*t/s)-1)+e},easeOutInSine:function(t,e,i,s,n){return t<s/2?this.easeOutSine(2*t,e,i/2,s,n):this.easeInSine(2*t-s,e+i/2,i/2,s,n)},easeInExpo:function(t,e,i,s,n){return 0===t?e:i*Math.pow(2,10*(t/s-1))+e-.001*i},easeOutExpo:function(t,e,i,s,n){return t===s?e+i:1.001*i*(1-Math.pow(2,-10*t/s))+e},easeInOutExpo:function(t,e,i,s,n){return 0===t?e:t===s?e+i:(t/=s/2)<1?i/2*Math.pow(2,10*(t-1))+e-5e-4*i:i/2*1.0005*(2-Math.pow(2,-10*--t))+e},easeOutInExpo:function(t,e,i,s,n){return t<s/2?this.easeOutExpo(2*t,e,i/2,s,n):this.easeInExpo(2*t-s,e+i/2,i/2,s,n)},easeInCirc:function(t,e,i,s,n){return-i*(Math.sqrt(1-(t/=s)*t)-1)+e},easeOutCirc:function(t,e,i,s,n){return i*Math.sqrt(1-(t=t/s-1)*t)+e},easeInOutCirc:function(t,e,i,s,n){return(t/=s/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeOutInCirc:function(t,e,i,s,n){return t<s/2?this.easeOutCirc(2*t,e,i/2,s,n):this.easeInCirc(2*t-s,e+i/2,i/2,s,n)},easeInElastic:function(t,e,i,s,n){var a;return 0===t?e:1==(t/=s)?e+i:(a=!n||isNaN(n.period)?.3*s:n.period,i=!(n=!n||isNaN(n.amplitude)?0:n.amplitude)||n<Math.abs(i)?(n=i,a/4):a/(2*Math.PI)*Math.asin(i/n),-(n*Math.pow(2,10*--t)*Math.sin((t*s-i)*(2*Math.PI)/a))+e)},easeOutElastic:function(t,e,i,s,n){var a,o;return 0===t?e:1==(t/=s)?e+i:(a=!n||isNaN(n.period)?.3*s:n.period,o=!(n=!n||isNaN(n.amplitude)?0:n.amplitude)||n<Math.abs(i)?(n=i,a/4):a/(2*Math.PI)*Math.asin(i/n),n*Math.pow(2,-10*t)*Math.sin((t*s-o)*(2*Math.PI)/a)+i+e)},easeInOutElastic:function(t,e,i,s,n){var a,o;return 0===t?e:2==(t/=s/2)?e+i:(a=!n||isNaN(n.period)?s*(.3*1.5):n.period,o=!(n=!n||isNaN(n.amplitude)?0:n.amplitude)||n<Math.abs(i)?(n=i,a/4):a/(2*Math.PI)*Math.asin(i/n),t<1?n*Math.pow(2,10*--t)*Math.sin((t*s-o)*(2*Math.PI)/a)*-.5+e:n*Math.pow(2,-10*--t)*Math.sin((t*s-o)*(2*Math.PI)/a)*.5+i+e)},easeOutInElastic:function(t,e,i,s,n){return t<s/2?this.easeOutElastic(2*t,e,i/2,s,n):this.easeInElastic(2*t-s,e+i/2,i/2,s,n)},easeInBack:function(t,e,i,s,n){n=!n||isNaN(n.overshoot)?1.70158:n.overshoot;return i*(t/=s)*t*((n+1)*t-n)+e},easeOutBack:function(t,e,i,s,n){n=!n||isNaN(n.overshoot)?1.70158:n.overshoot;return i*((t=t/s-1)*t*((n+1)*t+n)+1)+e},easeInOutBack:function(t,e,i,s,n){n=!n||isNaN(n.overshoot)?1.70158:n.overshoot;return(t/=s/2)<1?i/2*(t*t*((1+(n*=1.525))*t-n))+e:i/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeOutInBack:function(t,e,i,s,n){return t<s/2?this.easeOutBack(2*t,e,i/2,s,n):this.easeInBack(2*t-s,e+i/2,i/2,s,n)},easeInBounce:function(t,e,i,s,n){return i-this.easeOutBounce(s-t,0,i,s)+e},easeOutBounce:function(t,e,i,s,n){return(t/=s)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(t,e,i,s,n){return t<s/2?.5*this.easeInBounce(2*t,0,i,s)+e:.5*this.easeOutBounce(2*t-s,0,i,s)+.5*i+e},easeOutInBounce:function(t,e,i,s,n){return t<s/2?this.easeOutBounce(2*t,e,i/2,s,n):this.easeInBounce(2*t-s,e+i/2,i/2,s,n)}},Canvas2d.Colors=function(){return this},Canvas2d.Colors.prototype={randomRgb:function(t){var t=t||"string",e=Math.round(255*Math.random()),i=Math.round(255*Math.random()),s=Math.round(255*Math.random());return"array"===t?[Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())]:"rgb("+e+","+i+","+s+")"},invert:function(t){t=this._fromStringToArrayRgb(t);return"rgb("+(255-t[0])+","+(255-t[1])+","+(255-t[2])+")"},complementary:function(t){var t=this._fromStringToArrayRgb(t),e=this._rgbToHsv(t);return"rgb("+(t=this._hsvToRgb([this._hueShift(e[0],180),e[1],e[2]]))[0]+","+t[1]+","+t[2]+")"},_parseC:function(t){return"string"==typeof t?-1<t.indexOf("hsv")?this._fromStringToArrayRgb(t):t:t instanceof Array?this._fromArrayToStringRgb(t):t&&void 0},_fromArrayToStringRgb:function(t){let e=av="";return 3<t.length&&(e="a",av=","+t[3]),"rgb"+e+"("+t[0]+","+t[1]+","+t[2]+av+")"},_fromStringToArrayRgb:function(t){if(!t)return[0,0,0];var e,i;if("string"==typeof t)return-1<(e=t.replace(/\s/g,"").toLowerCase()).indexOf("rgb")?(i=e.replace(/[rgba\(\)]/g,"").split(","),[parseInt(i[0]),parseInt(i[1]),parseInt(i[2])]):-1<e.indexOf("#")?this._hexToRgb(e):-1<e.indexOf("hsl")?(i=e.replace(/[hsla\(%?\)]/g,"").split(","),this._hslToRgb(i)):-1<e.indexOf("hsv")?(i=e.replace(/[hsva\(%?\)]/g,"").split(","),this._hsvToRgb(i)):e in this.namedColor?this.namedColor[e][1]:[0,0,0];if(t instanceof Array)return t;throw"You are attempting to translate an INVALID color: "+t},_parseGetColor:function(t,e){return t?(e=e||"rgb","string"==typeof t?function(t,e){t=t.replace(/\s/g,"").toLowerCase();return-1<t.indexOf("rgb")?"rgb":-1<t.indexOf("#")?"hex":-1<t.indexOf("hsl")?"hsl":-1<t.indexOf("hsv")?"hsv":t in e.namedColor&&"name"}(t,this)===e?t:i(this._fromStringToArrayRgb(t),e,this):i(t,e)):"rgb(0,0,0)";function i(t,e,i){switch(e){case"hex":return i._rgbToHex(t);case"rgb":return"rgb("+t[0]+","+t[1]+","+t[2]+")";case"hsl":return"hsl("+(t=i._rgbToHsl(t))[0]+","+t[1]+"%,"+t[2]+"%)";case"hsv":return"hsv("+(t=i._rgbToHsv(t))[0]+","+t[1]+"%,"+t[2]+"%)";case"name":function a(t,e,i){return t<=(255<=e+i?255:e+i)&&(e-i<=0?0:e-i)<=t}return function t(e,i,s){for(var n in s)if(a(s[n][1][0],i[0],e)&&a(s[n][1][1],i[1],e)&&a(s[n][1][2],i[2],e))return n;e+=5;return t(e,i,s)}(5,t,i.namedColor);default:return c}}},_rgbToHsl:function(t){var e=t[0],i=t[1],t=t[2];e/=255,i/=255,t/=255;let n=s=d=c=0;var a=Math.max(e,i,t),o=Math.min(e,i,t),r=(a+o)/2;return a===o?n=s=0:(d=a-o,s=.5<r?d/(2-a-o):d/(a+o),a===e?(c=i<t?6:0,n=(i-t)/d+c):a===i?n=(t-e)/d+2:a===t&&(n=(e-i)/d+4),n/=6),[this._rod2(360*n),this._rod2(100*s),this._rod2(100*r)]},_rgbToHsv:function(t){var e=t[0],i=t[1],t=t[2],s=(e/=255,i/=255,t/=255,Math.max(e,i,t)),n=Math.min(e,i,t),a=s,o=s-n;let r=0==s?0:o/s;return s==n?h=0:(e===s&&(h=(i-t)/o,i<t)&&(h=(i-t)/o+6),i===s&&(h=(t-e)/o+2),t===s&&(h=(e-i)/o+4),h/=6),[this._rod2(360*h),this._rod2(100*r),this._rod2(100*a)]},_hslToRgb:function(t){var e=t[0],i=t[1],t=t[2];return e/=360,t/=100,0==(i/=100)?r=g=b=t:(q=t<.5?t*(1+i):t+i-t*i,p=2*t-q,r=this._hue2rgb(p,q,e+1/3),g=this._hue2rgb(p,q,e),b=this._hue2rgb(p,q,e-1/3)),[this._rod(255*r),this._rod(255*g),this._rod(255*b)]},_hsvToRgb:function(e){var s=e[0],n=e[1],e=e[2];s/=360,n/=100,e/=100;let a=g=b=0;return i=Math.floor(6*s),f=6*s-i,p=e*(1-n),q=e*(1-f*n),t=e*(1-(1-f)*n),i%6==0&&(a=e,g=t,b=p),i%6==1&&(a=q,g=e,b=p),i%6==2&&(a=p,g=e,b=t),i%6==3&&(a=p,g=q,b=e),i%6==4&&(a=t,g=p,b=e),i%6==5&&(a=e,g=p,b=q),[this._rod(255*a),this._rod(255*g),this._rod(255*b)]},_hexToRgb:function(t){return[this._toR(t),this._toG(t),this._toB(t)]},_rgbToHex:function(t){return"#"+this._toHex(t[0])+this._toHex(t[1])+this._toHex(t[2])},_nameToRgb:function(t){console.log(t)},_toHex:function(t){return null===t||0===(t=parseInt(t))||isNaN(t)?"00":(t=Math.max(0,t),t=Math.min(t,255),t=Math.round(t),"0123456789ABCDEF".charAt((t-t%16)/16)+"0123456789ABCDEF".charAt(t%16))},_toR:function(t){return parseInt(this._cutHex(t).substring(0,2),16)},_toG:function(t){return parseInt(this._cutHex(t).substring(2,4),16)},_toB:function(t){return parseInt(this._cutHex(t).substring(4,6),16)},_cutHex:function(t){return"#"===t.charAt(0)?t.substring(1,7):t},_rod:function(t){return parseInt(Math.floor(+t)+ +Math.floor(t%1/.5))},_rod2:function(t){return Math.round(t,2)},_hue2rgb:function(t,e,i){return i<0&&(i+=1),1<i&&--i,i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},_hueShift:function(t,e){for(t+=e;360<=t;)t-=360;for(;t<0;)t+=360;return t},namedColor:{aliceblue:["#f0f8ff",[240,248,255]],antiquewhite:["#faebd7",[250,235,215]],aqua:["#00ffff",[0,255,255]],aquamarine:["#7fffd4",[127,255,212]],azure:["#f0ffff",[240,255,255]],beige:["#f5f5dc",[245,245,220]],bisque:["#ffe4c4",[255,228,196]],black:["#000000",[0,0,0]],blanchedalmond:["#ffebcd",[255,235,205]],blue:["#0000ff",[0,0,255]],blueviolet:["#8a2be2",[138,43,226]],brown:["#a52a2a",[165,42,42]],burlywood:["#deb887",[222,184,135]],cadetblue:["#5f9ea0",[95,158,160]],chartreuse:["#7fff00",[127,255,0]],chocolate:["#d2691e",[210,105,30]],coral:["#ff7f50",[255,127,80]],cornflowerblue:["#6495ed",[100,149,237]],cornsilk:["#fff8dc",[255,248,220]],crimson:["#dc143c",[220,20,60]],cyan:["#00ffff",[0,255,255]],darkblue:["#00008b",[0,0,139]],darkcyan:["#008b8b",[0,139,139]],darkgoldenrod:["#b8860b",[184,134,11]],darkgray:["#a9a9a9",[169,169,169]],darkgreen:["#006400",[0,100,0]],darkgrey:["#a9a9a9",[169,169,169]],darkkhaki:["#bdb76b",[189,183,107]],darkmagenta:["#8b008b",[139,0,139]],darkolivegreen:["#556b2f",[85,107,47]],darkorange:["#ff8c00",[255,140,0]],darkorchid:["#9932cc",[153,50,204]],darkred:["#8b0000",[139,0,0]],darksalmon:["#e9967a",[233,150,122]],darkseagreen:["#8fbc8f",[143,188,143]],darkslateblue:["#483d8b",[72,61,139]],darkslategray:["#2f4f4f",[47,79,79]],darkslategrey:["#2f4f4f",[47,79,79]],darkturquoise:["#00ced1",[0,206,209]],darkviolet:["#9400d3",[148,0,211]],deeppink:["#ff1493",[255,20,147]],deepskyblue:["#00bfff",[0,191,255]],dimgray:["#696969",[105,105,105]],dimgrey:["#696969",[105,105,105]],dodgerblue:["#1e90ff",[30,144,255]],firebrick:["#b22222",[178,34,34]],floralwhite:["#fffaf0",[255,250,240]],forestgreen:["#228b22",[34,139,34]],fuchsia:["#ff00ff",[255,0,255]],gainsboro:["#dcdcdc",[220,220,220]],ghostwhite:["#f8f8ff",[248,248,255]],gold:["#ffd700",[255,215,0]],goldenrod:["#daa520",[218,165,32]],gray:["#808080",[128,128,128]],green:["#008000",[0,128,0]],greenyellow:["#adff2f",[173,255,47]],grey:["#808080",[128,128,128]],honeydew:["#f0fff0",[240,255,240]],hotpink:["#ff69b4",[255,105,180]],indianred:["#cd5c5c",[205,92,92]],indigo:["#4b0082",[75,0,130]],ivory:["#fffff0",[255,255,240]],khaki:["#f0e68c",[240,230,140]],lavender:["#e6e6fa",[230,230,250]],lavenderblush:["#fff0f5",[255,240,245]],lawngreen:["#7cfc00",[124,252,0]],lemonchiffon:["#fffacd",[255,250,205]],lightblue:["#add8e6",[173,216,230]],lightcoral:["#f08080",[240,128,128]],lightcyan:["#e0ffff",[224,255,255]],lightgoldenrodyellow:["#fafad2",[250,250,210]],lightgray:["#d3d3d3",[211,211,211]],lightgreen:["#90ee90",[144,238,144]],lightgrey:["#d3d3d3",[211,211,211]],lightpink:["#ffb6c1",[255,182,193]],lightsalmon:["#ffa07a",[255,160,122]],lightseagreen:["#20b2aa",[32,178,170]],lightskyblue:["#87cefa",[135,206,250]],lightslategray:["#778899",[119,136,153]],lightslategrey:["#778899",[119,136,153]],lightsteelblue:["#b0c4de",[176,196,222]],lightyellow:["#ffffe0",[255,255,224]],lime:["#00ff00",[0,255,0]],limegreen:["#32cd32",[50,205,50]],linen:["#faf0e6",[250,240,230]],magenta:["#ff00ff",[255,0,255]],maroon:["#800000",[128,0,0]],mediumaquamarine:["#66cdaa",[102,205,170]],mediumblue:["#0000cd",[0,0,205]],mediumorchid:["#ba55d3",[186,85,211]],mediumpurple:["#9370db",[147,112,219]],mediumseagreen:["#3cb371",[60,179,113]],mediumslateblue:["#7b68ee",[123,104,238]],mediumspringgreen:["#00fa9a",[0,250,154]],mediumturquoise:["#48d1cc",[72,209,204]],mediumvioletred:["#c71585",[199,21,133]],midnightblue:["#191970",[25,25,112]],mintcream:["#f5fffa",[245,255,250]],mistyrose:["#ffe4e1",[255,228,225]],moccasin:["#ffe4b5",[255,228,181]],navajowhite:["#ffdead",[255,222,173]],navy:["#000080",[0,0,128]],oldlace:["#fdf5e6",[253,245,230]],olive:["#808000",[128,128,0]],olivedrab:["#6b8e23",[107,142,35]],orange:["#ffa500",[255,165,0]],orangered:["#ff4500",[255,69,0]],orchid:["#da70d6",[218,112,214]],palegoldenrod:["#eee8aa",[238,232,170]],palegreen:["#98fb98",[152,251,152]],paleturquoise:["#afeeee",[175,238,238]],palevioletred:["#db7093",[219,112,147]],papayawhip:["#ffefd5",[255,239,213]],peachpuff:["#ffdab9",[255,218,185]],peru:["#cd853f",[205,133,63]],pink:["#ffc0cb",[255,192,203]],plum:["#dda0dd",[221,160,221]],powderblue:["#b0e0e6",[176,224,230]],purple:["#800080",[128,0,128]],red:["#ff0000",[255,0,0]],rosybrown:["#bc8f8f",[188,143,143]],royalblue:["#4169e1",[65,105,225]],saddlebrown:["#8b4513",[139,69,19]],salmon:["#fa8072",[250,128,114]],sandybrown:["#f4a460",[244,164,96]],seagreen:["#2e8b57",[46,139,87]],seashell:["#fff5ee",[255,245,238]],sienna:["#a0522d",[160,82,45]],silver:["#c0c0c0",[192,192,192]],skyblue:["#87ceeb",[135,206,235]],slateblue:["#6a5acd",[106,90,205]],slategray:["#708090",[112,128,144]],slategrey:["#708090",[112,128,144]],snow:["#fffafa",[255,250,250]],springgreen:["#00ff7f",[0,255,127]],steelblue:["#4682b4",[70,130,180]],tan:["#d2b48c",[210,180,140]],teal:["#008080",[0,128,128]],thistle:["#d8bfd8",[216,191,216]],tomato:["#ff6347",[255,99,71]],turquoise:["#40e0d0",[64,224,208]],violet:["#ee82ee",[238,130,238]],wheat:["#f5deb3",[245,222,179]],white:["#ffffff",[255,255,255]],whitesmoke:["#f5f5f5",[245,245,245]],yellow:["#ffff00",[255,255,0]],yellowgreen:["#9acd32",[154,205,50]]}};