text: var __extends=this&&this.__extends||function(){var 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])};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=annie.Sprite,a=annie.Shape,i=function(e){function i(i,n,r,o){void 0===o&&(o=!0);var s=e.call(this)||this;s.isVertical=!0,s.viewWidth=0,s.viewHeight=0,s._tweenId=0,s.maxDistance=1040,s.distance=0,s.minDis=2,s.maskObj=new a,s.view=new t,s.lastValue=0,s.speed=0,s.addSpeed=0,s.isStop=!0,s.maxSpeed=100,s.fSpeed=20,s.paramXY="y",s.stopTimes=-1,s.isMouseDownState=0,s.autoScroll=!1;var d=s;return d._instanceType="annieUI.ScrollPage",d.maskObj.alpha=0,d.addChild(d.maskObj),d.addChild(d.view),d.view.mask=d.maskObj,d.maxDistance=r,d.setViewRect(i,n,o),d.addEventListener(annie.MouseEvent.MOUSE_DOWN,d.onMouseEvent.bind(d)),d.addEventListener(annie.MouseEvent.MOUSE_MOVE,d.onMouseEvent.bind(d)),d.addEventListener(annie.MouseEvent.MOUSE_UP,d.onMouseEvent.bind(d)),d.addEventListener(annie.MouseEvent.MOUSE_OUT,d.onMouseEvent.bind(d)),d.addEventListener(annie.Event.ENTER_FRAME,function(){var e=d.view;if(!d.autoScroll)if(d.isStop)d.stopTimes>=0&&++d.stopTimes>=15&&(d.speed=0,(e[d.paramXY]>0||e[d.paramXY]<d.distance-d.maxDistance)&&(d.isStop=!1,d.stopTimes=-1));else if(Math.abs(d.speed)>0)e[d.paramXY]+=d.speed,e[d.paramXY]>0||e[d.paramXY]<d.distance-d.maxDistance?d.speed+=d.addSpeed*d.fSpeed:d.speed+=d.addSpeed,d.speed*d.addSpeed>0&&(d.dispatchEvent("onScrollStop"),d.speed=0);else if(0!=d.addSpeed){if(e[d.paramXY]>0||e[d.paramXY]<d.distance-d.maxDistance){var t=0;d.addSpeed>0&&d.distance<d.maxDistance&&(t=d.distance-d.maxDistance),e[d.paramXY]+=.4*(t-e[d.paramXY]),Math.abs(t-e[d.paramXY])<.1&&(d.isStop=!0,d.addSpeed>0?d.dispatchEvent("onScrollToEnd"):d.dispatchEvent("onScrollToHead"))}}else d.isStop=!0}),s}return __extends(i,e),i.prototype.setViewRect=function(e,t,a){var i=this;i.maskObj.clear(),i.maskObj.beginFill("#000000"),i.maskObj.drawRect(0,0,e,t),i.viewWidth=e,i.viewHeight=t,i.maskObj.endFill(),i.isVertical=a,a?(i.distance=i.viewHeight,i.paramXY="y"):(i.distance=i.viewWidth,i.paramXY="x"),i.isVertical=a},i.prototype.onMouseEvent=function(e){var t=this,a=t.view;if(e.type==annie.MouseEvent.MOUSE_DOWN)t.isStop||(t.isStop=!0),t.autoScroll&&(t.autoScroll=!1,annie.Tween.kill(t._tweenId)),t.isVertical?t.lastValue=e.localY:t.lastValue=e.localX,t.speed=0,t.isMouseDownState=1;else if(e.type==annie.MouseEvent.MOUSE_MOVE){if(t.isMouseDownState<1)return;1==t.isMouseDownState&&t.dispatchEvent("onScrollStart"),t.isMouseDownState=2;var i=void 0;if(i=t.isVertical?e.localY:e.localX,t.speed=i-t.lastValue,t.speed>t.minDis?(t.addSpeed=-2,t.speed>t.maxSpeed&&(t.speed=t.maxSpeed)):t.speed<-t.minDis?(t.speed<-t.maxSpeed&&(t.speed=-t.maxSpeed),t.addSpeed=2):t.speed=0,0!=t.speed){var n=1;(a[t.paramXY]>0||a[t.paramXY]<t.distance-t.maxDistance)&&(n=.2),a[t.paramXY]+=(i-t.lastValue)*n}t.lastValue=i,t.stopTimes=0}else t.isStop=!1,t.stopTimes=-1,0==t.speed&&2==t.isMouseDownState&&t.dispatchEvent("onScrollStop"),t.isMouseDownState=0},i.prototype.scrollTo=function(e,t){void 0===t&&(t=0);var a=this,i="x"==a.paramXY?a.viewWidth:a.viewHeight;if(e<0?e=0:e>a.maxDistance-i&&(e=a.maxDistance-i),Math.abs(a.view[a.paramXY]+e)>2){a.autoScroll=!0,a.isStop=!0,a.isMouseDownState=0;var n={};n.onComplete=function(){a.autoScroll=!1},n[a.paramXY]=-e,a._tweenId=annie.Tween.to(a.view,t,n),0==a.speed&&a.dispatchEvent("onScrollStart")}},i}(t);e.ScrollPage=i}(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.bitmap=new annie.Bitmap,a.maskObj=new annie.Shape,a.photo.onload=function(e){a.bitmap.bitmapData=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.radio-a.photo.width*t>>1,a.bitmap.y=a.radio-a.photo.height*t>>1,0==a.maskType?a.maskObj.drawCircle(a.radio>>1,a.radio>>1,a.radio>>1):a.maskObj.drawRect(0,0,a.radio,a.radio),a.maskObj.endFill(),a.dispatchEvent("onComplete")},a.addChild(a.bitmap),a.bitmap.mask=a.maskObj,t}return __extends(t,e),t.prototype.init=function(e,t,a){void 0===t&&(t=0),void 0===a&&(a=0);var i=this;i.radio=t,i.photo.src!=e&&(i.photo.src=e),i.maskType!=a&&(i.maskType=a)},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.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.maskObj.alpha=0,o.addChild(o.maskObj),o.addChild(o.view),o.view.mask=o.maskObj,o.setMask(t,a);var s=o.onMouseEvent.bind(o);return o.addEventListener(annie.MouseEvent.MOUSE_DOWN,s),o.addEventListener(annie.MouseEvent.MOUSE_MOVE,s),o.addEventListener(annie.MouseEvent.MOUSE_UP,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)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(e.type==annie.MouseEvent.MOUSE_UP){if(!t.isMouseDown)return;var n=t.movingY,r=t.movingX;if(t.isMouseDown=!1,t.isVertical||(n=t.movingX,r=t.movingY),0==t.currentPageIndex&&t.view[t.paramXY]>0||t.currentPageIndex==t.listLen-1&&t.view[t.paramXY]<-t.currentPageIndex*t.distance){var d={};d[t.paramXY]=-t.currentPageIndex*t.distance,t._ease&&(d.ease=t._ease),annie.Tween.to(t.view,t.slideSpeed*t.reBound,d)}else{var p=t.currentPageIndex;if(t.isPageFollowToMove)if(Math.abs(t._moveDis)>5||Math.abs(n*t.follow<<1)>=t.distance)t.slideTo(n<0?p+1:p-1);else{var l=-t.currentPageIndex*t.distance;if(l==t.view[t.paramXY])return;t.view.mouseEnable=!1,t.isMoving=!0;var d={};d[t.paramXY]=l,t._ease&&(d.ease=t._ease),d.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,d)}else Math.abs(n)>100&&!t._isBreak&&t.slideTo(n<0?p+1:p-1)}}},t.prototype.slideTo=function(e,t){void 0===t&&(t=!1);var a=this;if(!a.isMoving&&a.currentPageIndex!=e){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}(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,d,p){var l=e.call(this)||this;l.totalPage=0,l.currPage=0,l.speed=.4,l.state="stop",l.timerArg0=0,l.timerArg1=0,l.px=0,l.py=0,l.rPage0=new t,l.rPage1=new t,l.pageMC=new t,l.leftPage=null,l.rightPage=null,l.rMask0=new a,l.rMask1=new a,l.shadow0=new a,l.shadow1=new a,l.sMask0=new a,l.sMask1=new a,l.pages=[],l.stageMP=new r,l.canFlip=!0;var c=l;c._instanceType="annieUI.FlipBook",c.getPageCallback=p,c.bW=o,c.bH=s,c.totalPage=d,c.currPage=c.toPage=0,c.crossGap=Math.sqrt(c.bW*c.bW+c.bH*c.bH),c.p1=new r(0,0),c.p2=new r(0,c.bH),c.p3=new r(c.bW+c.bW,0),c.p4=new r(c.bW+c.bW,c.bH),c.limitP1=new r(c.bW,0),c.limitP2=new r(c.bW,c.bH),c.toPosArr=[c.p3,c.p4,c.p1,c.p2],c.myPosArr=[c.p1,c.p2,c.p3,c.p4],c.addChild(c.pageMC),c.addChild(c.rPage0),c.addChild(c.shadow0),c.addChild(c.rPage1),c.addChild(c.shadow1),c.rPage0.mouseEnable=!1,c.rPage1.mouseEnable=!1,c.shadow0.mouseEnable=!1,c.shadow1.mouseEnable=!1,c.setShadowMask(c.shadow0,c.sMask0,1.5*c.bW,3*c.bH),c.setShadowMask(c.shadow1,c.sMask1,1.5*c.bW,3*c.bH),c.shadow0.visible=!1,c.shadow1.visible=!1,c.rPage1.mask=c.rMask1,c.rPage0.mask=c.rMask0,c.setPage(c.currPage);var g=c.onMouseDown.bind(c),h=c.onMouseUp.bind(c),u=c.onMouseMove.bind(c),v=c.onEnterFrame.bind(c);return c.addEventListener(annie.Event.ADD_TO_STAGE,function(e){c.stage.addEventListener(n.MOUSE_DOWN,g),c.stage.addEventListener(n.MOUSE_UP,h),c.stage.addEventListener(n.MOUSE_MOVE,u),c.addEventListener(i.ENTER_FRAME,v)}),c.addEventListener(annie.Event.REMOVE_TO_STAGE,function(e){c.stage.removeEventListener(n.MOUSE_DOWN,g),c.stage.removeEventListener(n.MOUSE_UP,h),c.stage.removeEventListener(n.MOUSE_MOVE,u),c.removeEventListener(i.ENTER_FRAME,v)}),l}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.sMask0,n.p1,t,[n.p1,n.p3,n.p4,n.p2],.5),n.getShadow(n.shadow1,n.sMask1,n.p1,t,n.layer1Arr,.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.sMask0,n.p2,t,[n.p1,n.p3,n.p4,n.p2],.5),n.getShadow(n.shadow1,n.sMask1,n.p2,t,n.layer1Arr,.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.sMask0,n.p3,t,[n.p1,n.p3,n.p4,n.p2],.5),n.getShadow(n.shadow1,n.sMask1,n.p3,t,n.layer1Arr,.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.sMask0,n.p4,t,[n.p1,n.p3,n.p4,n.p2],.5),n.getShadow(n.shadow1,n.sMask1,n.p4,t,n.layer1Arr,.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),d=a*Math.cos(o/180*Math.PI);e=new r(t.x-d,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),d=o/Math.cos(s/180*Math.PI),p=new r(t.x-d,t.y),l=i.angle(e,p)-i.angle(e,a),c=i.pos(e,a),g=c*Math.sin(l/180*Math.PI),h=c*Math.cos(l/180*Math.PI),u=new r(t.x+h,t.y+g),v=i.angle(p,e),m=i.bW*Math.sin(v/180*Math.PI),w=i.bW*Math.cos(v/180*Math.PI),P=new r(u.x+w,u.y+m),M=new r(e.x+w,e.y+m);return n.push(e),n.push(u),n.push(P),n.push(M),n},o.prototype.getLayerArr=function(e,t,a,i,n,o){var s=this,d=[],p=[],l=Math.abs(.5*s.pos(a,e)),c=s.angle(a,e),g=l/Math.sin(c/180*Math.PI),h=l/Math.cos(c/180*Math.PI),u=new r(a.x-h,a.y),v=new r(a.x,a.y-g),m=t;if(Math.abs(s.pos(e,i))>s.bH){d.push(m);var w=Math.abs(.5*s.pos(m,i)),P=w/Math.cos(c/180*Math.PI);v=new r(i.x-P,i.y)}else p.push(i);d.push(v),d.push(u),d.push(e),s.layer1Arr=d,p.push(o),p.push(n),p.push(u),p.push(v),s.layer0Arr=p},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,i){e.beginLinearGradientFill(["rgba(0,0,0,0)","rgba(0,0,0,0.6)"],[0,1],[.5*-a,4,.5*a,4]),e.drawRect(.5*-a,.5*-i,.5*a,i),e.endFill(),e.beginLinearGradientFill(["rgba(0,0,0,0)","rgba(0,0,0,0.6)"],[1,0],[.5*-a,4,.5*a,4]),e.drawRect(0,.5*-i,.5*a,i),e.endFill(),e.mask=t},o.prototype.getShadow=function(e,t,a,i,n,r){var o,s,d=this;e.visible=!0,e.x=i.x+(a.x-i.x)*r,e.y=i.y+(a.y-i.y)*r,e.rotation=d.angle(a,i),o=.5*Math.abs(a.x-i.x)/d.bW,s=1-o*o,e.scaleX=o+.1,e.alpha=s+.1,d.getShape(t,n)},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(),e.updateAfterEvent(),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,d=this,p=d.toPosArr[d.timerArg0-1],l=d.myPosArr[d.timerArg0-1];if("start"==d.state){s=d.speed;var c=d.stageMP;d.px+=(c.x-d.px)*s>>0,d.py+=(c.y-d.py)*s>>0;var g=new r(d.px,d.py);d.drawPage(d.timerArg0,g)}else"auto"==d.state&&(Math.abs(p.x-d.px)>1.5*d.bW&&d.timerArg1>0?(t=l.x,a=l.y,i=0):(t=p.x,a=p.y,i=1),n=t-d.px>>0,o=a-d.py>>0,d.timerArg1<0?(s=.7*d.speed,d.py=d.arc(d.bW,n,p.y)):(s=d.speed,d.py=o*s+d.py),d.px=n*s+d.px,d.drawPage(d.timerArg0,new r(d.px,d.py)),0==n&&0==o&&(d.rPage0.removeAllChildren(),d.rPage1.removeAllChildren(),d.shadow0.visible=!1,d.shadow1.visible=!1,d.toPage=0==i?d.currPage:d.toPage,d.currPage=d.toPage,d.pageMC.removeAllChildren(),d.setPage(d.currPage),d.state="stop",d.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}(t);e.FlipBook=o}(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 d=e.call(this,n,r,0,o)||this;d._items=null,d.data=[],d.downL=null,d._lastFirstId=-1;var p=d;return p._isInit=!1,p._instanceType="annieUI.ScrollList",p._itemW=a,p._itemH=i,p._items=[],p._itemClass=t,p._itemCount=0,p._cols=s,p._updateViewRect(),p.addEventListener(annie.Event.ENTER_FRAME,p.flushData.bind(p)),d}return __extends(t,e),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(!a._isInit||t?(a.data=e,a._isInit=!0):a.data=a.data.concat(e),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}},t.prototype.flushData=function(){var e=this;if(e._isInit){var t=(Math.abs(Math.floor(e.view[e.paramXY]/e._itemRow))-1)*e._cols;if((t=t<0?0:t)!=e._lastFirstId){var a=-1==e._lastFirstId;if(e._lastFirstId=t,t!=e._items[0].id)for(var i=0;i<e._cols;i++)e.speed>0?e._items.unshift(e._items.pop()):e._items.push(e._items.shift());for(var n=0;n<e._itemCount;n++){var r=e._items[n];(r.id!=t||a)&&(r.initData(e.data[t]?t:-1,e.data[t]),r.visible=!!e.data[t],r[e.paramXY]=Math.floor(t/e._cols)*e._itemRow,r[e._disParam]=t%e._cols*e._itemCol),t++}}}},t.prototype.setViewRect=function(t,a,i){e.prototype.setViewRect.call(this,t,a,i);var n=this;n._itemRow&&n._itemCol&&n._updateViewRect()},t.prototype._updateViewRect=function(){var e=this;e.isVertical?(e._disParam="x",e._itemRow=e._itemH,e._itemCol=e._itemW):(e._disParam="y",e._itemRow=e._itemW,e._itemCol=e._itemH);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}(e.ScrollPage);e.ScrollList=t}(annieUI||(annieUI={}));var annieUI;!function(e){var t=function(e){function t(t,a,i){void 0===i&&(i="");var n=e.call(this)||this;n.context=null,n._isMouseDown=!1,n._drawRadius=50,n.drawColor="#ffffff",n.bgColor="",n.drawWidth=0,n.drawHeight=0,n.totalStepList=[],n.currentStepId=0;var r=n,o=document.createElement("canvas");o.width=t,o.height=a,r.context=o.getContext("2d"),r.context.lineCap="round",r.context.lineJoin="round",r.bitmapData=o,r.drawHeight=a,r.drawWidth=t,r.reset(i);var s=r.onMouseDown.bind(r),d=r.onMouseMove.bind(r),p=r.onMouseUp.bind(r);return r.addEventListener(annie.MouseEvent.MOUSE_DOWN,s),r.addEventListener(annie.MouseEvent.MOUSE_MOVE,d),r.addEventListener(annie.MouseEvent.MOUSE_UP,p),n}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.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){var a=t.context,i=e.localX>>0,n=e.localY>>0;a.lineTo(i,n),a.stroke(),t.addStepObj.ps.push(i,n)}},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.context.clearRect(0,0,t.bitmapData.width,t.bitmapData.height),t.currentStepId=0,t.totalStepList=[]},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}(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.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("onDrawTime",{per:i})}}}),o}return __extends(t,e),t.prototype.reset=function(t){void 0===t&&(t=""),e.prototype.reset.call(this,t);var a=this;if(a._drawList){""!=t&&(a.drawColor=t),a._currentDraw=0;var i=Math.floor(a.drawWidth/a._drawRadius),n=Math.floor(a.drawHeight/a._drawRadius);a._totalDraw=i*n;for(var r=0;r<i;r++){a._drawList[r]=[];for(var o=0;o<n;o++)a._drawList[r][o]=!0}}},t.prototype.cancel=function(e){return void 0===e&&(e=0),trace("no support"),!1},Object.defineProperty(t.prototype,"drawRadius",{set:function(e){var t=this;t._drawRadius=e;var a=Math.floor(t.drawWidth/e),i=Math.floor(t.drawHeight/e);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}(e.DrawingBoard);e.ScratchCard=t}(annieUI||(annieUI={}));