text: var __extends=this&&this.__extends||function(){var e=function(t,a){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a])})(t,a)};return function(t,a){function i(){this.constructor=t}e(t,a),t.prototype=null===a?Object.create(a):(i.prototype=a.prototype,new i)}}(),annieUI;!function(e){var t=function(e){function t(t,a,i,n,r){var o=e.call(this)||this;o.isScrollY=!0,o.isScrollX=!0,o.isMomentum=!0,o.isBounce=!0,o.bounceTime=300,o.isLocked=!0,o.lockDis=5,o._curX=0,o._curY=0,o._viewWidth=0,o._viewHeight=0,o._scrollWidth=0,o._scrollHeight=0,o.startX=0,o.startY=0,o.maxScrollX=0,o.maxScrollY=0,o.endTime=0,o.mouseStatus=0,o.distX=0,o.distY=0,o.startTime=0,o.absStartX=0,o.absStartY=0,o.pointX=0,o.pointY=0,o.deceleration=6e-4,o.destTime=0,o.destX=0,o.destY=0,o.duration=0,o._mouseEvent=null,o._enterFrame=null;var s=o;return s._instanceType="annieUI.Scroller",s._mouseEvent=s.onMouseEvent.bind(s),s._enterFrame=s.onEnterFrame.bind(s),s.init(t,a,i,n,r),o}return __extends(t,e),Object.defineProperty(t.prototype,"curX",{get:function(){return this._curX},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"curY",{get:function(){return this._curY},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewWidth",{get:function(){return this._viewWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewHeight",{get:function(){return this._viewHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollWidth",{get:function(){return this._scrollWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollHeight",{get:function(){return this._scrollHeight},enumerable:!0,configurable:!0}),t.prototype.init=function(e,t,a,i,n){var r=this;r._container&&r._container!=e&&(r._container.removeEventListener(annie.MouseEvent.MOUSE_DOWN,r._mouseEvent,!1),r._container.removeEventListener(annie.MouseEvent.MOUSE_MOVE,r._mouseEvent,!1),r._container.removeEventListener(annie.MouseEvent.MOUSE_UP,r._mouseEvent,!1),r._container.removeEventListener(annie.MouseEvent.MOUSE_OUT,r._mouseEvent),r._container.removeEventListener(annie.Event.ENTER_FRAME,r._enterFrame)),r._container!=e&&(r._container=e,e.addEventListener(annie.MouseEvent.MOUSE_DOWN,r._mouseEvent,!1),e.addEventListener(annie.MouseEvent.MOUSE_MOVE,r._mouseEvent,!1),e.addEventListener(annie.MouseEvent.MOUSE_UP,r._mouseEvent,!1),e.addEventListener(annie.MouseEvent.MOUSE_OUT,r._mouseEvent),e.addEventListener(annie.Event.ENTER_FRAME,r._enterFrame)),r.isRunning=!1,r.endTime=0,r.setViewWHAndScrollWH(t,a,i,n)},t.prototype.setViewWHAndScrollWH=function(e,t,a,i){var n=this;n._viewHeight=t,n._viewWidth=e,n._scrollWidth=a,n._scrollHeight=i,n._updateViewAndScroll()},t.prototype.setViewWH=function(e,t){var a=this;a._viewHeight=t,a._viewWidth=e,a._updateViewAndScroll()},t.prototype.setScrollWH=function(e,t){var a=this;a._scrollWidth=e,a._scrollHeight=t,a._updateViewAndScroll()},t.prototype._updateViewAndScroll=function(){var e=this;e.maxScrollX=e.viewWidth-e.scrollWidth,e.maxScrollY=e.viewHeight-e.scrollHeight,e.maxScrollX>0&&(e.maxScrollX=0),e.maxScrollY>0&&(e.maxScrollY=0),e.isScrollX||(e.maxScrollX=0,e._scrollWidth=e.viewWidth),e.isScrollY||(e.maxScrollY=0,e._scrollHeight=e.viewHeight),e.resetPosition(200)},t.prototype.onEnterFrame=function(e){var t=this;if(t.isRunning){var a=Date.now(),i=void 0,n=void 0,r=void 0;a>=t.destTime?(t.isRunning=!1,t._translate(t.destX,t.destY),t.resetPosition(t.bounceTime)||(t.dispatchEvent(annie.Event.ON_SCROLL_STOP),0==t._curX&&0==t._curY?t.dispatchEvent(annie.Event.ON_SCROLL_TO_HEAD):t._curX==t.maxScrollX&&t._curY==t.maxScrollY&&t.dispatchEvent(annie.Event.ON_SCROLL_TO_END))):(a=(a-t.startTime)/t.duration,r=t.easingFn(a),i=(t.destX-t.startX)*r+t.startX,n=(t.destY-t.startY)*r+t.startY,t._translate(i,n))}},t.prototype.onMouseEvent=function(e){var a=this;if(e.type==annie.MouseEvent.MOUSE_DOWN)a.isRunning=!1,a.mouseStatus=1,a.distX=0,a.distY=0,a.startTime=Date.now(),a.startX=a._curX,a.startY=a._curY,a.absStartX=a._curX,a.absStartY=a._curY,a.pointX=e.localX,a.pointY=e.localY;else if(e.type==annie.MouseEvent.MOUSE_MOVE){if(a.mouseStatus<1)return;var i=e.localX-a.pointX,n=e.localY-a.pointY,r=Date.now(),o=void 0,s=void 0,l=void 0,c=void 0;if(a.pointX=e.localX,a.pointY=e.localY,a.distX+=i,a.distY+=n,l=Math.abs(a.distX),c=Math.abs(a.distY),r-a.endTime>300&&l<10&&c<10)return;a.isLocked&&(l>c+a.lockDis?n=0:c>=l+a.lockDis&&(i=0)),i=a.isScrollX?i:0,n=a.isScrollY?n:0,o=a._curX+i,s=a._curY+n,(o>0||o<a.maxScrollX)&&(o=a.isBounce?a._curX+i/3:o>0?0:a.maxScrollX),(s>0||s<a.maxScrollY)&&(s=a.isBounce?a._curY+n/3:s>0?0:a.maxScrollY),1==a.mouseStatus&&a.dispatchEvent(annie.Event.ON_SCROLL_START),a.mouseStatus=2,a._translate(o,s),r-a.startTime>300&&(a.startTime=r,a.startX=a._curX,a.startY=a._curY)}else{a.endTime=Date.now();var d=void 0,u=void 0,p=a.endTime-a.startTime,o=a._curX,s=a._curY,g=0,v=null;if(a.resetPosition(a.bounceTime))return void(a.mouseStatus=0);if(2!=a.mouseStatus)return void(a.mouseStatus=0);if(a.mouseStatus=0,a.scrollTo(o,s),a.isMomentum&&p<300&&(d=a.isScrollX?t.toMomentum(a._curX,a.startX,p,a.maxScrollX,a.isBounce?a.viewWidth/2:0,a.deceleration):{destination:o,duration:0},u=a.isScrollY?t.toMomentum(a._curY,a.startY,p,a.maxScrollY,a.isBounce?a.viewHeight/2:0,a.deceleration):{destination:s,duration:0},o=d.destination,s=u.destination,g=Math.max(d.duration,u.duration)),o!=a._curX||s!=a._curY)return(o>0||o<a.maxScrollX||s>0||s<a.maxScrollY)&&(v=annie.Tween.quadraticOut),void a.scrollTo(o,s,g,v);a.dispatchEvent(annie.Event.ON_SCROLL_STOP)}},t.prototype.destroy=function(){var t=this;t._container&&(t._container.removeEventListener(annie.MouseEvent.MOUSE_MOVE,t._mouseEvent,!1),t._container.removeEventListener(annie.MouseEvent.MOUSE_DOWN,t._mouseEvent,!1),t._container.removeEventListener(annie.MouseEvent.MOUSE_UP,t._mouseEvent,!1),t._container.removeEventListener(annie.MouseEvent.MOUSE_OUT,t._mouseEvent),t._container.removeEventListener(annie.Event.ENTER_FRAME,t._enterFrame)),t._container=null,t.easingFn=null,e.prototype.destroy.call(this)},t.prototype.resetPosition=function(e){void 0===e&&(e=0);var t=this,a=t._curX,i=t._curY;return e=e||0,!t.isScrollX||t._curX>0?a=0:t._curX<t.maxScrollX&&(a=t.maxScrollX),!t.isScrollY||t._curY>0?i=0:t._curY<t.maxScrollY&&(i=t.maxScrollY),(a!=t._curX||i!=t._curY)&&(t.scrollTo(a,i,e,null),!0)},t.prototype.scrollBy=function(e,t,a,i){void 0===a&&(a=0),void 0===i&&(i=null);var n=this;e=n._curX+e,t=n._curY+t,a=a||0,n.scrollTo(e,t,a,i)},t.prototype.scrollTo=function(e,t,a,i){void 0===a&&(a=0),void 0===i&&(i=null);var n=this;a?(i=i||annie.Tween.circularOut,n.startX=n._curX,n.startY=n._curY,n.startTime=Date.now(),n.destTime=n.startTime+a,n.destX=e,n.destY=t,n.duration=a,n.easingFn=i,n.isRunning=!0):n._translate(e,t)},t.prototype._translate=function(e,t){var a=this;e!=Number.NaN&&(a._curX=e),t!=Number.NaN&&(a._curY=t),a.dispatchEvent(annie.Event.ON_SCROLL_ING,{posX:a._curX,posY:a._curY})},t.toMomentum=function(e,t,a,i,n,r){var o,s,l=e-t,c=Math.abs(l)/a;return r=void 0===r?6e-4:r,o=e+c*c/(2*r)*(l<0?-1:1),s=c/r,o<i?(o=n?i-n/2.5*(c/8):i,l=Math.abs(o-e),s=l/c):o>0&&(o=n?n/2.5*(c/8):0,l=Math.abs(e)+o,s=l/c),{destination:o,duration:s}},t}(annie.EventDispatcher);e.Scroller=t}(annieUI||(annieUI={}));var annieUI;!function(e){var t=function(e){function t(t,a,i){void 0===a&&(a=10),void 0===i&&(i=!0);var n=e.call(this,t,0,0,0,0)||this;n._rate=0,n._isVertical=!0;var r=n;return r._instanceType="annieUI.MCScroller",r.isBounce=!1,r.rate=a,r.isVertical=i,n}return __extends(t,e),Object.defineProperty(t.prototype,"rate",{get:function(){return this._rate},set:function(e){var t=this,a=t._container;if(e!=t._rate){t._rate=e;var i=t.curFramePos-1,n=0,r=0;t._isVertical?(t._curX=-i*e,r=a.totalFrames*e):(t._curY=-i*e,n=a.totalFrames*e),t.setScrollWH(n,r)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){var t=this;t._isVertical!=e&&(e?(t._curY=t._curX,t._scrollHeight=t._scrollWidth,t._scrollWidth=0):(t._curX=t._curY,t._scrollWidth=t._scrollHeight,t._scrollHeight=0),t._isVertical=e,t._updateViewAndScroll())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"curFramePos",{get:function(){var e=this,t=0;return t=e._isVertical?e._curY/e._rate:e._curX/e._rate,Math.abs(t)+1},enumerable:!0,configurable:!0}),t.prototype._translate=function(t,a){e.prototype._translate.call(this,t,a);var i=this;i._container.gotoAndStop(i.curFramePos)},t}(e.Scroller);e.MCScroller=t}(annieUI||(annieUI={}));var annieUI;!function(e){var t=annie.Sprite,a=annie.Shape,i=function(t){function i(i,n,r,o,s){var l=t.call(this)||this;l.maskObj=new a,l._view=null;var c=l;return c._instanceType="annieUI.ScrollPage",c._view=i||new annie.Sprite,c.addChild(c.maskObj),c.addChild(c._view),c.view.mask=c.maskObj,c.maskObj.x=-1,c.maskObj.y=-1,c.maskObj._isUseToMask=0,c.maskObj.alpha=0,c._scroller=new e.Scroller(c,n,r,o,s),c._scroller.addEventListener(annie.Event.ON_SCROLL_ING,function(e){c._view.y=e.data.posY,c._view.x=e.data.posX,c.dispatchEvent(e)}),c._scroller.addEventListener(annie.Event.ON_SCROLL_START,function(e){c.dispatchEvent(e)}),c._scroller.addEventListener(annie.Event.ON_SCROLL_STOP,function(e){c.dispatchEvent(e)}),c._scroller.addEventListener(annie.Event.ON_SCROLL_TO_HEAD,function(e){c.dispatchEvent(e)}),c._scroller.addEventListener(annie.Event.ON_SCROLL_TO_END,function(e){c.dispatchEvent(e)}),c.setViewWH(n,r),l}return __extends(i,t),Object.defineProperty(i.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scroller",{get:function(){return this._scroller},enumerable:!0,configurable:!0}),i.prototype.setViewWH=function(e,t){var a=this;a.maskObj.clear(),a.maskObj.beginFill("#000000"),a.maskObj.drawRect(0,0,e+2,t+2),a.maskObj.endFill(),a.scroll&&a.scroll.setViewWH(e,t)},i.prototype.destroy=function(){var e=this;e._scroller.destroy(),e._scroller=null,t.prototype.destroy.call(this)},i}(t);e.ScrollPage=i}(annieUI||(annieUI={}));var annieUI;!function(e){var t=function(e){function t(t,a,i,n,r,o,s){void 0===o&&(o=!0),void 0===s&&(s=1);var l=e.call(this,null,n,r,n,r)||this;l._items=null,l._isInit=0,l.data=[],l.downL=null,l._lastFirstId=-1,l._distance=0,l._paramXY="y",l._isVertical=!0,l._maxDistance=0;var c=l;return c._instanceType="annieUI.ScrollList",c._itemW=a,c._itemH=i,c._items=[],c._itemClass=t,c._itemCount=0,c._cols=s,c.isVertical=o,c.addEventListener(annie.Event.ENTER_FRAME,c.flushData.bind(c)),l}return __extends(t,e),Object.defineProperty(t.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){var t=this;t._isVertical=e,t._updateItems()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadingView",{get:function(){return this.downL},enumerable:!0,configurable:!0}),t.prototype.updateData=function(e,t){void 0===t&&(t=!1);var a=this;if(e&&(!a._isInit||t?a.data=e:a.data=a.data.concat(e),a._isInit=1),a._lastFirstId=-1,a._maxDistance=Math.ceil(a.data.length/a._cols)*a._itemRow,a.downL){a.downL[a._paramXY]=Math.max(a._distance,a._maxDistance);var i=a.downL.getWH();a._maxDistance+="x"==a._paramXY?i.width:i.height}a.resetMaxDistance()},t.prototype.resetMaxDistance=function(){var e=this;e._isVertical?e.scroller._scrollHeight=e._maxDistance:e.scroller._scrollWidth=e._maxDistance,e.scroller._updateViewAndScroll()},t.prototype.flushData=function(){var e=this;if(e._isInit>0){var t=(Math.abs(Math.floor(e._view[e._paramXY]/e._itemRow))-1)*e._cols;if((t=t<0?0:t)!=e._lastFirstId&&(e._lastFirstId=t,t!=e._items[0].id))for(var a=0;a<e._cols;a++)e.speed>0?e._items.unshift(e._items.pop()):e._items.push(e._items.shift());for(var i=0;i<e._itemCount;i++){var n=e._items[i];1==e._isInit&&(n._a2x_sl_id=-1),n._a2x_sl_id!=t&&(n.initData(e.data[t]?t:-1,e.data[t]),n[e._paramXY]=Math.floor(t/e._cols)*e._itemRow,n[e._disParam]=t%e._cols*e._itemCol,e.data[t]?(n._a2x_sl_id=t,n.visible=!0):(n._a2x_sl_id=-1,n.visible=!1)),t++}e._isInit=2}},t.prototype._updateItems=function(){var e=this;e._isVertical?(e._disParam="x",e._paramXY="y",e._itemRow=e._itemH,e._itemCol=e._itemW,e._distance=e._scroller.viewHeight):(e._disParam="y",e._paramXY="x",e._itemRow=e._itemW,e._itemCol=e._itemH,e._distance=e._scroller.viewWidth);var t=(Math.ceil(e._distance/e._itemRow)+1)*e._cols;if(t!=e._itemCount){if(t>e._itemCount)for(var a=e._itemCount;a<t;a++){var i=new e._itemClass;i.id=-1,i.data=null,e._items.push(i),e._view.addChild(i)}else for(var a=0;a<e._itemCount-t;a++)e._view.removeChild(e._items.pop());e._itemCount=t,e._lastFirstId=-1}},t.prototype.setLoading=function(e){var t=this;if(t.downL){t._view.removeChild(t.downL);var a=t.downL.getWH();t._maxDistance-="x"==t._paramXY?a.width:a.height,t.downL=null}if(e){t.downL=e,t._view.addChild(e),t.downL[t._paramXY]=Math.max(t._distance,t._maxDistance);var a=t.downL.getWH();t._maxDistance+="x"==t._paramXY?a.width:a.height}else t.isStop=!1;t.resetMaxDistance()},t.prototype.destroy=function(){var t=this;t._items=null,t._itemClass=null,t.data=null,t.downL=null,e.prototype.destroy.call(this)},t}(e.ScrollPage);e.ScrollList=t}(annieUI||(annieUI={}));var annieUI;!function(e){var t=annie.Sprite,a=function(e){function t(){var t=e.call(this)||this;t.maskType=0;var a=t;return a._instanceType="annieUI.FacePhoto",a.photo=new Image,a.maskObj=new annie.Shape,a.photo.onload=function(e){a.bitmap=new annie.Bitmap(a.photo),a.maskObj.clear(),a.maskObj.beginFill("#000000");var t=a.radio/(a.photo.width<a.photo.height?a.photo.width:a.photo.height);a.bitmap.scaleX=a.bitmap.scaleY=t,a.bitmap.x=a.radioW-a.photo.width*t>>1,a.bitmap.y=a.radioH-a.photo.height*t>>1,0==a.maskType?a.maskObj.drawEllipse(0,0,a.radioW,a.radioH):a.maskObj.drawRect(0,0,a.radioW,a.radioH),a.maskObj.endFill(),a.addChild(a.bitmap),a.addChild(a.maskObj),a.bitmap.mask=a.maskObj,a.dispatchEvent("onComplete")},t}return __extends(t,e),t.prototype.init=function(e,t,a,i){void 0===i&&(i=0);var n=this;n._bounds.width=t,n._bounds.height=a,n.radioW=t,n.radioH=a,n.radio=t>a?t:a,n.photo.corssOrigin="anonymous",n.photo.src!=e&&(n.photo.src=e),n.maskType!=i&&(n.maskType=i)},t.prototype.destroy=function(){var t=this;t.bitmap=null,t.photo=null,t.maskObj=null,e.prototype.destroy.call(this)},t}(t);e.FacePhoto=a}(annieUI||(annieUI={}));var annieUI;!function(e){var t=annie.Sprite,a=function(e){function t(t,a,i,n){void 0===i&&(i=!0),void 0===n&&(n=null);var r=e.call(this)||this;r.listLen=0,r.view=new annie.Sprite,r.maskObj=new annie.Shape,r.slideSpeed=.2,r._isBreak=!1,r.distance=0,r.touchEndX=0,r.movingX=0,r.movingY=0,r._moveDis=0,r.touchEndY=0,r.currentPageIndex=0,r.reBound=.3,r.isPageFollowToMove=!1,r.follow=.7,r.isMoving=!1,r.viewWidth=0,r.viewHeight=0,r.pageList=[],r.pageClassList=[],r.lastX=0,r.lastY=0,r.isMouseDown=!1,r.isCanUseMouseScroll=!0,r.canSlideNext=!0,r.canSlidePrev=!0,r.paramXY="y";var o=r;o.isVertical=i,o._ease=n,i?(o.paramXY="y",o.distance=a):(o.paramXY="x",o.distance=t),o.addChild(o.maskObj),o.addChild(o.view),o.view.mask=o.maskObj,o.maskObj._isUseToMask=0,o.maskObj.alpha=0,o.setMask(t,a);var s=o.onMouseEvent.bind(o);return o.addEventListener(annie.MouseEvent.MOUSE_DOWN,s,!1),o.addEventListener(annie.MouseEvent.MOUSE_MOVE,s,!1),o.addEventListener(annie.MouseEvent.MOUSE_UP,s,!1),o.addEventListener(annie.MouseEvent.MOUSE_OUT,s),r}return __extends(t,e),t.prototype.setMask=function(e,t){var a=this;a.maskObj.clear(),a.maskObj.beginFill("#000000"),a.maskObj.drawRect(0,0,e,t),a.viewWidth=e,a.viewHeight=t,a.maskObj.endFill()},t.prototype.onMouseEvent=function(e){var t=this;if(!t.isMoving&&t.isCanUseMouseScroll)if(e.type==annie.MouseEvent.MOUSE_DOWN)t.touchEndX=e.localX,t.touchEndY=e.localY,t.movingX=t.movingY=0,t.isMouseDown=!0,t._isBreak=!1,t.lastX=e.localX,t.lastY=e.localY,t._moveDis=0;else if(e.type==annie.MouseEvent.MOUSE_MOVE){if(!t.isMouseDown)return;var a=e.localX-t.touchEndX,i=e.localY-t.touchEndY,n=i,r=a,o=t.movingY;if(t._moveDis=t.lastY-e.localY,t.movingX=a,t.movingY=i,t.isVertical||(n=a,r=i,o=t.movingX,t._moveDis=t.lastX-e.localX),Math.abs(n)>Math.abs(r)){if(t.isPageFollowToMove||Math.abs(n)-Math.abs(o)<-1&&(t._isBreak=!0),n>0){if(0==t.currentPageIndex)t.view[t.paramXY]-=t._moveDis*t.reBound;else if(t.isPageFollowToMove){t.view[t.paramXY]-=t._moveDis*t.follow;var s=t.currentPageIndex-1;t.pageList[s]||(t.pageList[s]=new t.pageClassList[s]),t.pageList[s].parent!=t.view&&(t.view.addChild(t.pageList[s]),t.pageList[s][t.paramXY]=s*t.distance)}}else if(n<0)if(t.currentPageIndex==t.listLen-1)t.view[t.paramXY]-=t._moveDis*t.reBound;else if(t.isPageFollowToMove){t.view[t.paramXY]-=t._moveDis*t.follow;var s=t.currentPageIndex+1;t.pageList[s]||(t.pageList[s]=new t.pageClassList[s]),t.pageList[s].parent!=t.view&&(t.view.addChild(t.pageList[s]),t.pageList[s][t.paramXY]=s*t.distance)}}else t.movingX=t.movingY=0;t.lastX=e.localX,t.lastY=e.localY}else{if(!t.isMouseDown)return;var n=t.movingY;if(t.isMouseDown=!1,t.isVertical||(n=t.movingX),0==t.currentPageIndex&&t.view[t.paramXY]>0||t.currentPageIndex==t.listLen-1&&t.view[t.paramXY]<-t.currentPageIndex*t.distance){var l={};l[t.paramXY]=-t.currentPageIndex*t.distance,t._ease&&(l.ease=t._ease),annie.Tween.to(t.view,t.slideSpeed*t.reBound,l)}else{var c=t.currentPageIndex;if(t.isPageFollowToMove)if(Math.abs(t._moveDis)>5||Math.abs(n*t.follow<<1)>=t.distance)0!=n?t.slideTo(n<0?c+1:c-1):t.view[t.paramXY]=-t.currentPageIndex*t.distance;else{var d=-t.currentPageIndex*t.distance;if(d==t.view[t.paramXY])return;t.view.mouseEnable=!1,t.isMoving=!0;var l={};l[t.paramXY]=d,t._ease&&(l.ease=t._ease),l.onComplete=function(){t.view.mouseEnable=!0,t.isMoving=!1,t.currentPageIndex>0&&t.pageList[t.currentPageIndex-1]&&t.pageList[t.currentPageIndex-1].parent==t.view&&t.view.removeChild(t.pageList[t.currentPageIndex-1]),t.currentPageIndex<t.listLen-1&&t.pageList[t.currentPageIndex+1]&&t.pageList[t.currentPageIndex+1].parent==t.view&&t.view.removeChild(t.pageList[t.currentPageIndex+1])},annie.Tween.to(t.view,.5*t.slideSpeed,l)}else Math.abs(n)>100&&!t._isBreak&&t.slideTo(n<0?c+1:c-1)}}},t.prototype.slideTo=function(e,t){void 0===t&&(t=!1);var a=this;if(a.currentPageIndex!=e&&!a.isMoving){var i=a.currentPageIndex,n=a.currentPageIndex<e;if(n){if(!(e<a.listLen&&a.canSlideNext))return;a.currentPageIndex=e}else{if(!(e>=0&&a.canSlidePrev))return;a.currentPageIndex=e}if(a.pageList[a.currentPageIndex]||(a.pageList[a.currentPageIndex]=new a.pageClassList[a.currentPageIndex]),a.pageList[a.currentPageIndex][a.paramXY]=a.currentPageIndex*a.distance,a.pageList[i][a.paramXY]=n?(a.currentPageIndex-1)*a.distance:(a.currentPageIndex+1)*a.distance,a.isPageFollowToMove||(a.view[a.paramXY]=-a.pageList[i][a.paramXY]),a.pageList[a.currentPageIndex]!=a.view&&a.view.addChild(a.pageList[a.currentPageIndex]),t)a.dispatchEvent("onSlideStart",{currentPage:a.currentPageIndex,lastPage:i}),a.view[a.paramXY]=-a.currentPageIndex*a.distance,a.view.removeChild(a.pageList[i]),a.dispatchEvent("onSlideEnd");else{a.view.mouseEnable=!1,a.isMoving=!0;var r={};r[a.paramXY]=-a.currentPageIndex*a.distance,a._ease&&(r.ease=a._ease),r.onComplete=function(){a.view.mouseEnable=!0,a.isMoving=!1,a.view.removeChild(a.pageList[i]),a.dispatchEvent("onSlideEnd")},annie.Tween.to(a.view,a.slideSpeed,r),a.dispatchEvent("onSlideStart",{currentPage:a.currentPageIndex,lastPage:i})}}},t.prototype.addPageList=function(e){var t=this;if(t.pageClassList=t.pageClassList.concat(e),0==t.listLen&&t.pageClassList.length>0){var a=new t.pageClassList[0];t.pageList.push(a),t.view.addChild(a)}t.listLen=t.pageClassList.length},t.prototype.destroy=function(){var t=this;t.pageList=null,t.pageClassList=null,e.prototype.destroy.call(this)},t}(t);e.SlidePage=a}(annieUI||(annieUI={}));var annieUI;!function(e){var t=annie.Sprite,a=annie.Shape,i=annie.Event,n=annie.MouseEvent,r=annie.Point,o=function(e){function o(o,s,l,c){var d=e.call(this)||this;d.totalPage=0,d.currPage=0,d.speed=.4,d.state="stop",d.timerArg0=0,d.timerArg1=0,d.px=0,d.py=0,d.rPage0=new t,d.rPage1=new t,d.pageMC=new t,d.leftPage=null,d.rightPage=null,d.rMask0=new a,d.rMask1=new a,d.shadow0=new a,d.shadow1=new a,d.sMask0=new a,d.sMask1=new a,d.pages=[],d.stageMP=new r,d.canFlip=!0;var u=d;u._instanceType="annieUI.FlipBook",u.getPageCallback=c,u.bW=o,u.bH=s,u.totalPage=l,u.currPage=u.toPage=0,u.crossGap=Math.sqrt(u.bW*u.bW+u.bH*u.bH),u.p1=new r(0,0),u.p2=new r(0,u.bH),u.p3=new r(u.bW+u.bW,0),u.p4=new r(u.bW+u.bW,u.bH),u.limitP1=new r(u.bW,0),u.limitP2=new r(u.bW,u.bH),u.toPosArr=[u.p3,u.p4,u.p1,u.p2],u.myPosArr=[u.p1,u.p2,u.p3,u.p4],u.rPage0.mouseEnable=!1,u.rPage1.mouseEnable=!1,u.shadow0.mouseEnable=!1,u.shadow1.mouseEnable=!1,u.setShadowMask(u.shadow0,1.5*u.bW,3*u.bH),u.setShadowMask(u.shadow1,1.5*u.bW,3*u.bH),u.rPage1.mask=u.rMask1,u.shadow1.mask=u.rMask1,u.shadow0.mask=u.rMask0,u.rPage0.mask=u.rMask0,u.shadow0.visible=!1,u.shadow1.visible=!1,u.addChild(u.pageMC),u.addChild(u.rPage0),u.addChild(u.shadow0),u.addChild(u.rPage1),u.addChild(u.shadow1),u.addChild(u.rMask0),u.addChild(u.rMask1),u.setPage(u.currPage),u.md=u.onMouseDown.bind(u),u.mu=u.onMouseUp.bind(u),u.mm=u.onMouseMove.bind(u);var p=u.onEnterFrame.bind(u);return u.addEventListener(annie.Event.ADD_TO_STAGE,function(e){u.stage.addEventListener(n.MOUSE_DOWN,u.md),u.stage.addEventListener(n.MOUSE_UP,u.mu),u.stage.addEventListener(n.MOUSE_MOVE,u.mm),u.addEventListener(i.ENTER_FRAME,p)}),u.addEventListener(annie.Event.REMOVE_TO_STAGE,function(e){u.stage.removeEventListener(n.MOUSE_DOWN,u.md),u.stage.removeEventListener(n.MOUSE_UP,u.mu),u.stage.removeEventListener(n.MOUSE_MOVE,u.mm),u.removeEventListener(i.ENTER_FRAME,p)}),d}return __extends(o,e),o.prototype.drawPage=function(e,t){var a,i,n=this;1==e?(t=n.checkLimit(t,n.limitP1,n.bW),t=n.checkLimit(t,n.limitP2,n.crossGap),i=n.getBookArr(t,n.p1,n.p2),a=i[1],n.getLayerArr(t,a,n.p1,n.p2,n.limitP1,n.limitP2),n.getShadow(n.shadow0,n.p1,t,.5),n.getShadow(n.shadow1,n.p1,t,.45),n.rPage1.rotation=n.angle(t,a)+90,n.rPage1.x=i[3].x,n.rPage1.y=i[3].y,n.rPage0.x=n.p1.x,n.rPage0.y=n.p1.y):2==e?(t=n.checkLimit(t,n.limitP2,n.bW),t=n.checkLimit(t,n.limitP1,n.crossGap),i=n.getBookArr(t,n.p2,n.p1),a=i[1],n.getLayerArr(t,a,n.p2,n.p1,n.limitP2,n.limitP1),n.getShadow(n.shadow0,n.p2,t,.5),n.getShadow(n.shadow1,n.p2,t,.45),n.rPage1.rotation=n.angle(t,a)-90,n.rPage1.x=i[2].x,n.rPage1.y=i[2].y,n.rPage0.x=n.p1.x,n.rPage0.y=n.p1.y):3==e?(t=n.checkLimit(t,n.limitP1,n.bW),t=n.checkLimit(t,n.limitP2,n.crossGap),i=n.getBookArr(t,n.p3,n.p4),a=i[1],n.getLayerArr(t,a,n.p3,n.p4,n.limitP1,n.limitP2),n.getShadow(n.shadow0,n.p3,t,.5),n.getShadow(n.shadow1,n.p3,t,.4),n.rPage1.rotation=n.angle(t,a)+90,n.rPage1.x=t.x,n.rPage1.y=t.y,n.rPage0.x=n.limitP1.x,n.rPage0.y=n.limitP1.y):(t=n.checkLimit(t,n.limitP2,n.bW),t=n.checkLimit(t,n.limitP1,n.crossGap),i=n.getBookArr(t,n.p4,n.p3),a=i[1],n.getLayerArr(t,a,n.p4,n.p3,n.limitP2,n.limitP1),n.getShadow(n.shadow0,n.p4,t,.5),n.getShadow(n.shadow1,n.p4,t,.4),n.rPage1.rotation=n.angle(t,a)-90,n.rPage1.x=a.x,n.rPage1.y=a.y,n.rPage0.x=n.limitP1.x,n.rPage0.y=n.limitP1.y),n.getShape(n.rMask1,n.layer1Arr),n.getShape(n.rMask0,n.layer0Arr)},o.prototype.checkLimit=function(e,t,a){var i=this,n=Math.abs(i.pos(t,e)),o=i.angle(t,e);if(n>a){var s=a*Math.sin(o/180*Math.PI),l=a*Math.cos(o/180*Math.PI);e=new r(t.x-l,t.y-s)}return e},o.prototype.getPage=function(e){var t=this;return t.pages[e-1]||(t.pages[e-1]=t.getPageCallback(e)),t.pages[e-1]},o.prototype.getBookArr=function(e,t,a){var i=this,n=[],o=Math.abs(.5*i.pos(t,e)),s=i.angle(t,e),l=o/Math.cos(s/180*Math.PI),c=new r(t.x-l,t.y),d=i.angle(e,c)-i.angle(e,a),u=i.pos(e,a),p=u*Math.sin(d/180*Math.PI),g=u*Math.cos(d/180*Math.PI),v=new r(t.x+g,t.y+p),h=i.angle(c,e),_=i.bW*Math.sin(h/180*Math.PI),m=i.bW*Math.cos(h/180*Math.PI),w=new r(v.x+m,v.y+_),P=new r(e.x+m,e.y+_);return n.push(e),n.push(v),n.push(w),n.push(P),n},o.prototype.getLayerArr=function(e,t,a,i,n,o){var s=this,l=[],c=[],d=Math.abs(.5*s.pos(a,e)),u=s.angle(a,e),p=d/Math.sin(u/180*Math.PI),g=d/Math.cos(u/180*Math.PI),v=new r(a.x-g,a.y),h=new r(a.x,a.y-p),_=t;if(Math.abs(s.pos(e,i))>s.bH){l.push(_);var m=Math.abs(.5*s.pos(_,i)),w=m/Math.cos(u/180*Math.PI);h=new r(i.x-w,i.y)}else c.push(i);l.push(h),l.push(v),l.push(e),s.layer1Arr=l,c.push(o),c.push(n),c.push(v),c.push(h),s.layer0Arr=c},o.prototype.getShape=function(e,t){var a=t.length;e.clear(),e.beginFill("#000"),e.moveTo(t[0].x,t[0].y);for(var i=1;i<a;i++)e.lineTo(t[i].x,t[i].y);e.endFill()},o.prototype.setShadowMask=function(e,t,a){e.beginLinearGradientFill([.5*-t,4,.5*t,4],[[0,"#000000",0],[1,"#000000",.6]]),e.drawRect(.5*-t,.5*-a,.5*t,a),e.endFill(),e.beginLinearGradientFill([.5*-t,4,.5*t,4],[[1,"#000000",0],[0,"#000000",.6]]),e.drawRect(0,.5*-a,.5*t,a),e.endFill()},o.prototype.getShadow=function(e,t,a,i){var n,r,o=this;e.visible=!0,e.x=a.x+(t.x-a.x)*i,e.y=a.y+(t.y-a.y)*i,e.rotation=o.angle(t,a),n=.5*Math.abs(t.x-a.x)/o.bW,r=1-n*n,e.scaleX=n+.1,e.alpha=r+.1},o.prototype.setPage=function(e){var t=this;e>0&&e<=t.totalPage&&(t.leftPage=t.getPage(e),t.leftPage.x=t.leftPage.y=0,t.pageMC.addChild(t.leftPage)),e+1>0&&e+1<t.totalPage&&(t.rightPage=t.getPage(e+1),t.rightPage.x=t.bW,t.rightPage.y=0,t.pageMC.addChild(t.rightPage))},o.prototype.onMouseDown=function(e){var t=this;if(t.canFlip&&"stop"==t.state){t.stageMP.x=e.clientX,t.stageMP.y=e.clientY;var a=t.globalToLocal(t.stageMP);t.stageMP=a,t.timerArg0=t.checkArea(a),t.timerArg0=t.timerArg0<0?-t.timerArg0:t.timerArg0,t.timerArg0>0&&(t.timerArg0<3&&t.currPage>0||t.timerArg0>2&&t.currPage<=t.totalPage-2)&&(t.state="start",t.flushPage(),t.dispatchEvent("onFlipStart"))}},o.prototype.onMouseUp=function(e){var t=this;if("start"==t.state){t.stageMP.x=e.clientX,t.stageMP.y=e.clientY;var a=t.globalToLocal(t.stageMP);t.timerArg1=t.checkArea(a),t.state="auto",t.stageMP=a}},o.prototype.onMouseMove=function(e){var t=this;if("start"==t.state){t.stageMP.x=e.clientX,t.stageMP.y=e.clientY;var a=t.globalToLocal(t.stageMP);t.stageMP=a}},o.prototype.checkArea=function(e){var t,a=this,i=a.bW+a.bW,n=a.bH;return e.x>0&&e.x<=.5*i?(t=e.y>0&&e.y<=.5*n?1:e.y>.5*n&&e.y<n?2:0,e.x<=50&&(t=e.y>0&&e.y<=50?-1:e.y>n-50&&e.y<n?-2:t),t):e.x>.5*i&&e.x<i?(t=e.y>0&&e.y<=.5*n?3:e.y>.5*n&&e.y<n?4:0,e.x>=i-50&&(t=e.y>0&&e.y<=50?-3:e.y>n-50&&e.y<n?-4:t),t):0},o.prototype.flipTo=function(e){var t,a=this;e=e%2==1?e-1:e,t=e-a.currPage,"stop"==a.state&&e>=0&&e<=a.totalPage&&0!=t&&(a.timerArg0=t<0?1:3,a.timerArg1=-1,a.toPage=e>a.totalPage?a.totalPage:e,a.state="auto",a.flushPage())},o.prototype.nextPage=function(){this.flipTo(this.currPage+2)},o.prototype.prevPage=function(){this.flipTo(this.currPage-1)},o.prototype.startPage=function(){this.flipTo(0)},o.prototype.endPage=function(){this.flipTo(this.totalPage)},o.prototype.flushPage=function(){var e,t,a=this,i=a.myPosArr[a.timerArg0-1],n=null;1==a.timerArg0||2==a.timerArg0?(a.toPage=a.toPage==a.currPage?a.currPage-2:a.toPage,e=a.currPage,t=a.toPage+1,this.pageMC.removeChild(a.leftPage),a.toPage>0&&(n=a.getPage(a.currPage-2),n.x=0,a.leftPage=n,a.pageMC.addChild(n))):3!=a.timerArg0&&4!=a.timerArg0||(a.toPage=a.toPage==a.currPage?a.currPage+2:a.toPage,e=a.currPage+1,t=a.toPage,a.pageMC.removeChild(a.rightPage),a.toPage+1<a.totalPage&&(n=a.getPage(a.currPage+3),n.x=a.bW,a.rightPage=n,a.pageMC.addChild(n))),a.px=i.x,a.py=i.y,e>0&&e<=a.totalPage&&(n=a.getPage(e),n.x=0,n.y=0,a.rPage0.addChild(n)),t>0&&t<=a.totalPage&&(n=a.getPage(t),n.x=0,n.y=0,a.rPage1.addChild(n))},o.prototype.onEnterFrame=function(e){var t,a,i,n,o,s,l=this,c=l.toPosArr[l.timerArg0-1],d=l.myPosArr[l.timerArg0-1];if("start"==l.state){s=l.speed;var u=l.stageMP;l.px+=(u.x-l.px)*s>>0,l.py+=(u.y-l.py)*s>>0;var p=new r(l.px,l.py);l.drawPage(l.timerArg0,p)}else"auto"==l.state&&(Math.abs(c.x-l.px)>1.5*l.bW&&l.timerArg1>0?(t=d.x,a=d.y,i=0):(t=c.x,a=c.y,i=1),n=t-l.px>>0,o=a-l.py>>0,l.timerArg1<0?(s=.7*l.speed,l.py=l.arc(l.bW,n,c.y)):(s=l.speed,l.py=o*s+l.py),l.px=n*s+l.px,l.drawPage(l.timerArg0,new r(l.px,l.py)),0==n&&0==o&&(l.rPage0.removeAllChildren(),l.rPage1.removeAllChildren(),l.shadow0.visible=!1,l.shadow1.visible=!1,l.toPage=0==i?l.currPage:l.toPage,l.currPage=l.toPage,l.pageMC.removeAllChildren(),l.setPage(l.currPage),l.state="stop",l.dispatchEvent("onFlipStop")))},o.prototype.arc=function(e,t,a){var i=2*e,n=e*e+i*i,r=Math.abs(t)-e;return a-(Math.sqrt(n-r*r)-i)},o.prototype.angle=function(e,t){var a=e.x-t.x,i=e.y-t.y,n=180*Math.atan2(i,a)/Math.PI;return n<0?n+360:n},o.prototype.pos=function(e,t){var a=e.x-t.x,i=e.y-t.y,n=Math.sqrt(a*a+i*i);return e.x>t.x?n:-n},o.prototype.destroy=function(){var t=this;t.md=null,t.mu=null,t.mm=null,t.layer0Arr=null,t.layer1Arr=null,t.toPosArr=null,t.myPosArr=null,t.rPage0=null,t.rMask0=null,t.rMask1=null,t.sMask0=null,t.sMask1=null,t.leftPage=null,t.rightPage=null,t.pageMC=null,t.rightPage=null,t.shadow0=null,t.shadow1=null,t.p1=null,t.p2=null,t.p3=null,t.p4=null,t.limitP1=null,t.limitP2=null,t.pages=null,t.stageMP=null,t.getPageCallback=null,e.prototype.destroy.call(this)},o}(t);e.FlipBook=o}(annieUI||(annieUI={}));var annieUI;!function(e){var t=function(e){function t(a,i,n){void 0===n&&(n="");var r=e.call(this,t._getDrawCanvas(a,i))||this;r.context=null,r._isMouseDown=!1,r._drawRadius=50,r.drawColor="#ffffff",r.bgColor="",r.totalStepList=[],r.currentStepId=0;var o=r;o._instanceType="annieUI.DrawingBoard",o.context=o._texture.getContext("2d"),o.context.lineCap="round",o.context.lineJoin="round",o.reset(n);var s=o.onMouseDown.bind(o),l=o.onMouseMove.bind(o),c=o.onMouseUp.bind(o);return o.addEventListener(annie.MouseEvent.MOUSE_DOWN,s),o.addEventListener(annie.MouseEvent.MOUSE_MOVE,l),o.addEventListener(annie.MouseEvent.MOUSE_UP,c),r}return __extends(t,e),Object.defineProperty(t.prototype,"drawRadius",{get:function(){return this._drawRadius},set:function(e){this._drawRadius=e},enumerable:!0,configurable:!0}),t._getDrawCanvas=function(e,t){var a=document.createElement("canvas");return a.width=e,a.height=t,a},t.prototype.onMouseDown=function(e){var t=this;t._isMouseDown=!0;var a=t.context;a.beginPath(),a.strokeStyle=t.drawColor,a.lineWidth=t._drawRadius;var i=e.localX>>0,n=e.localY>>0;a.moveTo(i,n),t.addStepObj={},t.addStepObj.c=t.drawColor,t.addStepObj.r=t._drawRadius,t.addStepObj.sx=i,t.addStepObj.sy=n,t.addStepObj.ps=[]},t.prototype.onMouseUp=function(e){var t=this;t._isMouseDown&&(t._isMouseDown=!1,t.addStepObj.ps&&t.addStepObj.ps.length>0&&(t.currentStepId++,t.totalStepList.push(t.addStepObj)))},t.prototype.onMouseMove=function(e){var t=this;if(t._isMouseDown)if(t.addStepObj){var a=t.context,i=e.localX>>0,n=e.localY>>0;a.lineTo(i,n),a.stroke(),t.addStepObj.ps.push(i,n)}else t.onMouseDown(e)},t.prototype.reset=function(e){void 0===e&&(e="");var t=this;""!=e&&(t.bgColor=e),""!=t.bgColor&&(t.context.fillStyle=t.bgColor),t.context.fillRect(0,0,t._bitmapData.width,t._bitmapData.height),t.currentStepId=0,t.totalStepList=[],t.addStepObj=null,t._isMouseDown=!1},t.prototype.cancel=function(e){void 0===e&&(e=0);var t=this;if(0==e)t.reset();else{if(!(t.currentStepId-e>=0))return!1;t.currentStepId-=e,t.totalStepList.splice(t.currentStepId,e),""!=t.bgColor?(t.context.fillStyle=t.bgColor,t.context.fillRect(0,0,t.bitmapData.width,t.bitmapData.height)):t.context.clearRect(0,0,t.bitmapData.width,t.bitmapData.height);for(var a=t.totalStepList.length,i=0;i<a;i++){var n=t.context;n.beginPath(),n.strokeStyle=t.totalStepList[i].c,n.lineWidth=t.totalStepList[i].r,n.moveTo(t.totalStepList[i].sx,t.totalStepList[i].sy);for(var r=t.totalStepList[i].ps,o=r.length,s=0;s<o;s+=2)n.lineTo(r[s],r[s+1]),n.stroke()}}return!0},t.prototype.destroy=function(){var t=this;t.context=null,t.totalStepList=null,t.drawColor=null,t.bgColor=null,t.addStepObj=null,e.prototype.destroy.call(this)},t}(annie.Bitmap);e.DrawingBoard=t}(annieUI||(annieUI={}));var annieUI;!function(e){var t=function(e){function t(t,a,i,n,r){void 0===r&&(r=50);var o=e.call(this,t,a,i)||this;o._drawList=[],o._totalDraw=1,o._currentDraw=0;var s=o
  ;return s._instanceType="annieUI.ScratchCard",s.drawColor=n,s.drawRadius=r,s.addEventListener(annie.MouseEvent.MOUSE_MOVE,function(e){if(s._isMouseDown){var t=Math.floor(e.localX/s._drawRadius),a=Math.floor(e.localY/s._drawRadius);if(s._drawList[t]&&s._drawList[t][a]){s._drawList[t][a]=!1,s._currentDraw++;var i=Math.floor(s._currentDraw/s._totalDraw*100);s.dispatchEvent("onDrawPercent",{per:i})}}}),o}return __extends(t,e),t.prototype.reset=function(t,a){void 0===t&&(t=""),void 0===a&&(a=""),e.prototype.reset.call(this,t);var i=this;if(i._drawList){""!=a&&(i.drawColor=a),i._currentDraw=0;var n=Math.floor(i._bitmapData.width/i._drawRadius),r=Math.floor(i._bitmapData.height/i._drawRadius);i._totalDraw=n*r;for(var o=0;o<n;o++){i._drawList[o]=[];for(var s=0;s<r;s++)i._drawList[o][s]=!0}}},t.prototype.cancel=function(e){return void 0===e&&(e=0),console.log("no support"),!1},Object.defineProperty(t.prototype,"drawRadius",{set:function(e){var t=this;t._drawRadius=e;var a=Math.floor(t._bitmapData.width/t._drawRadius),i=Math.floor(t._bitmapData.height/t._drawRadius);t._totalDraw=a*i;for(var n=0;n<a;n++){t._drawList[n]=[];for(var r=0;r<i;r++)t._drawList[n][r]=!0}},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this._drawList=null,e.prototype.destroy.call(this)},t}(e.DrawingBoard);e.ScratchCard=t}(annieUI||(annieUI={}));