var egret;!function(t){var e;!function(e){function i(e,i,n,r,a){var s=t.TextField.default_fontFamily;return egret_native.Label.createLabel(s,n,"",0),egret_native.Label.getTextSize(e)[0]}t.sys.measureText=i}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i={"source-over":[1,771],lighter:[770,1],"destination-out":[0,771],"destination-in":[0,770]},n=function(n){function r(){n.apply(this,arguments),this.$matrix=new t.Matrix,this.$nativeContext=egret_native.Graphics,this.$nativeGraphicsContext=egret_native.rastergl,this.$globalCompositeOperation="source-over",this.$globalAlpha=1,this.$lineWidth=0,this.$strokeStyle="#000000",this.$fillStyle="#000000",this.$font="10px sans-serif",this.$fontSize=10,this.clipRectArray=null,this.$saveList=[],this.$clipRect=new t.Rectangle,this.$saveCount=0,this.$clipList=[],this.$hasStrokeText=!1}__extends(r,n);var a=__define,s=r,o=s.prototype;return a(o,"globalCompositeOperation",function(){return this.$globalCompositeOperation},function(t){this.$globalCompositeOperation=t;var n=i[t];n&&(this.checkSurface(),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setBlendArg(n[0],n[1]))}),a(o,"globalAlpha",function(){return this.$globalAlpha},function(t){this.$globalAlpha=t,this.checkSurface(),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setGlobalAlpha(t)}),a(o,"lineWidth",function(){return this.$lineWidth},function(t){this.$lineWidth=t,e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setLineWidth(t),this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.setLineWidth(t)}),a(o,"strokeStyle",function(){return this.$strokeStyle},function(t){this.$strokeStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),e.$cmdManager.setContext(egret_native.Label),e.$cmdManager.setStrokeColor(parseInt(t.replace("#","0x")))),this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext);var i=e.$cmdManager.pushString(t);e.$cmdManager.setStrokeStyle(i)}),a(o,"fillStyle",function(){return this.$fillStyle},function(t){this.$fillStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),e.$cmdManager.setContext(egret_native.Label),e.$cmdManager.setTextColor(parseInt(t.replace("#","0x")))),this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext);var i=e.$cmdManager.pushString(t);e.$cmdManager.setFillStyle(i)}),o.$fillColorStr=function(t){return t.length<2&&(t="0"+t),t},o.$parseRGBA=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(255*parseFloat(i[3])).toString(16),r=parseInt(i[0]).toString(16),a=parseInt(i[1]).toString(16),s=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)+this.$fillColorStr(s)},o.$parseRGB=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(i[0]).toString(16),r=parseInt(i[1]).toString(16),a=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)},a(o,"font",function(){return this.$font},function(t){this.$font=t;for(var e=t.split(" "),i=e.length,n=0;i>n;n++){var r=e[n];if(-1!=r.indexOf("px"))return void(this.$fontSize=parseInt(r.replace("px","")))}}),o.arc=function(t,i,n,r,a,s){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.arc(t,i,n,r,a,s?1:0)},o.quadraticCurveTo=function(t,i,n,r){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.quadraticCurveTo(t,i,n,r)},o.lineTo=function(t,i){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.lineTo(t,i)},o.fill=function(t){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext);var i=e.$cmdManager.pushString(t);e.$cmdManager.fill(i)},o.closePath=function(){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.closePath()},o.rect=function(t,i,n,r){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.rect(t,i,n,r),this.$clipRect.setTo(t,i,n,r)},o.moveTo=function(t,i){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.moveTo(t,i)},o.fillRect=function(t,i,n,r){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.fillRect(t,i,n,r)},o.bezierCurveTo=function(t,i,n,r,a,s){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.bezierCurveTo(t,i,n,r,a,s)},o.stroke=function(){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.stroke()},o.strokeRect=function(t,i,n,r){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.strokeRect(t,i,n,r)},o.beginPath=function(){this.checkSurface(),e.$cmdManager.setContext(this.$nativeGraphicsContext),e.$cmdManager.beginPath()},o.arcTo=function(t,e,i,n,r){this.checkSurface(),this.$nativeGraphicsContext.arcTo(t,e,i,n,r)},o.transform=function(t,e,i,n,r,a){this.$matrix.append(t,e,i,n,r,a),this.setTransformToNative()},o.translate=function(t,e){this.$matrix.translate(t,e),this.setTransformToNative()},o.scale=function(t,e){this.$matrix.scale(t,e),this.setTransformToNative()},o.rotate=function(t){this.$matrix.rotate(t),this.setTransformToNative()},o.restore=function(){if(this.$saveCount>0){if(this.$saveList.length){var t=this.$saveList.pop();for(var i in t)this[i]=t[i];this.setTransformToNative()}var n=this.$clipList.indexOf(this.$saveCount);if(-1!=n){var r=this.$clipList.length;for(this.$clipList.splice(n,r-n);r>n;n++)this.checkSurface(),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.popClip()}this.$saveCount--}},o.save=function(){var e=new t.Matrix;e.copyFrom(this.$matrix),this.$saveList.push({lineWidth:this.$lineWidth,globalCompositeOperation:this.$globalCompositeOperation,globalAlpha:this.$globalAlpha,strokeStyle:this.$strokeStyle,fillStyle:this.$fillStyle,font:this.$font,$matrix:e}),this.$saveCount++},o.clip=function(t){this.$clipRect.width>0&&this.$clipRect.height>0&&(this.checkSurface(),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.pushClip(this.$clipRect.x,this.$clipRect.y,this.$clipRect.width,this.$clipRect.height),this.$clipRect.setEmpty(),this.$clipList.push(this.$saveCount))},o.clearRect=function(t,i,n,r){this.checkSurface(),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.clearScreen(0,0,0,0)},o.setTransform=function(t,e,i,n,r,a){this.$matrix.setTo(t,e,i,n,r,a),this.setTransformToNative()},o.setTransformToNative=function(){var t=this.$matrix;this.checkSurface(),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setTransform(t.a,t.b,t.c,t.d,t.tx,t.ty)},o.createLinearGradient=function(t,e,i,n){return this.checkSurface(),this.$nativeGraphicsContext.createLinearGradient(t,e,i,n)},o.createRadialGradient=function(t,e,i,n,r,a){return this.checkSurface(),this.$nativeGraphicsContext.createRadialGradient(t,e,i,n,r,a)},o.fillText=function(i,n,r,a){var s=t.TextField.default_fontFamily;e.$cmdManager.setContext(egret_native.Label);var o=e.$cmdManager.pushString(s),h=e.$cmdManager.pushString("");e.$cmdManager.createLabel(o,this.$fontSize,h,this.$hasStrokeText?this.$lineWidth:0),this.$hasStrokeText=!1;var c=e.$cmdManager.pushString(i);e.$cmdManager.drawText(c,n,r)},o.strokeText=function(t,e,i,n){this.$hasStrokeText=!0},o.measureText=function(i){var n=t.TextField.default_fontFamily;e.$cmdManager.setContext(egret_native.Label);var r=e.$cmdManager.pushString(n),a=e.$cmdManager.pushString("");return e.$cmdManager.createLabel(r,this.$fontSize,a,this.$hasStrokeText?this.$lineWidth:0),{width:egret_native.Label.getTextSize(i)[0]}},o.drawImage=function(t,i,n,r,a,s,o,h,c){var u,l;if(t.$nativeRenderTexture?(u=t.$nativeRenderTexture,l=!0):(u=t,l=!1),u){3==arguments.length?(s=i,o=n,i=0,n=0,r=h=t.width,a=c=t.height):5==arguments.length?(s=i,o=n,h=r,c=a,i=0,n=0,r=t.width,a=t.height):(void 0==r&&(r=t.width),void 0==a&&(a=t.height),void 0==s&&(s=0),void 0==o&&(o=0),void 0==h&&(h=r),void 0==c&&(c=a)),this.checkSurface();var f;l?f=u.___native_texture__p:(u._native_tex_loc||(u._native_tex_loc=u.___native_texture__p),f=u._native_tex_loc),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.drawImage(f,i,n,r,a,s,o,h,c)}},o.createPattern=function(t,e){return null},o.getImageData=function(t,i,n,r){e.$cmdManager.flush();var a;return e.$currentSurface==this.surface&&null!=e.$currentSurface&&e.$currentSurface.end(),a=this.surface.getImageData(t,i,n,r),a.pixelData&&(a.data=a.pixelData),a},o.checkSurface=function(){e.$currentSurface!=this.surface&&(null!=e.$currentSurface&&e.$currentSurface.end(),this.surface&&this.surface.begin())},r}(t.HashObject);e.NativeRenderTextureRenderContext=n,t.registerClass(n,"egret.native.NativeRenderTextureRenderContext")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i={"source-over":[1,771],lighter:[770,1],"destination-out":[0,771],"destination-in":[0,770]},n=function(n){function r(){n.apply(this,arguments),this.$matrix=new t.Matrix,this.$nativeContext=egret_native.Graphics,this.$nativeGraphicsContext=egret_native.rastergl,this.$globalCompositeOperation="source-over",this.$globalAlpha=1,this.$lineWidth=0,this.$strokeStyle="#000000",this.$fillStyle="#000000",this.$font="10px sans-serif",this.$fontSize=10,this.clipRectArray=null,this.$saveList=[],this.$clipRect=new t.Rectangle,this.$saveCount=0,this.$clipList=[],this.$hasStrokeText=!1}__extends(r,n);var a=__define,s=r,o=s.prototype;return a(o,"globalCompositeOperation",function(){return this.$globalCompositeOperation},function(t){this.$globalCompositeOperation=t;var e=i[t];e&&(this.checkSurface(),this.$nativeContext.setBlendArg(e[0],e[1]))}),a(o,"globalAlpha",function(){return this.$globalAlpha},function(t){this.$globalAlpha=t,this.checkSurface(),this.$nativeContext.setGlobalAlpha(t)}),a(o,"lineWidth",function(){return this.$lineWidth},function(t){this.$lineWidth=t,this.$nativeContext.lineWidth=t,this.checkSurface(),this.$nativeGraphicsContext.lineWidth=t}),a(o,"strokeStyle",function(){return this.$strokeStyle},function(t){this.$strokeStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),egret_native.Label.setStrokeColor(parseInt(t.replace("#","0x")))),this.checkSurface(),this.$nativeGraphicsContext.strokeStyle=t}),a(o,"fillStyle",function(){return this.$fillStyle},function(t){this.$fillStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),egret_native.Label.setTextColor(parseInt(t.replace("#","0x")))),this.checkSurface(),this.$nativeGraphicsContext.fillStyle=t}),o.$fillColorStr=function(t){return t.length<2&&(t="0"+t),t},o.$parseRGBA=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(255*parseFloat(i[3])).toString(16),r=parseInt(i[0]).toString(16),a=parseInt(i[1]).toString(16),s=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)+this.$fillColorStr(s)},o.$parseRGB=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(i[0]).toString(16),r=parseInt(i[1]).toString(16),a=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)},a(o,"font",function(){return this.$font},function(t){this.$font=t;for(var e=t.split(" "),i=e.length,n=0;i>n;n++){var r=e[n];if(-1!=r.indexOf("px"))return void(this.$fontSize=parseInt(r.replace("px","")))}}),o.arc=function(t,e,i,n,r,a){this.checkSurface(),this.$nativeGraphicsContext.arc(t,e,i,n,r,a)},o.quadraticCurveTo=function(t,e,i,n){this.checkSurface(),this.$nativeGraphicsContext.quadraticCurveTo(t,e,i,n)},o.lineTo=function(t,e){this.checkSurface(),this.$nativeGraphicsContext.lineTo(t,e)},o.fill=function(t){this.checkSurface(),this.$nativeGraphicsContext.fill(t)},o.closePath=function(){this.checkSurface(),this.$nativeGraphicsContext.closePath()},o.rect=function(t,e,i,n){this.checkSurface(),this.$nativeGraphicsContext.rect(t,e,i,n),this.$clipRect.setTo(t,e,i,n)},o.moveTo=function(t,e){this.checkSurface(),this.$nativeGraphicsContext.moveTo(t,e)},o.fillRect=function(t,e,i,n){this.checkSurface(),this.$nativeGraphicsContext.fillRect(t,e,i,n)},o.bezierCurveTo=function(t,e,i,n,r,a){this.checkSurface(),this.$nativeGraphicsContext.bezierCurveTo(t,e,i,n,r,a)},o.stroke=function(){this.checkSurface(),this.$nativeGraphicsContext.stroke()},o.strokeRect=function(t,e,i,n){this.checkSurface(),this.$nativeGraphicsContext.strokeRect(t,e,i,n)},o.beginPath=function(){this.checkSurface(),this.$nativeGraphicsContext.beginPath()},o.arcTo=function(t,e,i,n,r){this.checkSurface(),this.$nativeGraphicsContext.arcTo(t,e,i,n,r)},o.transform=function(t,e,i,n,r,a){this.$matrix.append(t,e,i,n,r,a),this.setTransformToNative()},o.translate=function(t,e){this.$matrix.translate(t,e),this.setTransformToNative()},o.scale=function(t,e){this.$matrix.scale(t,e),this.setTransformToNative()},o.rotate=function(t){this.$matrix.rotate(t),this.setTransformToNative()},o.restore=function(){if(this.$saveCount>0){if(this.$saveList.length){var t=this.$saveList.pop();for(var e in t)this[e]=t[e];this.setTransformToNative()}var i=this.$clipList.indexOf(this.$saveCount);if(-1!=i){var n=this.$clipList.length;for(this.$clipList.splice(i,n-i);n>i;i++)this.checkSurface(),this.$nativeContext.popClip()}this.$saveCount--}},o.save=function(){var e=new t.Matrix;e.copyFrom(this.$matrix),this.$saveList.push({lineWidth:this.$lineWidth,globalCompositeOperation:this.$globalCompositeOperation,globalAlpha:this.$globalAlpha,strokeStyle:this.$strokeStyle,fillStyle:this.$fillStyle,font:this.$font,$matrix:e}),this.$saveCount++},o.clip=function(t){this.$clipRect.width>0&&this.$clipRect.height>0&&(this.checkSurface(),this.$nativeContext.pushClip(this.$clipRect.x,this.$clipRect.y,this.$clipRect.width,this.$clipRect.height),this.$clipRect.setEmpty(),this.$clipList.push(this.$saveCount))},o.clearRect=function(t,e,i,n){this.checkSurface(),this.$nativeContext.clearScreen(0,0,0)},o.setTransform=function(t,e,i,n,r,a){this.$matrix.setTo(t,e,i,n,r,a),this.setTransformToNative()},o.setTransformToNative=function(){var t=this.$matrix;this.checkSurface(),this.$nativeContext.setTransform(t.a,t.b,t.c,t.d,t.tx,t.ty)},o.createLinearGradient=function(t,e,i,n){return this.checkSurface(),this.$nativeGraphicsContext.createLinearGradient(t,e,i,n)},o.createRadialGradient=function(t,e,i,n,r,a){return this.checkSurface(),this.$nativeGraphicsContext.createRadialGradient(t,e,i,n,r,a)},o.fillText=function(e,i,n,r){var a=t.TextField.default_fontFamily;egret_native.Label.createLabel(a,this.$fontSize,"",this.$hasStrokeText?this.$lineWidth:0),this.$hasStrokeText=!1,egret_native.Label.drawText(e,i,n)},o.strokeText=function(t,e,i,n){this.$hasStrokeText=!0},o.measureText=function(e){var i=t.TextField.default_fontFamily;return egret_native.Label.createLabel(i,this.$fontSize,"",this.$hasStrokeText?this.$lineWidth:0),{width:egret_native.Label.getTextSize(e)[0]}},o.drawImage=function(t,e,i,n,r,a,s,o,h){var c,u;t.$nativeRenderTexture?(c=t.$nativeRenderTexture,u=!0):(c=t,u=!1),c&&(3==arguments.length?(a=e,s=i,e=0,i=0,n=o=t.width,r=h=t.height):5==arguments.length?(a=e,s=i,o=n,h=r,e=0,i=0,n=t.width,r=t.height):(void 0==n&&(n=t.width),void 0==r&&(r=t.height),void 0==a&&(a=0),void 0==s&&(s=0),void 0==o&&(o=n),void 0==h&&(h=r)),this.checkSurface(),this.$nativeContext.drawImage(c,e,i,n,r,a,s,o,h))},o.createPattern=function(t,e){return null},o.getImageData=function(t,i,n,r){var a;return e.$currentSurface==this.surface&&null!=e.$currentSurface&&e.$currentSurface.end(),a=this.surface.getImageData(t,i,n,r),a.pixelData&&(a.data=a.pixelData),a},o.checkSurface=function(){e.$currentSurface!=this.surface&&(null!=e.$currentSurface&&e.$currentSurface.end(),this.surface&&this.surface.begin())},r}(t.HashObject);e.OldNativeRenderTextureRenderContext=n,t.registerClass(n,"egret.native.OldNativeRenderTextureRenderContext")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(t){function i(){t.call(this),this.$widthReadySet=!1,this.$heightReadySet=!1,this.$isRoot=!1,this.$isDispose=!1,this.renderContext=e.$supportCmdBatch?new e.NativeRenderTextureRenderContext:new e.OldNativeRenderTextureRenderContext}__extends(i,t);var n=__define,r=i,a=r.prototype;return a.toDataURL=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return this.$nativeRenderTexture?this.$nativeRenderTexture.toDataURL.apply(this.$nativeRenderTexture,arguments):null},a.saveToFile=function(t,e){this.$nativeRenderTexture&&this.$nativeRenderTexture.saveToFile&&this.$nativeRenderTexture.saveToFile(t,e)},n(a,"width",function(){return this.$width},function(t){this.$width!=t&&(this.$width=t,this.$isDispose||(this.$widthReadySet=!0,this.createRenderTexture()))}),n(a,"height",function(){return this.$height},function(t){this.$height!=t&&(this.$height=t,this.$isDispose||(this.$heightReadySet=!0,this.createRenderTexture()))}),a.getImageData=function(t,e,i,n){return t!=Math.floor(t)&&(t=Math.floor(t),i++),e!=Math.floor(e)&&(e=Math.floor(e),n++),this.$nativeRenderTexture.getPixels(t,e,i,n)},a.createRenderTexture=function(){this.$isRoot||(this.$nativeRenderTexture||this.$widthReadySet&&this.$heightReadySet)&&(this.$nativeRenderTexture&&this.$nativeRenderTexture.dispose(),this.$nativeRenderTexture=new egret_native.RenderTexture(this.$width,this.$height),this.renderContext.globalAlpha=1,this.renderContext.globalCompositeOperation="source-over",this.renderContext.setTransform(1,0,0,1,0,0),this.$widthReadySet=!1,this.$heightReadySet=!1)},a.begin=function(){this.$nativeRenderTexture&&(e.$currentSurface=this,this.$nativeRenderTexture.getIn?this.$nativeRenderTexture.getIn():this.$nativeRenderTexture.begin())},a.end=function(){this.$nativeRenderTexture&&(e.$currentSurface=null,this.$nativeRenderTexture.getOut?this.$nativeRenderTexture.getOut():this.$nativeRenderTexture.end())},a.getContext=function(t){return this.renderContext},i}(t.HashObject);e.NativeRenderTexture=i,t.registerClass(i,"egret.native.NativeRenderTexture")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){function i(t,i){var n=new e.NativeRenderTexture;return isNaN(t)||isNaN(i)||(n.width=t,n.height=i),n}var n,r=function(){function t(t,e){this.surface=i(t,e),this.context=this.surface.getContext("2d")}var e=__define,r=t,a=r.prototype;return e(a,"width",function(){return this.surface.width}),e(a,"height",function(){return this.surface.height}),a.resize=function(t,e,i){var n=this.surface;i?(n.width<t&&(n.width=t),n.height<e&&(n.height=e)):(n.width!=t&&(n.width=t),n.height!=e&&(n.height=e)),this.clear()},a.resizeTo=function(t,e,r,a){n||(n=i());var s=(this.context,this.surface),o=n,h=o.getContext("2d");n=s,this.context=h,this.surface=o,o.width=Math.max(t,1),o.height=Math.max(e,1),h.setTransform(1,0,0,1,0,0),h.drawImage(s,r,a),s.height=1,s.width=1},a.setDirtyRegionPolicy=function(t){},a.beginClip=function(t,e,i){e=+e||0,i=+i||0;var n=this.context;n.save(),n.beginPath(),n.setTransform(1,0,0,1,e,i);for(var r=t.length,a=0;r>a;a++){var s=t[a];n.clearRect(s.minX,s.minY,s.width,s.height),n.rect(s.minX,s.minY,s.width,s.height)}n.clip()},a.endClip=function(){this.context.restore()},a.getPixel=function(t,e){return this.context.getImageData(t,e,1,1).data},a.toDataURL=function(t,e){return this.surface.toDataURL(t,e)},a.clear=function(){var t=this.surface.width,e=this.surface.height;t>0&&e>0&&(this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,t,e))},a.destroy=function(){this.surface.width=this.surface.height=1},t}();e.NativeRenderTextureRenderBuffer=r,t.registerClass(r,"egret.native.NativeRenderTextureRenderBuffer",["egret.sys.RenderBuffer"])}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i={"source-over":[1,771],lighter:[770,1],"destination-out":[0,771],"destination-in":[0,770]},n=function(n){function r(){n.apply(this,arguments),this.$matrix=new t.Matrix,this.$nativeContext=null,this.$globalCompositeOperation="source-over",this.$globalAlpha=1,this.$lineWidth=0,this.$strokeStyle="#000000",this.$fillStyle="#000000",this.$font="10px sans-serif",this.$fontSize=10,this.clipRectArray=null,this.$saveList=[],this.$clipRectArray=[],this.$clipRect=new t.Rectangle,this.$saveCount=0,this.$clipList=[],this.savedMatrix=new t.Matrix,this.$hasStrokeText=!1}__extends(r,n);var a=__define,s=r,o=s.prototype;return a(o,"globalCompositeOperation",function(){return this.$globalCompositeOperation},function(t){this.$globalCompositeOperation=t;var n=i[t];n&&(e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setBlendArg(n[0],n[1]))}),a(o,"globalAlpha",function(){return this.$globalAlpha},function(t){this.$globalAlpha=t,e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setGlobalAlpha(t)}),a(o,"lineWidth",function(){return this.$lineWidth},function(t){this.$lineWidth=t,e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setLineWidth(t)}),a(o,"strokeStyle",function(){return this.$strokeStyle},function(t){this.$strokeStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),e.$cmdManager.setContext(egret_native.Label),e.$cmdManager.setStrokeColor(parseInt(t.replace("#","0x")))),e.$cmdManager.setContext(this.$nativeContext);var i=e.$cmdManager.pushString(t);e.$cmdManager.setStrokeStyle(i)}),a(o,"fillStyle",function(){return this.$fillStyle},function(t){this.$fillStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),e.$cmdManager.setContext(egret_native.Label),e.$cmdManager.setTextColor(parseInt(t.replace("#","0x")))),e.$cmdManager.setContext(this.$nativeContext);var i=e.$cmdManager.pushString(t);e.$cmdManager.setFillStyle(i)}),o.$fillColorStr=function(t){return t.length<2&&(t="0"+t),t},o.$parseRGBA=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(255*parseFloat(i[3])).toString(16),r=parseInt(i[0]).toString(16),a=parseInt(i[1]).toString(16),s=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)+this.$fillColorStr(s)},o.$parseRGB=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(i[0]).toString(16),r=parseInt(i[1]).toString(16),a=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)},a(o,"font",function(){return this.$font},function(t){this.$font=t;for(var e=t.split(" "),i=e.length,n=0;i>n;n++){var r=e[n];if(-1!=r.indexOf("px"))return void(this.$fontSize=parseInt(r.replace("px","")))}}),o.arc=function(t,i,n,r,a,s){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.arc(t,i,n,r,a,s?1:0)},o.quadraticCurveTo=function(t,i,n,r){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.quadraticCurveTo(t,i,n,r)},o.lineTo=function(t,i){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.lineTo(t,i)},o.fill=function(t){e.$cmdManager.setContext(this.$nativeContext);var i=e.$cmdManager.pushString(t);e.$cmdManager.fill(i)},o.closePath=function(){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.closePath(),this.clipRectArray&&(this.$clipRectArray=this.clipRectArray,this.clipRectArray=null)},o.rect=function(t,i,n,r){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.rect(t,i,n,r),this.$clipRectArray.push({x:t,y:i,w:n,h:r})},o.moveTo=function(t,i){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.moveTo(t,i)},o.fillRect=function(t,i,n,r){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.fillRect(t,i,n,r)},o.bezierCurveTo=function(t,i,n,r,a,s){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.bezierCurveTo(t,i,n,r,a,s)},o.stroke=function(){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.stroke()},o.strokeRect=function(t,i,n,r){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.strokeRect(t,i,n,r)},o.beginPath=function(){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.beginPath(),this.clipRectArray=this.$clipRectArray.concat()},o.arcTo=function(t,e,i,n,r){this.$nativeContext.arcTo(t,e,i,n,r)},o.transform=function(t,e,i,n,r,a){this.$matrix.append(t,e,i,n,r,a),this.setTransformToNative()},o.translate=function(t,e){this.$matrix.translate(t,e),this.setTransformToNative()},o.scale=function(t,e){this.$matrix.scale(t,e),this.setTransformToNative()},o.rotate=function(t){this.$matrix.rotate(t),this.setTransformToNative()},o.restore=function(){if(this.$saveList.length){var t=this.$saveList.pop();for(var i in t)this[i]=t[i];this.setTransformToNative(),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.restore(),this.clipRectArray=null}},o.save=function(){var i=new t.Matrix;i.copyFrom(this.$matrix),this.$saveList.push({lineWidth:this.$lineWidth,globalCompositeOperation:this.$globalCompositeOperation,globalAlpha:this.$globalAlpha,strokeStyle:this.$strokeStyle,fillStyle:this.$fillStyle,font:this.$font,$matrix:i,$clipRectArray:this.$clipRectArray.concat()}),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.save()},o.clip=function(t){if(this.$clipRectArray.length>0){for(var i=[],n=0;n<this.$clipRectArray.length;n++){var r=this.$clipRectArray[n];i.push(r.x),i.push(r.y),i.push(r.w),i.push(r.h)}e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.pushRectStencils(i),this.$clipRectArray.length=0}},o.clearRect=function(t,i,n,r){e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.clearRect(t,i,n,r)},o.setTransform=function(t,e,i,n,r,a){this.$matrix.setTo(t,e,i,n,r,a),this.setTransformToNative()},o.setTransformToNative=function(){var t=this.$matrix;e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.setTransform(t.a,t.b,t.c,t.d,t.tx,t.ty)},o.saveTransform=function(){this.savedMatrix.copyFrom(this.$matrix)},o.restoreTransform=function(){this.$matrix.copyFrom(this.savedMatrix)},o.createLinearGradient=function(t,e,i,n){return this.$nativeContext.createLinearGradient(t,e,i,n)},o.createRadialGradient=function(t,e,i,n,r,a){return this.$nativeContext.createRadialGradient(t,e,i,n,r,a)},o.fillText=function(i,n,r,a){var s=t.TextField.default_fontFamily;e.$cmdManager.setContext(this.$nativeContext);var o=e.$cmdManager.pushString(s),h=e.$cmdManager.pushString("");e.$cmdManager.createLabel(o,this.$fontSize,h,this.$hasStrokeText?this.$lineWidth:0),this.$hasStrokeText=!1;var c=e.$cmdManager.pushString(i);e.$cmdManager.drawText(c,n,r)},o.strokeText=function(t,e,i,n){this.$hasStrokeText=!0},o.measureText=function(i){var n=t.TextField.default_fontFamily;e.$cmdManager.setContext(egret_native.Label);var r=e.$cmdManager.pushString(n),a=e.$cmdManager.pushString("");return e.$cmdManager.createLabel(r,this.$fontSize,a,this.$hasStrokeText?this.$lineWidth:0),{width:egret_native.Label.getTextSize(i)[0]}},o.drawImage=function(t,i,n,r,a,s,o,h,c){var u,l;if(t.$nativeCanvas?(u=t.$nativeCanvas,l=!0):(u=t,l=!1),u){3==arguments.length?(s=i,o=n,i=0,n=0,r=h=t.width,a=c=t.height):5==arguments.length?(s=i,o=n,h=r,c=a,i=0,n=0,r=t.width,a=t.height):(r||(r=t.width),a||(a=t.height),s||(s=0),o||(o=0),h||(h=r),c||(c=a));var f;l?f=u.___native_texture__p:(u._native_tex_loc||(u._native_tex_loc=u.___native_texture__p),f=u._native_tex_loc),e.$cmdManager.setContext(this.$nativeContext),e.$cmdManager.drawImage(f,i,n,r,a,s,o,h,c)}},o.drawMesh=function(t,i,n,r,a,s,o,h,c,u,l,f,d,v){var g;g=t.$nativeCanvas?t.$nativeCanvas:t,g&&(3==arguments.length?(s=i,o=n,i=0,n=0,r=h=t.width,a=c=t.height):5==arguments.length?(s=i,o=n,h=r,c=a,i=0,n=0,r=t.width,a=t.height):(r||(r=t.width),a||(a=t.height),s||(s=0),o||(o=0),h||(h=r),c||(c=a)),this.vertices=new Float32Array(d.length/2*5),this.indicesForMesh=new Uint32Array(v.length),this.cacheArrays(this.$matrix,1,i,n,r,a,s,o,h,c,u,l,f,d,v),e.$cmdManager.flush(),this.$nativeContext.drawMesh(g,this.vertices,this.indicesForMesh,this.vertices.length,this.indicesForMesh.length))},o.cacheArrays=function(t,e,i,n,r,a,s,o,h,c,u,l,f,d,v){var g=t,p=g.a,$=g.b,x=g.c,y=g.d,m=g.tx,C=g.ty;(0!=s||0!=o)&&g.append(1,0,0,1,s,o),(r/h!=1||a/c!=1)&&g.append(h/r,0,0,c/a,0,0);var S=g.a,T=g.b,_=g.c,w=g.d,R=g.tx,L=g.ty;if(g.a=p,g.b=$,g.c=x,g.d=y,g.tx=m,g.ty=C,d){var b=this.vertices,M=0,E=0,B=0,A=0,O=0,k=0,F=0;for(M=0,B=f.length;B>M;M+=2)E=5*M/2,k=d[M],F=d[M+1],A=f[M],O=f[M+1],b[E+0]=S*k+_*F+R,b[E+1]=T*k+w*F+L,b[E+2]=(i+A*r)/u,b[E+3]=(n+O*a)/l,b[E+4]=e;for(M=0;M<v.length;M++)this.indicesForMesh[M]=v[M]}else console.log("meshVertices not exist");this.vertices=b},o.createPattern=function(t,e){return null},o.getImageData=function(t,i,n,r){e.$cmdManager.flush();var a;return t!=Math.floor(t)&&(t=Math.floor(t),n++),i!=Math.floor(i)&&(i=Math.floor(i),r++),a=this.$nativeContext.getPixels(t,i,n,r),a.pixelData&&(a.data=a.pixelData),a},o.setGlobalShader=function(t){e.$cmdManager.setContext(this.$nativeContext);var i=e.$cmdManager.pushString(t);e.$cmdManager.setGlobalShader(i)},r}(t.HashObject);e.NativeCanvasRenderContext=n,t.registerClass(n,"egret.native.NativeCanvasRenderContext")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i={"source-over":[1,771],lighter:[770,1],"destination-out":[0,771],"destination-in":[0,770]},n=function(e){function n(){e.apply(this,arguments),this.$matrix=new t.Matrix,this.$nativeContext=null,this.$globalCompositeOperation="source-over",this.$globalAlpha=1,this.$lineWidth=0,this.$strokeStyle="#000000",this.$fillStyle="#000000",this.$font="10px sans-serif",this.$fontSize=10,this.clipRectArray=null,this.$saveList=[],this.$clipRectArray=[],this.$clipRect=new t.Rectangle,this.$saveCount=0,this.$clipList=[],this.savedMatrix=new t.Matrix,this.$hasStrokeText=!1}__extends(n,e);var r=__define,a=n,s=a.prototype;return r(s,"globalCompositeOperation",function(){return this.$globalCompositeOperation},function(t){this.$globalCompositeOperation=t;var e=i[t];e&&this.$nativeContext.setBlendArg(e[0],e[1])}),r(s,"globalAlpha",function(){return this.$globalAlpha},function(t){this.$globalAlpha=t,this.$nativeContext.setGlobalAlpha(t)}),r(s,"lineWidth",function(){return this.$lineWidth},function(t){this.$lineWidth=t,this.$nativeContext.lineWidth=t}),r(s,"strokeStyle",function(){return this.$strokeStyle},function(t){this.$strokeStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),egret_native.Label.setStrokeColor(parseInt(t.replace("#","0x")))),this.$nativeContext.strokeStyle=t}),r(s,"fillStyle",function(){return this.$fillStyle},function(t){this.$fillStyle=t,null!=t&&(-1!=t.indexOf("rgba")?t=this.$parseRGBA(t):-1!=t.indexOf("rgb")&&(t=this.$parseRGB(t)),egret_native.Label.setTextColor(parseInt(t.replace("#","0x")))),this.$nativeContext.fillStyle=t}),s.$fillColorStr=function(t){return t.length<2&&(t="0"+t),t},s.$parseRGBA=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(255*parseFloat(i[3])).toString(16),r=parseInt(i[0]).toString(16),a=parseInt(i[1]).toString(16),s=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)+this.$fillColorStr(s)},s.$parseRGB=function(t){var e=t.indexOf("(");t=t.slice(e+1,t.length-1);var i=t.split(","),n=parseInt(i[0]).toString(16),r=parseInt(i[1]).toString(16),a=parseInt(i[2]).toString(16);return t="#"+this.$fillColorStr(n)+this.$fillColorStr(r)+this.$fillColorStr(a)},r(s,"font",function(){return this.$font},function(t){this.$font=t;for(var e=t.split(" "),i=e.length,n=0;i>n;n++){var r=e[n];if(-1!=r.indexOf("px"))return void(this.$fontSize=parseInt(r.replace("px","")))}}),s.arc=function(t,e,i,n,r,a){this.$nativeContext.arc(t,e,i,n,r,a)},s.quadraticCurveTo=function(t,e,i,n){this.$nativeContext.quadraticCurveTo(t,e,i,n)},s.lineTo=function(t,e){this.$nativeContext.lineTo(t,e)},s.fill=function(t){this.$nativeContext.fill(t)
},s.closePath=function(){this.$nativeContext.closePath(),this.clipRectArray&&(this.$clipRectArray=this.clipRectArray,this.clipRectArray=null)},s.rect=function(t,e,i,n){this.$nativeContext.rect(t,e,i,n),this.$clipRectArray.push({x:t,y:e,w:i,h:n})},s.moveTo=function(t,e){this.$nativeContext.moveTo(t,e)},s.fillRect=function(t,e,i,n){this.$nativeContext.fillRect(t,e,i,n)},s.bezierCurveTo=function(t,e,i,n,r,a){this.$nativeContext.bezierCurveTo(t,e,i,n,r,a)},s.stroke=function(){this.$nativeContext.stroke()},s.strokeRect=function(t,e,i,n){this.$nativeContext.strokeRect(t,e,i,n)},s.beginPath=function(){this.$nativeContext.beginPath(),this.clipRectArray=this.$clipRectArray.concat()},s.arcTo=function(t,e,i,n,r){this.$nativeContext.arcTo(t,e,i,n,r)},s.transform=function(t,e,i,n,r,a){this.$matrix.append(t,e,i,n,r,a),this.setTransformToNative()},s.translate=function(t,e){this.$matrix.translate(t,e),this.setTransformToNative()},s.scale=function(t,e){this.$matrix.scale(t,e),this.setTransformToNative()},s.rotate=function(t){this.$matrix.rotate(t),this.setTransformToNative()},s.restore=function(){if(this.$saveList.length){var t=this.$saveList.pop();for(var e in t)this[e]=t[e];this.setTransformToNative(),this.$nativeContext.restore(),this.clipRectArray=null}},s.save=function(){var e=new t.Matrix;e.copyFrom(this.$matrix),this.$saveList.push({lineWidth:this.$lineWidth,globalCompositeOperation:this.$globalCompositeOperation,globalAlpha:this.$globalAlpha,strokeStyle:this.$strokeStyle,fillStyle:this.$fillStyle,font:this.$font,$matrix:e,$clipRectArray:this.$clipRectArray.concat()}),this.$nativeContext.save()},s.clip=function(t){if(this.$clipRectArray.length>0){for(var e=[],i=0;i<this.$clipRectArray.length;i++){var n=this.$clipRectArray[i];e.push(n.x),e.push(n.y),e.push(n.w),e.push(n.h)}this.$nativeContext.pushRectStencils(e),this.$clipRectArray.length=0}},s.clearRect=function(t,e,i,n){this.$nativeContext.clearRect(t,e,i,n)},s.setTransform=function(t,e,i,n,r,a){this.$matrix.setTo(t,e,i,n,r,a),this.setTransformToNative()},s.setTransformToNative=function(){var t=this.$matrix;this.$nativeContext.setTransform(t.a,t.b,t.c,t.d,t.tx,t.ty)},s.saveTransform=function(){this.savedMatrix.copyFrom(this.$matrix)},s.restoreTransform=function(){this.$matrix.copyFrom(this.savedMatrix)},s.createLinearGradient=function(t,e,i,n){return this.$nativeContext.createLinearGradient(t,e,i,n)},s.createRadialGradient=function(t,e,i,n,r,a){return this.$nativeContext.createRadialGradient(t,e,i,n,r,a)},s.fillText=function(e,i,n,r){var a=t.TextField.default_fontFamily;this.$nativeContext.createLabel(a,this.$fontSize,"",this.$hasStrokeText?this.$lineWidth:0),this.$hasStrokeText=!1,this.$nativeContext.drawText(e,i,n)},s.strokeText=function(t,e,i,n){this.$hasStrokeText=!0},s.measureText=function(e){var i=t.TextField.default_fontFamily;return egret_native.Label.createLabel(i,this.$fontSize,"",this.$hasStrokeText?this.$lineWidth:0),{width:egret_native.Label.getTextSize(e)[0]}},s.drawImage=function(t,e,i,n,r,a,s,o,h){var c,u;t.$nativeCanvas?(c=t.$nativeCanvas,u=!0):(c=t,u=!1),c&&(3==arguments.length?(a=e,s=i,e=0,i=0,n=o=t.width,r=h=t.height):5==arguments.length?(a=e,s=i,o=n,h=r,e=0,i=0,n=t.width,r=t.height):(n||(n=t.width),r||(r=t.height),a||(a=0),s||(s=0),o||(o=n),h||(h=r)),this.$nativeContext.drawImage(c,e,i,n,r,a,s,o,h))},s.drawMesh=function(t,e,i,n,r,a,s,o,h,c,u,l,f,d){var v;v=t.$nativeCanvas?t.$nativeCanvas:t,v&&(3==arguments.length?(a=e,s=i,e=0,i=0,n=o=t.width,r=h=t.height):5==arguments.length?(a=e,s=i,o=n,h=r,e=0,i=0,n=t.width,r=t.height):(n||(n=t.width),r||(r=t.height),a||(a=0),s||(s=0),o||(o=n),h||(h=r)),this.vertices=new Float32Array(f.length/2*5),this.indicesForMesh=new Uint32Array(d.length),this.cacheArrays(this.$matrix,1,e,i,n,r,a,s,o,h,c,u,l,f,d),this.$nativeContext.drawMesh(v,this.vertices,this.indicesForMesh,this.vertices.length,this.indicesForMesh.length))},s.cacheArrays=function(t,e,i,n,r,a,s,o,h,c,u,l,f,d,v){var g=t,p=g.a,$=g.b,x=g.c,y=g.d,m=g.tx,C=g.ty;(0!=s||0!=o)&&g.append(1,0,0,1,s,o),(r/h!=1||a/c!=1)&&g.append(h/r,0,0,c/a,0,0);var S=g.a,T=g.b,_=g.c,w=g.d,R=g.tx,L=g.ty;if(g.a=p,g.b=$,g.c=x,g.d=y,g.tx=m,g.ty=C,d){var b=this.vertices,M=0,E=0,B=0,A=0,O=0,k=0,F=0;for(M=0,B=f.length;B>M;M+=2)E=5*M/2,k=d[M],F=d[M+1],A=f[M],O=f[M+1],b[E+0]=S*k+_*F+R,b[E+1]=T*k+w*F+L,b[E+2]=(i+A*r)/u,b[E+3]=(n+O*a)/l,b[E+4]=e;for(M=0;M<v.length;M++)this.indicesForMesh[M]=v[M]}else console.log("meshVertices not exist");this.vertices=b},s.createPattern=function(t,e){return null},s.getImageData=function(t,e,i,n){var r;return t!=Math.floor(t)&&(t=Math.floor(t),i++),e!=Math.floor(e)&&(e=Math.floor(e),n++),r=this.$nativeContext.getPixels(t,e,i,n),r.pixelData&&(r.data=r.pixelData),r},n}(t.HashObject);e.OldNativeCanvasRenderContext=n,t.registerClass(n,"egret.native.OldNativeCanvasRenderContext")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(t){function i(){t.call(this),this.$width=0,this.$height=0,this.renderContext=e.$supportCmdBatch?new e.NativeCanvasRenderContext:new e.OldNativeCanvasRenderContext}__extends(i,t);var n=__define,r=i,a=r.prototype;return a.toDataURL=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return this.$nativeCanvas?this.$nativeCanvas.toDataURL.apply(this.$nativeCanvas,arguments):null},a.saveToFile=function(t,e){this.$nativeCanvas&&this.$nativeCanvas.saveToFile&&this.$nativeCanvas.saveToFile(t,e)},n(a,"width",function(){return this.$width},function(t){if(t>0)if(this.$width=t,this.$nativeCanvas)this.$nativeCanvas.width=t;else{this.$nativeCanvas=new egret_native.Canvas(t,1),this.$isRoot&&egret_native.setScreenCanvas(this.$nativeCanvas);var i=this.$nativeCanvas.getContext("2d");e.$supportCmdBatch?(e.$cmdManager.setContext(i),e.$cmdManager.clearScreen(0,0,0,0)):i.clearScreen(0,0,0,0),this.renderContext.$nativeContext=i}}),n(a,"height",function(){return this.$height},function(t){if(t>0)if(this.$height=t,this.$nativeCanvas)this.$nativeCanvas.height=t;else{this.$nativeCanvas=new egret_native.Canvas(1,t),this.$isRoot&&egret_native.setScreenCanvas(this.$nativeCanvas);var i=this.$nativeCanvas.getContext("2d");e.$supportCmdBatch?(e.$cmdManager.setContext(i),e.$cmdManager.clearScreen(0,0,0,0)):i.clearScreen(0,0,0,0),this.renderContext.$nativeContext=i}}),a.getContext=function(t){return this.renderContext},i}(t.HashObject);e.NativeCanvas=i,t.registerClass(i,"egret.native.NativeCanvas")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){function i(t,i){var n=new e.NativeCanvas;return isNaN(t)||isNaN(i)||(n.width=t,n.height=i),n}var n,r=function(){function t(t,e){this.surface=i(t,e),this.context=this.surface.getContext("2d")}var e=__define,r=t,a=r.prototype;return e(a,"width",function(){return this.surface.width}),e(a,"height",function(){return this.surface.height}),a.resize=function(t,e,i){var n=this.surface;n.width=t,n.height=e,this.clear()},a.resizeTo=function(t,e,r,a){n||(n=i());var s=(this.context,this.surface),o=n,h=o.getContext("2d");n=s,this.context=h,this.surface=o,o.width=Math.max(t,1),o.height=Math.max(e,1),h.setTransform(1,0,0,1,0,0),h.drawImage(s,r,a),s.height=1,s.width=1},a.setDirtyRegionPolicy=function(t){},a.beginClip=function(t,e,i){e=+e||0,i=+i||0;var n=this.context;n.save(),n.beginPath(),n.setTransform(1,0,0,1,e,i);for(var r=t.length,a=0;r>a;a++){var s=t[a];n.clearRect(s.minX,s.minY,s.width,s.height),n.rect(s.minX,s.minY,s.width,s.height)}n.clip()},a.endClip=function(){this.context.restore()},a.getPixel=function(t,e){return this.context.getImageData(t,e,1,1).data},a.toDataURL=function(t,e){return this.surface.toDataURL(t,e)},a.clear=function(){var t=this.surface.width,e=this.surface.height;t>0&&e>0&&(this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,t,e))},a.destroy=function(){this.surface.width=this.surface.height=1},t}();e.NativeCanvasRenderBuffer=r,t.registerClass(r,"egret.native.NativeCanvasRenderBuffer",["egret.sys.RenderBuffer"])}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){function i(e,i){var n=t.sys.canvasHitTestBuffer,r=e.$getTextureWidth(),a=e.$getTextureHeight();null==i&&(i=t.$TempRectangle,i.x=0,i.y=0,i.width=r,i.height=a),i.x=Math.min(i.x,r-1),i.y=Math.min(i.y,a-1),i.width=Math.min(i.width,r-i.x),i.height=Math.min(i.height,a-i.y);var s=i.width,o=i.height,h=n.surface;n.resize(s,o);var c=e,u=Math.round(c._offsetX),l=Math.round(c._offsetY),f=c._bitmapWidth,d=c._bitmapHeight;return n.context.drawImage(c._bitmapData,c._bitmapX+i.x/t.$TextureScaleFactor,c._bitmapY+i.y/t.$TextureScaleFactor,f*i.width/r,d*i.height/a,u,l,i.width,i.height),h}function n(e,n){try{var r=i(this,n),a=r.toDataURL(e);return a}catch(s){return t.$error(1033),null}}function r(e,n,r){try{var a=i(this,r);a.saveToFile(e,n)}catch(s){t.$error(1033)}}function a(e,i){return t.$error(1035),null}t.Texture.prototype.toDataURL=n,t.Texture.prototype.saveToFile=r,t.Texture.prototype.getPixel32=a}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(i){function n(){i.call(this),this.init(n.option)}__extends(n,i);var r=(__define,n),a=r.prototype;return a.init=function(i){i.showPaintRect=!1;var n=new t.Stage;n.$screen=this,n.$scaleMode=i.scaleMode,n.$maxTouches=i.maxTouches,n.textureScaleFactor=i.textureScaleFactor,n.frameRate=i.frameRate,t["native"].$supportCanvas||n.addEventListener(t.Event.ENTER_FRAME,function(){e.$currentSurface&&e.$currentSurface.end()},this);var r=new t.sys.RenderBuffer(void 0,void 0,!0),a=r.surface;a.$isRoot=!0;var s=new e.NativeTouchHandler(n),o=new t.sys.Player(r,n,i.entryClassName);if(new e.NativeHideHandler(n),o.showPaintRect(i.showPaintRect),i.showFPS||i.showLog){for(var h=i.fpsStyles||"",c=h.split(","),u={},l=0;l<c.length;l++){var f=c[l].split(":");u[f[0]]=f[1]}i.fpsStyles=u,o.displayFPS(i.showFPS,i.showLog,i.logFilter,i.fpsStyles)}this.playerOption=i,this.$stage=n,this.player=o,this.nativeTouch=s,this.updateScreenSize(),this.updateMaxTouches(),o.start()},a.updateScreenSize=function(){var e=this.playerOption,i=egret_native.EGTView.getFrameWidth(),n=egret_native.EGTView.getFrameHeight();t.Capabilities.$boundingClientWidth=i,t.Capabilities.$boundingClientHeight=n;var r=t.sys.screenAdapter.calculateStageSize(this.$stage.$scaleMode,i,n,e.contentWidth,e.contentHeight),a=r.stageWidth,s=r.stageHeight,o=r.displayWidth,h=r.displayHeight,c=(n-h)/2,u=(i-o)/2;egret_native.EGTView.setVisibleRect(u,c,o,h),egret_native.EGTView.setDesignSize(a,s),this.player.updateStageSize(a,s)},a.setContentSize=function(t,e){var i=this.playerOption;i.contentWidth=t,i.contentHeight=e,this.updateScreenSize()},a.updateMaxTouches=function(){this.nativeTouch.$updateMaxTouches()},n}(t.HashObject);e.NativePlayer=i,t.registerClass(i,"egret.native.NativePlayer",["egret.sys.Screen"])}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){function i(i){if(!o){o=!0,i||(i={}),n(i.renderMode);try{t.Capabilities.$setNativeCapabilities(egret_native.getVersion())}catch(r){}var a=t.sys.$ticker,s=e.$supportCmdBatch?function(){a.update(),e.$cmdManager.flush()}:function(){a.update()};egret_native.executeMainLoop(s,a),t.sys.screenAdapter||(i.screenAdapter?t.sys.screenAdapter=i.screenAdapter:t.sys.screenAdapter=new t.sys.DefaultScreenAdapter);var c=new e.NativePlayer;h.push(c),t.sys.customHitTestBuffer=new e.NativeCanvasRenderBuffer(3,3),t.sys.canvasHitTestBuffer=t.sys.customHitTestBuffer,e.$supportCanvas||(c.$stage.dirtyRegionPolicy=t.DirtyRegionPolicy.OFF,t.sys.DisplayList.prototype.setDirtyRegionPolicy=function(){})}}function n(i){e.$supportCanvas?(t.sys.RenderBuffer=e.NativeCanvasRenderBuffer,t.sys.CanvasRenderBuffer=e.NativeCanvasRenderBuffer):(t.sys.RenderBuffer=e.NativeRenderTextureRenderBuffer,t.sys.CanvasRenderBuffer=e.NativeRenderTextureRenderBuffer),t.sys.systemRenderer=new t.CanvasRenderer,t.sys.canvasRenderer=t.sys.systemRenderer,t.Capabilities.$renderMode="canvas"}function r(){for(var t=h.length,e=0;t>e;e++)h[e].updateScreenSize()}function a(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i]);return e}e.$supportCanvas=egret_native.Canvas?!0:!1,e.$supportCmdBatch=egret_native.sendToC?!0:!1;var s=function(){function t(){this.maxArrayBufferLen=8e4,this.arrayBuffer=new ArrayBuffer(4*this.maxArrayBufferLen),this.uint32View=new Uint32Array(this.arrayBuffer),this.float32View=new Float32Array(this.arrayBuffer),this.arrayBufferLen=0,this.strArray=new Array}var e=(__define,t),i=e.prototype;return i.flush=function(){egret_native.sendToC(this.float32View,this.arrayBufferLen,this.strArray),this.clear()},i.setContext=function(t){if(this.context!=t){this.arrayBufferLen+3>this.maxArrayBufferLen&&this.flush(),this.context=t;var e=this.uint32View,i=this.arrayBufferLen;e[i++]=1e3;var n=t.___native_texture__p;e[i++]=n/4294967296>>>0,e[i++]=(4294967295&n)>>>0,this.arrayBufferLen=i}},i.clear=function(){this.arrayBufferLen=0,this.strArray.length=0},i.pushString=function(t){var e=this.strArray,i=e.length;return e[i]=t,i},i.clearScreen=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.arrayBufferLen;r[a++]=100,r[a++]=t,r[a++]=e,r[a++]=i,r[a++]=n,this.arrayBufferLen=a},i.drawImage=function(t,e,i,n,r,a,s,o,h){this.arrayBufferLen+11>this.maxArrayBufferLen&&this.flush();var c=this.uint32View,u=this.float32View,l=this.arrayBufferLen;c[l++]=101,c[l++]=t/4294967296>>>0,c[l++]=(4294967295&t)>>>0,u[l++]=e,u[l++]=i,u[l++]=n,u[l++]=r,u[l++]=a,u[l++]=s,u[l++]=o,u[l++]=h,this.arrayBufferLen=l},i.setTransform=function(t,e,i,n,r,a){this.arrayBufferLen+7>this.maxArrayBufferLen&&this.flush();var s=this.uint32View,o=this.float32View,h=this.arrayBufferLen;s[h++]=103,o[h++]=t,o[h++]=e,o[h++]=i,o[h++]=n,o[h++]=r,o[h++]=a,this.arrayBufferLen=h},i.setGlobalAlpha=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.float32View,n=this.arrayBufferLen;e[n++]=106,i[n++]=t,this.arrayBufferLen=n},i.pushRectStencils=function(t){var e=t.length;this.arrayBufferLen+e+1>this.maxArrayBufferLen&&this.flush();var i=this.uint32View,n=this.float32View,r=this.arrayBufferLen;i[r++]=113,i[r++]=e;for(var a=0;e>a;a++)n[r++]=t[a];this.arrayBufferLen=r},i.restore=function(){this.arrayBufferLen+1>this.maxArrayBufferLen&&this.flush(),this.uint32View[this.arrayBufferLen++]=116},i.save=function(){this.arrayBufferLen+1>this.maxArrayBufferLen&&this.flush(),this.uint32View[this.arrayBufferLen++]=117},i.setBlendArg=function(t,e){this.arrayBufferLen+3>this.maxArrayBufferLen&&this.flush();var i=this.uint32View,n=this.float32View,r=this.arrayBufferLen;i[r++]=120,n[r++]=t,n[r++]=e,this.arrayBufferLen=r},i.beginPath=function(){this.arrayBufferLen+1>this.maxArrayBufferLen&&this.flush(),this.uint32View[this.arrayBufferLen++]=204},i.closePath=function(){this.arrayBufferLen+1>this.maxArrayBufferLen&&this.flush(),this.uint32View[this.arrayBufferLen++]=205},i.rect=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.float32View,s=this.arrayBufferLen;r[s++]=210,a[s++]=t,a[s++]=e,a[s++]=i,a[s++]=n,this.arrayBufferLen=s},i.clearRect=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.float32View,s=this.arrayBufferLen;r[s++]=214,a[s++]=t,a[s++]=e,a[s++]=i,a[s++]=n,this.arrayBufferLen=s},i.createLabel=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.float32View,s=this.arrayBufferLen;r[s++]=300,r[s++]=t,a[s++]=e,r[s++]=i,a[s++]=n,this.arrayBufferLen=s},i.drawText=function(t,e,i){this.arrayBufferLen+4>this.maxArrayBufferLen&&this.flush();var n=this.uint32View,r=this.float32View,a=this.arrayBufferLen;n[a++]=301,n[a++]=t,r[a++]=e,r[a++]=i,this.arrayBufferLen=a},i.setTextColor=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.arrayBufferLen;e[i++]=302,e[i++]=t,this.arrayBufferLen=i},i.setStrokeColor=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.arrayBufferLen;e[i++]=303,e[i++]=t,this.arrayBufferLen=i},i.setFillStyle=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.arrayBufferLen;e[i++]=1200,e[i++]=t,this.arrayBufferLen=i},i.setStrokeStyle=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.arrayBufferLen;e[i++]=1201,e[i++]=t,this.arrayBufferLen=i},i.setLineWidth=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.float32View,n=this.arrayBufferLen;e[n++]=1202,i[n++]=t,this.arrayBufferLen=n},i.moveTo=function(t,e){this.arrayBufferLen+3>this.maxArrayBufferLen&&this.flush();var i=this.uint32View,n=this.float32View,r=this.arrayBufferLen;i[r++]=207,n[r++]=t,n[r++]=e,this.arrayBufferLen=r},i.lineTo=function(t,e){this.arrayBufferLen+3>this.maxArrayBufferLen&&this.flush();var i=this.uint32View,n=this.float32View,r=this.arrayBufferLen;i[r++]=208,n[r++]=t,n[r++]=e,this.arrayBufferLen=r},i.fill=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.arrayBufferLen;e[i++]=203,e[i++]=t,this.arrayBufferLen=i},i.pushClip=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.float32View,s=this.arrayBufferLen;r[s++]=107,a[s++]=t,a[s++]=e,a[s++]=i,a[s++]=n,this.arrayBufferLen=s},i.popClip=function(){this.arrayBufferLen+1>this.maxArrayBufferLen&&this.flush(),this.uint32View[this.arrayBufferLen++]=108},i.stroke=function(){this.arrayBufferLen+1>this.maxArrayBufferLen&&this.flush(),this.uint32View[this.arrayBufferLen++]=206},i.arc=function(t,e,i,n,r,a){this.arrayBufferLen+7>this.maxArrayBufferLen&&this.flush();var s=this.uint32View,o=this.float32View,h=this.arrayBufferLen;s[h++]=209,o[h++]=t,o[h++]=e,o[h++]=i,o[h++]=n,o[h++]=r,s[h++]=a,this.arrayBufferLen=h},i.quadraticCurveTo=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.float32View,s=this.arrayBufferLen;r[s++]=211,a[s++]=t,a[s++]=e,a[s++]=i,a[s++]=n,this.arrayBufferLen=s},i.fillRect=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.float32View,s=this.arrayBufferLen;r[s++]=212,a[s++]=t,a[s++]=e,a[s++]=i,a[s++]=n,this.arrayBufferLen=s},i.strokeRect=function(t,e,i,n){this.arrayBufferLen+5>this.maxArrayBufferLen&&this.flush();var r=this.uint32View,a=this.float32View,s=this.arrayBufferLen;r[s++]=213,a[s++]=t,a[s++]=e,a[s++]=i,a[s++]=n,this.arrayBufferLen=s},i.bezierCurveTo=function(t,e,i,n,r,a){this.arrayBufferLen+7>this.maxArrayBufferLen&&this.flush();var s=this.uint32View,o=this.float32View,h=this.arrayBufferLen;s[h++]=215,o[h++]=t,o[h++]=e,o[h++]=i,o[h++]=n,o[h++]=r,o[h++]=a,this.arrayBufferLen=h},i.setGlobalShader=function(t){this.arrayBufferLen+2>this.maxArrayBufferLen&&this.flush();var e=this.uint32View,i=this.arrayBufferLen;e[i++]=111,e[i++]=t,this.arrayBufferLen=i},t}();t.registerClass(s,"CmdManager"),e.$cmdManager=new s;var o=!1,h=[];t.warn=function(){console.warn.apply(console,a(arguments))},t.error=function(){console.error.apply(console,a(arguments))},t.assert=function(){console.assert.apply(console,a(arguments))},t.log=function(){console.log.apply(console,a(arguments))},t.runEgret=i,t.updateAllScreens=r}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(e){function i(i,n,r,a,s){e.call(this),this.arrFps=[],this.arrLog=[],(n||r)&&(this.panelX=void 0===s.x?0:parseInt(s.x),this.panelY=void 0===s.y?0:parseInt(s.y),this._stage=i,this.showFps=n,this.showLog=r,this.fontColor=void 0===s.textColor?16777215:parseInt(s.textColor),this.fontSize=void 0===s.size?24:parseInt(s.size),this.bgAlpha=s.bgAlpha||.9,this.shape=new t.Shape,this.addChild(this.shape),n&&this.addFps(),r&&this.addLog())}__extends(i,e);var n=(__define,i),r=n.prototype;return r.addFps=function(){var e=new t.TextField;e.x=e.y=4,this.textFps=e,this.addChild(e),e.lineSpacing=2,e.size=this.fontSize,e.textColor=this.fontColor,e.textFlow=[{text:"0 FPS "+t.Capabilities.renderMode+"\n"},{text:"Draw: 0\nDirty: 0%\n"},{text:"Cost: "},{text:"0 ",style:{textColor:1638142}},{text:"0 ",style:{textColor:16776960}},{text:"0 ",style:{textColor:16711680}}]},r.addLog=function(){var e=new t.TextField;e.size=this.fontSize,e.textColor=this.fontColor,e.x=4,this.addChild(e),this.textLog=e},r.update=function(e){this.arrFps.push(e.fps);var i=0,n=this.arrFps.length;n>101&&(n=101,this.arrFps.shift());for(var r=this.arrFps[0],a=this.arrFps[0],s=0;n>s;s++){var o=this.arrFps[s];i+=o,r>o?r=o:o>a&&(a=o)}this.textFps.textFlow=[{text:e.fps+" FPS "+t.Capabilities.renderMode+"\n"},{text:"min"+r+" max"+a+" avg"+Math.floor(i/n)+"\n"},{text:"Draw: "+e.draw+"\nDirty: "+e.dirty+"%\n"},{text:"Cost: "},{text:e.costTicker+" ",style:{textColor:1638142}},{text:e.costDirty+" ",style:{textColor:16776960}},{text:e.costRender+" ",style:{textColor:16711680}}],this.updateLayout()},r.updateInfo=function(t){var e=0;if(this.showFps&&(e=this.textFps.height,this.textLog.y=e+4),this.arrLog.push(t),this.textLog.text=this.arrLog.join("\n"),this._stage.stageHeight>0)for(this.textLog.textWidth>this._stage.stageWidth-20-this.panelX&&(this.textLog.width=this._stage.stageWidth-20-this.panelX);this.textLog.textHeight>this._stage.stageHeight-e-20-this.panelY;)this.arrLog.shift(),this.textLog.text=this.arrLog.join("\n");this.updateLayout()},r.updateLayout=function(){if(t.Capabilities.runtimeType!=t.RuntimeType.NATIVE){var e=this.shape.$graphics;e.clear(),e.beginFill(0,this.bgAlpha),e.drawRect(0,0,this.width+8,this.height+8),e.endFill()}},i}(t.Sprite);e.NativeFps=i,t.registerClass(i,"egret.native.NativeFps",["egret.FPSDisplay"]),t.FPSDisplay=i}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){function i(t){return egret_native.getOption(t)}e.getOption=i,t.getOption=i}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){function i(e){var i=JSON.parse(e),r=i.functionName,a=n[r];if(a){var s=i.value;a.call(null,s)}else t.$warn(1004,r)}var n={},r=function(){function t(){}var e=(__define,t);e.prototype;return t.call=function(t,e){var i={};i.functionName=t,i.value=e,egret_native.sendInfoToPlugin(JSON.stringify(i))},t.addCallback=function(t,e){n[t]=e},t}();e.NativeExternalInterface=r,t.registerClass(r,"egret.native.NativeExternalInterface",["egret.ExternalInterface"]),t.ExternalInterface=r,egret_native.receivedPluginInfo=i}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(i){function n(){i.call(this),this.loaded=!1}__extends(n,i);var r=__define,a=n,s=a.prototype;return r(s,"length",function(){if(this.originAudio)return this.originAudio.duration;throw new Error("sound not loaded!")}),s.load=function(e){function i(){var i=t.PromiseObject.create();i.onSuccessFunc=r,i.onErrorFunc=s,egret_native.download(e,e,i)}function r(){c.load(),n.$recycle(e,c)}function a(){o(),h.loaded=!0,h.dispatchEventWith(t.Event.COMPLETE)}function s(){o(),h.dispatchEventWith(t.IOErrorEvent.IO_ERROR)}function o(){c.removeEventListener("canplaythrough",a),c.removeEventListener("error",s)}var h=this;this.url=e;var c=new Audio(e);c.addEventListener("canplaythrough",a),c.addEventListener("error",s),this.originAudio=c,egret_native.isFileExists(e)?r():i()},s.play=function(i,r){i=+i||0,r=+r||0;var a=n.$pop(this.url);null==a&&(a=new Audio(this.url)),a.autoplay=!0;var s=new e.NativeSoundChannel(a);return s.$url=this.url,s.$loops=r,s.$startTime=i,s.$play(),t.sys.$pushSoundChannel(s),s},s.close=function(){0==this.loaded&&this.originAudio&&(this.originAudio.src=""),this.originAudio&&(this.originAudio=null),n.$clear(this.url)},n.$clear=function(t){var e=n.audios[t];e&&(e.length=0)},n.$pop=function(t){var e=n.audios[t];return e&&e.length>0?e.pop():null},n.$recycle=function(t,e){var i=n.audios[t];null==n.audios[t]&&(i=n.audios[t]=[]),i.push(e)},n.MUSIC="music",n.EFFECT="effect",n.audios={},n}(t.EventDispatcher);e.NativeSound=i,t.registerClass(i,"egret.native.NativeSound",["egret.Sound"]),__global.Audio&&(t.Sound=i)}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(i){function n(e){var n=this;i.call(this),this.$startTime=0,this.audio=null,this.isStopped=!1,this.onPlayEnd=function(){return 1==n.$loops?(n.stop(),void n.dispatchEventWith(t.Event.SOUND_COMPLETE)):(n.$loops>0&&n.$loops--,void n.$play())},e.addEventListener("ended",this.onPlayEnd),this.audio=e}__extends(n,i);var r=__define,a=n,s=a.prototype;return s.$play=function(){if(this.isStopped)return void t.$error(1036);try{this.audio.currentTime=this.$startTime}catch(e){}finally{this.audio.play()}},s.stop=function(){if(this.audio){this.isStopped||t.sys.$popSoundChannel(this),this.isStopped=!0;var i=this.audio;i.pause(),i.removeEventListener("ended",this.onPlayEnd),this.audio=null,e.NativeSound.$recycle(this.$url,i)}},r(s,"volume",function(){return this.audio?this.audio.volume:1},function(e){return this.isStopped?void t.$error(1036):void(this.audio&&(this.audio.volume=e))}),r(s,"position",function(){return this.audio?this.audio.currentTime:0}),n}(t.EventDispatcher);e.NativeSoundChannel=i,t.registerClass(i,"egret.native.NativeSoundChannel",["egret.SoundChannel","egret.IEventDispatcher"])}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(i){function n(){i.call(this),this.loaded=!1}__extends(n,i);var r=__define,a=n,s=a.prototype;return r(s,"length",function(){throw new Error("sound length not supported")}),s.load=function(e){function i(){var i=t.PromiseObject.create();i.onSuccessFunc=n,i.onErrorFunc=function(){t.IOErrorEvent.dispatchIOErrorEvent(r)},egret_native.download(e,e,i)}function n(){r.loaded=!0,r.preload()}var r=this;this.url=e,egret_native.isFileExists(e)?__global.setTimeout?__global.setTimeout(n,0):t.$callAsync(n,r):i()},s.preload=function(){var e=this;if(e.type==t.Sound.EFFECT){var i=new t.PromiseObject;i.onSuccessFunc=function(i){e.dispatchEventWith(t.Event.COMPLETE)},egret_native.Audio.preloadEffectAsync(e.url,i)}else e.dispatchEventWith(t.Event.COMPLETE)},s.play=function(i,n){i=+i||0,n=+n||0;var r=new e.NaSoundChannel;return r.$url=this.url,r.$loops=n,r.$type=this.type,r.$startTime=i,r.$play(),t.sys.$pushSoundChannel(r),r},s.close=function(){},n.MUSIC="music",n.EFFECT="effect",n}(t.EventDispatcher);e.NaSound=i,t.registerClass(i,"egret.native.NaSound",["egret.Sound"]),__global.Audio||(t.Sound=i)}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(e){function i(){e.call(this),this.$startTime=0,this.isStopped=!1,this._startTime=0}__extends(i,e);var n=__define,r=i,a=r.prototype;return a.$play=function(){this.isStopped=!1,this.$type==t.Sound.EFFECT?this._effectId=egret_native.Audio.playEffect(this.$url,1!=this.$loops):(i.currentPath=this.$url,egret_native.Audio.playBackgroundMusic(this.$url,1!=this.$loops)),this._startTime=Date.now()},a.stop=function(){this.isStopped||t.sys.$popSoundChannel(this),this.isStopped=!0,this.$type==t.Sound.EFFECT?this._effectId&&(egret_native.Audio.stopEffect(this._effectId),this._effectId=null):this.$url==i.currentPath&&egret_native.Audio.stopBackgroundMusic(!1)},n(a,"volume",function(){return this.$type==t.Sound.EFFECT?egret_native.Audio.getEffectsVolume():egret_native.Audio.getBackgroundMusicVolume()},function(e){this.$type==t.Sound.EFFECT?egret_native.Audio.setEffectsVolume(e):egret_native.Audio.setBackgroundMusicVolume(e)}),n(a,"position",function(){return(Date.now()-this._startTime)/1e3}),i}(t.EventDispatcher);e.NaSoundChannel=i,t.registerClass(i,"egret.native.NaSoundChannel",["egret.SoundChannel","egret.IEventDispatcher"])}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(i){function n(e,n){void 0===n&&(n=!0),i.call(this),this.loaded=!1,this.loading=!1,this.loop=!1,this.isPlayed=!1,this.firstPlay=!0,this.src="",this._fullscreen=!0,this._bitmapData=null,this.paused=!1,this.isAddToStage=!1,this.heightSet=0,this.widthSet=0,this.$renderNode=new t.sys.BitmapNode,this.cache=n,__global.Video||t.$error(1044),e&&this.load(e,n)}__extends(n,i);var r=__define,a=n,s=a.prototype;return s.load=function(e,i){if(void 0===i&&(i=!0),!this.loading)if(0==e.indexOf("/")&&(e=e.slice(1,e.length)),this.src=e,this.loading=!0,this.loaded=!1,i&&!egret_native.isFileExists(e)){var n=this,r=t.PromiseObject.create();r.onSuccessFunc=function(){n.loadEnd()},r.onErrorFunc=function(){t.$warn(1048),n.dispatchEventWith(t.IOErrorEvent.IO_ERROR)},egret_native.download(e,e,r)}else this.loadEnd()},s.loadEnd=function(){function e(){a.setVideoRect(0,0,1,1),a.play()}function i(){a.setVideoRect(0,0,1,1),__global.setTimeout(function(){a.pause(),s._fullscreen&&(a.fullScreen=!0),a.currentTime=0,s.originVideo=a,s.loaded=!0,s.loading=!1,r(),s.dispatchEventWith(t.Event.COMPLETE),a.addEventListener("pause",function(){s.paused=!0}),a.addEventListener("playing",function(){s.paused=!1}),a.addEventListener("ended",function(){s.dispatchEventWith(t.Event.ENDED),s.loop&&s.play(0,!0)})},1)}function n(){r(),s.dispatchEventWith(t.IOErrorEvent.IO_ERROR)}function r(){a.removeEventListener("canplaythrough",e),a.removeEventListener("error",n),a.removeEventListener("playing",i)}var a=new __global.Video(this.src);a.setVideoRect(0,0,1,1),a.setKeepRatio(!1),a.addEventListener("canplaythrough",e),a.addEventListener("error",n),a.addEventListener("playing",i),a.load();var s=this},s.play=function(e,i){var n=this;if(void 0===i&&(i=!1),this.loop=i,!this.loaded)return this.load(this.src),void this.once(t.Event.COMPLETE,function(t){return n.play(e,i)},this);var r=!1;void 0!=e&&e!=this.originVideo.currentTime&&(this.originVideo.currentTime=e||0,r=!0),this.startPlay(r)},s.startPlay=function(e){void 0===e&&(e=!1),this.isAddToStage&&this.loaded&&(this.firstPlay=!1,this.setVideoSize(),this.isPlayed=!0,!e&&this.paused&&0!=this.position?this.originVideo.resume():this.originVideo.play(),t.startTick(this.markDirty,this))},s.stopPlay=function(){t.stopTick(this.markDirty,this),this.isPlayed&&(this.isPlayed=!1,this.originVideo.pause())},s.close=function(){this.originVideo&&this.originVideo.destroy(),this.loaded=!1,this.loading=!1,this.originVideo=null,this.loop=!1,this.src=null},r(s,"poster",function(){return this.posterUrl},function(i){var n=this;this.posterUrl=i;var r=new e.NativeImageLoader;r.load(i),r.addEventListener(t.Event.COMPLETE,function(){n.posterData=r.data,n.markDirty(),n.$invalidateContentBounds()},this)}),r(s,"fullscreen",function(){return this.originVideo?this.originVideo.fullScreen:this._fullscreen},function(t){this._fullscreen=t,this.originVideo&&(this.originVideo.fullScreen=t)}),r(s,"volume",function(){return this.loaded?this.originVideo.volume:0},function(t){this.loaded&&(this.originVideo.volume=t)}),r(s,"position",function(){return this.originVideo.currentTime},function(t){this.loaded&&(this.originVideo.currentTime=t)}),s.pause=function(){this.originVideo.pause()},r(s,"bitmapData",function(){return this._bitmapData}),r(s,"length",function(){if(this.loaded)return this.originVideo.duration;throw new Error("Video not loaded!")}),s.$onAddToStage=function(t,e){this.isAddToStage=!0,this.originVideo&&this.originVideo.setVideoVisible(!0),this.$invalidate(),this.$invalidateContentBounds(),i.prototype.$onAddToStage.call(this,t,e)},s.$onRemoveFromStage=function(){this.isAddToStage=!1,this.originVideo&&(this.stopPlay(),this.originVideo.setVideoVisible(!1)),i.prototype.$onRemoveFromStage.call(this)},s.getPlayWidth=function(){return isNaN(this.widthSet)?this.bitmapData?this.bitmapData.width:this.posterData?this.posterData.width:0/0:this.widthSet},s.getPlayHeight=function(){return isNaN(this.heightSet)?this.bitmapData?this.bitmapData.height:this.posterData?this.posterData.height:0/0:this.heightSet
},s.$setHeight=function(t){return this.heightSet=+t||0,this.setVideoSize(),this.$invalidate(),this.$invalidateContentBounds(),i.prototype.$setHeight.call(this,t)},s.$setWidth=function(t){return this.widthSet=+t||0,this.setVideoSize(),this.$invalidate(),this.$invalidateContentBounds(),i.prototype.$setWidth.call(this,t)},s.$setX=function(t){var e=i.prototype.$setX.call(this,t);return this.setVideoSize(),e},s.$setY=function(t){var e=i.prototype.$setY.call(this,t);return this.setVideoSize(),e},s.setVideoSize=function(){var t=this.originVideo;t&&!this.fullscreen&&(this.firstPlay?t.setVideoRect(this.x,this.y,0,0):t.setVideoRect(this.x,this.y,this.widthSet,this.heightSet))},s.$measureContentBounds=function(t){var e=this.posterData;e?t.setTo(0,0,this.getPlayWidth(),this.getPlayHeight()):t.setEmpty()},s.$render=function(){var t=this.$renderNode,e=this.posterData,i=this.getPlayWidth(),n=this.getPlayHeight();0>=i||0>=n||(!this.isPlayed&&e?(t.image=e,t.drawImage(0,0,e.width,e.height,0,0,i,n)):this.isPlayed&&this.setVideoSize())},s.markDirty=function(){return this.$invalidate(),!0},n}(t.DisplayObject);e.NativeVideo=i,t.registerClass(i,"egret.native.NativeVideo",["egret.Video"]),__global.Video?t.Video=i:t.$warn(1044)}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i;!function(i){function n(t){return c[t]}function r(e,i){i=void 0===i?"undefined":null===i?"null":i.toString(),c[e]=i;try{return o(),!0}catch(n){return t.$warn(1018,e,i),!1}}function a(t){delete c[t],o()}function s(){for(var t in c)delete c[t];o()}function o(){egret_native.saveRecord(h,JSON.stringify(c))}var h="LocalStorage.local",c={};if(egret_native.isRecordExists(h)){var u=egret_native.loadRecord(h);try{c=JSON.parse(u)}catch(l){c={}}}else c={};e.getItem=n,e.setItem=r,e.removeItem=a,e.clear=s}(i=e["native"]||(e["native"]={}))}(e=t.localStorage||(t.localStorage={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(e){function i(i){e.call(this),egret_native.pauseApp=function(){i.dispatchEvent(new t.Event(t.Event.DEACTIVATE)),egret_native.Audio.pauseBackgroundMusic(),egret_native.Audio.pauseAllEffects()},egret_native.resumeApp=function(){i.dispatchEvent(new t.Event(t.Event.ACTIVATE)),egret_native.Audio.resumeBackgroundMusic(),egret_native.Audio.resumeAllEffects()}}__extends(i,e);var n=(__define,i);n.prototype;return i}(t.HashObject);e.NativeHideHandler=i,t.registerClass(i,"egret.native.NativeHideHandler")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e=function(e){function i(){e.apply(this,arguments),this._downCount=0,this._path=null,this._bytesTotal=0}__extends(i,e);var n=(__define,i),r=n.prototype;return r.load=function(t,e){this._downCount=0,this._path=t,this._bytesTotal=e,this.reload()},r.reload=function(){if(this._downCount>=3)return void this.downloadFileError();this._downCount++;var e=t.PromiseObject.create(),i=this;e.onSuccessFunc=function(){i.loadOver()},e.onErrorFunc=function(){i.reload()},e.downloadingSizeFunc=function(t){i.downloadingProgress(t)},egret_native.download(this._path,this._path,e)},r.downloadingProgress=function(e){t.ProgressEvent.dispatchProgressEvent(this,t.ProgressEvent.PROGRESS,e,this._bytesTotal)},r.downloadFileError=function(){this.dispatchEvent(new t.Event(t.IOErrorEvent.IO_ERROR))},r.loadOver=function(){this.dispatchEvent(new t.Event(t.Event.COMPLETE))},i}(t.EventDispatcher);t.NativeResourceLoader=e,t.registerClass(e,"egret.NativeResourceLoader")}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(e){function i(i){e.call(this),this.$touch=new t.sys.TouchHandler(i);var n=this;egret_native.onTouchesBegin=function(t,e,i,r){n.$executeTouchCallback(t,e,i,r,n.$touch.onTouchBegin)},egret_native.onTouchesMove=function(t,e,i,r){n.$executeTouchCallback(t,e,i,r,n.$touch.onTouchMove)},egret_native.onTouchesEnd=function(t,e,i,r){n.$executeTouchCallback(t,e,i,r,n.$touch.onTouchEnd)},egret_native.onTouchesCancel=function(t,e,i,n){}}__extends(i,e);var n=(__define,i),r=n.prototype;return r.$executeTouchCallback=function(t,e,i,n,r){for(var a=0;t>a;a++){var s=e[a],o=i[a],h=n[a];r.call(this.$touch,o,h,s)}},r.$updateMaxTouches=function(){this.$touch.$initMaxTouches()},i}(t.HashObject);e.NativeTouchHandler=i,t.registerClass(i,"egret.native.NativeTouchHandler")}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(e){function i(){e.call(this),this._url="",this._method="",this.urlData={},this.responseHeader=""}__extends(i,e);var n=__define,r=i,a=r.prototype;return n(a,"response",function(){return this._response}),n(a,"responseType",function(){return this._responseType},function(t){this._responseType=t}),n(a,"withCredentials",function(){return this._withCredentials},function(t){this._withCredentials=t}),a.open=function(t,e){void 0===e&&(e="GET"),this._url=t,this._method=e},a.send=function(e){function i(){var e=new t.PromiseObject;e.onSuccessFunc=function(e){r._response=e,t.Event.dispatchEvent(r,t.Event.COMPLETE)},e.onErrorFunc=function(){t.Event.dispatchEvent(r,t.IOErrorEvent.IO_ERROR)},r._responseType==t.HttpResponseType.ARRAY_BUFFER?egret_native.readFileAsync(r._url,e,"ArrayBuffer"):egret_native.readFileAsync(r._url,e)}function n(){var e=t.PromiseObject.create();e.onSuccessFunc=i,e.onErrorFunc=function(){t.Event.dispatchEvent(r,t.IOErrorEvent.IO_ERROR)},e.onResponseHeaderFunc=this.onResponseHeader,e.onResponseHeaderThisObject=this,egret_native.download(r._url,r._url,e)}var r=this;if(r.isNetUrl(r._url)){r.urlData.type=r._method,r._method==t.HttpMethod.POST&&e?e instanceof ArrayBuffer?r.urlData.data=e:r.urlData.data=e.toString():delete r.urlData.data,r._responseType==t.HttpResponseType.ARRAY_BUFFER?r.urlData.binary=!0:r.urlData.header=!1,this.headerObj?r.urlData.header=JSON.stringify(this.headerObj):delete r.urlData.header;var a=t.PromiseObject.create();a.onSuccessFunc=function(e){r._response=e,t.callLater(t.Event.dispatchEvent,t.Event,r,t.Event.COMPLETE)},a.onErrorFunc=function(e){t.$warn(1019,e),t.Event.dispatchEvent(r,t.IOErrorEvent.IO_ERROR)},a.onResponseHeaderFunc=this.onResponseHeader,a.onResponseHeaderThisObject=this,egret_native.requireHttp(r._url,r.urlData,a)}else egret_native.isFileExists(r._url)?i():n()},a.isNetUrl=function(t){return-1!=t.indexOf("http://")||-1!=t.indexOf("HTTP://")},a.abort=function(){},a.onResponseHeader=function(t){this.responseHeader="";var e=JSON.parse(t);for(var i in e)this.responseHeader+=i+": "+e[i]+"\r\n"},a.getAllResponseHeaders=function(){return this.responseHeader},a.setRequestHeader=function(t,e){this.headerObj||(this.headerObj={}),this.headerObj[t]=e},a.getResponseHeader=function(t){return""},i}(t.EventDispatcher);e.NativeHttpRequest=i,t.registerClass(i,"egret.native.NativeHttpRequest",["egret.HttpRequest"]),t.HttpRequest=i}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(e){function i(){e.apply(this,arguments),this.data=null,this._crossOrigin=null}__extends(i,e);var n=__define,r=i,a=r.prototype;return n(a,"crossOrigin",function(){return this._crossOrigin},function(t){this._crossOrigin=t}),a.load=function(t){this.check(t)},a.check=function(t){var e=this;e.isNetUrl(t)?e.download(t):egret_native.isFileExists(t)?e.loadTexture(t):e.download(t)},a.download=function(e){var i=this,n=t.PromiseObject.create();n.onSuccessFunc=function(){i.loadTexture(e)},n.onErrorFunc=function(){i.dispatchEventWith(t.IOErrorEvent.IO_ERROR)},egret_native.download(e,e,n)},a.loadTexture=function(e){var i=this,n=new t.PromiseObject;n.onSuccessFunc=function(e){i.data=new t.BitmapData(e),i.dispatchEventWith(t.Event.COMPLETE)},n.onErrorFunc=function(){i.dispatchEventWith(t.IOErrorEvent.IO_ERROR)},egret_native.Texture.addTextureAsyn(e,n)},a.isNetUrl=function(t){return-1!=t.indexOf("http://")||-1!=t.indexOf("HTTP://")},i.crossOrigin=null,i}(t.EventDispatcher);e.NativeImageLoader=i,t.registerClass(i,"egret.native.NativeImageLoader",["egret.ImageLoader"]),t.ImageLoader=i}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){var i=function(e){function i(){e.call(this),this.textValue="",this.colorValue=16777215,this.isFinishDown=!1,this.textValue=""}__extends(i,e);var n=(__define,i),r=n.prototype;return r.$getText=function(){return this.textValue||(this.textValue=""),this.textValue},r.$setText=function(t){return this.textValue=t,!0},r.$setColor=function(t){return this.colorValue=t,!0},r.$onBlur=function(){},r.showScreenKeyboard=function(){var e=this;e.dispatchEvent(new t.Event("focus")),t.Event.dispatchEvent(e,"focus",!1,{showing:!0}),egret_native.EGT_TextInput=function(i){e.$textfield.multiline?(e.textValue=i,e.dispatchEvent(new t.Event("updateText")),e.isFinishDown&&(e.isFinishDown=!1,e.dispatchEvent(new t.Event("blur")))):(e.textValue=i.replace(/[\n|\r]/,""),egret_native.TextInputOp.setKeybordOpen(!1),e.dispatchEvent(new t.Event("updateText")),e.dispatchEvent(new t.Event("blur")))},egret_native.EGT_keyboardFinish=function(){e.$textfield.multiline&&(e.isFinishDown=!0)}},r.$show=function(){var e=this;egret_native.TextInputOp.setKeybordOpen(!1),egret_native.EGT_getTextEditerContentText=function(){return e.$getText()},egret_native.EGT_keyboardDidShow=function(){e.showScreenKeyboard(),egret_native.EGT_keyboardDidShow=function(){}},egret_native.EGT_keyboardDidHide=function(){},egret_native.EGT_deleteBackward=function(){};var i=this.$textfield,n=i.$TextField,r=n[37],a=n[30]?0:6,s=-1;r==t.TextFieldInputType.PASSWORD?s=0:r==t.TextFieldInputType.TEL&&(a=3);var o=1,h=n[21]<=0?-1:n[21],c=i.$getRenderNode(),u=c.renderMatrix;egret_native.TextInputOp.setKeybordOpen(!0,JSON.stringify({inputMode:a,inputFlag:s,returnType:o,maxLength:h,x:u.tx,y:u.ty,width:i.width,height:i.height,font_size:n[0],font_color:n[2],textAlign:n[9],verticalAlign:n[10]}))},r.$hide=function(){egret_native.TextInputOp.setKeybordOpen(!1),this.dispatchEvent(new t.Event("blur"))},r.$resetStageText=function(){},r.$addToStage=function(){},r.$removeFromStage=function(){},r.$setTextField=function(t){return this.$textfield=t,!0},i}(t.EventDispatcher);e.NativeStageText=i,t.registerClass(i,"egret.native.NativeStageText",["egret.StageText"]),t.StageText=i}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));var egret;!function(t){var e;!function(e){function i(t){var e=egret_native.xmlStr2JsonStr(t),i=JSON.parse(e);return n(i,null)}function n(t,e){if("parsererror"==t.localName)throw new Error(t.textContent);var i=new a(t.localName,e,t.prefix,t.namespace,t.name),r=t.attributes,o=i.attributes;for(var h in r)o[h]=r[h];for(var c=t.children,u=c.length,l=i.children,f=0;u>f;f++){var d=c[f],v=d.nodeType,g=null;if(1==v)g=n(d,i);else if(3==v){var p=d.text.trim();p&&(g=new s(p,i))}g&&l.push(g)}return i}var r=function(){function t(t,e){this.nodeType=t,this.parent=e}var e=(__define,t);e.prototype;return t}();e.XMLNode=r,t.registerClass(r,"egret.web.XMLNode");var a=function(t){function e(e,i,n,r,a){t.call(this,1,i),this.attributes={},this.children=[],this.localName=e,this.prefix=n,this.namespace=r,this.name=a}__extends(e,t);var i=(__define,e);i.prototype;return e}(r);e.XML=a,t.registerClass(a,"egret.web.XML");var s=function(t){function e(e,i){t.call(this,3,i),this.text=e}__extends(e,t);var i=(__define,e);i.prototype;return e}(r);e.XMLText=s,t.registerClass(s,"egret.web.XMLText"),t.XML={parse:i}}(e=t.web||(t.web={}))}(egret||(egret={}));var egret;!function(t){var e;!function(t){}(e=t["native"]||(t["native"]={}))}(egret||(egret={}));