UNPKG

@zimjs/createjs

Version:

A version of CreateJS https://createjs.com that that provides a Bitmap Object Model (BOM) and events to run with the ZIM JavaScript Canvas Framework https://zimjs.com

46 lines (42 loc) 271 kB
/*! * CreateJS * Visit http://createjs.com/ for documentation, updates and examples. * * Copyright (c) 2010 gskinner.com, inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /* Additional BitmapData for EaselJS Version: 1.11 Author: kudox http://kudox.jp/ http://twitter.com/u_kudox Licensed under the MIT License Copyright (c) 2013 kudox.jp */ /* Many additions by the ZIM Team - see: https://zimjs.org/cdn/1.5/createjs_doc.js */ // ZIM version var createjs=createjs||{};function makeRemotePointers(){createjs.addRemotePointers=function(t,e){createjs.remoteOriginalDOM=t._eventListeners,t.enableDOMEvents(!1),createjs.remotePointers=!0,e&&(Array.isArray(e)||(e=[e]),createjs.remoteTargets=e)},createjs.removeRemotePointers=function(t){createjs.remoteOriginalDOM&&t.enableDOMEvents(!0),createjs.remotePointers=!1,createjs.remoteTargets=null},createjs.handleRemotePointer=function(t,e,i,r,s,n){null==n&&(n=-1),"move"==i?s._handlePointerMove(n,r,t,e):"down"==i?s._handlePointerDown(n,r,t,e):"up"==i&&s._handlePointerUp(n,r,!1)}}createjs.stageTransformable=!0,createjs.willReadFrequently=!0,createjs.extend=function(t,e){"use strict";function i(){this.constructor=t}return i.prototype=e.prototype,t.prototype=new i},createjs.promote=function(t,e){"use strict";var i=t.prototype,r=Object.getPrototypeOf&&Object.getPrototypeOf(i)||i.__proto__;if(r)for(var s in i[(e+="_")+"constructor"]=r.constructor,r)i.hasOwnProperty(s)&&"function"==typeof r[s]&&(i[e+s]=r[s]);return t},createjs.indexOf=function(t,e){"use strict";for(var i=0,r=t.length;i<r;i++)if(e===t[i])return i;return-1},function(){"use strict";function t(){throw"UID cannot be instantiated"}t._nextID=0,t.get=function(){return t._nextID++},createjs.UID=t}(),createjs.deprecate=function(t,e){"use strict";return function(){var i="Deprecated property or method '"+e+"'. See docs for info.";return console&&(console.warn?console.warn(i):console.log(i)),t&&t.apply(this,arguments)}},function(){"use strict";function t(t,e,i){this.type=t,this.target=null,this.currentTarget=null,this.eventPhase=0,this.bubbles=!!e,this.cancelable=!!i,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.removed=!1}var e=t.prototype;e.preventDefault=function(){this.defaultPrevented=this.cancelable&&!0},e.stopPropagation=function(){this.propagationStopped=!0},e.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},e.remove=function(){this.removed=!0},e.clone=function(){return new t(this.type,this.bubbles,this.cancelable)},e.set=function(t){for(var e in t)this[e]=t[e];return this},e.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=t}(),function(){"use strict";function t(){this._listeners=null,this._captureListeners=null}var e=t.prototype;t.monitor=new t,t.initialize=function(t){t.addEventListener=e.addEventListener,t.on=e.on,t.removeEventListener=t.off=e.removeEventListener,t.removeAllEventListeners=e.removeAllEventListeners,t.hasEventListener=e.hasEventListener,t.dispatchEvent=e.dispatchEvent,t._dispatchEvent=e._dispatchEvent,t.willTrigger=e.willTrigger},t.monit=function(e,i,r,s){var n=new createjs.Event(e);n.eventType=i,n.obj=r,n.mID=s,t.monitor.dispatchEvent(n)},e.addEventListener=function(e,i,r,s){var n,a=(n=r?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{})[e];return a&&this.removeEventListener(e,i,r,"c~-"),(a=n[e])?a.push(i):n[e]=[i],t.monit("on",e,this,s),i},e.on=function(t,e,i,r,s,n,a){return e.handleEvent&&(i=i||e,e=e.handleEvent),i=i||this,this.addEventListener(t,(function(t){e.call(i,t,s),r&&t.remove(a)}),n,a)},e.removeEventListener=function(e,i,r,s){var n=r?this._captureListeners:this._listeners;if(n){var a=n[e];if(a){for(var o=0,h=a.length;o<h;o++)if(a[o]==i){1==h?delete n[e]:a.splice(o,1);break}t.monit("off",e,this,s)}}},e.off=e.removeEventListener,e.removeAllEventListeners=function(e,i){if(e){if(this._listeners){for(var r in this._listeners[e])t.monit("offs",e,this,i);delete this._listeners[e]}this._captureListeners&&delete this._captureListeners[e]}else{var s=0;if(this._listeners)for(var r in this._listeners)for(var n in this._listeners[r])++s>2&&t.monit("offs",e,this,i);this._listeners=this._captureListeners=null}},e.dispatchEvent=function(t,e,i){if("string"==typeof t){var r=this._listeners;if(!(e||r&&r[t]))return!0;t=new createjs.Event(t,e,i)}else t.target&&t.clone&&(t=t.clone());try{t.target=this}catch(t){}if(t.bubbles&&this.parent){for(var s=this,n=[s];s.parent;)n.push(s=s.parent);var a,o=n.length;for(a=o-1;a>=0&&!t.propagationStopped;a--)n[a]._dispatchEvent(t,1+(0==a));for(a=1;a<o&&!t.propagationStopped;a++)n[a]._dispatchEvent(t,3)}else this._dispatchEvent(t,2);return!t.defaultPrevented},e.hasEventListener=function(t){var e=this._listeners,i=this._captureListeners;return!!(e&&e[t]||i&&i[t])},e.willTrigger=function(t){for(var e=this;e;){if(e.hasEventListener(t))return!0;e=e.parent}return!1},e.toString=function(){return"[EventDispatcher]"},e._dispatchEvent=function(t,e){var i,r,s=e<=2?this._captureListeners:this._listeners;if(t&&s&&(r=s[t.type])&&(i=r.length)){try{t.currentTarget=this}catch(t){}try{t.eventPhase=0|e}catch(t){}t.removed=!1,r=r.slice();for(var n=0;n<i&&!t.immediatePropagationStopped;n++){var a=r[n];a.handleEvent?a.handleEvent(t):a(t),t.removed&&(this.off(t.type,a,1==e,"c~clear"),t.removed=!1)}}2===e&&this._dispatchEvent(t,2.1)},createjs.EventDispatcher=t}(),function(){"use strict";function t(){throw"Ticker cannot be instantiated."}t.RAF_SYNCHED="synched",t.RAF="raf",t.TIMEOUT="timeout",t.timingMode=null,t.maxDelta=0,t.paused=!1,t.removeEventListener=null,t.removeAllEventListeners=null,t.dispatchEvent=null,t.hasEventListener=null,t._listeners=null,createjs.EventDispatcher.initialize(t),t._addEventListener=t.addEventListener,t.addEventListener=function(){return!t._inited&&t.init(),t._addEventListener.apply(t,arguments)},t._inited=!1,t._startTime=0,t._pausedTime=0,t._ticks=0,t._pausedTicks=0,t._interval=50,t._lastTime=0,t._times=null,t._tickTimes=null,t._timerId=null,t._raf=!0,t._setInterval=function(e){t._interval=e,t._inited&&t._setupTick()},t.setInterval=createjs.deprecate(t._setInterval,"Ticker.setInterval"),t._getInterval=function(){return t._interval},t.getInterval=createjs.deprecate(t._getInterval,"Ticker.getInterval"),t._setFPS=function(e){t._setInterval(1e3/e)},t.setFPS=createjs.deprecate(t._setFPS,"Ticker.setFPS"),t._getFPS=function(){return 1e3/t._interval},t.getFPS=createjs.deprecate(t._getFPS,"Ticker.getFPS");try{Object.defineProperties(t,{interval:{get:t._getInterval,set:t._setInterval},framerate:{get:t._getFPS,set:t._setFPS}})}catch(t){console.log(t)}t.init=function(){t._inited||(t._inited=!0,t._times=[],t._tickTimes=[],t._startTime=t._getTime(),t._times.push(t._lastTime=0),t.interval=t._interval)},t.reset=function(){if(t._raf){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame;e&&e(t._timerId)}else clearTimeout(t._timerId);t.removeAllEventListeners("tick"),t._timerId=t._times=t._tickTimes=null,t._startTime=t._lastTime=t._ticks=t._pausedTime=0,t._inited=!1},t.getMeasuredTickTime=function(e){var i=0,r=t._tickTimes;if(!r||r.length<1)return-1;e=Math.min(r.length,e||0|t._getFPS());for(var s=0;s<e;s++)i+=r[s];return i/e},t.getMeasuredFPS=function(e){var i=t._times;return!i||i.length<2?-1:(e=Math.min(i.length-1,e||0|t._getFPS()),1e3/((i[0]-i[e])/e))},t.getTime=function(e){return t._startTime?t._getTime()-(e?t._pausedTime:0):-1},t.getEventTime=function(e){return t._startTime?(t._lastTime||t._startTime)-(e?t._pausedTime:0):-1},t.getTicks=function(e){return t._ticks-(e?t._pausedTicks:0)},t.toString=function(){return"[Ticker]"},t._handleSynch=function(){t._timerId=null,t._setupTick(),t._getTime()-t._lastTime>=.97*(t._interval-1)&&t._tick()},t._handleRAF=function(){t._timerId=null,t._setupTick(),t._tick()},t._handleTimeout=function(){t._timerId=null,t._setupTick(),t._tick()},t._setupTick=function(){if(null==t._timerId){var e=t.timingMode;if(e==t.RAF_SYNCHED||e==t.RAF){var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(i)return t._timerId=i(e==t.RAF?t._handleRAF:t._handleSynch),void(t._raf=!0)}t._raf=!1,t._timerId=setTimeout(t._handleTimeout,t._interval)}},t._tick=function(){var e=t.paused,i=t._getTime(),r=i-t._lastTime;if(t._lastTime=i,t._ticks++,e&&(t._pausedTicks++,t._pausedTime+=r),t.hasEventListener("tick")){var s=new createjs.Event("tick"),n=t.maxDelta;s.delta=n&&r>n?n:r,s.paused=e,s.time=i,s.runTime=i-t._pausedTime,t.dispatchEvent(s)}for(t._tickTimes.unshift(t._getTime()-i);t._tickTimes.length>100;)t._tickTimes.pop();for(t._times.unshift(i);t._times.length>100;)t._times.pop()};var e=window,i=e.performance.now||e.performance.mozNow||e.performance.msNow||e.performance.oNow||e.performance.webkitNow;t._getTime=function(){return(i&&i.call(e.performance)||(new Date).getTime())-t._startTime},createjs.Ticker=t}(),function(){"use strict";function t(t){this.readyState=t.readyState,this._video=t,this._canvas=null,this._lastTime=-1,this.readyState<2&&t.addEventListener("canplaythrough",this._videoReady.bind(this))}var e=t.prototype;e.getImage=function(){if(!(this.readyState<2)){var t=this._canvas,e=this._video;if(t||((t=this._canvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas")).width=e.videoWidth,t.height=e.videoHeight),e.readyState>=2&&e.currentTime!==this._lastTime){var i=t.getContext("2d");i.clearRect(0,0,t.width,t.height),i.drawImage(e,0,0,t.width,t.height),this._lastTime=e.currentTime}return t}},e._videoReady=function(){this.readyState=2},createjs.VideoBuffer=t}(),function(){"use strict";function t(t,e,i,r,s,n,a,o,h,c,u){this.Event_constructor(t,e,i),this.stageX=r,this.stageY=s,this.rawX=null==h?r:h,this.rawY=null==c?s:c,this.nativeEvent=n,this.pointerID=a,this.primary=!!o,this.relatedTarget=u}var e=createjs.extend(t,createjs.Event);e._get_localX=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).x},e._get_localY=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).y},e._get_isTouch=function(){return-1!==this.pointerID};try{Object.defineProperties(e,{localX:{get:e._get_localX},localY:{get:e._get_localY},isTouch:{get:e._get_isTouch}})}catch(t){}e.clone=function(){return new t(this.type,this.bubbles,this.cancelable,this.stageX,this.stageY,this.nativeEvent,this.pointerID,this.primary,this.rawX,this.rawY)},e.toString=function(){return"[MouseEvent (type="+this.type+" stageX="+this.stageX+" stageY="+this.stageY+")]"},createjs.MouseEvent=createjs.promote(t,"Event")}(),function(){"use strict";function t(t,e,i,r,s,n){this.setValues(t,e,i,r,s,n)}var e=t.prototype;t.DEG_TO_RAD=Math.PI/180,t.identity=null,e.setValues=function(t,e,i,r,s,n){return this.a=null==t?1:t,this.b=e||0,this.c=i||0,this.d=null==r?1:r,this.tx=s||0,this.ty=n||0,this},e.append=function(t,e,i,r,s,n){var a=this.a,o=this.b,h=this.c,c=this.d;return 1==t&&0==e&&0==i&&1==r||(this.a=a*t+h*e,this.b=o*t+c*e,this.c=a*i+h*r,this.d=o*i+c*r),this.tx=a*s+h*n+this.tx,this.ty=o*s+c*n+this.ty,this},e.prepend=function(t,e,i,r,s,n){var a=this.a,o=this.c,h=this.tx;return this.a=t*a+i*this.b,this.b=e*a+r*this.b,this.c=t*o+i*this.d,this.d=e*o+r*this.d,this.tx=t*h+i*this.ty+s,this.ty=e*h+r*this.ty+n,this},e.appendMatrix=function(t){return this.append(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.prependMatrix=function(t){return this.prepend(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.appendTransform=function(e,i,r,s,n,a,o,h,c){if(n%360)var u=n*t.DEG_TO_RAD,l=Math.cos(u),d=Math.sin(u);else l=1,d=0;return a||o?(a*=t.DEG_TO_RAD,o*=t.DEG_TO_RAD,this.append(Math.cos(o),Math.sin(o),-Math.sin(a),Math.cos(a),e,i),this.append(l*r,d*r,-d*s,l*s,0,0)):this.append(l*r,d*r,-d*s,l*s,e,i),(h||c)&&(this.tx-=h*this.a+c*this.c,this.ty-=h*this.b+c*this.d),this},e.prependTransform=function(e,i,r,s,n,a,o,h,c){if(n%360)var u=n*t.DEG_TO_RAD,l=Math.cos(u),d=Math.sin(u);else l=1,d=0;return(h||c)&&(this.tx-=h,this.ty-=c),a||o?(a*=t.DEG_TO_RAD,o*=t.DEG_TO_RAD,this.prepend(l*r,d*r,-d*s,l*s,0,0),this.prepend(Math.cos(o),Math.sin(o),-Math.sin(a),Math.cos(a),e,i)):this.prepend(l*r,d*r,-d*s,l*s,e,i),this},e.rotate=function(e){e*=t.DEG_TO_RAD;var i=Math.cos(e),r=Math.sin(e),s=this.a,n=this.b;return this.a=s*i+this.c*r,this.b=n*i+this.d*r,this.c=-s*r+this.c*i,this.d=-n*r+this.d*i,this},e.skew=function(e,i){return e*=t.DEG_TO_RAD,i*=t.DEG_TO_RAD,this.append(Math.cos(i),Math.sin(i),-Math.sin(e),Math.cos(e),0,0),this},e.scale=function(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this},e.translate=function(t,e){return this.tx+=this.a*t+this.c*e,this.ty+=this.b*t+this.d*e,this},e.identity=function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},e.invert=function(){var t=this.a,e=this.b,i=this.c,r=this.d,s=this.tx,n=t*r-e*i;return this.a=r/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-r*s)/n,this.ty=-(t*this.ty-e*s)/n,this},e.isIdentity=function(){return 0===this.tx&&0===this.ty&&1===this.a&&0===this.b&&0===this.c&&1===this.d},e.equals=function(t){return this.tx===t.tx&&this.ty===t.ty&&this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d},e.transformPoint=function(t,e,i){return(i=i||{}).x=t*this.a+e*this.c+this.tx,i.y=t*this.b+e*this.d+this.ty,i},e.decompose=function(e){null==e&&(e={}),e.x=this.tx,e.y=this.ty,e.scaleX=Math.sqrt(this.a*this.a+this.b*this.b),e.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var i=Math.atan2(-this.c,this.d),r=Math.atan2(this.b,this.a);return Math.abs(1-i/r)<1e-5?(e.rotation=r/t.DEG_TO_RAD,this.a<0&&this.d>=0&&(e.rotation+=e.rotation<=0?180:-180),e.skewX=e.skewY=0):(e.skewX=i/t.DEG_TO_RAD,e.skewY=r/t.DEG_TO_RAD),e},e.copy=function(t){return this.setValues(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.clone=function(){return new t(this.a,this.b,this.c,this.d,this.tx,this.ty)},e.toString=function(){return"[Matrix2D (a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+")]"},t.identity=new t,createjs.Matrix2D=t}(),function(){"use strict";function t(t,e,i,r,s){this.setValues(t,e,i,r,s)}var e=t.prototype;e.setValues=function(t,e,i,r,s){return this.visible=null==t||!!t,this.alpha=null==e?1:e,this.shadow=i,this.compositeOperation=r,this.matrix=s||this.matrix&&this.matrix.identity()||new createjs.Matrix2D,this},e.append=function(t,e,i,r,s){return this.alpha*=e,this.shadow=i||this.shadow,this.compositeOperation=r||this.compositeOperation,this.visible=this.visible&&t,s&&this.matrix.appendMatrix(s),this},e.prepend=function(t,e,i,r,s){return this.alpha*=e,this.shadow=this.shadow||i,this.compositeOperation=this.compositeOperation||r,this.visible=this.visible&&t,s&&this.matrix.prependMatrix(s),this},e.identity=function(){return this.visible=!0,this.alpha=1,this.shadow=this.compositeOperation=null,this.matrix.identity(),this},e.clone=function(){return new t(this.alpha,this.shadow,this.compositeOperation,this.visible,this.matrix.clone())},createjs.DisplayProps=t}(),function(){"use strict";function t(t,e){this.setValues(t,e)}var e=t.prototype;e.setValues=function(t,e){return this.x=t||0,this.y=e||0,this},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.subtract=function(t){return new createjs.Point(this.x-t.x,this.y-t.y)},e.add=function(t){return new createjs.Point(this.x+t.x,this.y+t.y)},e.angle=function(t){return null==t?Math.atan2(this.y,this.x):t.subtract(this).angle()},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.distance=function(t){return t.subtract(this).length()},e.project=function(t,e){return new createjs.Point(this.x+Math.cos(t)*e,this.y+Math.sin(t)*e)},e.interpolate=function(t,e){return new createjs.Point(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},e.average=function(t){return this.interpolate(t,.5)},e.clone=function(){return new t(this.x,this.y)},e.toString=function(){return"[Point (x="+this.x+" y="+this.y+")]"},createjs.Point=t}(),function(){"use strict";function t(t,e,i,r){this.setValues(t,e,i,r)}var e=t.prototype;e.setValues=function(t,e,i,r){return this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0,this},e.extend=function(t,e,i,r){return r=r||0,t+(i=i||0)>this.x+this.width&&(this.width=t+i-this.x),e+r>this.y+this.height&&(this.height=e+r-this.y),t<this.x&&(this.width+=this.x-t,this.x=t),e<this.y&&(this.height+=this.y-e,this.y=e),this},e.pad=function(t,e,i,r){return this.x-=e,this.y-=t,this.width+=e+r,this.height+=t+i,this},e.copy=function(t){return this.setValues(t.x,t.y,t.width,t.height)},e.contains=function(t,e,i,r){return i=i||0,r=r||0,t>=this.x&&t+i<=this.x+this.width&&e>=this.y&&e+r<=this.y+this.height},e.union=function(t){return this.clone().extend(t.x,t.y,t.width,t.height)},e.intersection=function(e){var i=e.x,r=e.y,s=i+e.width,n=r+e.height;return this.x>i&&(i=this.x),this.y>r&&(r=this.y),this.x+this.width<s&&(s=this.x+this.width),this.y+this.height<n&&(n=this.y+this.height),s<=i||n<=r?null:new t(i,r,s-i,n-r)},e.intersects=function(t){return t.x<=this.x+this.width&&this.x<=t.x+t.width&&t.y<=this.y+this.height&&this.y<=t.y+t.height},e.isEmpty=function(){return this.width<=0||this.height<=0},e.clone=function(){return new t(this.x,this.y,this.width,this.height)},e.toString=function(){return"[Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")]"},createjs.Rectangle=t}(),function(){"use strict";function t(t,e,i,r,s,n,a){t.addEventListener&&(this.target=t,this.overLabel=null==i?"over":i,this.outLabel=null==e?"out":e,this.downLabel=null==r?"down":r,this.play=s,this._isPressed=!1,this._isOver=!1,this._enabled=!1,t.mouseChildren=!1,this.enabled=!0,this.handleEvent({}),n&&(a&&(n.actionsEnabled=!1,n.gotoAndStop&&n.gotoAndStop(a)),t.hitArea=n))}var e=t.prototype;e._setEnabled=function(t){if(t!=this._enabled){var e=this.target;this._enabled=t,t?(e.cursor="pointer",e.addEventListener("rollover",this),e.addEventListener("rollout",this),e.addEventListener("mousedown",this),e.addEventListener("pressup",this),e._reset&&(e.__reset=e._reset,e._reset=this._reset)):(e.cursor=null,e.removeEventListener("rollover",this),e.removeEventListener("rollout",this),e.removeEventListener("mousedown",this),e.removeEventListener("pressup",this),e.__reset&&(e._reset=e.__reset,delete e.__reset))}},e.setEnabled=createjs.deprecate(e._setEnabled,"ButtonHelper.setEnabled"),e._getEnabled=function(){return this._enabled},e.getEnabled=createjs.deprecate(e._getEnabled,"ButtonHelper.getEnabled");try{Object.defineProperties(e,{enabled:{get:e._getEnabled,set:e._setEnabled}})}catch(t){}e.toString=function(){return"[ButtonHelper]"},e.handleEvent=function(t){var e,i=this.target,r=t.type;"mousedown"==r?(this._isPressed=!0,e=this.downLabel):"pressup"==r?(this._isPressed=!1,e=this._isOver?this.overLabel:this.outLabel):"rollover"==r?(this._isOver=!0,e=this._isPressed?this.downLabel:this.overLabel):(this._isOver=!1,e=this._isPressed?this.overLabel:this.outLabel),this.play?i.gotoAndPlay&&i.gotoAndPlay(e):i.gotoAndStop&&i.gotoAndStop(e)},e._reset=function(){var t=this.paused;this.__reset(),this.paused=t},createjs.ButtonHelper=t}(),function(){"use strict";function t(t,e,i,r){this.color=t||"black",this.offsetX=e||0,this.offsetY=i||0,this.blur=r||0}var e=t.prototype;t.identity=new t("transparent",0,0,0),e.toString=function(){return"[Shadow]"},e.clone=function(){return new t(this.color,this.offsetX,this.offsetY,this.blur)},createjs.Shadow=t}(),function(){"use strict";function t(t){this.EventDispatcher_constructor(),this.complete=!0,this.framerate=0,this._animations=null,this._frames=null,this._images=null,this._data=null,this._loadCount=0,this._frameHeight=0,this._frameWidth=0,this._numFrames=0,this._regX=0,this._regY=0,this._spacing=0,this._margin=0,this._parseData(t)}var e=createjs.extend(t,createjs.EventDispatcher);e._getAnimations=function(){return this._animations.slice()},e.getAnimations=createjs.deprecate(e._getAnimations,"SpriteSheet.getAnimations");try{Object.defineProperties(e,{animations:{get:e._getAnimations}})}catch(t){}e.getNumFrames=function(t){if(null==t)return this._frames?this._frames.length:this._numFrames||0;var e=this._data[t];return null==e?0:e.frames.length},e.getAnimation=function(t){return this._data[t]},e.getFrame=function(t){var e;return this._frames&&(e=this._frames[t])?e:null},e.getFrameBounds=function(t,e){var i=this.getFrame(t);return i?(e||new createjs.Rectangle).setValues(-i.regX,-i.regY,i.rect.width,i.rect.height):null},e.toString=function(){return"[SpriteSheet]"},e.clone=function(){throw"SpriteSheet cannot be cloned."},e._parseData=function(t){var e,i,r,s;if(null!=t){if(this.framerate=t.framerate||0,t.images&&(i=t.images.length)>0)for(s=this._images=[],e=0;e<i;e++){var n=t.images[e];if("string"==typeof n){var a=n;(n=document.createElement("img")).src=a}s.push(n),n.getContext||n.naturalWidth||(this._loadCount++,this.complete=!1,function(t,e){n.onload=function(){t._handleImageLoad(e)}}(this,a),function(t,e){n.onerror=function(){t._handleImageError(e)}}(this,a))}if(null==t.frames);else if(Array.isArray(t.frames))for(this._frames=[],e=0,i=(s=t.frames).length;e<i;e++){var o=s[e];this._frames.push({image:this._images[o[4]?o[4]:0],rect:new createjs.Rectangle(o[0],o[1],o[2],o[3]),regX:o[5]||0,regY:o[6]||0})}else r=t.frames,this._frameWidth=r.width,this._frameHeight=r.height,this._regX=r.regX||0,this._regY=r.regY||0,this._spacing=r.spacing||0,this._margin=r.margin||0,this._numFrames=r.count,0==this._loadCount&&this._calculateFrames();var h;if(this._animations=[],null!=(r=t.animations))for(h in this._data={},r){var c={name:h},u=r[h];if("number"==typeof u)s=c.frames=[u];else if(Array.isArray(u))if(1==u.length)c.frames=[u[0]];else for(c.speed=u[3],c.next=u[2],s=c.frames=[],e=u[0];e<=u[1];e++)s.push(e);else{c.speed=u.speed,c.next=u.next;var l=u.frames;s=c.frames="number"==typeof l?[l]:l.slice(0)}!0!==c.next&&void 0!==c.next||(c.next=h),(!1===c.next||s.length<2&&c.next==h)&&(c.next=null),c.speed||(c.speed=1),this._animations.push(h),this._data[h]=c}}},e._handleImageLoad=function(t){0==--this._loadCount&&(this._calculateFrames(),this.complete=!0,this.dispatchEvent("complete"))},e._handleImageError=function(t){var e=new createjs.Event("error");e.src=t,this.dispatchEvent(e),0==--this._loadCount&&this.dispatchEvent("complete")},e._calculateFrames=function(){if(!this._frames&&0!=this._frameWidth){this._frames=[];var t=this._numFrames||1e5,e=0,i=this._frameWidth,r=this._frameHeight,s=this._spacing,n=this._margin;t:for(var a=0,o=this._images;a<o.length;a++)for(var h=o[a],c=h.width||h.naturalWidth,u=h.height||h.naturalHeight,l=n;l<=u-n-r;){for(var d=n;d<=c-n-i;){if(e>=t)break t;e++,this._frames.push({image:h,rect:new createjs.Rectangle(d,l,i,r),regX:this._regX,regY:this._regY}),d+=i+s}l+=r+s}this._numFrames=e}},createjs.SpriteSheet=createjs.promote(t,"EventDispatcher")}(),function(){"use strict";function t(){this.command=null,this._stroke=null,this._strokeStyle=null,this._oldStrokeStyle=null,this._strokeDash=null,this._oldStrokeDash=null,this._strokeIgnoreScale=!1,this._fill=null,this._instructions=[],this._commitIndex=0,this._activeInstructions=[],this._dirty=!1,this._storeIndex=0,this.clear()}var e=t.prototype,i=t;t.getRGB=function(t,e,i,r){return null!=t&&null==i&&(r=e,i=255&t,e=t>>8&255,t=t>>16&255),null==r?"rgb("+t+","+e+","+i+")":"rgba("+t+","+e+","+i+","+r+")"},t.getHSL=function(t,e,i,r){return null==r?"hsl("+t%360+","+e+"%,"+i+"%)":"hsla("+t%360+","+e+"%,"+i+"%,"+r+")"},t.BASE_64={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,0:52,1:53,2:54,3:55,4:56,5:57,6:58,7:59,8:60,9:61,"+":62,"/":63},t.STROKE_CAPS_MAP=["butt","round","square"],t.STROKE_JOINTS_MAP=["miter","round","bevel"];var r=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");r.getContext&&(t._ctx=r.getContext("2d"),r.width=r.height=1),e._getInstructions=function(){return this._updateInstructions(),this._instructions},e.getInstructions=createjs.deprecate(e._getInstructions,"Graphics.getInstructions");try{Object.defineProperties(e,{instructions:{get:e._getInstructions}})}catch(t){}e.isEmpty=function(){return!(this._instructions.length||this._activeInstructions.length)},e.draw=function(t,e){this._updateInstructions();for(var i=this._instructions,r=this._storeIndex,s=i.length;r<s;r++)i[r].exec(t,e)},e.drawAsPath=function(t){this._updateInstructions();for(var e,i=this._instructions,r=this._storeIndex,s=i.length;r<s;r++)!1!==(e=i[r]).path&&e.exec(t)},e.moveTo=function(t,e){return this.append(new i.MoveTo(t,e),!0)},e.lineTo=function(t,e){return this.append(new i.LineTo(t,e))},e.arcTo=function(t,e,r,s,n){return this.append(new i.ArcTo(t,e,r,s,n))},e.arc=function(t,e,r,s,n,a){return this.append(new i.Arc(t,e,r,s,n,a))},e.quadraticCurveTo=function(t,e,r,s){return this.append(new i.QuadraticCurveTo(t,e,r,s))},e.bezierCurveTo=function(t,e,r,s,n,a){return this.append(new i.BezierCurveTo(t,e,r,s,n,a))},e.rect=function(t,e,r,s){return this.append(new i.Rect(t,e,r,s))},e.closePath=function(){return this._activeInstructions.length?this.append(new i.ClosePath):this},e.clear=function(){return this._instructions.length=this._activeInstructions.length=this._commitIndex=0,this._strokeStyle=this._oldStrokeStyle=this._stroke=this._fill=this._strokeDash=this._oldStrokeDash=null,this._dirty=this._strokeIgnoreScale=!1,this},e.beginFill=function(t){return this._setFill(t?new i.Fill(t):null)},e.beginLinearGradientFill=function(t,e,r,s,n,a){return this._setFill((new i.Fill).linearGradient(t,e,r,s,n,a))},e.beginRadialGradientFill=function(t,e,r,s,n,a,o,h){return this._setFill((new i.Fill).radialGradient(t,e,r,s,n,a,o,h))},e.beginBitmapFill=function(t,e,r){return this._setFill(new i.Fill(null,r).bitmap(t,e))},e.endFill=function(){return this.beginFill()},e.setStrokeStyle=function(t,e,r,s,n){return this._updateInstructions(!0),this._strokeStyle=this.command=new i.StrokeStyle(t,e,r,s,n),this._stroke&&(this._stroke.ignoreScale=n),this._strokeIgnoreScale=n,this},e.setStrokeDash=function(t,e){return this._updateInstructions(!0),this._strokeDash=this.command=new i.StrokeDash(t,e),this},e.beginStroke=function(t){return this._setStroke(t?new i.Stroke(t):null)},e.beginLinearGradientStroke=function(t,e,r,s,n,a){return this._setStroke((new i.Stroke).linearGradient(t,e,r,s,n,a))},e.beginRadialGradientStroke=function(t,e,r,s,n,a,o,h){return this._setStroke((new i.Stroke).radialGradient(t,e,r,s,n,a,o,h))},e.beginBitmapStroke=function(t,e){return this._setStroke((new i.Stroke).bitmap(t,e))},e.endStroke=function(){return this.beginStroke()},e.curveTo=e.quadraticCurveTo,e.drawRect=e.rect,e.drawRoundRect=function(t,e,i,r,s){return this.drawRoundRectComplex(t,e,i,r,s,s,s,s)},e.drawRoundRectComplex=function(t,e,r,s,n,a,o,h){return this.append(new i.RoundRect(t,e,r,s,n,a,o,h))},e.drawCircle=function(t,e,r){return this.append(new i.Circle(t,e,r))},e.drawEllipse=function(t,e,r,s){return this.append(new i.Ellipse(t,e,r,s))},e.drawPolyStar=function(t,e,r,s,n,a){return this.append(new i.PolyStar(t,e,r,s,n,a))},e.drawPolygon=function(t,e){return this.append(new i.Polygon(t,e))},e.append=function(t,e){return this._activeInstructions.push(t),this.command=t,e||(this._dirty=!0),this},e.decodePath=function(e){for(var i=[this.moveTo,this.lineTo,this.quadraticCurveTo,this.bezierCurveTo,this.closePath],r=[2,2,4,6,0],s=0,n=e.length,a=[],o=0,h=0,c=t.BASE_64;s<n;){var u=e.charAt(s),l=c[u],d=l>>3,_=i[d];if(!_||3&l)throw"bad path data (@"+s+"): "+u;var f=r[d];d||(o=h=0),a.length=0,s++;for(var p=2+(l>>2&1),g=0;g<f;g++){var m=c[e.charAt(s)],v=m>>5?-1:1;m=(31&m)<<6|c[e.charAt(s+1)],3==p&&(m=m<<6|c[e.charAt(s+2)]),m=v*m/10,g%2?o=m+=o:h=m+=h,a[g]=m,s+=p}_.apply(this,a)}return this},e.store=function(){return this._updateInstructions(!0),this._storeIndex=this._instructions.length,this},e.unstore=function(){return this._storeIndex=0,this},e.clone=function(){var e=new t;return e.command=this.command,e._stroke=this._stroke,e._strokeStyle=this._strokeStyle,e._strokeDash=this._strokeDash,e._strokeIgnoreScale=this._strokeIgnoreScale,e._fill=this._fill,e._instructions=this._instructions.slice(),e._commitIndex=this._commitIndex,e._activeInstructions=this._activeInstructions.slice(),e._dirty=this._dirty,e._storeIndex=this._storeIndex,e},e.toString=function(){return"[Graphics]"},e.mt=e.moveTo,e.lt=e.lineTo,e.at=e.arcTo,e.bt=e.bezierCurveTo,e.qt=e.quadraticCurveTo,e.a=e.arc,e.r=e.rect,e.cp=e.closePath,e.c=e.clear,e.f=e.beginFill,e.lf=e.beginLinearGradientFill,e.rf=e.beginRadialGradientFill,e.bf=e.beginBitmapFill,e.ef=e.endFill,e.ss=e.setStrokeStyle,e.sd=e.setStrokeDash,e.s=e.beginStroke,e.ls=e.beginLinearGradientStroke,e.rs=e.beginRadialGradientStroke,e.bs=e.beginBitmapStroke,e.es=e.endStroke,e.dr=e.drawRect,e.rr=e.drawRoundRect,e.rc=e.drawRoundRectComplex,e.dc=e.drawCircle,e.de=e.drawEllipse,e.dp=e.drawPolyStar,e.pg=e.drawPolygon,e.p=e.decodePath,e._updateInstructions=function(e){var i=this._instructions,r=this._activeInstructions,s=this._commitIndex;if(this._dirty&&r.length){i.length=s,i.push(t.beginCmd);var n=r.length,a=i.length;i.length=a+n;for(var o=0;o<n;o++)i[o+a]=r[o];this._fill&&i.push(this._fill),this._stroke&&(this._strokeDash!==this._oldStrokeDash&&i.push(this._strokeDash),this._strokeStyle!==this._oldStrokeStyle&&i.push(this._strokeStyle),e&&(this._oldStrokeStyle=this._strokeStyle,this._oldStrokeDash=this._strokeDash),i.push(this._stroke)),this._dirty=!1}e&&(r.length=0,this._commitIndex=i.length)},e._setFill=function(t){return this._updateInstructions(!0),this.command=this._fill=t,this},e._setStroke=function(t){return this._updateInstructions(!0),(this.command=this._stroke=t)&&(t.ignoreScale=this._strokeIgnoreScale),this},(i.LineTo=function(t,e){this.x=t,this.y=e}).prototype.exec=function(t){t.lineTo(this.x,this.y)},(i.MoveTo=function(t,e){this.x=t,this.y=e}).prototype.exec=function(t){t.moveTo(this.x,this.y)},(i.ArcTo=function(t,e,i,r,s){this.x1=t,this.y1=e,this.x2=i,this.y2=r,this.radius=s}).prototype.exec=function(t){t.arcTo(this.x1,this.y1,this.x2,this.y2,this.radius)},(i.Arc=function(t,e,i,r,s,n){this.x=t,this.y=e,this.radius=i,this.startAngle=r,this.endAngle=s,this.anticlockwise=!!n}).prototype.exec=function(t){t.arc(this.x,this.y,this.radius,this.startAngle,this.endAngle,this.anticlockwise)},(i.QuadraticCurveTo=function(t,e,i,r){this.cpx=t,this.cpy=e,this.x=i,this.y=r}).prototype.exec=function(t){t.quadraticCurveTo(this.cpx,this.cpy,this.x,this.y)},(i.BezierCurveTo=function(t,e,i,r,s,n){this.cp1x=t,this.cp1y=e,this.cp2x=i,this.cp2y=r,this.x=s,this.y=n}).prototype.exec=function(t){t.bezierCurveTo(this.cp1x,this.cp1y,this.cp2x,this.cp2y,this.x,this.y)},(i.Rect=function(t,e,i,r){this.x=t,this.y=e,this.w=i,this.h=r}).prototype.exec=function(t){t.rect(this.x,this.y,this.w,this.h)},(i.ClosePath=function(){}).prototype.exec=function(t){t.closePath()},(i.BeginPath=function(){}).prototype.exec=function(t){t.beginPath()},(e=(i.Fill=function(t,e){this.style=t,this.matrix=e}).prototype).exec=function(t){if(this.style){t.fillStyle=this.style;var e=this.matrix;e&&(t.save(),t.transform(e.a,e.b,e.c,e.d,e.tx,e.ty)),t.fill(),e&&t.restore()}},e.linearGradient=function(e,i,r,s,n,a){for(var o=this.style=t._ctx.createLinearGradient(r,s,n,a),h=0,c=e.length;h<c;h++)o.addColorStop(i[h],e[h]);return o.props={colors:e,ratios:i,x0:r,y0:s,x1:n,y1:a,type:"linear"},this},e.radialGradient=function(e,i,r,s,n,a,o,h){for(var c=this.style=t._ctx.createRadialGradient(r,s,n,a,o,h),u=0,l=e.length;u<l;u++)c.addColorStop(i[u],e[u]);return c.props={colors:e,ratios:i,x0:r,y0:s,r0:n,x1:a,y1:o,r1:h,type:"radial"},this},e.bitmap=function(e,i,r){(r&&(this.matrix=r),e.naturalWidth||e.getContext||e.readyState>=2)&&((this.style=t._ctx.createPattern(e,i||"")).props={image:e,repetition:i,type:"bitmap"});return this},e.path=!1,(e=(i.Stroke=function(t,e){this.style=t,this.ignoreScale=e}).prototype).exec=function(t){this.style&&(t.strokeStyle=this.style,this.ignoreScale&&(t.save(),t.setTransform(1,0,0,1,0,0)),t.stroke(),this.ignoreScale&&t.restore())},e.linearGradient=i.Fill.prototype.linearGradient,e.radialGradient=i.Fill.prototype.radialGradient,e.bitmap=i.Fill.prototype.bitmap,e.path=!1,(e=(i.StrokeStyle=function(t,e,i,r,s){this.width=t,this.caps=e,this.joints=i,this.miterLimit=r,this.ignoreScale=s}).prototype).exec=function(e){e.lineWidth=null==this.width?"1":this.width,e.lineCap=null==this.caps?"butt":isNaN(this.caps)?this.caps:t.STROKE_CAPS_MAP[this.caps],e.lineJoin=null==this.joints?"miter":isNaN(this.joints)?this.joints:t.STROKE_JOINTS_MAP[this.joints],e.miterLimit=null==this.miterLimit?"10":this.miterLimit,e.ignoreScale=null!=this.ignoreScale&&this.ignoreScale},e.path=!1,(i.StrokeDash=function(t,e){this.segments=t,this.offset=e||0}).prototype.exec=function(t){t.setLineDash&&(t.setLineDash(this.segments||i.StrokeDash.EMPTY_SEGMENTS),t.lineDashOffset=this.offset||0)},i.StrokeDash.EMPTY_SEGMENTS=[],(i.RoundRect=function(t,e,i,r,s,n,a,o){this.x=t,this.y=e,this.w=i,this.h=r,this.radiusTL=s,this.radiusTR=n,this.radiusBR=a,this.radiusBL=o}).prototype.exec=function(t){var e=(h<c?h:c)/2,i=0,r=0,s=0,n=0,a=this.x,o=this.y,h=this.w,c=this.h,u=this.radiusTL,l=this.radiusTR,d=this.radiusBR,_=this.radiusBL;u<0&&(u*=i=-1),u>e&&(u=e),l<0&&(l*=r=-1),l>e&&(l=e),d<0&&(d*=s=-1),d>e&&(d=e),_<0&&(_*=n=-1),_>e&&(_=e),t.moveTo(a+h-l,o),t.arcTo(a+h+l*r,o-l*r,a+h,o+l,l),t.lineTo(a+h,o+c-d),t.arcTo(a+h+d*s,o+c+d*s,a+h-d,o+c,d),t.lineTo(a+_,o+c),t.arcTo(a-_*n,o+c+_*n,a,o+c-_,_),t.lineTo(a,o+u),t.arcTo(a-u*i,o-u*i,a+u,o,u),t.closePath()},(i.Circle=function(t,e,i){this.x=t,this.y=e,this.radius=i}).prototype.exec=function(t){t.arc(this.x,this.y,this.radius,0,2*Math.PI)},(i.Ellipse=function(t,e,i,r){this.x=t,this.y=e,this.w=i,this.h=r}).prototype.exec=function(t){var e=this.x,i=this.y,r=this.w,s=this.h,n=.5522848,a=r/2*n,o=s/2*n,h=e+r,c=i+s,u=e+r/2,l=i+s/2;t.moveTo(e,l),t.bezierCurveTo(e,l-o,u-a,i,u,i),t.bezierCurveTo(u+a,i,h,l-o,h,l),t.bezierCurveTo(h,l+o,u+a,c,u,c),t.bezierCurveTo(u-a,c,e,l+o,e,l)},(i.PolyStar=function(t,e,i,r,s,n){this.x=t,this.y=e,this.radius=i,this.sides=r,this.pointSize=s,this.angle=n}).prototype.exec=function(t){var e=this.x,i=this.y,r=this.radius,s=(this.angle||0)/180*Math.PI,n=this.sides,a=1-(this.pointSize||0),o=Math.PI/n;t.moveTo(e+Math.cos(s)*r,i+Math.sin(s)*r);for(var h=0;h<n+1&&(s+=o,1==a||(t.lineTo(e+Math.cos(s)*r*a,i+Math.sin(s)*r*a),h!=n));h++)s+=o,t.lineTo(e+Math.cos(s)*r,i+Math.sin(s)*r);t.closePath()},(i.Polygon=function(t,e){this.points=t,null==e&&(e=!0),this.close=e}).prototype.exec=function(t){var e,i,r,s=this.points,n=this.close;i=s[0],t.moveTo(i[0],i[1]);for(var a=1;a<s.length;a++)e=s[a],1==a&&(r=[e[0],e[1]]),t.lineTo(e[0],e[1]);n&&(t.lineTo(i[0],i[1]),t.lineTo(r[0],r[1])),t.closePath()},t.beginCmd=new i.BeginPath,createjs.Graphics=t}(),function(){"use strict";function t(){this.EventDispatcher_constructor(),this.alpha=1,this.cacheCanvas=null,this.bitmapCache=null,this.id=createjs.UID.get(),this.mouseEnabled=!0,this.tickEnabled=!0,this.name=null,this.parent=null,this.regX=0,this.regY=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.skewX=0,this.skewY=0,this.shadow=null,this.visible=!0,this.x=0,this.y=0,this.transformMatrix=null,this.compositeOperation=null,this.snapToPixel=!0,this.filters=null,this.mask=null,this.hitArea=null,this.cursor=null,this._props=new createjs.DisplayProps,this._rectangle=new createjs.Rectangle,this._bounds=null,this._webGLRenderStyle=t._StageGL_NONE}var e=createjs.extend(t,createjs.EventDispatcher);t._MOUSE_EVENTS=["click","dblclick","mousedown","mouseout","mouseover","pressmove","pressup","rollout","rollover"],t.suppressCrossDomainErrors=!1,t._snapToPixelEnabled=!1,t._StageGL_NONE=0,t._StageGL_SPRITE=1,t._StageGL_BITMAP=2;var i=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");i.getContext&&(t._hitTestCanvas=i,t._hitTestContext=i.getContext("2d",createjs.willReadFrequently?{willReadFrequently:!0}:void 0),i.width=i.height=1),e._getStage=function(){for(var t=this,e=createjs.Stage;t.parent;)t=t.parent;return t instanceof e?t:null},e.getStage=createjs.deprecate(e._getStage,"DisplayObject.getStage");try{Object.defineProperties(e,{stage:{get:e._getStage},cacheID:{get:function(){return this.bitmapCache&&this.bitmapCache.cacheID},set:function(t){this.bitmapCache&&(this.bitmapCache.cacheID=t)}},scale:{get:function(){return this.scaleX},set:function(t){this.scaleX=this.scaleY=t}}})}catch(t){}e.isVisible=function(){return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY)},e.draw=function(t,e){var i=this.bitmapCache;return!(!i||e)&&i.draw(t)},e.updateContext=function(e){var i=this,r=i.mask,s=i._props.matrix;r&&r.graphics&&!r.graphics.isEmpty()&&(r.getMatrix(s),e.transform(s.a,s.b,s.c,s.d,s.tx,s.ty),r.graphics.drawAsPath(e),e.clip(),s.invert(),e.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),this.getMatrix(s);var n=s.tx,a=s.ty;t._snapToPixelEnabled&&i.snapToPixel&&(n=n+(n<0?-.5:.5)|0,a=a+(a<0?-.5:.5)|0),e.transform(s.a,s.b,s.c,s.d,n,a),e.globalAlpha*=i.alpha,i.compositeOperation&&(e.globalCompositeOperation=i.compositeOperation),i.shadow&&this._applyShadow(e,i.shadow)},e.cache=function(t,e,i,r,s,n,a,o){this.bitmapCache||(this.bitmapCache=new createjs.BitmapCache),this.bitmapCache.define(this,t,e,i,r,s,n,a,o)},e.updateCache=function(t,e){if(!this.bitmapCache)throw"cache() must be called before updateCache()";this.bitmapCache.update(t,e)},e.uncache=function(){this.bitmapCache&&(this.bitmapCache.release(),this.bitmapCache=void 0)},e.getCacheDataURL=function(){return this.bitmapCache?this.bitmapCache.getCacheDataURL():null},e.localToGlobal=function(t,e,i){var r=this.getConcatenatedMatrix(this._props.matrix).transformPoint(t,e,i||new createjs.Point);return this.stage&&createjs.stageTransformable&&(r=this.stage.getConcatenatedMatrix(this._mtx).invert().transformPoint(r.x,r.y)),r},e.globalToLocal=function(t,e,i){if(this.stage&&createjs.stageTransformable){var r=this.stage.getConcatenatedMatrix(this._mtx).transformPoint(t,e);t=r.x,e=r.y}return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(t,e,i||new createjs.Point)},e.localToLocal=function(t,e,i,r){return r=this.localToGlobal(t,e,r),i.globalToLocal(r.x,r.y,r)},e.setTransform=function(t,e,i,r,s,n,a,o,h){return this.x=t||0,this.y=e||0,this.scaleX=null==i?1:i,this.scaleY=null==r?1:r,this.rotation=s||0,this.skewX=n||0,this.skewY=a||0,this.regX=o||0,this.regY=h||0,this},e.getMatrix=function(t){var e=this,i=t&&t.identity()||new createjs.Matrix2D;return e.transformMatrix?i.copy(e.transformMatrix):i.appendTransform(e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.skewX,e.skewY,e.regX,e.regY)},e.getConcatenatedMatrix=function(t){for(var e=this,i=this.getMatrix(t);e=e.parent;)i.prependMatrix(e.getMatrix(e._props.matrix));return i},e.getConcatenatedDisplayProps=function(t){t=t?t.identity():new createjs.DisplayProps;var e=this,i=e.getMatrix(t.matrix);do{t.prepend(e.visible,e.alpha,e.shadow,e.compositeOperation),e!=this&&i.prependMatrix(e.getMatrix(e._props.matrix))}while(e=e.parent);return t},e.hitTest=function(e,i){var r=t._hitTestContext;r.setTransform(1,0,0,1,-e,-i),this.draw(r);var s=this._testHit(r);return r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,2,2),s},e.set=function(t){for(var e in t)this[e]=t[e];return this},e.getBounds=function(){if(this._bounds)return this._rectangle.copy(this._bounds);var t=this.cacheCanvas;if(t){var e=this._cacheScale;return this._rectangle.setValues(this._cacheOffsetX,this._cacheOffsetY,t.width/e,t.height/e)}return null},e.getTransformedBounds=function(){return this._getBounds()},e.setBounds=function(t,e,i,r){this._bounds=null!=t?(this._bounds||new createjs.Rectangle).setValues(t,e,i,r):t},e.clone=function(){return this._cloneProps(new t)},e.toString=function(){return"[DisplayObject (name="+this.name+")]"},e._updateState=null,e._cloneProps=function(t){return t.alpha=this.alpha,t.mouseEnabled=this.mouseEnabled,t.tickEnabled=this.tickEnabled,t.name=this.name,t.regX=this.regX,t.regY=this.regY,t.rotation=this.rotation,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.shadow=this.shadow,t.skewX=this.skewX,t.skewY=this.skewY,t.visible=this.visible,t.x=this.x,t.y=this.y,t.compositeOperation=this.compositeOperation,t.snapToPixel=this.snapToPixel,t.filters=null==this.filters?null:this.filters.slice(0),t.mask=this.mask,t.hitArea=this.hitArea,t.cursor=this.cursor,t._bounds=this._bounds,t},e._applyShadow=function(t,e){e=e||Shadow.identity,t.shadowColor=e.color,t.shadowOffsetX=e.offsetX,t.shadowOffsetY=e.offsetY,t.shadowBlur=e.blur},e._tick=function(t){var e=this._listeners;e&&e.tick&&(t.target=null,t.propagationStopped=t.immediatePropagationStopped=!1,this.dispatchEvent(t))},e._testHit=function(e){try{var i=e.getImageData(0,0,1,1).data[3]>1}catch(e){if(!t.suppressCrossDomainErrors)throw"An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."}return i},e._getBounds=function(t,e){return this._transformBounds(this.getBounds(),t,e)},e._transformBounds=function(t,e,i){if(!t)return t;var r=t.x,s=t.y,n=t.width,a=t.height,o=this._props.matrix;o=i?o.identity():this.getMatrix(o),(r||s)&&o.appendTransform(0,0,1,1,0,0,0,-r,-s),e&&o.prependMatrix(e);var h=n*o.a,c=n*o.b,u=a*o.c,l=a*o.d,d=o.tx,_=o.ty,f=d,p=d,g=_,m=_;return(r=h+d)<f?f=r:r>p&&(p=r),(r=h+u+d)<f?f=r:r>p&&(p=r),(r=u+d)<f?f=r:r>p&&(p=r),(s=c+_)<g?g=s:s>m&&(m=s),(s=c+l+_)<g?g=s:s>m&&(m=s),(s=l+_)<g?g=s:s>m&&(m=s),t.setValues(f,g,p-f,m-g)},e._hasMouseEventListener=function(){for(var e=t._MOUSE_EVENTS,i=0,r=e.length;i<r;i++)if(this.hasEventListener(e[i]))return!0;return!!this.cursor},createjs.DisplayObject=createjs.promote(t,"EventDispatcher")}(),function(){"use strict";function t(){this.DisplayObject_constructor(),this.children=[],this.mouseChildren=!0,this.tickChildren=!0}var e=createjs.extend(t,createjs.DisplayObject);e._getNumChildren=function(){return this.children.length},e.getNumChildren=createjs.deprecate(e._getNumChildren,"Container.getNumChildren");try{Object.defineProperties(e,{numChildren:{get:e._getNumChildren}})}catch(t){}e.initialize=t,e.isVisible=function(){var t=this.cacheCanvas||this.children.length;return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&t)},e.draw=function(t,e){if(this.DisplayObject_draw(t,e))return!0;for(var i=this.children.slice(),r=0,s=i.length;r<s;r++){var n=i[r];n.isVisible()&&(t.save(),n.updateContext(t),n.draw(t),t.restore())}return!0},e.addChild=function(t){if(null==t)return t;var e=arguments.length;if(e>1){for(var i=0;i<e;i++)this.addChild(arguments[i]);return arguments[e-1]}var r=t.parent,s=r===this;return r&&r._removeChildAt(createjs.indexOf(r.children,t),s),t.parent=this,this.children.push(t),s||t.dispatchEvent("added"),t},e.addChildAt=function(t,e){var i=arguments.length,r=arguments[i-1];if(r<0||r>this.children.length)return arguments[i-2];if(i>2){for(var s=0;s<i-1;s++)this.addChildAt(arguments[s],r+s);return arguments[i-2]}var n=t.parent,a=n===this;return n&&n._removeChildAt(createjs.indexOf(n.children,t),a),t.parent=this,this.children.splice(e,0,t),a||t.dispatchEvent("added"),t},e.removeChild=function(t){var e=arguments.length;if(e>1){for(var i=!0,r=0;r<e;r++)i=i&&this.removeChild(arguments[r]);return i}return this._removeChildAt(createjs.indexOf(this.children,t))},e.removeChildAt=function(t){var e=arguments.length;if(e>1){for(var i=[],r=0;r<e;r++)i[r]=arguments[r];i.sort((function(t,e){return e-t}));var s=!0;for(r=0;r<e;r++)s=s&&this._removeChildAt(i[r]);return s}return this._removeChildAt(t)},e.removeAllChildren=function(){for(var t=this.children;t.length;)this._removeChildAt(0)},e.getChildAt=function(t){return this.children[t]},e.getChildByName=function(t){for(var e=this.children,i=0,r=e.length;i<r;i++)if(e[i].name==t)return e[i];return null},e.sortChildren=function(t){this.children.sort(t)},e.getChildIndex=function(t){return createjs.indexOf(this.children,t)},e.swapChildrenAt=function(t,e){var i=this.children,r=i[t],s=i[e];r&&s&&(i[t]=s,i[e]=r)},e.swapChildren=function(t,e){for(var i,r,s=this.children,n=0,a=s.length;n<a&&(s[n]==t&&(i=n),s[n]==e&&(r=n),null==i||null==r);n++);n!=a&&(s[i]=e,s[r]=t)},e.setChildIndex=function(t,e){var i=this.children,r=i.length;if(!(t.parent!=this||e<0||e>=r)){for(var s=0;s<r&&i[s]!=t;s++);s!=r&&s!=e&&(i.splice(s,1),i.splice(e,0,t))}},e.contains=function(t){for(;t;){if(t==this)return!0;t=t.parent}return!1},e.hitTest=function(t,e){return null!=this.getObjectUnderPoint(t,e)},e.getObjectsUnderPoint=function(t,e,i){var r=[],s=this.localToGlobal(t,e);return this._getObjectsUnderPoint(s.x,s.y,r,i>0,1==i),r},e.getObjectUnderPoint=function(t,e,i){var r=this.localToGlobal(t,e);return this._getObjectsUnderPoint(r.x,r.y,null,i>0,1==i)},e.getBounds=function(){return this._getBounds(null,!0)},e.getTransformedBounds=function(){return this._getBounds()},e.clone=function(e){var i=this._cloneProps(new t);return e&&this._cloneChildren(i),i},e.toString=function(){return"[Container (name="+this.name+")]"},e._tick=function(t){if(this.tickChildren)for(var e=this.children.length-1;e>=0;e--){var i=this.children[e];i.tickEnabled&&i._tick&&i._tick(t)}this.DisplayObject__tick(t)},e._cloneChildren=function(t){t.children.length&&t.removeAllChildren();for(var e=t.children,i=0,r=this.children.length;i<r;i++){var s=this.children[i].clone(!0);s.parent=t,e.push(s)}},e._removeChildAt=function(t,e){if(t<0||t>this.children.length-1)return!1;var i=this.children[t];return i&&(i.parent=null),this.children.splice(t,1),e||i.dispatchEvent("removed"),!0},e._getObjectsUnderPoint=function(e,i,r,s,n,a){if(this.stage&&createjs.stageTransformable){var o=e,h=i,c=this.stage.getConcatenatedMatrix(this._mtx).transformPoint(e,i);e=c.x,i=c.y}if(!(a=a||0)&&!this._testMask(this,e,i))return null;var u,l=createjs.DisplayObject._hitTestContext;n=n||s&&this._hasMouseEventListener();for(var d=this.children,_=d.length-1;_>=0;_--){var f=d[_],p=f.hitArea;if(f.visible&&(p||f.isVisible())&&(!s||f.mouseEnabled)&&(p||this._testMask(f,e,i)))if(!p&&f instanceof t){var g=f._getObjectsUnderPoint(null!=o?o:e,null!=h?h:i,r,s,n,a+1);if(!r&&g)return s&&!this.mouseChildren?this:g}else{if(s&&!n&&!f._hasMouseEventListener())continue;var m=f.getConcatenatedDisplayProps(f._props);if(u=m.matrix,p&&(u.appendMatrix(p.getMatrix(p._props.matrix)),m.alpha=p.alpha),l.globalAlpha=m.alpha,l.setTransform(u.a,u.b,u.c,u.d,u.tx-e,u.ty-i),(p||f).draw(l),!this._testHit(l))continue;if(l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,2,2),!r)return s&&!this.mouseChildren?this:f;r.push(f)}}return null},e._testMask=function(t,e,i){var r=t.mask;if(!r||!r.graphics||r.graphics.isEmpty())return!0;var s=this._props.matrix,n=t.parent;s=n?n.getConcatenatedMatrix(s):s.identity(),s=r.getMatrix(r._props.matrix).prependMatrix(s);var a=createjs.DisplayObject._hitTestContext;return a.setTransform(s.a,s.b,s.c,s.d,s.tx-e,s.ty-i),r.graphics.drawAsPath(a),a.fillStyle="#000",a.fill(),!!this._testHit(a)&&(a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,2,2),!0)},e._getBounds=function(t,e){var i=this.DisplayObject_getBounds();if(i)return this._transformBounds(i,t,e);var r=this._props.matrix;r=e?r.identity():this.getMatrix(r),t&&r.prependMatrix(t);for(var s=this.children.length,n=null,a=0;a<s;a++){var o=this.children[a];o.visible&&(i=o._getBounds(r))&&(n?n.extend(i.x,i.y,i.width,i.height):n=i.clone())}return n},createjs.Container=createjs.promote(t,"DisplayObject")}(),function(){"use strict";function t(t,e){this.Container_constructor(),!1===e&&createjs&&createjs.DisplayObject&&(createjs.DisplayObject._hitTestContext=createjs.DisplayObject._hitTestCanvas.getContext("2d",{willReadFrequently:!1}),createjs.willReadFrequently=!1),this.autoClear=!0,this.canvas="string"==typeof t?document.getElementById(t):t,this.mouseX=0,this.mouseY=0,this.drawRect=null,this.snapToPixelEnabled=!1,this.mouseInBounds=!1,this.tickOnUpdate=!0,this.mouseMoveOutside=!1,this.preventSelection=!0,this._pointerData={},this._pointerCount=0,this._primaryPointerID=null,this._mouseOverIntervalID=null,this._nextStage=null,this._prevStage=null,this.enableDOMEvents(!0)}var e=createjs.extend(t,createjs.Container);e._get_nextStage=function(){return this._nextStage},e._set_nextStage=function(t){this._nextStage&&(this._nextStage._prevStage=null),t&&(t._prevStage=this),this._nextStage=t};try{Object.defineProperties(e,{nextStage:{get:e._get_nextStage,set:e._set_nextStage}})}catch(t){}e.update=function(t){if(this.canvas&&(this.tickOnUpdate&&this.tick(t),!1!==this.dispatchEvent("drawstart",!1,!0))){var e,i,r,s,n;if(createjs.remoteQueue)for(e=createjs.remoteQueue.length,r=0;r<e;r++)if((n=createjs.remoteQueue[r]).cacheCanvas&&n.updateCache(),n.textureMaps)for(i=n.textureMaps.length,s=0;s<i;s++)n.textureMaps[s].needsUpdate=!0;createjs.DisplayObject._snapToPixelEnabled=this.snapT