1 |
- var Laya=window.Laya=function(window,document){var Laya={__internals:[],__packages:{},__classmap:{Object:Object,Function:Function,Array:Array,String:String},__sysClass:{object:"Object",array:"Array",string:"String",dictionary:"Dictionary"},__propun:{writable:!0,enumerable:!1,configurable:!0},__presubstr:String.prototype.substr,__substr:function(ofs,sz){return 1==arguments.length?Laya.__presubstr.call(this,ofs):Laya.__presubstr.call(this,ofs,sz>0?sz:this.length+sz)},__init:function(_classs){_classs.forEach(function(o){o.__init$&&o.__init$()})},__isClass:function(o){return o&&(o.__isclass||o==Object||o==String||o==Array)},__newvec:function(sz,value){var d=[];d.length=sz;for(var i=0;i<sz;i++)d[i]=value;return d},__extend:function(d,b){for(var p in b)if(b.hasOwnProperty(p)){var gs=Object.getOwnPropertyDescriptor(b,p),g=gs.get,s=gs.set;g||s?g&&s?Object.defineProperty(d,p,gs):(g&&Object.defineProperty(d,p,g),s&&Object.defineProperty(d,p,s)):d[p]=b[p]}function __(){Laya.un(this,"constructor",d)}__.prototype=b.prototype,d.prototype=new __,Laya.un(d.prototype,"__imps",Laya.__copy({},b.prototype.__imps))},__copy:function(dec,src){if(!src)return null;for(var i in dec=dec||{},src)dec[i]=src[i];return dec},__package:function(name,o){if(!Laya.__packages[name]){Laya.__packages[name]=!0;var p=window,strs=name.split(".");if(strs.length>1)for(var i=0,sz=strs.length-1;i<sz;i++){var c=p[strs[i]];p=c||(p[strs[i]]={})}p[strs[strs.length-1]]||(p[strs[strs.length-1]]=o||{})}},__hasOwnProperty:function(name,o){return o=o||this,Object.hasOwnProperty.call(o,name)||function classHas(name,o){if(Object.hasOwnProperty.call(o.prototype,name))return!0;var s=o.prototype.__super;return null==s?null:classHas(name,s)}(name,o.__class)},__typeof:function(o,value){if(!o||!value)return!1;if(value===String)return"string"==typeof o;if(value===Number)return"number"==typeof o;if(value.__interface__)value=value.__interface__;else if("string"!=typeof value)return o instanceof value;return o.__imps&&o.__imps[value]||o.__class==value},__as:function(value,type){return this.__typeof(value,type)?value:null},__int:function(value){return value?parseInt(value):0},interface:function(name,_super){Laya.__package(name,{});var ins=Laya.__internals,a=ins[name]=ins[name]||{self:name};if(_super){var supers=_super.split(",");a.extend=[];for(var i=0;i<supers.length;i++){var nm=supers[i];ins[nm]=ins[nm]||{self:nm},a.extend.push(ins[nm])}}var o=window,words=name.split(".");for(i=0;i<words.length-1;i++)o=o[words[i]];o[words[words.length-1]]={__interface__:name}},class:function(o,fullName,_super,miniName){if(_super&&Laya.__extend(o,_super),fullName)if(Laya.__package(fullName,o),Laya.__classmap[fullName]=o,fullName.indexOf(".")>0){if(0==fullName.indexOf("laya.")){var paths=fullName.split(".");miniName=miniName||paths[paths.length-1],Laya[miniName]&&console.log("Warning!,this class["+miniName+"] already exist:",Laya[miniName]),Laya[miniName]=o}}else"Main"==fullName?window.Main=o:(Laya[fullName]&&console.log("Error!,this class["+fullName+"] already exist:",Laya[fullName]),Laya[fullName]=o);var un=Laya.un,p=o.prototype;un(p,"hasOwnProperty",Laya.__hasOwnProperty),un(p,"__class",o),un(p,"__super",_super),un(p,"__className",fullName),un(o,"__super",_super),un(o,"__className",fullName),un(o,"__isclass",!0),un(o,"super",function(o){this.__super.call(o)})},imps:function(dec,src){if(!src)return null;var d=dec.__imps||Laya.un(dec,"__imps",{});function __(name){var c,exs;if((c=Laya.__internals[name])&&(d[name]=!0,exs=c.extend))for(var i=0;i<exs.length;i++)__(exs[i].self)}for(var i in src)__(i)},superSet:function(clas,o,prop,value){var fun=clas.prototype["_$set_"+prop];fun&&fun.call(o,value)},superGet:function(clas,o,prop){var fun=clas.prototype["_$get_"+prop];return fun?fun.call(o):null},getset:function(isStatic,o,name,getfn,setfn){isStatic?(getfn&&(o["_$GET_"+name]=getfn),setfn&&(o["_$SET_"+name]=setfn)):(getfn&&Laya.un(o,"_$get_"+name,getfn),setfn&&Laya.un(o,"_$set_"+name,setfn)),getfn&&setfn?Object.defineProperty(o,name,{get:getfn,set:setfn,enumerable:!1,configurable:!0}):(getfn&&Object.defineProperty(o,name,{get:getfn,enumerable:!1,configurable:!0}),setfn&&Object.defineProperty(o,name,{set:setfn,enumerable:!1,configurable:!0}))},static:function(_class,def){for(var i=0,sz=def.length;i<sz;i+=2)if("length"==def[i])_class.length=def[i+1].call(_class);else{function tmp(){var name=def[i],getfn=def[i+1];Object.defineProperty(_class,name,{get:function(){return delete this[name],this[name]=getfn.call(this)},set:function(v){delete this[name],this[name]=v},enumerable:!0,configurable:!0})}tmp()}},un:function(obj,name,value){return value||(value=obj[name]),Laya.__propun.value=value,Object.defineProperty(obj,name,Laya.__propun),value},uns:function(obj,names){names.forEach(function(o){Laya.un(obj,o)})}};return window.console=window.console||{log:function(){}},window.trace=window.console.log,Error.prototype.throwError=function(){throw arguments},Object.defineProperty(Array.prototype,"fixed",{enumerable:!1}),Laya}(window,document);!function(window,document,Laya){Laya.un,Laya.uns,Laya.static,Laya.class,Laya.getset,Laya.__newvec}(window,document,Laya),function(window,document,Laya){Laya.un,Laya.uns;var __static=Laya.static,__class=Laya.class,__getset=Laya.getset;Laya.__newvec;Laya.interface("laya.filters.IFilter"),Laya.interface("laya.resource.IDispose"),Laya.interface("laya.resource.IDestroy"),Laya.interface("laya.webgl.submit.ISubmit"),Laya.interface("laya.resource.ICreateResource"),Laya.interface("laya.webgl.canvas.save.ISaveData"),Laya.interface("laya.resource.ISingletonElement");__getset(1,Laya,"alertGlobalError",null,function(value){var erralert=0;Browser.window.onerror=value?function(msg,url,line,column,detail){erralert++<5&&detail&&alert("出错啦,请把此信息截图给研发商\n"+msg+"\n"+detail.stack)}:null}),Laya.init=function(width,height,__plugins){for(var plugins=[],i=2,sz=arguments.length;i<sz;i++)plugins.push(arguments[i]);if(!Laya._isinit){Laya._isinit=!0,ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=Laya._arrayBufferSlice),Browser.__init__(),Laya.systemTimer=new Timer(!1),Laya.startTimer=new Timer(!1),Laya.physicsTimer=new Timer(!1),Laya.updateTimer=new Timer(!1),Laya.lateTimer=new Timer(!1),Laya.timer=new Timer(!1),Laya.loader=new LoaderManager,WeakObject.__init__(),WebGL.inner_enable(),i=0;for(var n=plugins.length;i<n;i++)plugins[i]&&plugins[i].enable&&plugins[i].enable();return Render.isConchApp&&RunDriver.enableNative(),CacheManger.beginCheck(),Laya._currentStage=Laya.stage=new Stage,URL.rootPath=URL._basePath=Laya._getUrlPath(),Laya.render=new Render(0,0),Laya.stage.size(width,height),window.stage=Laya.stage,RenderSprite.__init__(),KeyBoardManager.__init__(),MouseManager.instance.__init__(Laya.stage,Render.canvas),Input.__init__(),SoundManager.autoStopMusic=!0,Render.canvas}},Laya._getUrlPath=function(){var location=Browser.window.location,pathName=location.pathname;return pathName=":"==pathName.charAt(2)?pathName.substring(1):pathName,URL.getPath("file:"==location.protocol?pathName:location.protocol+"//"+location.host+location.pathname)},Laya._arrayBufferSlice=function(start,end){var arrU8List=new Uint8Array(this,start,end-start),newU8List=new Uint8Array(arrU8List.length);return newU8List.set(arrU8List),newU8List.buffer},Laya._runScript=function(script){return Browser.window[Laya._evcode](script)},Laya.enableDebugPanel=function(debugJsPath){if(void 0===debugJsPath&&(debugJsPath="libs/laya.debugtool.js"),Laya.DebugPanel)Laya.DebugPanel.enable();else{var script=Browser.createElement("script");script.onload=function(){Laya.DebugPanel.enable()},script.src=debugJsPath,Browser.document.body.appendChild(script)}},Laya.stage=null,Laya.systemTimer=null,Laya.startTimer=null,Laya.physicsTimer=null,Laya.updateTimer=null,Laya.lateTimer=null,Laya.timer=null,Laya.loader=null,Laya.version="2.1.1.1",Laya.render=null,Laya._currentStage=null,Laya._isinit=!1,Laya.isWXOpenDataContext=!1,Laya.isWXPosMsg=!1,__static(Laya,["_evcode",function(){return this._evcode="eval"}]);var LayaGLQuickRunner=function(){function LayaGLQuickRunner(){}return __class(LayaGLQuickRunner,"laya.renders.LayaGLQuickRunner"),LayaGLQuickRunner.__init__=function(){LayaGLQuickRunner.map[515]=LayaGLQuickRunner.alpha_transform_drawLayaGL,LayaGLQuickRunner.map[513]=LayaGLQuickRunner.alpha_drawLayaGL,LayaGLQuickRunner.map[514]=LayaGLQuickRunner.transform_drawLayaGL,LayaGLQuickRunner.map[8194]=LayaGLQuickRunner.transform_drawNodes,LayaGLQuickRunner.map[259]=LayaGLQuickRunner.alpha_transform_drawTexture,LayaGLQuickRunner.map[257]=LayaGLQuickRunner.alpha_drawTexture,LayaGLQuickRunner.map[258]=LayaGLQuickRunner.transform_drawTexture,LayaGLQuickRunner.map[8704]=LayaGLQuickRunner.drawLayaGL_drawNodes},LayaGLQuickRunner.transform_drawTexture=function(sprite,context,x,y){sprite._style;var tex=sprite.texture;context.saveTransform(LayaGLQuickRunner.curMat),context.transformByMatrix(sprite.transform,x,y),context.drawTexture(tex,-sprite.pivotX,-sprite.pivotY,sprite._width||tex.width,sprite._height||tex.height),context.restoreTransform(LayaGLQuickRunner.curMat)},LayaGLQuickRunner.alpha_drawTexture=function(sprite,context,x,y){var alpha,style=sprite._style,tex=sprite.texture;if((alpha=style.alpha)>.01||sprite._needRepaint()){var temp=context.globalAlpha;context.globalAlpha*=alpha,context.drawTexture(tex,x-style.pivotX+tex.offsetX,y-style.pivotY+tex.offsetY,sprite._width||tex.width,sprite._height||tex.height),context.globalAlpha=temp}},LayaGLQuickRunner.alpha_transform_drawTexture=function(sprite,context,x,y){var alpha,style=sprite._style,tex=sprite.texture;if((alpha=style.alpha)>.01||sprite._needRepaint()){var temp=context.globalAlpha;context.globalAlpha*=alpha,context.saveTransform(LayaGLQuickRunner.curMat),context.transformByMatrix(sprite.transform,x,y),context.drawTexture(tex,-style.pivotX+tex.offsetX,-style.pivotY+tex.offsetY,sprite._width||tex.width,sprite._height||tex.height),context.restoreTransform(LayaGLQuickRunner.curMat),context.globalAlpha=temp}},LayaGLQuickRunner.alpha_transform_drawLayaGL=function(sprite,context,x,y){var alpha,style=sprite._style;if((alpha=style.alpha)>.01||sprite._needRepaint()){var temp=context.globalAlpha;context.globalAlpha*=alpha,context.saveTransform(LayaGLQuickRunner.curMat),context.transformByMatrix(sprite.transform,x,y),sprite._graphics&&sprite._graphics._render(sprite,context,-style.pivotX,-style.pivotY),context.restoreTransform(LayaGLQuickRunner.curMat),context.globalAlpha=temp}},LayaGLQuickRunner.alpha_drawLayaGL=function(sprite,context,x,y){var alpha,style=sprite._style;if((alpha=style.alpha)>.01||sprite._needRepaint()){var temp=context.globalAlpha;context.globalAlpha*=alpha,sprite._graphics&&sprite._graphics._render(sprite,context,x-style.pivotX,y-style.pivotY),context.globalAlpha=temp}},LayaGLQuickRunner.transform_drawLayaGL=function(sprite,context,x,y){var style=sprite._style;context.saveTransform(LayaGLQuickRunner.curMat),context.transformByMatrix(sprite.transform,x,y),sprite._graphics&&sprite._graphics._render(sprite,context,-style.pivotX,-style.pivotY),context.restoreTransform(LayaGLQuickRunner.curMat)},LayaGLQuickRunner.transform_drawNodes=function(sprite,context,x,y){var textLastRender=sprite._getBit(256)&&context.drawCallOptimize(!0),style=sprite._style;context.saveTransform(LayaGLQuickRunner.curMat),context.transformByMatrix(sprite.transform,x,y),x=-style.pivotX,y=-style.pivotY;var ele,childs=sprite._children,n=childs.length;if(style.viewport){var rect=style.viewport,left=rect.x,top=rect.y,right=rect.right,bottom=rect.bottom,_x=NaN,_y=NaN;for(i=0;i<n;++i)(ele=childs[i])._visible&&(_x=ele._x)<right&&_x+ele.width>left&&(_y=ele._y)<bottom&&_y+ele.height>top&&ele.render(context,x,y)}else for(var i=0;i<n;++i)(ele=childs[i])._visible&&ele.render(context,x,y);context.restoreTransform(LayaGLQuickRunner.curMat),textLastRender&&context.drawCallOptimize(!1)},LayaGLQuickRunner.drawLayaGL_drawNodes=function(sprite,context,x,y){var textLastRender=sprite._getBit(256)&&context.drawCallOptimize(!0),style=sprite._style;x-=style.pivotX,y-=style.pivotY,sprite._graphics&&sprite._graphics._render(sprite,context,x,y);var ele,childs=sprite._children,n=childs.length;if(style.viewport){var rect=style.viewport,left=rect.x,top=rect.y,right=rect.right,bottom=rect.bottom,_x=NaN,_y=NaN;for(i=0;i<n;++i)(ele=childs[i])._visible&&(_x=ele._x)<right&&_x+ele.width>left&&(_y=ele._y)<bottom&&_y+ele.height>top&&ele.render(context,x,y)}else for(var i=0;i<n;++i)(ele=childs[i])._visible&&ele.render(context,x,y);textLastRender&&context.drawCallOptimize(!1)},LayaGLQuickRunner.map={},__static(LayaGLQuickRunner,["curMat",function(){return this.curMat=new Matrix}]),LayaGLQuickRunner}(),ColorUtils=function(){function ColorUtils(value){if(this.arrColor=[],null==value)return this.strColor="#00000000",this.numColor=0,void(this.arrColor=[0,0,0,0]);var i=0,len=0,color=0;if("string"==typeof value)if(value.indexOf("rgba(")>=0||value.indexOf("rgb(")>=0){var beginI,endI,tStr=value;for(beginI=tStr.indexOf("("),endI=tStr.indexOf(")"),tStr=tStr.substring(beginI+1,endI),this.arrColor=tStr.split(","),len=this.arrColor.length,i=0;i<len;i++)this.arrColor[i]=parseFloat(this.arrColor[i]),i<3&&(this.arrColor[i]=Math.round(this.arrColor[i]));color=4==this.arrColor.length?256*(256*(256*this.arrColor[0]+this.arrColor[1])+this.arrColor[2])+Math.round(255*this.arrColor[3]):256*(256*this.arrColor[0]+this.arrColor[1])+this.arrColor[2],this.strColor=value}else{if(this.strColor=value,"#"===value.charAt(0)&&(value=value.substr(1)),3===(len=value.length)||4===len){var temp="";for(i=0;i<len;i++)temp+=value[i]+value[i];value=temp}color=parseInt(value,16)}else color=value,this.strColor=Utils.toHexColor(color);this.strColor.indexOf("rgba")>=0||9===this.strColor.length?(this.arrColor=[((4278190080&color)>>>24)/255,((16711680&color)>>16)/255,((65280&color)>>8)/255,(255&color)/255],this.numColor=(4278190080&color)>>>24|(16711680&color)>>8|(65280&color)<<8|(255&color)<<24):(this.arrColor=[((16711680&color)>>16)/255,((65280&color)>>8)/255,(255&color)/255,1],this.numColor=4278190080|(16711680&color)>>16|65280&color|(255&color)<<16),this.arrColor.__id=++ColorUtils._COLODID}return __class(ColorUtils,"laya.utils.ColorUtils"),ColorUtils._initDefault=function(){for(var i in ColorUtils._DEFAULT={},ColorUtils._COLOR_MAP)ColorUtils._SAVE[i]=ColorUtils._DEFAULT[i]=new ColorUtils(ColorUtils._COLOR_MAP[i]);return ColorUtils._DEFAULT},ColorUtils._initSaveMap=function(){for(var i in ColorUtils._SAVE_SIZE=0,ColorUtils._SAVE={},ColorUtils._DEFAULT)ColorUtils._SAVE[i]=ColorUtils._DEFAULT[i]},ColorUtils.create=function(value){var key=value+"",color=ColorUtils._SAVE[key];return null!=color?color:(ColorUtils._SAVE_SIZE<1e3&&ColorUtils._initSaveMap(),ColorUtils._SAVE[key]=new ColorUtils(value))},ColorUtils._SAVE={},ColorUtils._SAVE_SIZE=0,ColorUtils._COLOR_MAP={purple:"#800080",orange:"#ffa500",white:"#FFFFFF",red:"#FF0000",green:"#00FF00",blue:"#0000FF",black:"#000000",yellow:"#FFFF00",gray:"#808080"},ColorUtils._DEFAULT=ColorUtils._initDefault(),ColorUtils._COLODID=1,ColorUtils}(),SaveBase=function(){function SaveBase(){}__class(SaveBase,"laya.webgl.canvas.save.SaveBase");var __proto=SaveBase.prototype;return Laya.imps(__proto,{"laya.webgl.canvas.save.ISaveData":!0}),__proto.isSaveMark=function(){return!1},__proto.restore=function(context){this._dataObj[this._valueName]=this._value,SaveBase.POOL[SaveBase.POOL._length++]=this,this._newSubmit&&(context._curSubmit=Submit.RENDERBASE)},SaveBase._createArray=function(){var value=[];return value._length=0,value},SaveBase._init=function(){var namemap=SaveBase._namemap={};return namemap[1]="ALPHA",namemap[2]="fillStyle",namemap[8]="font",namemap[256]="lineWidth",namemap[512]="strokeStyle",namemap[8192]="_mergeID",namemap[1024]=namemap[2048]=namemap[4096]=[],namemap[16384]="textBaseline",namemap[32768]="textAlign",namemap[65536]="_nBlendType",namemap[1048576]="shader",namemap[2097152]="filters",namemap[8388608]="_colorFiler",namemap},SaveBase.save=function(context,type,dataObj,newSubmit){if((context._saveMark._saveuse&type)!==type){context._saveMark._saveuse|=type;var cache=SaveBase.POOL,o=cache._length>0?cache[--cache._length]:new SaveBase;o._value=dataObj[o._valueName=SaveBase._namemap[type]],o._dataObj=dataObj,o._newSubmit=newSubmit;var _save=context._save;_save[_save._length++]=o}},SaveBase.POOL=laya.webgl.canvas.save.SaveBase._createArray(),SaveBase._namemap=SaveBase._init(),SaveBase}(),Submit=function(){function Submit(renderType){this.clipInfoID=-1,this._mesh=null,this._blendFn=null,this._id=0,this._renderType=0,this._parent=null,this._startIdx=0,this._numEle=0,this._ref=1,this.shaderValue=null,this._key=new SubmitKey,void 0===renderType&&(renderType=1e4),this._renderType=renderType,this._id=++Submit.ID}__class(Submit,"laya.webgl.submit.Submit");var __proto=Submit.prototype;return Laya.imps(__proto,{"laya.webgl.submit.ISubmit":!0}),__proto.getID=function(){return this._id},__proto.releaseRender=function(){Submit.RENDERBASE!=this&&--this._ref<1&&(Submit.POOL[Submit._poolSize++]=this,this.shaderValue.release(),this.shaderValue=null,this._mesh=null,this._parent&&(this._parent.releaseRender(),this._parent=null))},__proto.getRenderType=function(){return this._renderType},__proto.renderSubmit=function(){if(0===this._numEle||!this._mesh||0==this._numEle)return 1;var _tex=this.shaderValue.textureHost;if(_tex){var source=_tex._getSource();if(!source)return 1;this.shaderValue.texture=source}var gl=WebGL.mainContext;return this._mesh.useMesh(gl),this.shaderValue.upload(),BlendMode.activeBlendFunction!==this._blendFn&&(WebGLContext.setBlend(gl,!0),this._blendFn(gl),BlendMode.activeBlendFunction=this._blendFn),gl.drawElements(4,this._numEle,5123,this._startIdx),Stat.renderBatches++,Stat.trianglesFaces+=this._numEle/3,1},__proto._cloneInit=function(o,context,mesh,pos){o._ref=1,o._mesh=mesh,o._id=this._id,o._key.copyFrom(this._key),o._parent=this,o._blendFn=this._blendFn,o._renderType=this._renderType,o._startIdx=pos*CONST3D2D.BYTES_PIDX,o._numEle=this._numEle,o.shaderValue=this.shaderValue,this.shaderValue.ref++,this._ref++},__proto.clone=function(context,mesh,pos){return null},__proto.reUse=function(context,pos){return 0},__proto.toString=function(){return"ibindex:"+this._startIdx+" num:"+this._numEle+" key="+this._key},Submit.__init__=function(){var s=Submit.RENDERBASE=new Submit(-1);s.shaderValue=new Value2D(0,0),s.shaderValue.ALPHA=1,s._ref=4294967295},Submit.create=function(context,mesh,sv){var o=Submit._poolSize?Submit.POOL[--Submit._poolSize]:new Submit;o._ref=1,o._mesh=mesh,o._key.clear(),o._startIdx=mesh.indexNum*CONST3D2D.BYTES_PIDX,o._numEle=0;var blendType=context._nBlendType;o._blendFn=context._targets?BlendMode.targetFns[blendType]:BlendMode.fns[blendType],o.shaderValue=sv,o.shaderValue.setValue(context._shader2D);var filters=context._shader2D.filters;return filters&&o.shaderValue.setFilters(filters),o},Submit.createShape=function(ctx,mesh,numEle,sv){var o=Submit._poolSize?Submit.POOL[--Submit._poolSize]:new Submit;o._mesh=mesh,o._numEle=numEle,o._startIdx=2*mesh.indexNum,o._ref=1,o.shaderValue=sv,o.shaderValue.setValue(ctx._shader2D);var blendType=ctx._nBlendType;return o._key.blendShader=blendType,o._blendFn=ctx._targets?BlendMode.targetFns[blendType]:BlendMode.fns[blendType],o},Submit.TYPE_2D=1e4,Submit.TYPE_CANVAS=10003,Submit.TYPE_CMDSETRT=10004,Submit.TYPE_CUSTOM=10005,Submit.TYPE_BLURRT=10006,Submit.TYPE_CMDDESTORYPRERT=10007,Submit.TYPE_DISABLESTENCIL=10008,Submit.TYPE_OTHERIBVB=10009,Submit.TYPE_PRIMITIVE=10010,Submit.TYPE_RT=10011,Submit.TYPE_BLUR_RT=10012,Submit.TYPE_TARGET=10013,Submit.TYPE_CHANGE_VALUE=10014,Submit.TYPE_SHAPE=10015,Submit.TYPE_TEXTURE=10016,Submit.TYPE_FILLTEXTURE=10017,Submit.KEY_ONCE=-1,Submit.KEY_FILLRECT=1,Submit.KEY_DRAWTEXTURE=2,Submit.KEY_VG=3,Submit.KEY_TRIANGLES=4,Submit.RENDERBASE=null,Submit.ID=1,Submit.preRender=null,Submit._poolSize=0,Submit.POOL=[],Submit}(),FillTextureCmd=function(){function FillTextureCmd(){}__class(FillTextureCmd,"laya.display.cmd.FillTextureCmd");var __proto=FillTextureCmd.prototype;return __proto.recover=function(){this.texture=null,this.offset=null,this.other=null,Pool.recover("FillTextureCmd",this)},__proto.run=function(context,gx,gy){context.fillTexture(this.texture,this.x+gx,this.y+gy,this.width,this.height,this.type,this.offset,this.other)},__getset(0,__proto,"cmdID",function(){return"FillTexture"}),FillTextureCmd.create=function(texture,x,y,width,height,type,offset,other){var cmd=Pool.getItemByClass("FillTextureCmd",FillTextureCmd);return cmd.texture=texture,cmd.x=x,cmd.y=y,cmd.width=width,cmd.height=height,cmd.type=type,cmd.offset=offset,cmd.other=other,cmd},FillTextureCmd.ID="FillTexture",FillTextureCmd}(),Filter=function(){function Filter(){this._glRender=null}__class(Filter,"laya.filters.Filter");var __proto=Filter.prototype;return Laya.imps(__proto,{"laya.filters.IFilter":!0}),__getset(0,__proto,"type",function(){return-1}),Filter.BLUR=16,Filter.COLOR=32,Filter.GLOW=8,Filter._filter=function(sprite,context,x,y){var webglctx=context,next=this._next;if(next){var filters=sprite.filters,len=filters.length;if(1==len&&32==filters[0].type)return context.save(),context.setColorFilter(filters[0]),next._fun.call(next,sprite,context,x,y),void context.restore();var b,svCP=Value2D.create(1,0),p=Point.TEMP,tMatrix=webglctx._curMat,mat=Matrix.create();tMatrix.copyTo(mat);var tPadding=0,tHalfPadding=0,source=null,out=sprite._cacheStyle.filterCache||null;if(out&&0==sprite.getRepaint()){if((sprite._cacheStyle.hasGlowFilter||!1)&&(tPadding=50,tHalfPadding=25),(b=sprite.getBounds()).width<=0||b.height<=0)return;b.width+=tPadding,b.height+=tPadding,p.x=b.x*mat.a+b.y*mat.c,p.y=b.y*mat.d+b.x*mat.b,b.x=p.x,b.y=p.y,p.x=b.width*mat.a+b.height*mat.c,p.y=b.height*mat.d+b.width*mat.b,b.width=p.x,b.height=p.y}else{sprite._isHaveGlowFilter()&&(tPadding=50,tHalfPadding=25),(b=new Rectangle).copyFrom(sprite.getSelfBounds()),b.x+=sprite.x,b.y+=sprite.y,b.x-=sprite.pivotX+4,b.y-=sprite.pivotY+4;var tSX=b.x,tSY=b.y;if(b.width+=tPadding+8,b.height+=tPadding+8,p.x=b.x*mat.a+b.y*mat.c,p.y=b.y*mat.d+b.x*mat.b,b.x=p.x,b.y=p.y,p.x=b.width*mat.a+b.height*mat.c,p.y=b.height*mat.d+b.width*mat.b,b.width=p.x,b.height=p.y,b.width<=0||b.height<=0)return;out&&WebGLRTMgr.releaseRT(out),source=WebGLRTMgr.getRT(b.width,b.height);var outRT=out=WebGLRTMgr.getRT(b.width,b.height);sprite._getCacheStyle().filterCache=out,webglctx.pushRT(),webglctx.useRT(source);var tX=sprite.x-tSX+tHalfPadding,tY=sprite.y-tSY+tHalfPadding;next._fun.call(next,sprite,context,tX,tY),webglctx.useRT(outRT);for(var i=0;i<len;i++){0!=i&&(webglctx.useRT(source),webglctx.drawTarget(outRT,0,0,b.width,b.height,Matrix.TEMP.identity(),svCP,null,BlendMode.TOINT.overlay),webglctx.useRT(outRT));var fil=filters[i];switch(fil.type){case 16:case 8:fil._glRender&&fil._glRender.render(source,context,b.width,b.height,fil);break;case 32:webglctx.setColorFilter(fil),webglctx.drawTarget(source,0,0,b.width,b.height,Matrix.EMPTY.identity(),Value2D.create(1,0)),webglctx.setColorFilter(null)}}webglctx.popRT()}if(x=x-tHalfPadding-sprite.x,y=y-tHalfPadding-sprite.y,p.setTo(x,y),mat.transformPoint(p),x=p.x+b.x,y=p.y+b.y,webglctx._drawRenderTexture(out,x,y,b.width,b.height,Matrix.TEMP.identity(),1,RenderTexture2D.defuv),source){var submit=SubmitCMD.create([source],function(s){s.destroy()},this);source=null,context.addRenderObject(submit)}mat.destroy()}},Filter}(),TouchManager=(function(){function Log(){}__class(Log,"laya.utils.Log"),Log.enable=function(){Log._logdiv||(Log._logdiv=Browser.createElement("div"),Log._logdiv.style.cssText="border:white;padding:4px;overflow-y:auto;z-index:1000000;background:rgba(100,100,100,0.6);color:white;position: absolute;left:0px;top:0px;width:50%;height:50%;",Browser.document.body.appendChild(Log._logdiv),Log._btn=Browser.createElement("button"),Log._btn.innerText="Hide",Log._btn.style.cssText="z-index:1000001;position: absolute;left:10px;top:10px;",Log._btn.onclick=Log.toggle,Browser.document.body.appendChild(Log._btn))},Log.toggle=function(){var style=Log._logdiv.style;""===style.display?(Log._btn.innerText="Show",style.display="none"):(Log._btn.innerText="Hide",style.display="")},Log.print=function(value){Log._logdiv&&(Log._count>=Log.maxCount&&Log.clear(),Log._count++,Log._logdiv.innerText+=value+"\n",Log.autoScrollToBottom&&Log._logdiv.scrollHeight-Log._logdiv.scrollTop-Log._logdiv.clientHeight<50&&(Log._logdiv.scrollTop=Log._logdiv.scrollHeight))},Log.clear=function(){Log._logdiv.innerText="",Log._count=0},Log._logdiv=null,Log._btn=null,Log._count=0,Log.maxCount=50,Log.autoScrollToBottom=!0}(),function(){function TouchManager(){this.preOvers=[],this.preDowns=[],this.preRightDowns=[],this.enable=!0,this._lastClickTime=0,this._event=new Event}__class(TouchManager,"laya.events.TouchManager");var __proto=TouchManager.prototype;return __proto._clearTempArrs=function(){TouchManager._oldArr.length=0,TouchManager._newArr.length=0,TouchManager._tEleArr.length=0},__proto.getTouchFromArr=function(touchID,arr){var len,tTouchO,i=0;for(len=arr.length,i=0;i<len;i++)if((tTouchO=arr[i]).id==touchID)return tTouchO;return null},__proto.removeTouchFromArr=function(touchID,arr){var i=0;for(i=arr.length-1;i>=0;i--)arr[i].id==touchID&&arr.splice(i,1)},__proto.createTouchO=function(ele,touchID){var rst;return(rst=Pool.getItem("TouchData")||{}).id=touchID,rst.tar=ele,rst},__proto.onMouseDown=function(ele,touchID,isLeft){var preO,tO,arrs,preDowns;(void 0===isLeft&&(isLeft=!1),this.enable)&&(preO=this.getTouchFromArr(touchID,this.preOvers),arrs=this.getEles(ele,null,TouchManager._tEleArr),preO?preO.tar=ele:(tO=this.createTouchO(ele,touchID),this.preOvers.push(tO)),Browser.onMobile&&this.sendEvents(arrs,"mouseover"),preDowns=isLeft?this.preDowns:this.preRightDowns,(preO=this.getTouchFromArr(touchID,preDowns))?preO.tar=ele:(tO=this.createTouchO(ele,touchID),preDowns.push(tO)),this.sendEvents(arrs,isLeft?"mousedown":"rightmousedown"),this._clearTempArrs())},__proto.sendEvents=function(eles,type){var len,_target,tE,i=0;for(len=eles.length,this._event._stoped=!1,_target=eles[0],i=0;i<len;i++){if((tE=eles[i]).destroyed)return;if(tE.event(type,this._event.setTo(type,tE,_target)),this._event._stoped)break}},__proto.getEles=function(start,end,rst){for(rst?rst.length=0:rst=[];start&&start!=end;)rst.push(start),start=start.parent;return rst},__proto.checkMouseOutAndOverOfMove=function(eleNew,elePre,touchID){if(void 0===touchID&&(touchID=0),elePre!=eleNew){var tar,arrs,i=0,len=0;if(elePre.contains(eleNew))arrs=this.getEles(eleNew,elePre,TouchManager._tEleArr),this.sendEvents(arrs,"mouseover");else if(eleNew.contains(elePre))arrs=this.getEles(elePre,eleNew,TouchManager._tEleArr),this.sendEvents(arrs,"mouseout");else{var oldArr,newArr;(arrs=TouchManager._tEleArr).length=0,oldArr=this.getEles(elePre,null,TouchManager._oldArr),newArr=this.getEles(eleNew,null,TouchManager._newArr),len=oldArr.length;var tIndex=0;for(i=0;i<len;i++){if(tar=oldArr[i],(tIndex=newArr.indexOf(tar))>=0){newArr.splice(tIndex,newArr.length-tIndex);break}arrs.push(tar)}arrs.length>0&&this.sendEvents(arrs,"mouseout"),newArr.length>0&&this.sendEvents(newArr,"mouseover")}}},__proto.onMouseMove=function(ele,touchID){var preO,arrs;this.enable&&((preO=this.getTouchFromArr(touchID,this.preOvers))?(this.checkMouseOutAndOverOfMove(ele,preO.tar),preO.tar=ele,arrs=this.getEles(ele,null,TouchManager._tEleArr)):(arrs=this.getEles(ele,null,TouchManager._tEleArr),this.sendEvents(arrs,"mouseover"),this.preOvers.push(this.createTouchO(ele,touchID))),this.sendEvents(arrs,"mousemove"),this._clearTempArrs())},__proto.getLastOvers=function(){return TouchManager._tEleArr.length=0,this.preOvers.length>0&&this.preOvers[0].tar?this.getEles(this.preOvers[0].tar,null,TouchManager._tEleArr):(TouchManager._tEleArr.push(Laya.stage),TouchManager._tEleArr)},__proto.stageMouseOut=function(){var lastOvers;lastOvers=this.getLastOvers(),this.preOvers.length=0,this.sendEvents(lastOvers,"mouseout")},__proto.onMouseUp=function(ele,touchID,isLeft){if(void 0===isLeft&&(isLeft=!1),this.enable){var preO,arrs,oldArr,tar,sendArr,preDowns,i=0,len=0,onMobile=Browser.onMobile;if(arrs=this.getEles(ele,null,TouchManager._tEleArr),this.sendEvents(arrs,isLeft?"mouseup":"rightmouseup"),preDowns=isLeft?this.preDowns:this.preRightDowns,preO=this.getTouchFromArr(touchID,preDowns)){var isDouble,now=Browser.now();if(isDouble=now-this._lastClickTime<300,this._lastClickTime=now,ele==preO.tar)sendArr=arrs;else for(oldArr=this.getEles(preO.tar,null,TouchManager._oldArr),(sendArr=TouchManager._newArr).length=0,len=oldArr.length,i=0;i<len;i++)tar=oldArr[i],arrs.indexOf(tar)>=0&&sendArr.push(tar);sendArr.length>0&&this.sendEvents(sendArr,isLeft?"click":"rightclick"),isLeft&&isDouble&&this.sendEvents(sendArr,"doubleclick"),this.removeTouchFromArr(touchID,preDowns),preO.tar=null,Pool.recover("TouchData",preO)}else;(preO=this.getTouchFromArr(touchID,this.preOvers))&&onMobile&&((sendArr=this.getEles(preO.tar,null,sendArr))&&sendArr.length>0&&this.sendEvents(sendArr,"mouseout"),this.removeTouchFromArr(touchID,this.preOvers),preO.tar=null,Pool.recover("TouchData",preO)),this._clearTempArrs()}},TouchManager._oldArr=[],TouchManager._newArr=[],TouchManager._tEleArr=[],__static(TouchManager,["I",function(){return this.I=new TouchManager}]),TouchManager}()),SubmitTarget=function(){function SubmitTarget(){this._mesh=null,this._startIdx=0,this._numEle=0,this.shaderValue=null,this.blendType=0,this._ref=1,this.srcRT=null,this._key=new SubmitKey}__class(SubmitTarget,"laya.webgl.submit.SubmitTarget");var __proto=SubmitTarget.prototype;return Laya.imps(__proto,{"laya.webgl.submit.ISubmit":!0}),__proto.renderSubmit=function(){var gl=WebGL.mainContext;this._mesh.useMesh(gl);var target=this.srcRT;return target&&(this.shaderValue.texture=target._getSource(),this.shaderValue.upload(),this.blend(),Stat.renderBatches++,Stat.trianglesFaces+=this._numEle/3,WebGL.mainContext.drawElements(4,this._numEle,5123,this._startIdx)),1},__proto.blend=function(){if(BlendMode.activeBlendFunction!==BlendMode.fns[this.blendType]){var gl=WebGL.mainContext;gl.enable(3042),BlendMode.fns[this.blendType](gl),BlendMode.activeBlendFunction=BlendMode.fns[this.blendType]}},__proto.getRenderType=function(){return 0},__proto.releaseRender=function(){if(--this._ref<1){var pool=SubmitTarget.POOL;pool[pool._length++]=this}},__proto.reUse=function(context,pos){return this._startIdx=pos,this._ref++,pos},SubmitTarget.create=function(context,mesh,sv,rt){var o=SubmitTarget.POOL._length?SubmitTarget.POOL[--SubmitTarget.POOL._length]:new SubmitTarget;if(o._mesh=mesh,o.srcRT=rt,o._startIdx=mesh.indexNum*CONST3D2D.BYTES_PIDX,o._ref=1,o._key.clear(),o._numEle=0,o.blendType=context._nBlendType,o._key.blendShader=o.blendType,o.shaderValue=sv,o.shaderValue.setValue(context._shader2D),context._colorFiler){var ft=context._colorFiler;sv.defines.add(ft.type),sv.colorMat=ft._mat,sv.colorAlpha=ft._alpha}return o},SubmitTarget.POOL=[],SubmitTarget.__init$=function(){SubmitTarget.POOL._length=0},SubmitTarget}(),DrawImageCmd=function(){function DrawImageCmd(){}__class(DrawImageCmd,"laya.display.cmd.DrawImageCmd");var __proto=DrawImageCmd.prototype;return __proto.recover=function(){this.texture._removeReference(),this.texture=null,Pool.recover("DrawImageCmd",this)},__proto.run=function(context,gx,gy){context.drawTexture(this.texture,this.x+gx,this.y+gy,this.width,this.height)},__getset(0,__proto,"cmdID",function(){return"DrawImage"}),DrawImageCmd.create=function(texture,x,y,width,height){var cmd=Pool.getItemByClass("DrawImageCmd",DrawImageCmd);return cmd.texture=texture,texture._addReference(),cmd.x=x,cmd.y=y,cmd.width=width,cmd.height=height,cmd},DrawImageCmd.ID="DrawImage",DrawImageCmd}(),Component=function(){function Component(){this._id=Utils.getGID(),this._resetComp()}__class(Component,"laya.components.Component");var __proto=Component.prototype;return Laya.imps(__proto,{"laya.resource.ISingletonElement":!0,"laya.resource.IDestroy":!0}),__proto._isScript=function(){return!1},__proto._resetComp=function(){this._indexInList=-1,this._enabled=!0,this._awaked=!1,this.owner=null},__proto._getIndexInList=function(){return this._indexInList},__proto._setIndexInList=function(index){this._indexInList=index},__proto._onAdded=function(){},__proto._onAwake=function(){},__proto._onEnable=function(){},__proto._onDisable=function(){},__proto._onEnableInScene=function(){},__proto._onDisableInScene=function(){},__proto._onDestroy=function(){},__proto.onReset=function(){},__proto._parse=function(data){},__proto._cloneTo=function(dest){},__proto._setActive=function(value){value?(this._awaked||(this._awaked=!0,this._onAwake()),this._enabled&&this._onEnable()):this._enabled&&this._onDisable()},__proto._setActiveInScene=function(value){value?this._onEnableInScene():this._onDisableInScene()},__proto.destroy=function(){this.owner&&this.owner._destroyComponent(this)},__proto._destroy=function(){this.owner.activeInHierarchy&&this._enabled&&(this._setActive(!1),this._isScript()&&this.onDisable()),this.owner._scene&&this._setActiveInScene(!1),this._onDestroy(),this._destroyed=!0,this.onReset!==laya.components.Component.prototype.onReset?(this.onReset(),this._resetComp(),Pool.recoverByClass(this)):this._resetComp()},__getset(0,__proto,"id",function(){return this._id}),__getset(0,__proto,"enabled",function(){return this._enabled},function(value){this._enabled=value,this.owner&&(value?this.owner.activeInHierarchy&&this._onEnable():this.owner.activeInHierarchy&&this._onDisable())}),__getset(0,__proto,"isSingleton",function(){return!0}),__getset(0,__proto,"destroyed",function(){return this._destroyed}),Component}(),EventDispatcher=function(){var EventHandler;function EventDispatcher(){this._$0__events=null}__class(EventDispatcher,"laya.events.EventDispatcher");var __proto=EventDispatcher.prototype;return __proto.hasListener=function(type){return!!(this._$0__events&&this._$0__events[type])},__proto.event=function(type,data){if(!this._$0__events||!this._$0__events[type])return!1;var listeners=this._$0__events[type];if(listeners.run)listeners.once&&delete this._$0__events[type],null!=data?listeners.runWith(data):listeners.run();else{for(var i=0,n=listeners.length;i<n;i++){var listener=listeners[i];listener&&(null!=data?listener.runWith(data):listener.run()),listener&&!listener.once||(listeners.splice(i,1),i--,n--)}0===listeners.length&&this._$0__events&&delete this._$0__events[type]}return!0},__proto.on=function(type,caller,listener,args){return this._createListener(type,caller,listener,args,!1)},__proto.once=function(type,caller,listener,args){return this._createListener(type,caller,listener,args,!0)},__proto._createListener=function(type,caller,listener,args,once,offBefore){void 0===offBefore&&(offBefore=!0),offBefore&&this.off(type,caller,listener,once);var handler=EventHandler.create(caller||this,listener,args,once);this._$0__events||(this._$0__events={});var events=this._$0__events;return events[type]?events[type].run?events[type]=[events[type],handler]:events[type].push(handler):events[type]=handler,this},__proto.off=function(type,caller,listener,onceOnly){if(void 0===onceOnly&&(onceOnly=!1),!this._$0__events||!this._$0__events[type])return this;var listeners=this._$0__events[type];if(null!=listeners)if(listeners.run)caller&&listeners.caller!==caller||null!=listener&&listeners.method!==listener||onceOnly&&!listeners.once||(delete this._$0__events[type],listeners.recover());else{for(var count=0,i=0,n=listeners.length;i<n;i++){var item=listeners[i];item?!item||caller&&item.caller!==caller||null!=listener&&item.method!==listener||onceOnly&&!item.once||(count++,listeners[i]=null,item.recover()):count++}count===n&&delete this._$0__events[type]}return this},__proto.offAll=function(type){var events=this._$0__events;if(!events)return this;if(type)this._recoverHandlers(events[type]),delete events[type];else{for(var name in events)this._recoverHandlers(events[name]);this._$0__events=null}return this},__proto.offAllCaller=function(caller){if(caller&&this._$0__events)for(var name in this._$0__events)this.off(name,caller,null);return this},__proto._recoverHandlers=function(arr){if(arr)if(arr.run)arr.recover();else for(var i=arr.length-1;i>-1;i--)arr[i]&&(arr[i].recover(),arr[i]=null)},__proto.isMouseEvent=function(type){return EventDispatcher.MOUSE_EVENTS[type]||!1},EventDispatcher.MOUSE_EVENTS={rightmousedown:!0,rightmouseup:!0,rightclick:!0,mousedown:!0,mouseup:!0,mousemove:!0,mouseover:!0,mouseout:!0,click:!0,doubleclick:!0},EventDispatcher.__init$=function(){Object.defineProperty(laya.events.EventDispatcher.prototype,"_events",{enumerable:!1,writable:!0}),EventHandler=function(_super){function EventHandler(caller,method,args,once){EventHandler.__super.call(this,caller,method,args,once)}return __class(EventHandler,"",Handler),EventHandler.prototype.recover=function(){this._id>0&&(this._id=0,EventHandler._pool.push(this.clear()))},EventHandler.create=function(caller,method,args,once){return void 0===once&&(once=!0),EventHandler._pool.length?EventHandler._pool.pop().setTo(caller,method,args,once):new EventHandler(caller,method,args,once)},EventHandler._pool=[],EventHandler}()},EventDispatcher}(),Handler=function(){function Handler(caller,method,args,once){this.once=!1,this._id=0,void 0===once&&(once=!1),this.setTo(caller,method,args,once)}__class(Handler,"laya.utils.Handler");var __proto=Handler.prototype;return __proto.setTo=function(caller,method,args,once){return this._id=Handler._gid++,this.caller=caller,this.method=method,this.args=args,this.once=once,this},__proto.run=function(){if(null==this.method)return null;var id=this._id,result=this.method.apply(this.caller,this.args);return this._id===id&&this.once&&this.recover(),result},__proto.runWith=function(data){if(null==this.method)return null;var id=this._id;if(null==data)var result=this.method.apply(this.caller,this.args);else result=this.args||data.unshift?this.args?this.method.apply(this.caller,this.args.concat(data)):this.method.apply(this.caller,data):this.method.call(this.caller,data);return this._id===id&&this.once&&this.recover(),result},__proto.clear=function(){return this.caller=null,this.method=null,this.args=null,this},__proto.recover=function(){this._id>0&&(this._id=0,Handler._pool.push(this.clear()))},Handler.create=function(caller,method,args,once){return void 0===once&&(once=!0),Handler._pool.length?Handler._pool.pop().setTo(caller,method,args,once):new Handler(caller,method,args,once)},Handler._pool=[],Handler._gid=1,Handler}(),SkinMeshBuffer=function(){function SkinMeshBuffer(){this.ib=null,this.vb=null;WebGL.mainContext;this.ib=IndexBuffer2D.create(35048),this.vb=VertexBuffer2D.create(8)}__class(SkinMeshBuffer,"laya.webgl.shader.d2.skinAnishader.SkinMeshBuffer");var __proto=SkinMeshBuffer.prototype;return __proto.addSkinMesh=function(skinMesh){skinMesh.getData2(this.vb,this.ib,this.vb._byteLength/32)},__proto.reset=function(){this.vb.clear(),this.ib.clear()},SkinMeshBuffer.getInstance=function(){return SkinMeshBuffer.instance=SkinMeshBuffer.instance||new SkinMeshBuffer},SkinMeshBuffer.instance=null,SkinMeshBuffer}(),DrawTrianglesCmd=function(){function DrawTrianglesCmd(){}__class(DrawTrianglesCmd,"laya.display.cmd.DrawTrianglesCmd");var __proto=DrawTrianglesCmd.prototype;return __proto.recover=function(){this.texture=null,this.vertices=null,this.uvs=null,this.indices=null,this.matrix=null,Pool.recover("DrawTrianglesCmd",this)},__proto.run=function(context,gx,gy){context.drawTriangles(this.texture,this.x+gx,this.y+gy,this.vertices,this.uvs,this.indices,this.matrix,this.alpha,this.color,this.blendMode)},__getset(0,__proto,"cmdID",function(){return"DrawTriangles"}),DrawTrianglesCmd.create=function(texture,x,y,vertices,uvs,indices,matrix,alpha,color,blendMode){var cmd=Pool.getItemByClass("DrawTrianglesCmd",DrawTrianglesCmd);if(cmd.texture=texture,cmd.x=x,cmd.y=y,cmd.vertices=vertices,cmd.uvs=uvs,cmd.indices=indices,cmd.matrix=matrix,cmd.alpha=alpha,color){cmd.color=new ColorFilter;var c=ColorUtils.create(color).arrColor;cmd.color.color(255*c[0],255*c[1],255*c[2],255*c[3])}return cmd.blendMode=blendMode,cmd},DrawTrianglesCmd.ID="DrawTriangles",DrawTrianglesCmd}(),DrawPieCmd=function(){function DrawPieCmd(){}__class(DrawPieCmd,"laya.display.cmd.DrawPieCmd");var __proto=DrawPieCmd.prototype;return __proto.recover=function(){this.fillColor=null,this.lineColor=null,Pool.recover("DrawPieCmd",this)},__proto.run=function(context,gx,gy){context._drawPie(this.x+gx,this.y+gy,this.radius,this._startAngle,this._endAngle,this.fillColor,this.lineColor,this.lineWidth,this.vid)},__getset(0,__proto,"startAngle",function(){return 180*this._startAngle/Math.PI},function(value){this._startAngle=value*Math.PI/180}),__getset(0,__proto,"cmdID",function(){return"DrawPie"}),__getset(0,__proto,"endAngle",function(){return 180*this._endAngle/Math.PI},function(value){this._endAngle=value*Math.PI/180}),DrawPieCmd.create=function(x,y,radius,startAngle,endAngle,fillColor,lineColor,lineWidth,vid){var cmd=Pool.getItemByClass("DrawPieCmd",DrawPieCmd);return cmd.x=x,cmd.y=y,cmd.radius=radius,cmd._startAngle=startAngle,cmd._endAngle=endAngle,cmd.fillColor=fillColor,cmd.lineColor=lineColor,cmd.lineWidth=lineWidth,cmd.vid=vid,cmd},DrawPieCmd.ID="DrawPie",DrawPieCmd}(),WordText=function(){function WordText(){this.id=NaN,this.save=[],this.toUpperCase=null,this.changed=!1,this._text=null,this.width=-1,this.pageChars=[],this.startID=0,this.startIDStroke=0,this.lastGCCnt=0,this.splitRender=!1}__class(WordText,"laya.utils.WordText");var __proto=WordText.prototype;return __proto.setText=function(txt){this.changed=!0,this._text=txt,this.width=-1,this.cleanCache()},__proto.toString=function(){return this._text},__proto.charCodeAt=function(i){return this._text?this._text.charCodeAt(i):NaN},__proto.charAt=function(i){return this._text?this._text.charAt(i):null},__proto.cleanCache=function(){this.pageChars.forEach(function(p){var tex=p.tex;p.words;1==p.words.length&&tex&&tex.ri&&tex.destroy()}),this.pageChars=[],this.startID=0},__getset(0,__proto,"length",function(){return this._text?this._text.length:0}),WordText}(),Mesh2D=function(){function Mesh2D(stride,vballoc,iballoc){this._stride=0,this.vertNum=0,this.indexNum=0,this._applied=!1,this._vb=null,this._ib=null,this._vao=null,this._attribInfo=null,this._quadNum=0,this.canReuse=!1,this._stride=stride,this._vb=new VertexBuffer2D(stride,35048),vballoc?this._vb._resizeBuffer(vballoc,!1):Config.webGL2D_MeshAllocMaxMem&&this._vb._resizeBuffer(65536*stride,!1),this._ib=new IndexBuffer2D,iballoc&&this._ib._resizeBuffer(iballoc,!1)}__class(Mesh2D,"laya.webgl.utils.Mesh2D");var __proto=Mesh2D.prototype;return __proto.cloneWithNewVB=function(){var mesh=new Mesh2D(this._stride,0,0);return mesh._ib=this._ib,mesh._quadNum=this._quadNum,mesh._attribInfo=this._attribInfo,mesh},__proto.cloneWithNewVBIB=function(){var mesh=new Mesh2D(this._stride,0,0);return mesh._attribInfo=this._attribInfo,mesh},__proto.getVBW=function(){return this._vb.setNeedUpload(),this._vb},__proto.getVBR=function(){return this._vb},__proto.getIBR=function(){return this._ib},__proto.getIBW=function(){return this._ib.setNeedUpload(),this._ib},__proto.createQuadIB=function(QuadNum){this._quadNum=QuadNum,this._ib._resizeBuffer(6*QuadNum*2,!1),this._ib.byteLength=this._ib.bufferLength;for(var bd=this._ib.getUint16Array(),idx=0,curvert=0,i=0;i<QuadNum;i++)bd[idx++]=curvert,bd[idx++]=curvert+2,bd[idx++]=curvert+1,bd[idx++]=curvert,bd[idx++]=curvert+3,bd[idx++]=curvert+2,curvert+=4;this._ib.setNeedUpload()},__proto.setAttributes=function(attribs){if(this._attribInfo=attribs,this._attribInfo.length%3!=0)throw"Mesh2D setAttributes error!"},__proto.configVAO=function(gl){if(!this._applied){this._applied=!0,this._vao||(this._vao=new BufferState2D),this._vao.bind(),this._vb._bindForVAO(),this._ib.setNeedUpload(),this._ib._bind_uploadForVAO();for(var attribNum=this._attribInfo.length/3,idx=0,i=0;i<attribNum;i++){var _size=this._attribInfo[idx+1],_type=this._attribInfo[idx],_off=this._attribInfo[idx+2];gl.enableVertexAttribArray(i),gl.vertexAttribPointer(i,_size,_type,!1,this._stride,_off),idx+=3}this._vao.unBind()}},__proto.useMesh=function(gl){this._applied||this.configVAO(gl),this._vao.bind(),this._vb.bind(),this._ib._bind_upload()||this._ib.bind(),this._vb._bind_upload()||this._vb.bind()},__proto.getEleNum=function(){return this._ib.getBuffer().byteLength/2},__proto.releaseMesh=function(){},__proto.destroy=function(){},__proto.clearVB=function(){this._vb.clear()},Mesh2D._gvaoid=0,Mesh2D}(),Event=function(){function Event(){}__class(Event,"laya.events.Event");var __proto=Event.prototype;return __proto.setTo=function(type,currentTarget,target){return this.type=type,this.currentTarget=currentTarget,this.target=target,this},__proto.stopPropagation=function(){this._stoped=!0},__getset(0,__proto,"stageY",function(){return Laya.stage.mouseY}),__getset(0,__proto,"charCode",function(){return this.nativeEvent.charCode}),__getset(0,__proto,"touches",function(){if(!this.nativeEvent)return null;var arr=this.nativeEvent.touches;if(arr)for(var stage=Laya.stage,i=0,n=arr.length;i<n;i++){var e=arr[i],point=Point.TEMP;point.setTo(e.clientX,e.clientY),stage._canvasTransform.invertTransformPoint(point),stage.transform.invertTransformPoint(point),e.stageX=point.x,e.stageY=point.y}return arr}),__getset(0,__proto,"keyLocation",function(){return this.nativeEvent.location||this.nativeEvent.keyLocation}),__getset(0,__proto,"ctrlKey",function(){return this.nativeEvent.ctrlKey}),__getset(0,__proto,"altKey",function(){return this.nativeEvent.altKey}),__getset(0,__proto,"shiftKey",function(){return this.nativeEvent.shiftKey}),__getset(0,__proto,"stageX",function(){return Laya.stage.mouseX}),Event.EMPTY=new Event,Event.MOUSE_DOWN="mousedown",Event.MOUSE_UP="mouseup",Event.CLICK="click",Event.RIGHT_MOUSE_DOWN="rightmousedown",Event.RIGHT_MOUSE_UP="rightmouseup",Event.RIGHT_CLICK="rightclick",Event.MOUSE_MOVE="mousemove",Event.MOUSE_OVER="mouseover",Event.MOUSE_OUT="mouseout",Event.MOUSE_WHEEL="mousewheel",Event.ROLL_OVER="mouseover",Event.ROLL_OUT="mouseout",Event.DOUBLE_CLICK="doubleclick",Event.CHANGE="change",Event.CHANGED="changed",Event.RESIZE="resize",Event.ADDED="added",Event.REMOVED="removed",Event.DISPLAY="display",Event.UNDISPLAY="undisplay",Event.ERROR="error",Event.COMPLETE="complete",Event.LOADED="loaded",Event.READY="ready",Event.PROGRESS="progress",Event.INPUT="input",Event.RENDER="render",Event.OPEN="open",Event.MESSAGE="message",Event.CLOSE="close",Event.KEY_DOWN="keydown",Event.KEY_PRESS="keypress",Event.KEY_UP="keyup",Event.FRAME="enterframe",Event.DRAG_START="dragstart",Event.DRAG_MOVE="dragmove",Event.DRAG_END="dragend",Event.ENTER="enter",Event.SELECT="select",Event.BLUR="blur",Event.FOCUS="focus",Event.VISIBILITY_CHANGE="visibilitychange",Event.FOCUS_CHANGE="focuschange",Event.PLAYED="played",Event.PAUSED="paused",Event.STOPPED="stopped",Event.START="start",Event.END="end",Event.COMPONENT_ADDED="componentadded",Event.COMPONENT_REMOVED="componentremoved",Event.RELEASED="released",Event.LINK="link",Event.LABEL="label",Event.FULL_SCREEN_CHANGE="fullscreenchange",Event.DEVICE_LOST="devicelost",Event.TRANSFORM_CHANGED="transformchanged",Event.ANIMATION_CHANGED="animationchanged",Event.TRAIL_FILTER_CHANGE="trailfilterchange",Event.TRIGGER_ENTER="triggerenter",Event.TRIGGER_STAY="triggerstay",Event.TRIGGER_EXIT="triggerexit",Event}(),TextRender=function(){function TextRender(){this.fontSizeInfo={},this.charRender=null,this.mapFont={},this.fontID=0,this.mapColor=[],this.colorID=0,this.fontScaleX=1,this.fontScaleY=1,this._curStrPos=0,this.bmpData32=null,this.lastFont=null,this.fontSizeW=0,this.fontSizeH=0,this.fontSizeOffX=0,this.fontSizeOffY=0,this.renderPerChar=!0,this.textureMem=0,this.fontStr=null,this.textAtlases=[],this.isoTextures=[],this.tmpAtlasPos=new Point;var bugIOS=!1,miniadp=Laya.MiniAdpter;miniadp&&miniadp.systemInfo&&miniadp.systemInfo.system&&(bugIOS="ios 10.1.1"===miniadp.systemInfo.system.toLowerCase()),Browser.onMiniGame&&!bugIOS&&(TextRender.isWan1Wan=!0),Browser.onLimixiu&&(TextRender.isWan1Wan=!0),this.charRender=Render.isConchApp?new CharRender_Native:new CharRender_Canvas(TextRender.atlasWidth,TextRender.atlasWidth,TextRender.scaleFontWithCtx,!TextRender.isWan1Wan,!1),TextRender.textRenderInst=this,Laya.textRender=this,TextRender.atlasWidth2=TextRender.atlasWidth*TextRender.atlasWidth}__class(TextRender,"laya.webgl.text.TextRender");var __proto=TextRender.prototype;return __proto.setFont=function(font){if(this.lastFont!=font){this.lastFont=font;var fontsz=this.getFontSizeInfo(font._family),offx=fontsz>>24,offy=fontsz>>16&255,fw=fontsz>>8&255,fh=255&fontsz,k=font._size/TextRender.standardFontSize;this.fontSizeOffX=Math.ceil(offx*k),this.fontSizeOffY=Math.ceil(offy*k),this.fontSizeW=Math.ceil(fw*k),this.fontSizeH=Math.ceil(fh*k),font._font.indexOf("italic")>=0?this.fontStr=font._font.replace("italic",""):this.fontStr=font._font}},__proto.getNextChar=function(str){var len=str.length,start=this._curStrPos;if(start>=len)return null;for(var i=start,state=0;i<len;i++){var c=str.charCodeAt(i);if(c>>>11==27){if(1==state)break;state=1,i++}else if(65038===c||65039===c);else if(8205==c)state=2;else if(0==state)state=1;else if(1==state)break}return this._curStrPos=i,str.substring(start,i)},__proto.filltext=function(ctx,data,x,y,fontStr,color,strokeColor,lineWidth,textAlign,underLine){if(void 0===underLine&&(underLine=0),!(data.length<=0)){var font=FontInfo.Parse(fontStr),nTextAlign=0;switch(textAlign){case"center":nTextAlign=Context.ENUM_TEXTALIGN_CENTER;break;case"right":nTextAlign=Context.ENUM_TEXTALIGN_RIGHT}this._fast_filltext(ctx,data,null,x,y,font,color,strokeColor,lineWidth,nTextAlign,underLine)}},__proto.fillWords=function(ctx,data,x,y,fontStr,color,strokeColor,lineWidth){if(data&&!(data.length<=0)){var font=FontInfo.Parse(fontStr);this._fast_filltext(ctx,null,data,x,y,font,color,strokeColor,lineWidth,0,0)}},__proto._fast_filltext=function(ctx,data,htmlchars,x,y,font,color,strokeColor,lineWidth,textAlign,underLine){if(void 0===underLine&&(underLine=0),!(data&&data.length<1||htmlchars&&htmlchars.length<1)){if(lineWidth<0&&(lineWidth=0),this.setFont(font),this.fontScaleX=this.fontScaleY=1,!Render.isConchApp&&TextRender.scaleFontWithCtx){var sx=1,sy=1;if(Render.isConchApp?(sx=ctx._curMat.getScaleX(),sy=ctx._curMat.getScaleY()):(sx=ctx.getMatScaleX(),sy=ctx.getMatScaleY()),sx<1e-4||sy<.1)return;sx>1&&(this.fontScaleX=sx),sy>1&&(this.fontScaleY=sy)}font._italic&&(ctx._italicDeg=13);var wt=data,isWT=!htmlchars&&data instanceof laya.utils.WordText,str=data,isHtmlChar=!!htmlchars,sameTexData=isWT?wt.pageChars:[],strWidth=0;switch(isWT?(str=wt._text,(strWidth=wt.width)<0&&(strWidth=wt.width=this.charRender.getWidth(this.fontStr,str))):strWidth=str?this.charRender.getWidth(this.fontStr,str):0,textAlign){case Context.ENUM_TEXTALIGN_CENTER:x-=strWidth/2;break;case Context.ENUM_TEXTALIGN_RIGHT:x-=strWidth}wt&&sameTexData&&this.hasFreedText(sameTexData)&&(sameTexData=wt.pageChars=[]);var ri=null,splitTex=(isWT||TextRender.forceWholeRender,this.renderPerChar=!isWT||TextRender.forceSplitRender||isHtmlChar||isWT&&wt.splitRender);if(!sameTexData||sameTexData.length<1)if(splitTex){var curstr,stx=0,sty=0;for(this._curStrPos=0;;){if(isHtmlChar){var chc=htmlchars[this._curStrPos++];chc?(curstr=chc.char,stx=chc.x,sty=chc.y):curstr=null}else curstr=this.getNextChar(str);if(!curstr)break;if(!(ri=this.getCharRenderInfo(curstr,font,color,strokeColor,lineWidth,!1)))break;if(ri.isSpace);else{var add=sameTexData[ri.tex.id];if(add)add=add.words;else{var o1={texgen:ri.tex.genID,tex:ri.tex,words:[]};sameTexData[ri.tex.id]=o1,add=o1.words}Render.isConchApp?add.push({ri:ri,x:stx,y:sty,w:ri.bmpWidth/this.fontScaleX,h:ri.bmpHeight/this.fontScaleY}):add.push({ri:ri,x:stx+1/this.fontScaleX,y:sty,w:(ri.bmpWidth-2)/this.fontScaleX,h:(ri.bmpHeight-1)/this.fontScaleY}),stx+=ri.width}}}else{var isotex=TextRender.noAtlas||strWidth*this.fontScaleX>TextRender.atlasWidth;ri=this.getCharRenderInfo(str,font,color,strokeColor,lineWidth,isotex),Render.isConchApp?sameTexData[0]={texgen:ri.tex.genID,tex:ri.tex,words:[{ri:ri,x:0,y:0,w:ri.bmpWidth/this.fontScaleX,h:ri.bmpHeight/this.fontScaleY}]}:sameTexData[0]={texgen:ri.tex.genID,tex:ri.tex,words:[{ri:ri,x:1/this.fontScaleX,y:0/this.fontScaleY,w:(ri.bmpWidth-2)/this.fontScaleX,h:(ri.bmpHeight-1)/this.fontScaleY}]}}this._drawResortedWords(ctx,x,y,sameTexData),ctx._italicDeg=0}},__proto._drawResortedWords=function(ctx,startx,starty,samePagesData){for(var isLastRender=ctx._charSubmitCache&&ctx._charSubmitCache._enbale,mat=ctx._curMat,slen=samePagesData.length,id=0;id<slen;id++){var dt=samePagesData[id];if(dt){var pri=dt.words,pisz=pri.length;if(!(pisz<=0))for(var tex=samePagesData[id].tex,j=0;j<pisz;j++){var riSaved=pri[j],ri=riSaved.ri;ri.isSpace||(ri.touch(),ctx.drawTexAlign=!0,Render.isConchApp?ctx._drawTextureM(tex.texture,startx+riSaved.x-ri.orix,starty+riSaved.y-ri.oriy,riSaved.w,riSaved.h,null,1,ri.uv):ctx._inner_drawTexture(tex.texture,tex.texture.bitmap.id,startx+riSaved.x-ri.orix,starty+riSaved.y-ri.oriy,riSaved.w,riSaved.h,mat,ri.uv,1,isLastRender),ctx.touches&&ctx.touches.push(ri))}}}},__proto.hasFreedText=function(txts){for(var sz=txts.length,i=0;i<sz;i++){var pri=txts[i];if(pri){var tex=pri.tex;if(tex.__destroyed||tex.genID!=pri.texgen)return!0}}return!1},__proto.getCharRenderInfo=function(str,font,color,strokeColor,lineWidth,isoTexture){void 0===isoTexture&&(isoTexture=!1);var fid=this.mapFont[font._family];null==fid&&(this.mapFont[font._family]=fid=this.fontID++);var key=str+"_"+fid+"_"+font._size+"_"+color;lineWidth>0&&(key+="_"+strokeColor+lineWidth),font._bold&&(key+="P"),1==this.fontScaleX&&1==this.fontScaleY||(key+=(20*this.fontScaleX|0)+"_"+(20*this.fontScaleY|0));var i=0,sz=this.textAtlases.length,ri=null,atlas=null;if(!isoTexture)for(i=0;i<sz;i++)if(ri=(atlas=this.textAtlases[i]).charMaps[key])return ri.touch(),ri;ri=new CharRenderInfo,this.charRender.scale(this.fontScaleX,this.fontScaleY),ri.char=str,ri.height=font._size;var margin=font._size/3|0,imgdt=null,w1=Math.ceil(this.charRender.getWidth(this.fontStr,str)*this.fontScaleX);if(w1>this.charRender.canvasWidth&&(this.charRender.canvasWidth=Math.min(2048,w1+2*margin)),isoTexture){imgdt=this.charRender.getCharBmp(str,this.fontStr,lineWidth,color,strokeColor,ri,margin,margin,margin,margin,null);var tex=TextTexture.getTextTexture(imgdt.width,imgdt.height);tex.addChar(imgdt,0,0,ri.uv),ri.tex=tex,ri.orix=margin,ri.oriy=margin,tex.ri=ri,this.isoTextures.push(tex)}else{var len=str.length,lineExt=1*lineWidth,fw=Math.ceil((this.fontSizeW+2*lineExt)*this.fontScaleX),fh=Math.ceil((this.fontSizeH+2*lineExt)*this.fontScaleY);TextRender.imgdtRect[0]=(margin-this.fontSizeOffX-lineExt)*this.fontScaleX|0,TextRender.imgdtRect[1]=(margin-this.fontSizeOffY-lineExt)*this.fontScaleY|0,this.renderPerChar||1==len?(TextRender.imgdtRect[2]=Math.max(w1,fw),TextRender.imgdtRect[3]=Math.max(w1,fh)):(TextRender.imgdtRect[2]=-1,TextRender.imgdtRect[3]=fh),imgdt=this.charRender.getCharBmp(str,this.fontStr,lineWidth,color,strokeColor,ri,margin,margin,margin,margin,TextRender.imgdtRect),atlas=this.addBmpData(imgdt,ri),TextRender.isWan1Wan?(ri.orix=margin,ri.oriy=margin):(ri.orix=this.fontSizeOffX+lineExt,ri.oriy=this.fontSizeOffY+lineExt),atlas.charMaps[key]=ri}return ri},__proto.addBmpData=function(data,ri){for(var w=data.width,h=data.height,sz=this.textAtlases.length,atlas=null,find=!1,i=0;i<sz&&!(find=(atlas=this.textAtlases[i]).getAEmpty(w,h,this.tmpAtlasPos));i++);if(!find){if(atlas=new TextAtlas,this.textAtlases.push(atlas),!(find=atlas.getAEmpty(w,h,this.tmpAtlasPos)))throw"err1";this.cleanAtlases()}return find&&(atlas.texture.addChar(data,this.tmpAtlasPos.x,this.tmpAtlasPos.y,ri.uv),ri.tex=atlas.texture),atlas},__proto.GC=function(){for(var i=0,sz=this.textAtlases.length,destroyDt=TextRender.destroyAtlasDt,totalUsedRateAtlas=0,curloop=Stat.loopCount,maxWasteRateID=-1,maxWasteRate=0,tex=null,curatlas=null;i<sz;i++){if(tex=(curatlas=this.textAtlases[i]).texture){tex.curUsedCovRate,totalUsedRateAtlas+=tex.curUsedCovRateAtlas;var waste=curatlas.usedRate-tex.curUsedCovRateAtlas;maxWasteRate<waste&&(maxWasteRate=waste,maxWasteRateID=i)}curloop-curatlas.texture.lastTouchTm>destroyDt&&(TextRender.showLog&&console.log(curatlas.texture.id),curatlas.destroy(),this.textAtlases[i]=this.textAtlases[sz-1],sz--,i--,maxWasteRateID=-1)}for(this.textAtlases.length=sz,sz=this.isoTextures.length,i=0;i<sz;i++)curloop-(tex=this.isoTextures[i]).lastTouchTm>TextRender.destroyUnusedTextureDt&&(tex.ri.deleted=!0,tex.ri.tex=null,tex.destroy(),this.isoTextures[i]=this.isoTextures[sz-1],sz--,i--);this.isoTextures.length=sz;var needGC=this.textAtlases.length>1&&this.textAtlases.length-totalUsedRateAtlas>=2;(TextRender.atlasWidth*TextRender.atlasWidth*4*this.textAtlases.length>TextRender.cleanMem||needGC||TextRender.simClean)&&(TextRender.simClean=!1,TextRender.showLog&&console.log("清理使用率低的贴图。总使用率:",totalUsedRateAtlas,":",this.textAtlases.length,"最差贴图:"+maxWasteRateID),maxWasteRateID>=0&&((curatlas=this.textAtlases[maxWasteRateID]).destroy(),this.textAtlases[maxWasteRateID]=this.textAtlases[this.textAtlases.length-1],this.textAtlases.length=this.textAtlases.length-1)),TextTexture.clean()},__proto.cleanAtlases=function(){},__proto.getCharBmp=function(c){},__proto.checkBmpLine=function(data,l,sx,ex){this.bmpData32.buffer!=data.data.buffer&&(this.bmpData32=new Uint32Array(data.data.buffer));for(var stpos=data.width*l+sx,x=sx;x<ex;x++)if(0!=this.bmpData32[stpos++])return!0;return!1},__proto.updateBbx=function(data,curbbx,onlyH){void 0===onlyH&&(onlyH=!1);var w=data.width,h=data.height,x=0,sy=curbbx[1],ey=0,y=sy;if(this.checkBmpLine(data,sy,0,w))for(;;){if((y=(sy+ey)/2|0)+1>=sy){curbbx[1]=y;break}this.checkBmpLine(data,y,0,w)?sy=y:ey=y}if(curbbx[3]>h)curbbx[3]=h;else if(y=sy=curbbx[3],ey=h,this.checkBmpLine(data,sy,0,w))for(;;){if((y=(sy+ey)/2|0)-1<=sy){curbbx[3]=y;break}this.checkBmpLine(data,y,0,w)?sy=y:ey=y}if(!onlyH){var minx=curbbx[0],stpos=w*curbbx[1];for(y=curbbx[1];y<curbbx[3];y++){for(x=0;x<minx;x++)if(0!=this.bmpData32[stpos+x]){minx=x;break}stpos+=w}curbbx[0]=minx;var maxx=curbbx[2];for(stpos=w*curbbx[1],y=curbbx[1];y<curbbx[3];y++){for(x=maxx;x<w;x++)if(0!=this.bmpData32[stpos+x]){maxx=x;break}stpos+=w}curbbx[2]=maxx}},__proto.getFontSizeInfo=function(font){var finfo=this.fontSizeInfo[font];if(null!=finfo)return finfo;var fontstr="bold "+TextRender.standardFontSize+"px "+font;if(TextRender.isWan1Wan){this.fontSizeW=1.5*this.charRender.getWidth(fontstr,"有"),this.fontSizeH=1.5*TextRender.standardFontSize;var szinfo=this.fontSizeW<<8|this.fontSizeH;return this.fontSizeInfo[font]=szinfo,szinfo}TextRender.pixelBBX[0]=TextRender.standardFontSize/2,TextRender.pixelBBX[1]=TextRender.standardFontSize/2,TextRender.pixelBBX[2]=TextRender.standardFontSize,TextRender.pixelBBX[3]=TextRender.standardFontSize;var orix=16,oriy=16;this.charRender.scale(1,1),TextRender.tmpRI.height=TextRender.standardFontSize;var bmpdt=this.charRender.getCharBmp("g",fontstr,0,"red",null,TextRender.tmpRI,orix,oriy,16,16);Render.isConchApp&&(bmpdt.data=new Uint8ClampedArray(bmpdt.data)),this.bmpData32=new Uint32Array(bmpdt.data.buffer),this.updateBbx(bmpdt,TextRender.pixelBBX,!1),bmpdt=this.charRender.getCharBmp("有",fontstr,0,"red",null,TextRender.tmpRI,oriy,oriy,16,16),Render.isConchApp&&(bmpdt.data=new Uint8ClampedArray(bmpdt.data)),this.bmpData32=new Uint32Array(bmpdt.data.buffer),TextRender.pixelBBX[2]<orix+TextRender.tmpRI.width&&(TextRender.pixelBBX[2]=orix+TextRender.tmpRI.width),this.updateBbx(bmpdt,TextRender.pixelBBX,!1),Render.isConchApp&&(orix=0,oriy=0);var sizeinfo=Math.max(orix-TextRender.pixelBBX[0],0)<<24|Math.max(oriy-TextRender.pixelBBX[1],0)<<16|TextRender.pixelBBX[2]-TextRender.pixelBBX[0]<<8|TextRender.pixelBBX[3]-TextRender.pixelBBX[1]+2;return this.fontSizeInfo[font]=sizeinfo,sizeinfo},__proto.printDbgInfo=function(){for(var f in console.log("图集个数:"+this.textAtlases.length+",每个图集大小:"+TextRender.atlasWidth+"x"+TextRender.atlasWidth," 用canvas:",TextRender.isWan1Wan),console.log("图集占用空间:"+TextRender.atlasWidth*TextRender.atlasWidth*4/1024/1024*this.textAtlases.length+"M"),console.log("缓存用到的字体:"),this.mapFont){var fontsz=this.getFontSizeInfo(f),offx=fontsz>>24,offy=fontsz>>16&255,fw=fontsz>>8&255,fh=255&fontsz;console.log(" "+f," off:",offx,offy," size:",fw,fh)}var num=0;console.log("缓存数据:");var totalUsedRate=0,totalUsedRateAtlas=0;this.textAtlases.forEach(function(a){var id=a.texture.id,dt=Stat.loopCount-a.texture.lastTouchTm,dtstr=dt>0?dt+"帧以前":"当前帧";for(var k in totalUsedRate+=a.texture.curUsedCovRate,totalUsedRateAtlas+=a.texture.curUsedCovRateAtlas,console.log("--图集(id:"+id+",当前使用率:"+(1e3*a.texture.curUsedCovRate|0)+"‰","当前图集使用率:",(100*a.texture.curUsedCovRateAtlas|0)+"%","图集使用率:",100*a.usedRate|0,"%, 使用于:"+dtstr+")--:"),a.charMaps){var ri=a.charMaps[k];console.log(" off:",ri.orix,ri.oriy," bmp宽高:",ri.bmpWidth,ri.bmpHeight,"无效:",ri.deleted,"touchdt:",Stat.loopCount-ri.touchTick,"位置:",ri.uv[0]*TextRender.atlasWidth|0,ri.uv[1]*TextRender.atlasWidth|0,"字符:",ri.char,"key:",k),num++}}),console.log("独立贴图文字("+this.isoTextures.length+"个):"),this.isoTextures.forEach(function(tex){console.log(" size:",tex._texW,tex._texH,"touch间隔:",Stat.loopCount-tex.lastTouchTm,"char:",tex.ri.char)}),console.log("总缓存:",num,"总使用率:",totalUsedRate,"总当前图集使用率:",totalUsedRateAtlas)},__proto.showAtlas=function(n,bgcolor,x,y,w,h){if(!this.textAtlases[n])return console.log("没有这个图集"),null;var sp=new Sprite,texttex=this.textAtlases[n].texture,texture={width:TextRender.atlasWidth,height:TextRender.atlasWidth,sourceWidth:TextRender.atlasWidth,sourceHeight:TextRender.atlasWidth,offsetX:0,offsetY:0,getIsReady:function(){return!0},_addReference:function(){},_removeReference:function(){},_getSource:function(){return texttex._getSource()},bitmap:{id:texttex.id},_uv:Texture.DEF_UV};return sp.size=function(w,h){return this.width=w,this.height=h,sp.graphics.clear(),sp.graphics.drawRect(0,0,sp.width,sp.height,bgcolor),sp.graphics.drawTexture(texture,0,0,sp.width,sp.height),this},sp.graphics.drawRect(0,0,w,h,bgcolor),sp.graphics.drawTexture(texture,0,0,w,h),sp.pos(x,y),Laya.stage.addChild(sp),sp},__proto.filltext_native=function(ctx,data,htmlchars,x,y,fontStr,color,strokeColor,lineWidth,textAlign,underLine){if(void 0===underLine&&(underLine=0),!(data&&data.length<=0||htmlchars&&htmlchars.length<1)){var font=FontInfo.Parse(fontStr),nTextAlign=0;switch(textAlign){case"center":nTextAlign=Context.ENUM_TEXTALIGN_CENTER;break;case"right":nTextAlign=Context.ENUM_TEXTALIGN_RIGHT}return this._fast_filltext(ctx,data,htmlchars,x,y,font,color,strokeColor,lineWidth,nTextAlign,underLine)}},TextRender.useOldCharBook=!1,TextRender.atlasWidth=2048,TextRender.noAtlas=!1,TextRender.forceSplitRender=!1,TextRender.forceWholeRender=!1,TextRender.scaleFontWithCtx=!0,TextRender.standardFontSize=32,TextRender.destroyAtlasDt=10,TextRender.checkCleanTextureDt=2e3,TextRender.destroyUnusedTextureDt=3e3,TextRender.cleanMem=104857600,TextRender.isWan1Wan=!1,TextRender.showLog=!1,TextRender.debugUV=!1,TextRender.atlasWidth2=4194304,TextRender.textRenderInst=null,TextRender.simClean=!1,__static(TextRender,["tmpRI",function(){return this.tmpRI=new CharRenderInfo},"pixelBBX",function(){return this.pixelBBX=[0,0,0,0]},"imgdtRect",function(){return this.imgdtRect=[0,0,0,0]}]),TextRender}(),Stat=function(){function Stat(){}return __class(Stat,"laya.utils.Stat"),__getset(1,Stat,"onclick",null,function(fn){Stat._sp&&Stat._sp.on("click",Stat._sp,fn),Stat._canvas&&(Stat._canvas.source.onclick=fn,Stat._canvas.source.style.pointerEvents="")}),Stat.show=function(x,y){void 0===x&&(x=0),void 0===y&&(y=0),Browser.onMiniGame||Browser.onLimixiu||Render.isConchApp||Browser.onBDMiniGame||Browser.onKGMiniGame||Browser.onQGMiniGame||Browser.onVVMiniGame||Browser.onAlipayMiniGame||Browser.onBLMiniGame||Browser.onQQMiniGame||(Stat._useCanvas=!0),Stat._show=!0,Stat._fpsData.length=60,Stat._view[0]={title:"FPS(Canvas)",value:"_fpsStr",color:"yellow",units:"int"},Stat._view[1]={title:"Sprite",value:"_spriteStr",color:"white",units:"int"},Stat._view[2]={title:"RenderBatches",value:"renderBatches",color:"white",units:"int"},Stat._view[3]={title:"SavedRenderBatches",value:"savedRenderBatches",color:"white",units:"int"},Stat._view[4]={title:"CPUMemory",value:"cpuMemory",color:"yellow",units:"M"},Stat._view[5]={title:"GPUMemory",value:"gpuMemory",color:"yellow",units:"M"},Stat._view[6]={title:"Shader",value:"shaderCall",color:"white",units:"int"},Render.is3DMode?(Stat._view[0].title="FPS(3D)",Stat._view[7]={title:"TriFaces",value:"trianglesFaces",color:"white",units:"int"},Stat._view[8]={title:"FrustumCulling",value:"frustumCulling",color:"white",units:"int"},Stat._view[9]={title:"OctreeNodeCulling",value:"octreeNodeCulling",color:"white",units:"int"}):(Stat._view[0].title="FPS(WebGL)",Stat._view[7]={title:"Canvas",value:"_canvasStr",color:"white",units:"int"}),Stat._useCanvas?Stat.createUIPre(x,y):Stat.createUI(x,y),Stat.enable()},Stat.createUIPre=function(x,y){var pixel=Browser.pixelRatio;(Browser.onQGMiniGame||Browser.onVVMiniGame)&&(pixel=3),Stat._width=180*pixel,Stat._vx=120*pixel,Stat._height=pixel*(12*Stat._view.length+3*pixel)+4,Stat._fontSize=12*pixel;for(var i=0;i<Stat._view.length;i++)Stat._view[i].x=4,Stat._view[i].y=i*Stat._fontSize+2*pixel;Stat._canvas||(Stat._canvas=new HTMLCanvas(!0),Stat._canvas.size(Stat._width,Stat._height),Stat._ctx=Stat._canvas.getContext("2d"),Stat._ctx.textBaseline="top",Stat._ctx.font=Stat._fontSize+"px Arial",Stat._canvas.source.style.cssText="pointer-events:none;background:rgba(150,150,150,0.8);z-index:100000;position: absolute;direction:ltr;left:"+x+"px;top:"+y+"px;width:"+Stat._width/pixel+"px;height:"+Stat._height/pixel+"px;"),Browser.onKGMiniGame||Browser.container.appendChild(Stat._canvas.source),Stat._first=!0,Stat.loop(),Stat._first=!1},Stat.createUI=function(x,y){var stat=Stat._sp,pixel=Browser.pixelRatio;(Browser.onQGMiniGame||Browser.onVVMiniGame)&&(pixel=3),stat||(stat=new Sprite,Stat._leftText=new Text,Stat._leftText.pos(5,5),Stat._leftText.color="#ffffff",stat.addChild(Stat._leftText),Stat._txt=new Text,Stat._txt.pos(80*pixel,5),Stat._txt.color="#ffffff",stat.addChild(Stat._txt),Stat._sp=stat),stat.pos(x,y);for(var text="",i=0;i<Stat._view.length;i++){text+=Stat._view[i].title+"\n"}Stat._leftText.text=text;var width=138*pixel,height=pixel*(12*Stat._view.length+3*pixel)+4;Stat._txt.fontSize=Stat._fontSize*pixel,Stat._leftText.fontSize=Stat._fontSize*pixel,stat.size(width,height),stat.graphics.clear(),stat.graphics.alpha(.5),stat.graphics.drawRect(0,0,width,height,"#999999"),stat.graphics.alpha(2),Stat.loop()},Stat.enable=function(){Laya.systemTimer.frameLoop(1,Stat,Stat.loop)},Stat.hide=function(){Stat._show=!1,Laya.systemTimer.clear(Stat,Stat.loop),Stat._canvas&&Browser.removeElement(Stat._canvas.source)},Stat.clear=function(){Stat.trianglesFaces=Stat.renderBatches=Stat.savedRenderBatches=Stat.shaderCall=Stat.spriteRenderUseCacheCount=Stat.frustumCulling=Stat.octreeNodeCulling=Stat.canvasNormal=Stat.canvasBitmap=Stat.canvasReCache=0},Stat.loop=function(){Stat._count++;var timer=Browser.now();if(!(timer-Stat._timer<1e3)){var count=Stat._count;if(Stat.FPS=Math.round(1e3*count/(timer-Stat._timer)),Stat._show){Stat.trianglesFaces=Math.round(Stat.trianglesFaces/count),Stat._useCanvas?Stat.renderBatches=Math.round(Stat.renderBatches/count):Stat.renderBatches=Math.round(Stat.renderBatches/count)-1,Stat.savedRenderBatches=Math.round(Stat.savedRenderBatches/count),Stat.shaderCall=Math.round(Stat.shaderCall/count),Stat.spriteRenderUseCacheCount=Math.round(Stat.spriteRenderUseCacheCount/count),Stat.canvasNormal=Math.round(Stat.canvasNormal/count),Stat.canvasBitmap=Math.round(Stat.canvasBitmap/count),Stat.canvasReCache=Math.ceil(Stat.canvasReCache/count),Stat.frustumCulling=Math.round(Stat.frustumCulling/count),Stat.octreeNodeCulling=Math.round(Stat.octreeNodeCulling/count);var delay=Stat.FPS>0?Math.floor(1e3/Stat.FPS).toString():" ";Stat._fpsStr=Stat.FPS+(Stat.renderSlow?" slow":"")+" "+delay,Stat._useCanvas?Stat._spriteStr=Stat.spriteCount-1+(Stat.spriteRenderUseCacheCount?"/"+Stat.spriteRenderUseCacheCount:""):Stat._spriteStr=Stat.spriteCount-4+(Stat.spriteRenderUseCacheCount?"/"+Stat.spriteRenderUseCacheCount:""),Stat._canvasStr=Stat.canvasReCache+"/"+Stat.canvasNormal+"/"+Stat.canvasBitmap,Stat.cpuMemory=Resource.cpuMemory,Stat.gpuMemory=Resource.gpuMemory,Stat._useCanvas?Stat.renderInfoPre():Stat.renderInfo(),Stat.clear()}Stat._count=0,Stat._timer=timer}},Stat.renderInfoPre=function(){var one,value,i=0;if(Stat._canvas){var ctx=Stat._ctx;for(ctx.clearRect(Stat._first?0:Stat._vx,0,Stat._width,Stat._height),i=0;i<Stat._view.length;i++)one=Stat._view[i],Stat._first&&(ctx.fillStyle="white",ctx.fillText(one.title,one.x,one.y)),ctx.fillStyle=one.color,value=Stat[one.value],"M"==one.units&&(value=Math.floor(value/1048576*100)/100+" M"),ctx.fillText(value+"",one.x+Stat._vx,one.y)}},Stat.renderInfo=function(){for(var text="",i=0;i<Stat._view.length;i++){var one=Stat._view[i],value=Stat[one.value];"M"==one.units&&(value=Math.floor(value/1048576*100)/100+" M"),"K"==one.units&&(value=Math.floor(value/1024*100)/100+" K"),text+=value+"\n"}Stat._txt.text=text},Stat.FPS=0,Stat.loopCount=0,Stat.shaderCall=0,Stat.renderBatches=0,Stat.savedRenderBatches=0,Stat.trianglesFaces=0,Stat.spriteCount=0,Stat.spriteRenderUseCacheCount=0,Stat.frustumCulling=0,Stat.octreeNodeCulling=0,Stat.canvasNormal=0,Stat.canvasBitmap=0,Stat.canvasReCache=0,Stat.renderSlow=!1,Stat.gpuMemory=0,Stat.cpuMemory=0,Stat._fpsStr=null,Stat._canvasStr=null,Stat._spriteStr=null,Stat._fpsData=[],Stat._timer=0,Stat._count=0,Stat._view=[],Stat._fontSize=12,Stat._txt=null,Stat._leftText=null,Stat._sp=null,Stat._titleSp=null,Stat._bgSp=null,Stat._show=!1,Stat._useCanvas=!1,Stat._canvas=null,Stat._ctx=null,Stat._first=!1,Stat._vx=NaN,Stat._width=0,Stat._height=100,Stat}(),Path=function(){var renderPath;function Path(){this._lastOriX=0,this._lastOriY=0,this.paths=[],this._curPath=null}__class(Path,"laya.webgl.canvas.Path");var __proto=Path.prototype;return __proto.beginPath=function(convex){this.paths.length=1,this._curPath=this.paths[0]=new renderPath,this._curPath.convex=convex},__proto.closePath=function(){this._curPath.loop=!0},__proto.newPath=function(){this._curPath=new renderPath,this.paths.push(this._curPath)},__proto.addPoint=function(pointX,pointY){this._curPath.path.push(pointX,pointY)},__proto.push=function(points,convex){this._curPath?this._curPath.path.length>0&&(this._curPath=new renderPath,this.paths.push(this._curPath)):(this._curPath=new renderPath,this.paths.push(this._curPath));var rp=this._curPath;rp.path=points.slice(),rp.convex=convex},__proto.reset=function(){this.paths.length=0},Path.__init$=function(){renderPath=function(){function renderPath(){this.path=[],this.loop=!1,this.convex=!1}return __class(renderPath,""),renderPath}()},Path}(),MouseManager=function(){function MouseManager(){this.mouseX=0,this.mouseY=0,this.disableMouseEvent=!1,this.mouseDownTime=0,this.mouseMoveAccuracy=2,this._stage=null,this._captureSp=null,this._captureExlusiveMode=!1,this._hitCaputreSp=!1,this._target=null,this._lastMoveTimer=0,this._isLeftMouse=!1,this._touchIDs={},this._id=1,this._tTouchID=0,this._event=new Event,this._captureChain=[],this._matrix=new Matrix,this._point=new Point,this._rect=new Rectangle,this._prePoint=new Point,this._curTouchID=NaN}__class(MouseManager,"laya.events.MouseManager");var __proto=MouseManager.prototype;return __proto.__init__=function(stage,canvas){var _$this=this;this._stage=stage;var _this=this;canvas.oncontextmenu=function(e){if(MouseManager.enabled)return!1},canvas.addEventListener("mousedown",function(e){MouseManager.enabled&&(Browser.onIE||e.preventDefault(),_this.mouseDownTime=Browser.now(),_$this.runEvent(e))}),canvas.addEventListener("mouseup",function(e){MouseManager.enabled&&(e.preventDefault(),_this.mouseDownTime=-Browser.now(),_$this.runEvent(e))},!0),canvas.addEventListener("mousemove",function(e){if(MouseManager.enabled){e.preventDefault();var now=Browser.now();if(now-_this._lastMoveTimer<10)return;_this._lastMoveTimer=now,_$this.runEvent(e)}},!0),canvas.addEventListener("mouseout",function(e){MouseManager.enabled&&_$this.runEvent(e)}),canvas.addEventListener("mouseover",function(e){MouseManager.enabled&&_$this.runEvent(e)}),canvas.addEventListener("touchstart",function(e){MouseManager.enabled&&(MouseManager._isFirstTouch||Input.isInputting||e.preventDefault(),_this.mouseDownTime=Browser.now(),_$this.runEvent(e))}),canvas.addEventListener("touchend",function(e){MouseManager.enabled?(MouseManager._isFirstTouch||Input.isInputting||e.preventDefault(),MouseManager._isFirstTouch=!1,_this.mouseDownTime=-Browser.now(),_$this.runEvent(e)):_$this._curTouchID=NaN},!0),canvas.addEventListener("touchmove",function(e){MouseManager.enabled&&(e.preventDefault(),_$this.runEvent(e))},!0),canvas.addEventListener("touchcancel",function(e){MouseManager.enabled?(e.preventDefault(),_$this.runEvent(e)):_$this._curTouchID=NaN},!0),canvas.addEventListener("mousewheel",function(e){MouseManager.enabled&&_$this.runEvent(e)}),canvas.addEventListener("DOMMouseScroll",function(e){MouseManager.enabled&&_$this.runEvent(e)})},__proto.initEvent=function(e,nativeEvent){var evt;this._event._stoped=!1,this._event.nativeEvent=nativeEvent||e,this._target=null,this._point.setTo(e.pageX||e.clientX,e.pageY||e.clientY),this._stage._canvasTransform&&(this._stage._canvasTransform.invertTransformPoint(this._point),this.mouseX=this._point.x,this.mouseY=this._point.y),this._event.touchId=e.identifier||0,this._tTouchID=this._event.touchId,(evt=TouchManager.I._event)._stoped=!1,evt.nativeEvent=this._event.nativeEvent,evt.touchId=this._event.touchId},__proto.checkMouseWheel=function(e){this._event.delta=e.wheelDelta?.025*e.wheelDelta:-e.detail;for(var _lastOvers=TouchManager.I.getLastOvers(),i=0,n=_lastOvers.length;i<n;i++){var ele=_lastOvers[i];ele.event("mousewheel",this._event.setTo("mousewheel",ele,this._target))}},__proto.onMouseMove=function(ele){TouchManager.I.onMouseMove(ele,this._tTouchID)},__proto.onMouseDown=function(ele){if(Input.isInputting&&Laya.stage.focus&&Laya.stage.focus.focus&&!Laya.stage.focus.contains(this._target)){var pre_input=Laya.stage.focus._tf||Laya.stage.focus,new_input=ele._tf||ele;new_input instanceof laya.display.Input&&new_input.multiline==pre_input.multiline?pre_input._focusOut():pre_input.focus=!1}TouchManager.I.onMouseDown(ele,this._tTouchID,this._isLeftMouse)},__proto.onMouseUp=function(ele){TouchManager.I.onMouseUp(ele,this._tTouchID,this._isLeftMouse)},__proto.check=function(sp,mouseX,mouseY,callBack){this._point.setTo(mouseX,mouseY),sp.fromParentPoint(this._point),mouseX=this._point.x,mouseY=this._point.y;var scrollRect=sp._style.scrollRect;if(scrollRect&&(this._rect.setTo(scrollRect.x,scrollRect.y,scrollRect.width,scrollRect.height),!this._rect.contains(mouseX,mouseY)))return!1;if(!this.disableMouseEvent){if(sp.hitTestPrior&&!sp.mouseThrough&&!this.hitTest(sp,mouseX,mouseY))return!1;for(var i=sp._children.length-1;i>-1;i--){var child=sp._children[i];if(!child.destroyed&&child._mouseState>1&&child._visible&&this.check(child,mouseX,mouseY,callBack))return!0}for(i=sp._extUIChild.length-1;i>=0;i--){var c=sp._extUIChild[i];if(!c.destroyed&&c._mouseState>1&&c._visible&&this.check(c,mouseX,mouseY,callBack))return!0}}var isHit=!(!sp.hitTestPrior||sp.mouseThrough||this.disableMouseEvent)||this.hitTest(sp,mouseX,mouseY);return isHit?(this._target=sp,callBack.call(this,sp),this._target==this._hitCaputreSp&&(this._hitCaputreSp=!0)):callBack===this.onMouseUp&&sp===this._stage&&(this._target=this._stage,callBack.call(this,this._target)),isHit},__proto.hitTest=function(sp,mouseX,mouseY){var isHit=!1;sp.scrollRect&&(mouseX-=sp._style.scrollRect.x,mouseY-=sp._style.scrollRect.y);var hitArea=sp._style.hitArea;return hitArea&&hitArea._hit?hitArea.contains(mouseX,mouseY):((sp.width>0&&sp.height>0||sp.mouseThrough||hitArea)&&(isHit=sp.mouseThrough?sp.getGraphicBounds().contains(mouseX,mouseY):(hitArea||this._rect.setTo(0,0,sp.width,sp.height)).contains(mouseX,mouseY)),isHit)},__proto._checkAllBaseUI=function(mousex,mousey,callback){var ret=this.handleExclusiveCapture(this.mouseX,this.mouseY,callback);return!!ret||(ret=this.check(this._stage,this.mouseX,this.mouseY,callback),this.handleCapture(this.mouseX,this.mouseY,callback)||ret)},__proto.check3DUI=function(mousex,mousey,callback){for(var uis=this._stage._3dUI,i=0,ret=!1;i<uis.length;i++){var curui=uis[i];this._stage._curUIBase=curui,!curui.destroyed&&curui._mouseState>1&&curui._visible&&(ret=ret||this.check(curui,this.mouseX,this.mouseY,callback))}return this._stage._curUIBase=this._stage,ret},__proto.handleExclusiveCapture=function(mousex,mousey,callback){if(this._captureExlusiveMode&&this._captureSp&&this._captureChain.length>0){var cursp;this._point.setTo(mousex,mousey);for(var i=0;i<this._captureChain.length;i++)(cursp=this._captureChain[i]).fromParentPoint(this._point);return this._target=cursp,callback.call(this,cursp),!0}return!1},__proto.handleCapture=function(mousex,mousey,callback){if(!this._hitCaputreSp&&this._captureSp&&this._captureChain.length>0){var cursp;this._point.setTo(mousex,mousey);for(var i=0;i<this._captureChain.length;i++)(cursp=this._captureChain[i]).fromParentPoint(this._point);return this._target=cursp,callback.call(this,cursp),!0}return!1},__proto.runEvent=function(evt){var touch,i=0,n=0;switch("mousemove"!==evt.type&&(this._prePoint.x=this._prePoint.y=-1e6),evt.type){case"mousedown":this._touchIDs[0]=this._id++,MouseManager._isTouchRespond?MouseManager._isTouchRespond=!1:(this._isLeftMouse=0===evt.button,this.initEvent(evt),this._checkAllBaseUI(this.mouseX,this.mouseY,this.onMouseDown));break;case"mouseup":this._isLeftMouse=0===evt.button,this.initEvent(evt),this._checkAllBaseUI(this.mouseX,this.mouseY,this.onMouseUp);break;case"mousemove":Math.abs(this._prePoint.x-evt.clientX)+Math.abs(this._prePoint.y-evt.clientY)>=this.mouseMoveAccuracy&&(this._prePoint.x=evt.clientX,this._prePoint.y=evt.clientY,this.initEvent(evt),this._checkAllBaseUI(this.mouseX,this.mouseY,this.onMouseMove));break;case"touchstart":MouseManager._isTouchRespond=!0,this._isLeftMouse=!0;var touches=evt.changedTouches;for(i=0,n=touches.length;i<n;i++)touch=touches[i],(MouseManager.multiTouchEnabled||isNaN(this._curTouchID))&&(this._curTouchID=touch.identifier,this._id%200==0&&(this._touchIDs={}),this._touchIDs[touch.identifier]=this._id++,this.initEvent(touch,evt),this._checkAllBaseUI(this.mouseX,this.mouseY,this.onMouseDown));break;case"touchend":case"touchcancel":MouseManager._isTouchRespond=!0,this._isLeftMouse=!0;var touchends=evt.changedTouches;for(i=0,n=touchends.length;i<n;i++)if(touch=touchends[i],MouseManager.multiTouchEnabled||touch.identifier==this._curTouchID){this._curTouchID=NaN,this.initEvent(touch,evt);this._checkAllBaseUI(this.mouseX,this.mouseY,this.onMouseUp)||this.onMouseUp(null)}break;case"touchmove":var touchemoves=evt.changedTouches;for(i=0,n=touchemoves.length;i<n;i++)touch=touchemoves[i],(MouseManager.multiTouchEnabled||touch.identifier==this._curTouchID)&&(this.initEvent(touch,evt),this._checkAllBaseUI(this.mouseX,this.mouseY,this.onMouseMove));break;case"wheel":case"mousewheel":case"DOMMouseScroll":this.checkMouseWheel(evt);break;case"mouseout":TouchManager.I.stageMouseOut();break;case"mouseover":this._stage.event("mouseover",this._event.setTo("mouseover",this._stage,this._stage))}},__proto.setCapture=function(sp,exclusive){void 0===exclusive&&(exclusive=!1),this._captureSp=sp,this._captureExlusiveMode=exclusive,this._captureChain.length=0,this._captureChain.push(sp);for(var cursp=sp;cursp!=Laya.stage&&cursp!=Laya.stage._curUIBase&&(cursp=cursp.parent);)this._captureChain.splice(0,0,cursp)},__proto.releaseCapture=function(){console.log("release capture"),this._captureSp=null},MouseManager.enabled=!0,MouseManager.multiTouchEnabled=!0,MouseManager._isTouchRespond=!1,MouseManager._isFirstTouch=!0,__static(MouseManager,["instance",function(){return this.instance=new MouseManager}]),MouseManager}(),VectorGraphManager=function(){function VectorGraphManager(){this.useDic={},this.shapeDic={},this.shapeLineDic={},this._id=0,this._checkKey=!1,this._freeIdArray=[],CacheManger.regCacheByFunction(Utils.bind(this.startDispose,this),Utils.bind(this.getCacheList,this))}__class(VectorGraphManager,"laya.utils.VectorGraphManager");var __proto=VectorGraphManager.prototype;return __proto.getId=function(){return this._id++},__proto.addShape=function(id,shape){this.shapeDic[id]=shape,this.useDic[id]||(this.useDic[id]=!0)},__proto.addLine=function(id,Line){this.shapeLineDic[id]=Line,this.shapeLineDic[id]||(this.shapeLineDic[id]=!0)},__proto.getShape=function(id){this._checkKey&&null!=this.useDic[id]&&(this.useDic[id]=!0)},__proto.deleteShape=function(id){this.shapeDic[id]&&(this.shapeDic[id]=null,delete this.shapeDic[id]),this.shapeLineDic[id]&&(this.shapeLineDic[id]=null,delete this.shapeLineDic[id]),null!=this.useDic[id]&&delete this.useDic[id]},__proto.getCacheList=function(){var str,list=[];for(str in this.shapeDic)list.push(this.shapeDic[str]);for(str in this.shapeLineDic)list.push(this.shapeLineDic[str]);return list},__proto.startDispose=function(key){var str;for(str in this.useDic)this.useDic[str]=!1;this._checkKey=!0},__proto.endDispose=function(){if(this._checkKey){var str;for(str in this.useDic)this.useDic[str]||this.deleteShape(str);this._checkKey=!1}},VectorGraphManager.getInstance=function(){return VectorGraphManager.instance=VectorGraphManager.instance||new VectorGraphManager},VectorGraphManager.instance=null,VectorGraphManager}(),MathUtil=function(){function MathUtil(){}return __class(MathUtil,"laya.maths.MathUtil"),MathUtil.subtractVector3=function(l,r,o){o[0]=l[0]-r[0],o[1]=l[1]-r[1],o[2]=l[2]-r[2]},MathUtil.lerp=function(left,right,amount){return left*(1-amount)+right*amount},MathUtil.scaleVector3=function(f,b,e){e[0]=f[0]*b,e[1]=f[1]*b,e[2]=f[2]*b},MathUtil.lerpVector3=function(l,r,t,o){var ax=l[0],ay=l[1],az=l[2];o[0]=ax+t*(r[0]-ax),o[1]=ay+t*(r[1]-ay),o[2]=az+t*(r[2]-az)},MathUtil.lerpVector4=function(l,r,t,o){var ax=l[0],ay=l[1],az=l[2],aw=l[3];o[0]=ax+t*(r[0]-ax),o[1]=ay+t*(r[1]-ay),o[2]=az+t*(r[2]-az),o[3]=aw+t*(r[3]-aw)},MathUtil.slerpQuaternionArray=function(a,Offset1,b,Offset2,t,out,Offset3){var omega,cosom,sinom,scale0,scale1,ax=a[Offset1+0],ay=a[Offset1+1],az=a[Offset1+2],aw=a[Offset1+3],bx=b[Offset2+0],by=b[Offset2+1],bz=b[Offset2+2],bw=b[Offset2+3];return(cosom=ax*bx+ay*by+az*bz+aw*bw)<0&&(cosom=-cosom,bx=-bx,by=-by,bz=-bz,bw=-bw),1-cosom>1e-6?(omega=Math.acos(cosom),sinom=Math.sin(omega),scale0=Math.sin((1-t)*omega)/sinom,scale1=Math.sin(t*omega)/sinom):(scale0=1-t,scale1=t),out[Offset3+0]=scale0*ax+scale1*bx,out[Offset3+1]=scale0*ay+scale1*by,out[Offset3+2]=scale0*az+scale1*bz,out[Offset3+3]=scale0*aw+scale1*bw,out},MathUtil.getRotation=function(x0,y0,x1,y1){return Math.atan2(y1-y0,x1-x0)/Math.PI*180},MathUtil.sortBigFirst=function(a,b){return a==b?0:b>a?1:-1},MathUtil.sortSmallFirst=function(a,b){return a==b?0:b>a?-1:1},MathUtil.sortNumBigFirst=function(a,b){return parseFloat(b)-parseFloat(a)},MathUtil.sortNumSmallFirst=function(a,b){return parseFloat(a)-parseFloat(b)},MathUtil.sortByKey=function(key,bigFirst,forceNum){var _sortFun;return void 0===bigFirst&&(bigFirst=!1),void 0===forceNum&&(forceNum=!0),_sortFun=bigFirst?forceNum?MathUtil.sortNumBigFirst:MathUtil.sortBigFirst:forceNum?MathUtil.sortNumSmallFirst:MathUtil.sortSmallFirst,function(a,b){return _sortFun(a[key],b[key])}},MathUtil}(),RenderSprite=function(){function RenderSprite(type,next){if(LayaGLQuickRunner.map[type])return this._fun=LayaGLQuickRunner.map[type],void(this._next=RenderSprite.NORENDER);switch(this._next=next||RenderSprite.NORENDER,type){case 0:return void(this._fun=this._no);case 1:return void(this._fun=this._alpha);case 2:return void(this._fun=this._transform);case 4:return void(this._fun=this._blend);case 8:return void(this._fun=this._canvas);case 32:return void(this._fun=this._mask);case 64:return void(this._fun=this._clip);case 128:return void(this._fun=this._style);case 512:return void(this._fun=this._graphics);case 8192:return void(this._fun=this._children);case 2048:return void(this._fun=this._custom);case 256:return void(this._fun=this._texture);case 16:return void(this._fun=Filter._filter);case 69905:return void(this._fun=RenderSprite._initRenderFun)}this.onCreate(type)}__class(RenderSprite,"laya.renders.RenderSprite");var __proto=RenderSprite.prototype;return __proto.onCreate=function(type){},__proto._style=function(sprite,context,x,y){var style=sprite._style;null!=style.render&&style.render(sprite,context,x,y);var next=this._next;next._fun.call(next,sprite,context,x,y)},__proto._no=function(sprite,context,x,y){},__proto._custom=function(sprite,context,x,y){sprite.customRender(context,x,y),this._next._fun.call(this._next,sprite,context,x-sprite.pivotX,y-sprite.pivotY)},__proto._clip=function(sprite,context,x,y){var next=this._next;if(next!=RenderSprite.NORENDER){var r=sprite._style.scrollRect;context.save(),context.clipRect(x,y,r.width,r.height),next._fun.call(next,sprite,context,x-r.x,y-r.y),context.restore()}},__proto._texture=function(sprite,context,x,y){var tex=sprite.texture;tex._getSource()&&context.drawTexture(tex,x-sprite.pivotX+tex.offsetX,y-sprite.pivotY+tex.offsetY,sprite._width||tex.width,sprite._height||tex.height);var next=this._next;next!=RenderSprite.NORENDER&&next._fun.call(next,sprite,context,x,y)},__proto._graphics=function(sprite,context,x,y){var style=sprite._style,g=sprite._graphics;g&&g._render(sprite,context,x-style.pivotX,y-style.pivotY);var next=this._next;next!=RenderSprite.NORENDER&&next._fun.call(next,sprite,context,x,y)},__proto._image=function(sprite,context,x,y){var style=sprite._style;context.drawTexture2(x,y,style.pivotX,style.pivotY,sprite.transform,sprite._graphics._one)},__proto._image2=function(sprite,context,x,y){var style=sprite._style;context.drawTexture2(x,y,style.pivotX,style.pivotY,sprite.transform,sprite._graphics._one)},__proto._alpha=function(sprite,context,x,y){var alpha;if((alpha=sprite._style.alpha)>.01||sprite._needRepaint()){var temp=context.globalAlpha;context.globalAlpha*=alpha;var next=this._next;next._fun.call(next,sprite,context,x,y),context.globalAlpha=temp}},__proto._transform=function(sprite,context,x,y){var transform=sprite.transform,_next=this._next;sprite._style;transform&&_next!=RenderSprite.NORENDER?(context.save(),context.transform(transform.a,transform.b,transform.c,transform.d,transform.tx+x,transform.ty+y),_next._fun.call(_next,sprite,context,0,0),context.restore()):_next!=RenderSprite.NORENDER&&_next._fun.call(_next,sprite,context,x,y)},__proto._children=function(sprite,context,x,y){var ele,style=sprite._style,childs=sprite._children,n=childs.length;x-=sprite.pivotX,y-=sprite.pivotY;var textLastRender=sprite._getBit(256)&&context.drawCallOptimize(!0);if(style.viewport){var rect=style.viewport,left=rect.x,top=rect.y,right=rect.right,bottom=rect.bottom,_x=NaN,_y=NaN;for(i=0;i<n;++i)(ele=childs[i])._visible&&(_x=ele._x)<right&&_x+ele.width>left&&(_y=ele._y)<bottom&&_y+ele.height>top&&ele.render(context,x,y)}else for(var i=0;i<n;++i)(ele=childs[i])._visible&&ele.render(context,x,y);textLastRender&&context.drawCallOptimize(!1)},__proto._canvas=function(sprite,context,x,y){var _cacheStyle=sprite._cacheStyle,_next=this._next;if(_cacheStyle.enableCanvasRender){"bitmap"===_cacheStyle.cacheAs?Stat.canvasBitmap++:Stat.canvasNormal++;var cacheNeedRebuild=!1,textNeedRestore=!1;if(_cacheStyle.canvas){var canv=_cacheStyle.canvas,charRIs=(canv.context,canv.touches);if(charRIs)for(var ci=0;ci<charRIs.length;ci++)if(charRIs[ci].deleted){textNeedRestore=!0;break}cacheNeedRebuild=canv.isCacheValid&&!canv.isCacheValid()}if(sprite._needRepaint()||!_cacheStyle.canvas||textNeedRestore||cacheNeedRebuild||Laya.stage.isGlobalRepaint())if("normal"===_cacheStyle.cacheAs){if(context._targets)return void _next._fun.call(_next,sprite,context,x,y);this._canvas_webgl_normal_repaint(sprite,context)}else this._canvas_repaint(sprite,context,x,y);var tRec=_cacheStyle.cacheRect;context.drawCanvas(_cacheStyle.canvas,x+tRec.x,y+tRec.y,tRec.width,tRec.height)}else _next._fun.call(_next,sprite,context,x,y)},__proto._canvas_repaint=function(sprite,context,x,y){var tx,left,top,tRec,w,h,scaleX,scaleY,scaleInfo,_cacheStyle=sprite._cacheStyle,_next=this._next,canvas=_cacheStyle.canvas,tCacheType=_cacheStyle.cacheAs;if(scaleX=(scaleInfo=_cacheStyle._calculateCacheRect(sprite,tCacheType,x,y)).x,scaleY=scaleInfo.y,w=(tRec=_cacheStyle.cacheRect).width*scaleX,h=tRec.height*scaleY,left=tRec.x,top=tRec.y,"bitmap"===tCacheType&&(w>2048||h>2048))return console.warn("cache bitmap size larger than 2048,cache ignored"),_cacheStyle.releaseContext(),void _next._fun.call(_next,sprite,context,x,y);if(canvas||(_cacheStyle.createContext(),canvas=_cacheStyle.canvas),(tx=canvas.context).sprite=sprite,(canvas.width!=w||canvas.height!=h)&&canvas.size(w,h),"bitmap"===tCacheType?tx.asBitmap=!0:"normal"===tCacheType&&(tx.asBitmap=!1),tx.clear(),1!=scaleX||1!=scaleY){var ctx=tx;ctx.save(),ctx.scale(scaleX,scaleY),_next._fun.call(_next,sprite,tx,-left,-top),ctx.restore(),sprite._applyFilters()}else ctx=tx,_next._fun.call(_next,sprite,tx,-left,-top),sprite._applyFilters();_cacheStyle.staticCache&&(_cacheStyle.reCache=!1),Stat.canvasReCache++},__proto._canvas_webgl_normal_repaint=function(sprite,context){var _cacheStyle=sprite._cacheStyle,_next=this._next,canvas=_cacheStyle.canvas,tCacheType=_cacheStyle.cacheAs;_cacheStyle._calculateCacheRect(sprite,tCacheType,0,0);canvas||(canvas=_cacheStyle.canvas=new Laya.WebGLCacheAsNormalCanvas(context,sprite));var tx=canvas.context;canvas.startRec(),_next._fun.call(_next,sprite,tx,sprite.pivotX,sprite.pivotY),sprite._applyFilters(),Stat.canvasReCache++,canvas.endRec()},__proto._blend=function(sprite,context,x,y){var style=sprite._style,next=this._next;style.blendMode?(context.save(),context.globalCompositeOperation=style.blendMode,next._fun.call(next,sprite,context,x,y),context.restore()):next._fun.call(next,sprite,context,x,y)},__proto._mask=function(sprite,context,x,y){var next=this._next,mask=sprite.mask,ctx=context;if(mask){ctx.save();var preBlendMode=ctx.globalCompositeOperation,tRect=new Rectangle;if(tRect.copyFrom(mask.getBounds()),tRect.width=Math.round(tRect.width),tRect.height=Math.round(tRect.height),tRect.x=Math.round(tRect.x),tRect.y=Math.round(tRect.y),tRect.width>0&&tRect.height>0){var w=tRect.width,h=tRect.height,tmpRT=WebGLRTMgr.getRT(w,h);ctx.breakNextMerge(),ctx.pushRT(),ctx.addRenderObject(SubmitCMD.create([ctx,tmpRT,w,h],RenderSprite.tmpTarget,this)),mask.render(ctx,-tRect.x,-tRect.y),ctx.breakNextMerge(),ctx.popRT(),ctx.save(),ctx.clipRect(x+tRect.x-sprite.getStyle().pivotX,y+tRect.y-sprite.getStyle().pivotY,w,h),next._fun.call(next,sprite,ctx,x,y),ctx.restore(),preBlendMode=ctx.globalCompositeOperation,ctx.addRenderObject(SubmitCMD.create(["mask"],RenderSprite.setBlendMode,this));var shaderValue=Value2D.create(1,0),uv=Texture.INV_UV;ctx.drawTarget(tmpRT,x+tRect.x-sprite.getStyle().pivotX,y+tRect.y-sprite.getStyle().pivotY,w,h,Matrix.TEMP.identity(),shaderValue,uv,6),ctx.addRenderObject(SubmitCMD.create([tmpRT],RenderSprite.recycleTarget,this)),ctx.addRenderObject(SubmitCMD.create([preBlendMode],RenderSprite.setBlendMode,this))}ctx.restore()}else next._fun.call(next,sprite,context,x,y)},RenderSprite.__init__=function(){LayaGLQuickRunner.__init__();var len,initRender,i=0;for(initRender=new RenderSprite(69905,null),len=RenderSprite.renders.length=16384,i=0;i<len;i++)RenderSprite.renders[i]=initRender;RenderSprite.renders[0]=new RenderSprite(0,null)},RenderSprite._initRenderFun=function(sprite,context,x,y){var type=sprite._renderType;(RenderSprite.renders[type]=RenderSprite._getTypeRender(type))._fun(sprite,context,x,y)},RenderSprite._getTypeRender=function(type){if(LayaGLQuickRunner.map[type])return new RenderSprite(type,null);for(var rst=null,tType=8192;tType>0;)tType&type&&(rst=new RenderSprite(tType,rst)),tType>>=1;return rst},RenderSprite.tmpTarget=function(ctx,rt,w,h){rt.start(),rt.clear(0,0,0,0)},RenderSprite.recycleTarget=function(rt){WebGLRTMgr.releaseRT(rt)},RenderSprite.setBlendMode=function(blendMode){var gl=WebGL.mainContext;BlendMode.targetFns[BlendMode.TOINT[blendMode]](gl)},RenderSprite.INIT=69905,RenderSprite.renders=[],RenderSprite.NORENDER=new RenderSprite(0,null),__static(RenderSprite,["tempUV",function(){return this.tempUV=new Array(8)}]),RenderSprite}(),RestoreCmd=(function(){function Keyboard(){}__class(Keyboard,"laya.events.Keyboard"),Keyboard.NUMBER_0=48,Keyboard.NUMBER_1=49,Keyboard.NUMBER_2=50,Keyboard.NUMBER_3=51,Keyboard.NUMBER_4=52,Keyboard.NUMBER_5=53,Keyboard.NUMBER_6=54,Keyboard.NUMBER_7=55,Keyboard.NUMBER_8=56,Keyboard.NUMBER_9=57,Keyboard.A=65,Keyboard.B=66,Keyboard.C=67,Keyboard.D=68,Keyboard.E=69,Keyboard.F=70,Keyboard.G=71,Keyboard.H=72,Keyboard.I=73,Keyboard.J=74,Keyboard.K=75,Keyboard.L=76,Keyboard.M=77,Keyboard.N=78,Keyboard.O=79,Keyboard.P=80,Keyboard.Q=81,Keyboard.R=82,Keyboard.S=83,Keyboard.T=84,Keyboard.U=85,Keyboard.V=86,Keyboard.W=87,Keyboard.X=88,Keyboard.Y=89,Keyboard.Z=90,Keyboard.F1=112,Keyboard.F2=113,Keyboard.F3=114,Keyboard.F4=115,Keyboard.F5=116,Keyboard.F6=117,Keyboard.F7=118,Keyboard.F8=119,Keyboard.F9=120,Keyboard.F10=121,Keyboard.F11=122,Keyboard.F12=123,Keyboard.F13=124,Keyboard.F14=125,Keyboard.F15=126,Keyboard.NUMPAD=21,Keyboard.NUMPAD_0=96,Keyboard.NUMPAD_1=97,Keyboard.NUMPAD_2=98,Keyboard.NUMPAD_3=99,Keyboard.NUMPAD_4=100,Keyboard.NUMPAD_5=101,Keyboard.NUMPAD_6=102,Keyboard.NUMPAD_7=103,Keyboard.NUMPAD_8=104,Keyboard.NUMPAD_9=105,Keyboard.NUMPAD_ADD=107,Keyboard.NUMPAD_DECIMAL=110,Keyboard.NUMPAD_DIVIDE=111,Keyboard.NUMPAD_ENTER=108,Keyboard.NUMPAD_MULTIPLY=106,Keyboard.NUMPAD_SUBTRACT=109,Keyboard.SEMICOLON=186,Keyboard.EQUAL=187,Keyboard.COMMA=188,Keyboard.MINUS=189,Keyboard.PERIOD=190,Keyboard.SLASH=191,Keyboard.BACKQUOTE=192,Keyboard.LEFTBRACKET=219,Keyboard.BACKSLASH=220,Keyboard.RIGHTBRACKET=221,Keyboard.QUOTE=222,Keyboard.ALTERNATE=18,Keyboard.BACKSPACE=8,Keyboard.CAPS_LOCK=20,Keyboard.COMMAND=15,Keyboard.CONTROL=17,Keyboard.DELETE=46,Keyboard.ENTER=13,Keyboard.ESCAPE=27,Keyboard.PAGE_UP=33,Keyboard.PAGE_DOWN=34,Keyboard.END=35,Keyboard.HOME=36,Keyboard.LEFT=37,Keyboard.UP=38,Keyboard.RIGHT=39,Keyboard.DOWN=40,Keyboard.SHIFT=16,Keyboard.SPACE=32,Keyboard.TAB=9,Keyboard.INSERT=45}(),function(){function RestoreCmd(){}__class(RestoreCmd,"laya.display.cmd.RestoreCmd");var __proto=RestoreCmd.prototype;return __proto.recover=function(){Pool.recover("RestoreCmd",this)},__proto.run=function(context,gx,gy){context.restore()},__getset(0,__proto,"cmdID",function(){return"Restore"}),RestoreCmd.create=function(){return Pool.getItemByClass("RestoreCmd",RestoreCmd)},RestoreCmd.ID="Restore",RestoreCmd}()),ShaderDefinesBase=function(){function ShaderDefinesBase(name2int,int2name,int2nameMap){this._value=0,this._name2int=name2int,this._int2name=int2name,this._int2nameMap=int2nameMap}__class(ShaderDefinesBase,"laya.webgl.shader.ShaderDefinesBase");var __proto=ShaderDefinesBase.prototype;return __proto.add=function(value){return"string"==typeof value&&(value=this._name2int[value]),this._value|=value,this._value},__proto.addInt=function(value){return this._value|=value,this._value},__proto.remove=function(value){return"string"==typeof value&&(value=this._name2int[value]),this._value&=~value,this._value},__proto.isDefine=function(def){return(this._value&def)===def},__proto.getValue=function(){return this._value},__proto.setValue=function(value){this._value=value},__proto.toNameDic=function(){var r=this._int2nameMap[this._value];return r||ShaderDefinesBase._toText(this._value,this._int2name,this._int2nameMap)},ShaderDefinesBase._reg=function(name,value,_name2int,_int2name){_name2int[name]=value,_int2name[value]=name},ShaderDefinesBase._toText=function(value,_int2name,_int2nameMap){var r=_int2nameMap[value];if(r)return r;for(var o={},d=1,i=0;i<32&&!((d=1<<i)>value);i++)if(value&d){var name=_int2name[d];name&&(o[name]="")}return _int2nameMap[value]=o,o},ShaderDefinesBase._toInt=function(names,_name2int){for(var words=names.split("."),num=0,i=0,n=words.length;i<n;i++){var value=_name2int[words[i]];if(!value)throw new Error("Defines to int err:"+names+"/"+words[i]);num|=value}return num},ShaderDefinesBase}(),BitmapFont=function(){function BitmapFont(){this._texture=null,this._fontCharDic={},this._fontWidthMap={},this._complete=null,this._path=null,this._maxWidth=0,this._spaceWidth=10,this._padding=null,this.fontSize=12,this.autoScaleSize=!1,this.letterSpacing=0}__class(BitmapFont,"laya.display.BitmapFont");var __proto=BitmapFont.prototype;return __proto.loadFont=function(path,complete){this._path=path,this._complete=complete,path&&-1!==path.indexOf(".fnt")?Laya.loader.load([{url:path,type:"xml"},{url:path.replace(".fnt",".png"),type:"image"}],Handler.create(this,this._onLoaded)):console.error('Bitmap font configuration information must be a ".fnt" file')},__proto._onLoaded=function(){this.parseFont(Loader.getRes(this._path),Loader.getRes(this._path.replace(".fnt",".png"))),this._complete&&this._complete.run()},__proto.parseFont=function(xml,texture){if(null!=xml&&null!=texture){this._texture=texture;var tInfo=xml.getElementsByTagName("info");if(!tInfo[0].getAttributeNode)return this.parseFont2(xml,texture);this.fontSize=parseInt(tInfo[0].getAttributeNode("size").nodeValue);var chars,tPaddingArray=tInfo[0].getAttributeNode("padding").nodeValue.split(",");this._padding=[parseInt(tPaddingArray[0]),parseInt(tPaddingArray[1]),parseInt(tPaddingArray[2]),parseInt(tPaddingArray[3])],chars=xml.getElementsByTagName("char");var i=0;for(i=0;i<chars.length;i++){var tAttribute=chars[i],tId=parseInt(tAttribute.getAttributeNode("id").nodeValue),xOffset=parseInt(tAttribute.getAttributeNode("xoffset").nodeValue)/1,yOffset=parseInt(tAttribute.getAttributeNode("yoffset").nodeValue)/1,xAdvance=parseInt(tAttribute.getAttributeNode("xadvance").nodeValue)/1,region=new Rectangle;region.x=parseInt(tAttribute.getAttributeNode("x").nodeValue),region.y=parseInt(tAttribute.getAttributeNode("y").nodeValue),region.width=parseInt(tAttribute.getAttributeNode("width").nodeValue),region.height=parseInt(tAttribute.getAttributeNode("height").nodeValue);var tTexture=Texture.create(texture,region.x,region.y,region.width,region.height,xOffset,yOffset);this._maxWidth=Math.max(this._maxWidth,xAdvance+this.letterSpacing),this._fontCharDic[tId]=tTexture,this._fontWidthMap[tId]=xAdvance}}},__proto.parseFont2=function(xml,texture){if(null!=xml&&null!=texture){this._texture=texture;var tInfo=xml.getElementsByTagName("info");this.fontSize=parseInt(tInfo[0].attributes.size.nodeValue);var tPaddingArray=tInfo[0].attributes.padding.nodeValue.split(",");this._padding=[parseInt(tPaddingArray[0]),parseInt(tPaddingArray[1]),parseInt(tPaddingArray[2]),parseInt(tPaddingArray[3])];var chars=xml.getElementsByTagName("char"),i=0;for(i=0;i<chars.length;i++){var tAttribute=chars[i].attributes,tId=parseInt(tAttribute.id.nodeValue),xOffset=parseInt(tAttribute.xoffset.nodeValue)/1,yOffset=parseInt(tAttribute.yoffset.nodeValue)/1,xAdvance=parseInt(tAttribute.xadvance.nodeValue)/1,region=new Rectangle;region.x=parseInt(tAttribute.x.nodeValue),region.y=parseInt(tAttribute.y.nodeValue),region.width=parseInt(tAttribute.width.nodeValue),region.height=parseInt(tAttribute.height.nodeValue);var tTexture=Texture.create(texture,region.x,region.y,region.width,region.height,xOffset,yOffset);this._maxWidth=Math.max(this._maxWidth,xAdvance+this.letterSpacing),this._fontCharDic[tId]=tTexture,this._fontWidthMap[tId]=xAdvance}}},__proto.getCharTexture=function(char){return this._fontCharDic[char.charCodeAt(0)]},__proto.destroy=function(){if(this._texture){for(var p in this._fontCharDic){var tTexture=this._fontCharDic[p];tTexture&&tTexture.destroy()}this._texture.destroy(),this._fontCharDic=null,this._fontWidthMap=null,this._texture=null,this._complete=null,this._padding=null}},__proto.setSpaceWidth=function(spaceWidth){this._spaceWidth=spaceWidth},__proto.getCharWidth=function(char){var code=char.charCodeAt(0);return this._fontWidthMap[code]?this._fontWidthMap[code]+this.letterSpacing:" "===char?this._spaceWidth+this.letterSpacing:0},__proto.getTextWidth=function(text){for(var tWidth=0,i=0,n=text.length;i<n;i++)tWidth+=this.getCharWidth(text.charAt(i));return tWidth},__proto.getMaxWidth=function(){return this._maxWidth},__proto.getMaxHeight=function(){return this.fontSize},__proto._drawText=function(text,sprite,drawX,drawY,align,width){var tTexture,tWidth=this.getTextWidth(text),dx=0;"center"===align&&(dx=(width-tWidth)/2),"right"===align&&(dx=width-tWidth);for(var tx=0,i=0,n=text.length;i<n;i++)(tTexture=this.getCharTexture(text.charAt(i)))&&(sprite.graphics.drawImage(tTexture,drawX+tx+dx,drawY),tx+=this.getCharWidth(text.charAt(i)))},BitmapFont}(),ClipRectCmd=function(){function ClipRectCmd(){}__class(ClipRectCmd,"laya.display.cmd.ClipRectCmd");var __proto=ClipRectCmd.prototype;return __proto.recover=function(){Pool.recover("ClipRectCmd",this)},__proto.run=function(context,gx,gy){context.clipRect(this.x+gx,this.y+gy,this.width,this.height)},__getset(0,__proto,"cmdID",function(){return"ClipRect"}),ClipRectCmd.create=function(x,y,width,height){var cmd=Pool.getItemByClass("ClipRectCmd",ClipRectCmd);return cmd.x=x,cmd.y=y,cmd.width=width,cmd.height=height,cmd},ClipRectCmd.ID="ClipRect",ClipRectCmd}(),Shader2D=function(){function Shader2D(){this.ALPHA=1,this.shaderType=0,this.defines=new ShaderDefines2D,this.fillStyle=DrawStyle.DEFAULT,this.strokeStyle=DrawStyle.DEFAULT}return __class(Shader2D,"laya.webgl.shader.d2.Shader2D"),Shader2D.prototype.destroy=function(){this.defines=null,this.filters=null},Shader2D.__init__=function(){var vs,ps;vs="/*\n\ttexture和fillrect使用的。\n*/\nattribute vec4 posuv;\nattribute vec4 attribColor;\nattribute vec4 attribFlags;\n//attribute vec4 clipDir;\n//attribute vec2 clipRect;\nuniform vec4 clipMatDir;\nuniform vec2 clipMatPos;\t\t// 这个是全局的,不用再应用矩阵了。\nvarying vec2 cliped;\nuniform vec2 size;\nuniform vec2 clipOff;\t\t\t// 使用要把clip偏移。cacheas normal用. 只用了[0]\n#ifdef WORLDMAT\n\tuniform mat4 mmat;\n#endif\n#ifdef MVP3D\n\tuniform mat4 u_MvpMatrix;\n#endif\nvarying vec4 v_texcoordAlpha;\nvarying vec4 v_color;\nvarying float v_useTex;\n\nvoid main() {\n\n\tvec4 pos = vec4(posuv.xy,0.,1.);\n#ifdef WORLDMAT\n\tpos=mmat*pos;\n#endif\n\tvec4 pos1 =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,0.,1.0);\n#ifdef MVP3D\n\tgl_Position=u_MvpMatrix*pos1;\n#else\n\tgl_Position=pos1;\n#endif\n\tv_texcoordAlpha.xy = posuv.zw;\n\t//v_texcoordAlpha.z = attribColor.a/255.0;\n\tv_color = attribColor/255.0;\n\tv_color.xyz*=v_color.w;//反正后面也要预乘\n\t\n\tv_useTex = attribFlags.r/255.0;\n\tfloat clipw = length(clipMatDir.xy);\n\tfloat cliph = length(clipMatDir.zw);\n\t\n\tvec2 clpos = clipMatPos.xy;\n\t#ifdef WORLDMAT\n\t\t// 如果有mmat,需要修改clipMatPos,因为 这是cacheas normal (如果不是就错了), clipMatPos被去掉了偏移\n\t\tif(clipOff[0]>0.0){\n\t\t\tclpos.x+=mmat[3].x;\t//tx\t最简单处理\n\t\t\tclpos.y+=mmat[3].y;\t//ty\n\t\t}\n\t#endif\n\tvec2 clippos = pos.xy - clpos;\t//pos已经应用矩阵了,为了减的有意义,clip的位置也要缩放\n\tif(clipw>20000. && cliph>20000.)\n\t\tcliped = vec2(0.5,0.5);\n\telse {\n\t\t//转成0到1之间。/clipw/clipw 表示clippos与normalize之后的clip朝向点积之后,再除以clipw\n\t\tcliped=vec2( dot(clippos,clipMatDir.xy)/clipw/clipw, dot(clippos,clipMatDir.zw)/cliph/cliph);\n\t}\n\n}",ps="/*\n\ttexture和fillrect使用的。\n*/\n#ifdef FSHIGHPRECISION\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nvarying vec4 v_texcoordAlpha;\nvarying vec4 v_color;\nvarying float v_useTex;\nuniform sampler2D texture;\nvarying vec2 cliped;\n\n#ifdef BLUR_FILTER\nuniform vec4 strength_sig2_2sig2_gauss1;\nuniform vec2 blurInfo;\n\n#define PI 3.141593\n\nfloat getGaussian(float x, float y){\n return strength_sig2_2sig2_gauss1.w*exp(-(x*x+y*y)/strength_sig2_2sig2_gauss1.z);\n}\n\nvec4 blur(){\n const float blurw = 9.0;\n vec4 vec4Color = vec4(0.0,0.0,0.0,0.0);\n vec2 halfsz=vec2(blurw,blurw)/2.0/blurInfo; \n vec2 startpos=v_texcoordAlpha.xy-halfsz;\n vec2 ctexcoord = startpos;\n vec2 step = 1.0/blurInfo; //每个像素 \n \n for(float y = 0.0;y<=blurw; ++y){\n ctexcoord.x=startpos.x;\n for(float x = 0.0;x<=blurw; ++x){\n //TODO 纹理坐标的固定偏移应该在vs中处理\n vec4Color += texture2D(texture, ctexcoord)*getGaussian(x-blurw/2.0,y-blurw/2.0);\n ctexcoord.x+=step.x;\n }\n ctexcoord.y+=step.y;\n }\n return vec4Color;\n}\n#endif\n\n#ifdef COLOR_FILTER\nuniform vec4 colorAlpha;\nuniform mat4 colorMat;\n#endif\n\n#ifdef GLOW_FILTER\nuniform vec4 u_color;\nuniform vec4 u_blurInfo1;\nuniform vec4 u_blurInfo2;\n#endif\n\n#ifdef COLOR_ADD\nuniform vec4 colorAdd;\n#endif\n\n#ifdef FILLTEXTURE\t\nuniform vec4 u_TexRange;//startu,startv,urange, vrange\n#endif\nvoid main() {\n\tif(cliped.x<0.) discard;\n\tif(cliped.x>1.) discard;\n\tif(cliped.y<0.) discard;\n\tif(cliped.y>1.) discard;\n\t\n#ifdef FILLTEXTURE\t\n vec4 color= texture2D(texture, fract(v_texcoordAlpha.xy)*u_TexRange.zw + u_TexRange.xy);\n#else\n vec4 color= texture2D(texture, v_texcoordAlpha.xy);\n#endif\n\n if(v_useTex<=0.)color = vec4(1.,1.,1.,1.);\n color.a*=v_color.w;\n //color.rgb*=v_color.w;\n color.rgb*=v_color.rgb;\n gl_FragColor=color;\n \n #ifdef COLOR_ADD\n\tgl_FragColor = vec4(colorAdd.rgb,colorAdd.a*gl_FragColor.a);\n\tgl_FragColor.xyz *= colorAdd.a;\n #endif\n \n #ifdef BLUR_FILTER\n\tgl_FragColor = blur();\n\tgl_FragColor.w*=v_color.w; \n #endif\n \n #ifdef COLOR_FILTER\n\tmat4 alphaMat =colorMat;\n\n\talphaMat[0][3] *= gl_FragColor.a;\n\talphaMat[1][3] *= gl_FragColor.a;\n\talphaMat[2][3] *= gl_FragColor.a;\n\n\tgl_FragColor = gl_FragColor * alphaMat;\n\tgl_FragColor += colorAlpha/255.0*gl_FragColor.a;\n #endif\n \n #ifdef GLOW_FILTER\n\tconst float c_IterationTime = 10.0;\n\tfloat floatIterationTotalTime = c_IterationTime * c_IterationTime;\n\tvec4 vec4Color = vec4(0.0,0.0,0.0,0.0);\n\tvec2 vec2FilterDir = vec2(-(u_blurInfo1.z)/u_blurInfo2.x,-(u_blurInfo1.w)/u_blurInfo2.y);\n\tvec2 vec2FilterOff = vec2(u_blurInfo1.x/u_blurInfo2.x/c_IterationTime * 2.0,u_blurInfo1.y/u_blurInfo2.y/c_IterationTime * 2.0);\n\tfloat maxNum = u_blurInfo1.x * u_blurInfo1.y;\n\tvec2 vec2Off = vec2(0.0,0.0);\n\tfloat floatOff = c_IterationTime/2.0;\n\tfor(float i = 0.0;i<=c_IterationTime; ++i){\n\t\tfor(float j = 0.0;j<=c_IterationTime; ++j){\n\t\t\tvec2Off = vec2(vec2FilterOff.x * (i - floatOff),vec2FilterOff.y * (j - floatOff));\n\t\t\tvec4Color += texture2D(texture, v_texcoordAlpha.xy + vec2FilterDir + vec2Off)/floatIterationTotalTime;\n\t\t}\n\t}\n\tgl_FragColor = vec4(u_color.rgb,vec4Color.a * u_blurInfo2.z);\n\tgl_FragColor.rgb *= gl_FragColor.a; \n #endif\n \n}",Shader.preCompile2D(0,1,vs,ps,null),vs="attribute vec4 position;\nattribute vec4 attribColor;\n//attribute vec4 clipDir;\n//attribute vec2 clipRect;\nuniform vec4 clipMatDir;\nuniform vec2 clipMatPos;\n#ifdef WORLDMAT\n\tuniform mat4 mmat;\n#endif\nuniform mat4 u_mmat2;\n//uniform vec2 u_pos;\nuniform vec2 size;\nvarying vec4 color;\n//vec4 dirxy=vec4(0.9,0.1, -0.1,0.9);\n//vec4 clip=vec4(100.,30.,300.,600.);\nvarying vec2 cliped;\nvoid main(){\n\t\n#ifdef WORLDMAT\n\tvec4 pos=mmat*vec4(position.xy,0.,1.);\n\tgl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n#else\n\tgl_Position =vec4((position.x/size.x-0.5)*2.0,(0.5-position.y/size.y)*2.0,position.z,1.0);\n#endif\t\n\tfloat clipw = length(clipMatDir.xy);\n\tfloat cliph = length(clipMatDir.zw);\n\tvec2 clippos = position.xy - clipMatPos.xy;\t//pos已经应用矩阵了,为了减的有意义,clip的位置也要缩放\n\tif(clipw>20000. && cliph>20000.)\n\t\tcliped = vec2(0.5,0.5);\n\telse {\n\t\t//clipdir是带缩放的方向,由于上面clippos是在缩放后的空间计算的,所以需要把方向先normalize一下\n\t\tcliped=vec2( dot(clippos,clipMatDir.xy)/clipw/clipw, dot(clippos,clipMatDir.zw)/cliph/cliph);\n\t}\n //pos2d.x = dot(clippos,dirx);\n color=attribColor/255.;\n}",ps="precision mediump float;\n//precision mediump float;\nvarying vec4 color;\n//uniform float alpha;\nvarying vec2 cliped;\nvoid main(){\n\t//vec4 a=vec4(color.r, color.g, color.b, 1);\n\t//a.a*=alpha;\n gl_FragColor= color;// vec4(color.r, color.g, color.b, alpha);\n\tgl_FragColor.rgb*=color.a;\n\tif(cliped.x<0.) discard;\n\tif(cliped.x>1.) discard;\n\tif(cliped.y<0.) discard;\n\tif(cliped.y>1.) discard;\n}",Shader.preCompile2D(0,4,vs,ps,null),vs="attribute vec2 position;\nattribute vec2 texcoord;\nattribute vec4 color;\nuniform vec2 size;\nuniform float offsetX;\nuniform float offsetY;\nuniform mat4 mmat;\nuniform mat4 u_mmat2;\nvarying vec2 v_texcoord;\nvarying vec4 v_color;\nvoid main() {\n vec4 pos=mmat*u_mmat2*vec4(offsetX+position.x,offsetY+position.y,0,1 );\n gl_Position = vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n v_color = color;\n v_color.rgb *= v_color.a;\n v_texcoord = texcoord; \n}",ps="precision mediump float;\nvarying vec2 v_texcoord;\nvarying vec4 v_color;\nuniform sampler2D texture;\nuniform float alpha;\nvoid main() {\n\tvec4 t_color = texture2D(texture, v_texcoord);\n\tgl_FragColor = t_color.rgba * v_color;\n\tgl_FragColor *= alpha;\n}",Shader.preCompile2D(0,512,vs,ps,null)},Shader2D}(),DrawPolyCmd=function(){function DrawPolyCmd(){}__class(DrawPolyCmd,"laya.display.cmd.DrawPolyCmd");var __proto=DrawPolyCmd.prototype;return __proto.recover=function(){this.points=null,this.fillColor=null,this.lineColor=null,Pool.recover("DrawPolyCmd",this)},__proto.run=function(context,gx,gy){context._drawPoly(this.x+gx,this.y+gy,this.points,this.fillColor,this.lineColor,this.lineWidth,this.isConvexPolygon,this.vid)},__getset(0,__proto,"cmdID",function(){return"DrawPoly"}),DrawPolyCmd.create=function(x,y,points,fillColor,lineColor,lineWidth,isConvexPolygon,vid){var cmd=Pool.getItemByClass("DrawPolyCmd",DrawPolyCmd);return cmd.x=x,cmd.y=y,cmd.points=points,cmd.fillColor=fillColor,cmd.lineColor=lineColor,cmd.lineWidth=lineWidth,cmd.isConvexPolygon=isConvexPolygon,cmd.vid=vid,cmd},DrawPolyCmd.ID="DrawPoly",DrawPolyCmd}(),TTFLoader=function(){function TTFLoader(){this.fontName=null,this.complete=null,this.err=null,this._fontTxt=null,this._url=null,this._div=null,this._txtWidth=NaN,this._http=null}__class(TTFLoader,"laya.net.TTFLoader");var __proto=TTFLoader.prototype;return __proto.load=function(fontPath){this._url=fontPath;var tArr=fontPath.split(".ttf")[0].split("/");this.fontName=tArr[tArr.length-1],Render.isConchApp?this._loadConch():Browser.window.FontFace?this._loadWithFontFace():this._loadWithCSS()},__proto._loadConch=function(){this._http=new HttpRequest,this._http.on("error",this,this._onErr),this._http.on("complete",this,this._onHttpLoaded),this._http.send(this._url,null,"get","arraybuffer")},__proto._onHttpLoaded=function(data){Browser.window.conchTextCanvas.setFontFaceFromBuffer(this.fontName,data),this._clearHttp(),this._complete()},__proto._clearHttp=function(){this._http&&(this._http.off("error",this,this._onErr),this._http.off("complete",this,this._onHttpLoaded),this._http=null)},__proto._onErr=function(){this._clearHttp(),this.err&&(this.err.runWith("fail:"+this._url),this.err=null)},__proto._complete=function(){Laya.systemTimer.clear(this,this._complete),Laya.systemTimer.clear(this,this._checkComplete),this._div&&this._div.parentNode&&(this._div.parentNode.removeChild(this._div),this._div=null),this.complete&&(this.complete.runWith(this),this.complete=null)},__proto._checkComplete=function(){RunDriver.measureText("LayaTTFFont",this._fontTxt).width!=this._txtWidth&&this._complete()},__proto._loadWithFontFace=function(){var fontFace=new Browser.window.FontFace(this.fontName,"url('"+this._url+"')");Browser.window.document.fonts.add(fontFace);var self=this;fontFace.loaded.then(function(){self._complete()}),fontFace.load()},__proto._createDiv=function(){this._div=Browser.createElement("div"),this._div.innerHTML="laya";var _style=this._div.style;_style.fontFamily=this.fontName,_style.position="absolute",_style.left="-100px",_style.top="-100px",Browser.document.body.appendChild(this._div)},__proto._loadWithCSS=function(){var _$this=this,fontStyle=Browser.createElement("style");fontStyle.type="text/css",Browser.document.body.appendChild(fontStyle),fontStyle.textContent="@font-face { font-family:'"+this.fontName+"'; src:url('"+this._url+"');}",this._fontTxt="40px "+this.fontName,this._txtWidth=RunDriver.measureText("LayaTTFFont",this._fontTxt).width;var self=this;fontStyle.onload=function(){Laya.systemTimer.once(1e4,self,_$this._complete)},Laya.systemTimer.loop(20,this,this._checkComplete),this._createDiv()},TTFLoader._testString="LayaTTFFont",TTFLoader}(),SubmitKey=function(){function SubmitKey(){this.blendShader=0,this.submitType=0,this.other=0,this.clear()}__class(SubmitKey,"laya.webgl.submit.SubmitKey");var __proto=SubmitKey.prototype;return __proto.clear=function(){this.submitType=-1,this.blendShader=this.other=0},__proto.copyFrom=function(src){this.other=src.other,this.blendShader=src.blendShader,this.submitType=src.submitType},__proto.copyFrom2=function(src,submitType,other){this.other=other,this.submitType=submitType},__proto.equal3_2=function(next,submitType,other){return this.submitType===submitType&&this.other===other&&this.blendShader===next.blendShader},__proto.equal4_2=function(next,submitType,other){return this.submitType===submitType&&this.other===other&&this.blendShader===next.blendShader},__proto.equal_3=function(next){return this.submitType===next.submitType&&this.blendShader===next.blendShader},__proto.equal=function(next){return this.other===next.other&&this.submitType===next.submitType&&this.blendShader===next.blendShader},SubmitKey}(),Pool=(function(){function DrawCanvasCmd(){this._graphicsCmdEncoder=null,this._index=0,this._paramData=null,this.texture=null,this.x=NaN,this.y=NaN,this.width=NaN,this.height=NaN}__class(DrawCanvasCmd,"laya.display.cmd.DrawCanvasCmd");var __proto=DrawCanvasCmd.prototype;__proto.recover=function(){this._graphicsCmdEncoder=null,Pool.recover("DrawCanvasCmd",this)},__getset(0,__proto,"cmdID",function(){return"DrawCanvasCmd"}),DrawCanvasCmd.create=function(texture,x,y,width,height){return null},DrawCanvasCmd.ID="DrawCanvasCmd",DrawCanvasCmd._DRAW_IMAGE_CMD_ENCODER_=null,DrawCanvasCmd._PARAM_TEXTURE_POS_=2,DrawCanvasCmd._PARAM_VB_POS_=5}(),function(){function Pool(){}return __class(Pool,"laya.utils.Pool"),Pool.getPoolBySign=function(sign){return Pool._poolDic[sign]||(Pool._poolDic[sign]=[])},Pool.clearBySign=function(sign){Pool._poolDic[sign]&&(Pool._poolDic[sign].length=0)},Pool.recover=function(sign,item){item.__InPool||(item.__InPool=!0,Pool.getPoolBySign(sign).push(item))},Pool.recoverByClass=function(instance){if(instance){var className=instance.__className||instance.constructor._$gid;className&&Pool.recover(className,instance)}},Pool._getClassSign=function(cla){var className=cla.__className||cla._$gid;return className||(cla._$gid=className=Utils.getGID()+""),className},Pool.createByClass=function(cls){return Pool.getItemByClass(Pool._getClassSign(cls),cls)},Pool.getItemByClass=function(sign,cls){if(!Pool._poolDic[sign])return new cls;var pool=Pool.getPoolBySign(sign);if(pool.length){var rst=pool.pop();rst.__InPool=!1}else rst=new cls;return rst},Pool.getItemByCreateFun=function(sign,createFun,caller){var pool=Pool.getPoolBySign(sign),rst=pool.length?pool.pop():createFun.call(caller);return rst.__InPool=!1,rst},Pool.getItem=function(sign){var pool=Pool.getPoolBySign(sign),rst=pool.length?pool.pop():null;return rst&&(rst.__InPool=!1),rst},Pool.POOLSIGN="__InPool",Pool._poolDic={},Pool}()),InlcudeFile=function(){function InlcudeFile(txt){this.script=null,this.codes={},this.funs={},this.curUseID=-1,this.funnames="",this.script=txt;for(var begin=0,ofs=0,end=0;!((begin=txt.indexOf("#begin",begin))<0);){for(end=begin+5;!((end=txt.indexOf("#end",end))<0)&&"i"===txt.charAt(end+4);)end+=5;if(end<0)throw"add include err,no #end:"+txt;ofs=txt.indexOf("\n",begin);var words=ShaderCompile.splitToWords(txt.substr(begin,ofs-begin),null);"code"==words[1]?this.codes[words[2]]=txt.substr(ofs+1,end-ofs-1):"function"==words[1]&&(ofs=txt.indexOf("function",begin),ofs+="function".length,this.funs[words[3]]=txt.substr(ofs+1,end-ofs-1),this.funnames+=words[3]+";"),begin=end+1}}__class(InlcudeFile,"laya.webgl.utils.InlcudeFile");var __proto=InlcudeFile.prototype;return __proto.getWith=function(name){var r=name?this.codes[name]:this.script;if(!r)throw"get with error:"+name;return r},__proto.getFunsScript=function(funsdef){var r="";for(var i in this.funs)funsdef.indexOf(i+";")>=0&&(r+=this.funs[i]);return r},InlcudeFile}(),Buffer=(function(){function SpriteConst(){}__class(SpriteConst,"laya.display.SpriteConst"),SpriteConst.ALPHA=1,SpriteConst.TRANSFORM=2,SpriteConst.BLEND=4,SpriteConst.CANVAS=8,SpriteConst.FILTERS=16,SpriteConst.MASK=32,SpriteConst.CLIP=64,SpriteConst.STYLE=128,SpriteConst.TEXTURE=256,SpriteConst.GRAPHICS=512,SpriteConst.LAYAGL3D=1024,SpriteConst.CUSTOM=2048,SpriteConst.ONECHILD=4096,SpriteConst.CHILDS=8192,SpriteConst.REPAINT_NONE=0,SpriteConst.REPAINT_NODE=1,SpriteConst.REPAINT_CACHE=2,SpriteConst.REPAINT_ALL=3}(),function(){function Buffer(){this._glBuffer=null,this._buffer=null,this._bufferType=0,this._bufferUsage=0,this._byteLength=0,this._glBuffer=LayaGL.instance.createBuffer()}__class(Buffer,"laya.webgl.utils.Buffer");var __proto=Buffer.prototype;return __proto._bindForVAO=function(){},__proto.bind=function(){return!1},__proto.destroy=function(){this._glBuffer&&(LayaGL.instance.deleteBuffer(this._glBuffer),this._glBuffer=null)},__getset(0,__proto,"bufferUsage",function(){return this._bufferUsage}),Buffer._bindedVertexBuffer=null,Buffer._bindedIndexBuffer=null,Buffer}()),DrawTextureCmd=function(){function DrawTextureCmd(){this.colorFlt=null}__class(DrawTextureCmd,"laya.display.cmd.DrawTextureCmd");var __proto=DrawTextureCmd.prototype;return __proto.recover=function(){this.texture._removeReference(),this.texture=null,this.matrix=null,Pool.recover("DrawTextureCmd",this)},__proto.run=function(context,gx,gy){context.drawTextureWithTransform(this.texture,this.x,this.y,this.width,this.height,this.matrix,gx,gy,this.alpha,this.blendMode,this.colorFlt)},__getset(0,__proto,"cmdID",function(){return"DrawTexture"}),DrawTextureCmd.create=function(texture,x,y,width,height,matrix,alpha,color,blendMode){var cmd=Pool.getItemByClass("DrawTextureCmd",DrawTextureCmd);return cmd.texture=texture,texture._addReference(),cmd.x=x,cmd.y=y,cmd.width=width,cmd.height=height,cmd.matrix=matrix,cmd.alpha=alpha,cmd.color=color,cmd.blendMode=blendMode,color&&(cmd.colorFlt=new ColorFilter,cmd.colorFlt.setColor(color)),cmd},DrawTextureCmd.ID="DrawTexture",DrawTextureCmd}(),Value2D=function(){function Value2D(mainID,subID){this.size=[0,0],this.alpha=1,this.ALPHA=1,this.subID=0,this.ref=1,this._cacheID=0,this.clipMatDir=[99999999,0,0,99999999],this.clipMatPos=[0,0],this.clipOff=[0,0],this.defines=new ShaderDefines2D,this.mainID=mainID,this.subID=subID,this.textureHost=null,this.texture=null,this.color=null,this.colorAdd=null,this.u_mmat2=null,this._cacheID=mainID|subID,this._inClassCache=Value2D._cache[this._cacheID],mainID>0&&!this._inClassCache&&(this._inClassCache=Value2D._cache[this._cacheID]=[],this._inClassCache._length=0),this.clear()}__class(Value2D,"laya.webgl.shader.d2.value.Value2D");var __proto=Value2D.prototype;return __proto.setValue=function(value){},__proto._ShaderWithCompile=function(){return Shader.withCompile2D(0,this.mainID,this.defines.toNameDic(),this.mainID|this.defines._value,Shader2X.create,this._attribLocation)},__proto.upload=function(){var renderstate2d=RenderState2D;RenderState2D.worldMatrix4===RenderState2D.TEMPMAT4_ARRAY||this.defines.addInt(128),this.mmat=renderstate2d.worldMatrix4,RenderState2D.matWVP&&(this.defines.addInt(2048),this.u_MvpMatrix=RenderState2D.matWVP.elements);var sd=Shader.sharders[this.mainID|this.defines._value]||this._ShaderWithCompile();sd._shaderValueWidth!==renderstate2d.width||sd._shaderValueHeight!==renderstate2d.height?(this.size[0]=renderstate2d.width,this.size[1]=renderstate2d.height,sd._shaderValueWidth=renderstate2d.width,sd._shaderValueHeight=renderstate2d.height,sd.upload(this,null)):sd.upload(this,sd._params2dQuick2||sd._make2dQuick2())},__proto.setFilters=function(value){if(this.filters=value,value)for(var f,n=value.length,i=0;i<n;i++)(f=value[i])&&(this.defines.add(f.type),f.action.setValue(this))},__proto.clear=function(){this.defines._value=this.subID+(WebGL.shaderHighPrecision?1024:0),this.clipOff[0]=0},__proto.release=function(){--this.ref<1&&(this._inClassCache&&(this._inClassCache[this._inClassCache._length++]=this),this.clear(),this.filters=null,this.ref=1,this.clipOff[0]=0)},Value2D._initone=function(type,classT){Value2D._typeClass[type]=classT,Value2D._cache[type]=[],Value2D._cache[type]._length=0},Value2D.__init__=function(){Value2D._initone(4,PrimitiveSV),Value2D._initone(512,SkinSV),Value2D._initone(1,TextureSV),Value2D._initone(9,TextureSV)},Value2D.create=function(mainType,subType){var types=Value2D._cache[mainType|subType];return types._length?types[--types._length]:new Value2D._typeClass[mainType|subType](subType)},Value2D._cache=[],Value2D._typeClass=[],Value2D.TEMPMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Value2D}(),GrahamScan=function(){function GrahamScan(){}return __class(GrahamScan,"laya.maths.GrahamScan"),GrahamScan.multiply=function(p1,p2,p0){return(p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y)},GrahamScan.dis=function(p1,p2){return(p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)},GrahamScan._getPoints=function(count,tempUse,rst){for(void 0===tempUse&&(tempUse=!1),GrahamScan._mPointList||(GrahamScan._mPointList=[]);GrahamScan._mPointList.length<count;)GrahamScan._mPointList.push(new Point);return rst||(rst=[]),rst.length=0,tempUse?GrahamScan.getFrom(rst,GrahamScan._mPointList,count):GrahamScan.getFromR(rst,GrahamScan._mPointList,count),rst},GrahamScan.getFrom=function(rst,src,count){var i=0;for(i=0;i<count;i++)rst.push(src[i]);return rst},GrahamScan.getFromR=function(rst,src,count){var i=0;for(i=0;i<count;i++)rst.push(src.pop());return rst},GrahamScan.pListToPointList=function(pList,tempUse){void 0===tempUse&&(tempUse=!1);var i=0,len=pList.length/2,rst=GrahamScan._getPoints(len,tempUse,GrahamScan._tempPointList);for(i=0;i<len;i++)rst[i].setTo(pList[i+i],pList[i+i+1]);return rst},GrahamScan.pointListToPlist=function(pointList){var tPoint,i=0,len=pointList.length,rst=GrahamScan._temPList;for(rst.length=0,i=0;i<len;i++)tPoint=pointList[i],rst.push(tPoint.x,tPoint.y);return rst},GrahamScan.scanPList=function(pList){return Utils.copyArray(pList,GrahamScan.pointListToPlist(GrahamScan.scan(GrahamScan.pListToPointList(pList,!0))))},GrahamScan.scan=function(PointSet){var tmp,ch,key,i=0,j=0,k=0,n=PointSet.length,_tmpDic={};for((ch=GrahamScan._temArr).length=0,i=(n=PointSet.length)-1;i>=0;i--)key=(tmp=PointSet[i]).x+"_"+tmp.y,_tmpDic.hasOwnProperty(key)||(_tmpDic[key]=!0,ch.push(tmp));for(n=ch.length,Utils.copyArray(PointSet,ch),i=1;i<n;i++)(PointSet[i].y<PointSet[k].y||PointSet[i].y==PointSet[k].y&&PointSet[i].x<PointSet[k].x)&&(k=i);for(tmp=PointSet[0],PointSet[0]=PointSet[k],PointSet[k]=tmp,i=1;i<n-1;i++){for(k=i,j=i+1;j<n;j++)(GrahamScan.multiply(PointSet[j],PointSet[k],PointSet[0])>0||0==GrahamScan.multiply(PointSet[j],PointSet[k],PointSet[0])&&GrahamScan.dis(PointSet[0],PointSet[j])<GrahamScan.dis(PointSet[0],PointSet[k]))&&(k=j);tmp=PointSet[i],PointSet[i]=PointSet[k],PointSet[k]=tmp}if((ch=GrahamScan._temArr).length=0,PointSet.length<3)return Utils.copyArray(ch,PointSet);for(ch.push(PointSet[0],PointSet[1],PointSet[2]),i=3;i<n;i++){for(;ch.length>=2&&GrahamScan.multiply(PointSet[i],ch[ch.length-1],ch[ch.length-2])>=0;)ch.pop();PointSet[i]&&ch.push(PointSet[i])}return ch},GrahamScan._mPointList=null,GrahamScan._tempPointList=[],GrahamScan._temPList=[],GrahamScan._temArr=[],GrahamScan}(),SaveMark=function(){function SaveMark(){this._saveuse=0}__class(SaveMark,"laya.webgl.canvas.save.SaveMark");var __proto=SaveMark.prototype;return Laya.imps(__proto,{"laya.webgl.canvas.save.ISaveData":!0}),__proto.isSaveMark=function(){return!0},__proto.restore=function(context){context._saveMark=this._preSaveMark,SaveMark.POOL[SaveMark.POOL._length++]=this},SaveMark.Create=function(context){var no=SaveMark.POOL,o=no._length>0?no[--no._length]:new SaveMark;return o._saveuse=0,o._preSaveMark=context._saveMark,context._saveMark=o,o},SaveMark.POOL=SaveBase._createArray(),SaveMark}(),Tween=function(){function Tween(){this.gid=0,this.repeat=1,this._count=0}__class(Tween,"laya.utils.Tween");var __proto=Tween.prototype;return __proto.to=function(target,props,duration,ease,complete,delay,coverBefore){return void 0===delay&&(delay=0),void 0===coverBefore&&(coverBefore=!1),this._create(target,props,duration,ease,complete,delay,coverBefore,!0,!1,!0)},__proto.from=function(target,props,duration,ease,complete,delay,coverBefore){return void 0===delay&&(delay=0),void 0===coverBefore&&(coverBefore=!1),this._create(target,props,duration,ease,complete,delay,coverBefore,!1,!1,!0)},__proto._create=function(target,props,duration,ease,complete,delay,coverBefore,isTo,usePool,runNow){if(!target)throw new Error("Tween:target is null");this._target=target,this._duration=duration,this._ease=ease||props.ease||Tween.easeNone,this._complete=complete||props.complete,this._delay=delay,this._props=[],this._usedTimer=0,this._startTimer=Browser.now(),this._usedPool=usePool,this._delayParam=null,this.update=props.update;var gid=target.$_GID||(target.$_GID=Utils.getGID());return Tween.tweenMap[gid]?(coverBefore&&Tween.clearTween(target),Tween.tweenMap[gid].push(this)):Tween.tweenMap[gid]=[this],runNow?delay<=0?this.firstStart(target,props,isTo):(this._delayParam=[target,props,isTo],Laya.timer.once(delay,this,this.firstStart,this._delayParam)):this._initProps(target,props,isTo),this},__proto.firstStart=function(target,props,isTo){this._delayParam=null,target.destroyed?this.clear():(this._initProps(target,props,isTo),this._beginLoop())},__proto._initProps=function(target,props,isTo){for(var p in props)if("number"==typeof target[p]){var start=isTo?target[p]:props[p],end=isTo?props[p]:target[p];this._props.push([p,start,end-start]),isTo||(target[p]=start)}},__proto._beginLoop=function(){Laya.timer.frameLoop(1,this,this._doEase)},__proto._doEase=function(){this._updateEase(Browser.now())},__proto._updateEase=function(time){var target=this._target;if(target){if(target.destroyed)return Tween.clearTween(target);var usedTimer=this._usedTimer=time-this._startTimer-this._delay;if(!(usedTimer<0)){if(usedTimer>=this._duration)return this.complete();for(var ratio=usedTimer>0?this._ease(usedTimer,0,1,this._duration):0,props=this._props,i=0,n=props.length;i<n;i++){var prop=props[i];target[prop[0]]=prop[1]+ratio*prop[2]}this.update&&this.update.run()}}},__proto.complete=function(){if(this._target){Laya.timer.runTimer(this,this.firstStart);for(var target=this._target,props=this._props,handler=this._complete,i=0,n=props.length;i<n;i++){var prop=props[i];target[prop[0]]=prop[1]+prop[2]}this.update&&this.update.run(),this._count++,0!=this.repeat&&this._count>=this.repeat?(this.clear(),handler&&handler.run()):this.restart()}},__proto.pause=function(){Laya.timer.clear(this,this._beginLoop),Laya.timer.clear(this,this._doEase),Laya.timer.clear(this,this.firstStart);var dTime;(dTime=Browser.now()-this._startTimer-this._delay)<0&&(this._usedTimer=dTime)},__proto.setStartTime=function(startTime){this._startTimer=startTime},__proto.clear=function(){this._target&&(this._remove(),this._clear())},__proto._clear=function(){this.pause(),Laya.timer.clear(this,this.firstStart),this._complete=null,this._target=null,this._ease=null,this._props=null,this._delayParam=null,this._usedPool&&(this.update=null,Pool.recover("tween",this))},__proto.recover=function(){this._usedPool=!0,this._clear()},__proto._remove=function(){var tweens=Tween.tweenMap[this._target.$_GID];if(tweens)for(var i=0,n=tweens.length;i<n;i++)if(tweens[i]===this){tweens.splice(i,1);break}},__proto.restart=function(){if(this.pause(),this._usedTimer=0,this._startTimer=Browser.now(),this._delayParam)Laya.timer.once(this._delay,this,this.firstStart,this._delayParam);else{for(var props=this._props,i=0,n=props.length;i<n;i++){var prop=props[i];this._target[prop[0]]=prop[1]}Laya.timer.once(this._delay,this,this._beginLoop)}},__proto.resume=function(){this._usedTimer>=this._duration||(this._startTimer=Browser.now()-this._usedTimer-this._delay,this._delayParam?this._usedTimer<0?Laya.timer.once(-this._usedTimer,this,this.firstStart,this._delayParam):this.firstStart.apply(this,this._delayParam):this._beginLoop())},__getset(0,__proto,"progress",null,function(v){var uTime=v*this._duration;this._startTimer=Browser.now()-this._delay-uTime}),Tween.to=function(target,props,duration,ease,complete,delay,coverBefore,autoRecover){return void 0===delay&&(delay=0),void 0===coverBefore&&(coverBefore=!1),void 0===autoRecover&&(autoRecover=!0),Pool.getItemByClass("tween",Tween)._create(target,props,duration,ease,complete,delay,coverBefore,!0,autoRecover,!0)},Tween.from=function(target,props,duration,ease,complete,delay,coverBefore,autoRecover){return void 0===delay&&(delay=0),void 0===coverBefore&&(coverBefore=!1),void 0===autoRecover&&(autoRecover=!0),Pool.getItemByClass("tween",Tween)._create(target,props,duration,ease,complete,delay,coverBefore,!1,autoRecover,!0)},Tween.clearAll=function(target){if(target&&target.$_GID){var tweens=Tween.tweenMap[target.$_GID];if(tweens){for(var i=0,n=tweens.length;i<n;i++)tweens[i]._clear();tweens.length=0}}},Tween.clear=function(tween){tween.clear()},Tween.clearTween=function(target){Tween.clearAll(target)},Tween.easeNone=function(t,b,c,d){return c*t/d+b},Tween.tweenMap=[],Tween}(),DrawRectCmd=function(){function DrawRectCmd(){}__class(DrawRectCmd,"laya.display.cmd.DrawRectCmd");var __proto=DrawRectCmd.prototype;return __proto.recover=function(){this.fillColor=null,this.lineColor=null,Pool.recover("DrawRectCmd",this)},__proto.run=function(context,gx,gy){context.drawRect(this.x+gx,this.y+gy,this.width,this.height,this.fillColor,this.lineColor,this.lineWidth)},__getset(0,__proto,"cmdID",function(){return"DrawRect"}),DrawRectCmd.create=function(x,y,width,height,fillColor,lineColor,lineWidth){var cmd=Pool.getItemByClass("DrawRectCmd",DrawRectCmd);return cmd.x=x,cmd.y=y,cmd.width=width,cmd.height=height,cmd.fillColor=fillColor,cmd.lineColor=lineColor,cmd.lineWidth=lineWidth,cmd},DrawRectCmd.ID="DrawRect",DrawRectCmd}(),EarcutNode=function(){function EarcutNode(i,x,y){this.i=null,this.x=null,this.y=null,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=null,this.i=i,this.x=x,this.y=y,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}return __class(EarcutNode,"laya.webgl.shapes.EarcutNode"),EarcutNode}(),SubmitCMD=function(){function SubmitCMD(){this.fun=null,this._this=null,this.args=null,this._ref=1,this._key=new SubmitKey}__class(SubmitCMD,"laya.webgl.submit.SubmitCMD");var __proto=SubmitCMD.prototype;return Laya.imps(__proto,{"laya.webgl.submit.ISubmit":!0}),__proto.renderSubmit=function(){return this.fun.apply(this._this,this.args),1},__proto.getRenderType=function(){return 0},__proto.reUse=function(context,pos){return this._ref++,pos},__proto.releaseRender=function(){if(--this._ref<1){var pool=SubmitCMD.POOL;pool[pool._length++]=this}},__proto.clone=function(context,mesh,pos){return null},SubmitCMD.create=function(args,fun,thisobj){var o=SubmitCMD.POOL._length?SubmitCMD.POOL[--SubmitCMD.POOL._length]:new SubmitCMD;return o.fun=fun,o.args=args,o._this=thisobj,o._ref=1,o._key.clear(),o},SubmitCMD.POOL=[],SubmitCMD.__init$=function(){SubmitCMD.POOL._length=0},SubmitCMD}(),URL=function(){function URL(url){this._url=null,this._path=null,this._url=URL.formatURL(url),this._path=URL.getPath(url)}__class(URL,"laya.net.URL");var __proto=URL.prototype;return __getset(0,__proto,"path",function(){return this._path}),__getset(0,__proto,"url",function(){return this._url}),__getset(1,URL,"basePath",function(){return URL._basePath},function(value){URL._basePath=Laya._getUrlPath(),URL._basePath=URL.formatURL(value)}),URL.formatURL=function(url){if(!url)return"null path";if(url.indexOf(":")>0)return url;if(null!=URL.customFormat&&(url=URL.customFormat(url)),url.indexOf(":")>0)return url;var char1=url.charAt(0);if("."===char1)return URL._formatRelativePath(URL._basePath+url);if("~"===char1)return URL.rootPath+url.substring(1);if("d"===char1){if(0===url.indexOf("data:image"))return url}else if("/"===char1)return url;return URL._basePath+url},URL._formatRelativePath=function(value){for(var parts=value.split("/"),i=0,len=parts.length;i<len;i++)".."==parts[i]&&(parts.splice(i-1,2),i-=2);return parts.join("/")},URL.getPath=function(url){var ofs=url.lastIndexOf("/");return ofs>0?url.substr(0,ofs+1):""},URL.getFileName=function(url){var ofs=url.lastIndexOf("/");return ofs>0?url.substr(ofs+1):url},URL.getAdptedFilePath=function(url){if(!URL.exportSceneToJson||!url)return url;var len,tArr,i=0;for(len=URL._adpteTypeList.length,i=0;i<len;i++)tArr=URL._adpteTypeList[i],url=url.replace(tArr[0],tArr[1]);return url},URL.version={},URL.exportSceneToJson=!1,URL._basePath="",URL.rootPath="",URL.customFormat=function(url){var newUrl=URL.version[url];return!Render.isConchApp&&newUrl&&(url+="?v="+newUrl),url},__static(URL,["_adpteTypeList",function(){return this._adpteTypeList=[[".scene3d",".json"],[".scene",".json"],[".taa",".json"],[".prefab",".json"]]}]),URL}(),CacheManger=function(){function CacheManger(){}return __class(CacheManger,"laya.utils.CacheManger"),CacheManger.regCacheByFunction=function(disposeFunction,getCacheListFunction){var cache;CacheManger.unRegCacheByFunction(disposeFunction,getCacheListFunction),cache={tryDispose:disposeFunction,getCacheList:getCacheListFunction},CacheManger._cacheList.push(cache)},CacheManger.unRegCacheByFunction=function(disposeFunction,getCacheListFunction){var len,i=0;for(len=CacheManger._cacheList.length,i=0;i<len;i++)if(CacheManger._cacheList[i].tryDispose==disposeFunction&&CacheManger._cacheList[i].getCacheList==getCacheListFunction)return void CacheManger._cacheList.splice(i,1)},CacheManger.forceDispose=function(){var i=0,len=CacheManger._cacheList.length;for(i=0;i<len;i++)CacheManger._cacheList[i].tryDispose(!0)},CacheManger.beginCheck=function(waitTime){void 0===waitTime&&(waitTime=15e3),Laya.systemTimer.loop(waitTime,null,CacheManger._checkLoop)},CacheManger.stopCheck=function(){Laya.systemTimer.clear(null,CacheManger._checkLoop)},CacheManger._checkLoop=function(){var cacheList=CacheManger._cacheList;if(!(cacheList.length<1)){var len,tTime=Browser.now(),count=0;for(len=count=cacheList.length;count>0&&(CacheManger._index++,CacheManger._index=CacheManger._index%len,cacheList[CacheManger._index].tryDispose(!1),!(Browser.now()-tTime>CacheManger.loopTimeLimit));)count--}},CacheManger.loopTimeLimit=2,CacheManger._cacheList=[],CacheManger._index=0,CacheManger}(),SpriteStyle=function(){function SpriteStyle(){this.reset()}__class(SpriteStyle,"laya.display.css.SpriteStyle");var __proto=SpriteStyle.prototype;return __proto.reset=function(){return this.scaleX=this.scaleY=1,this.skewX=this.skewY=0,this.pivotX=this.pivotY=this.rotation=0,this.alpha=1,this.scrollRect&&this.scrollRect.recover(),this.scrollRect=null,this.viewport&&this.viewport.recover(),this.viewport=null,this.hitArea=null,this.dragging=null,this.blendMode=null,this},__proto.recover=function(){this!==SpriteStyle.EMPTY&&Pool.recover("SpriteStyle",this.reset())},SpriteStyle.create=function(){return Pool.getItemByClass("SpriteStyle",SpriteStyle)},SpriteStyle.EMPTY=new SpriteStyle,SpriteStyle}(),Timer=(function(){function WebGLCacheAsNormalCanvas(ctx,sp){this.submitStartPos=0,this.submitEndPos=0,this.context=null,this.touches=[],this.submits=[],this.sprite=null,this._mesh=null,this._pathMesh=null,this._triangleMesh=null,this.meshlist=[],this._oldMesh=null,this._oldPathMesh=null,this._oldTriMesh=null,this._oldMeshList=null,this.oldTx=0,this.oldTy=0,this.cachedClipInfo=new Matrix,this.invMat=new Matrix,this.context=ctx,this.sprite=sp,ctx._globalClipMatrix.copyTo(this.cachedClipInfo)}__class(WebGLCacheAsNormalCanvas,"laya.webgl.canvas.WebGLCacheAsNormalCanvas");var __proto=WebGLCacheAsNormalCanvas.prototype;__proto.startRec=function(){this.context._charSubmitCache._enbale&&(this.context._charSubmitCache.enable(!1,this.context),this.context._charSubmitCache.enable(!0,this.context)),this.context._incache=!0,this.touches.length=0,this.context.touches=this.touches,this.context._globalClipMatrix.copyTo(this.cachedClipInfo),this.submits.length=0,this.submitStartPos=this.context._submits._length;for(var i=0,sz=this.meshlist.length;i<sz;i++){var curm=this.meshlist[i];curm.canReuse?curm.releaseMesh():curm.destroy()}this.meshlist.length=0,this._mesh=MeshQuadTexture.getAMesh(!1),this._pathMesh=MeshVG.getAMesh(!1),this._triangleMesh=MeshTexture.getAMesh(!1),this.meshlist.push(this._mesh),this.meshlist.push(this._pathMesh),this.meshlist.push(this._triangleMesh),this.context._curSubmit=Submit.RENDERBASE,this._oldMesh=this.context._mesh,this._oldPathMesh=this.context._pathMesh,this._oldTriMesh=this.context._triangleMesh,this._oldMeshList=this.context.meshlist,this.context._mesh=this._mesh,this.context._pathMesh=this._pathMesh,this.context._triangleMesh=this._triangleMesh,this.context.meshlist=this.meshlist,this.oldTx=this.context._curMat.tx,this.oldTy=this.context._curMat.ty,this.context._curMat.tx=0,this.context._curMat.ty=0,this.context._curMat.copyTo(this.invMat),this.invMat.invert()},__proto.endRec=function(){this.context._charSubmitCache._enbale&&(this.context._charSubmitCache.enable(!1,this.context),this.context._charSubmitCache.enable(!0,this.context));var parsubmits=this.context._submits;this.submitEndPos=parsubmits._length;for(var num=this.submitEndPos-this.submitStartPos,i=0;i<num;i++)this.submits.push(parsubmits[this.submitStartPos+i]);parsubmits._length-=num,this.context._mesh=this._oldMesh,this.context._pathMesh=this._oldPathMesh,this.context._triangleMesh=this._oldTriMesh,this.context.meshlist=this._oldMeshList,this.context._curSubmit=Submit.RENDERBASE,this.context._curMat.tx=this.oldTx,this.context._curMat.ty=this.oldTy,this.context.touches=null,this.context._incache=!1},__proto.isCacheValid=function(){var curclip=this.context._globalClipMatrix;return curclip.a==this.cachedClipInfo.a&&curclip.b==this.cachedClipInfo.b&&curclip.c==this.cachedClipInfo.c&&curclip.d==this.cachedClipInfo.d&&curclip.tx==this.cachedClipInfo.tx&&curclip.ty==this.cachedClipInfo.ty},__proto.flushsubmit=function(){var curSubmit=Submit.RENDERBASE;this.submits.forEach(function(subm){subm!=Submit.RENDERBASE&&(Submit.preRender=curSubmit,curSubmit=subm,subm.renderSubmit())})},__proto.releaseMem=function(){},__static(WebGLCacheAsNormalCanvas,["matI",function(){return this.matI=new Matrix}])}(),function(){var TimerHandler;function Timer(autoActive){this.scale=1,this.currFrame=0,this._delta=0,this._map=[],this._handlers=[],this._temp=[],this._count=0,this.currTimer=Browser.now(),this._lastTimer=Browser.now(),void 0===autoActive&&(autoActive=!0),autoActive&&Laya.systemTimer&&Laya.systemTimer.frameLoop(1,this,this._update)}__class(Timer,"laya.utils.Timer");var __proto=Timer.prototype;return __proto._update=function(){if(this.scale<=0)this._lastTimer=Browser.now();else{var frame=this.currFrame=this.currFrame+this.scale,now=Browser.now();this._delta=(now-this._lastTimer)*this.scale;var timer=this.currTimer=this.currTimer+this._delta;this._lastTimer=now;var handlers=this._handlers;this._count=0;for(var i=0,n=handlers.length;i<n;i++){var handler=handlers[i];if(null!==handler.method){var t=handler.userFrame?frame:timer;if(t>=handler.exeTime)if(handler.repeat)if(handler.jumpFrame)for(;t>=handler.exeTime;)handler.exeTime+=handler.delay,handler.run(!1);else handler.exeTime+=handler.delay,handler.run(!1),t>handler.exeTime&&(handler.exeTime+=Math.ceil((t-handler.exeTime)/handler.delay)*handler.delay);else handler.run(!0)}else this._count++}(this._count>30||frame%200==0)&&this._clearHandlers()}},__proto._clearHandlers=function(){for(var handlers=this._handlers,i=0,n=handlers.length;i<n;i++){var handler=handlers[i];null!==handler.method?this._temp.push(handler):this._recoverHandler(handler)}this._handlers=this._temp,handlers.length=0,this._temp=handlers},__proto._recoverHandler=function(handler){this._map[handler.key]==handler&&(this._map[handler.key]=null),handler.clear(),Timer._pool.push(handler)},__proto._create=function(useFrame,repeat,delay,caller,method,args,coverBefore){if(!delay)return method.apply(caller,args),null;if(coverBefore){var handler=this._getHandler(caller,method);if(handler)return handler.repeat=repeat,handler.userFrame=useFrame,handler.delay=delay,handler.caller=caller,handler.method=method,handler.args=args,handler.exeTime=delay+(useFrame?this.currFrame:this.currTimer+Browser.now()-this._lastTimer),handler}return(handler=Timer._pool.length>0?Timer._pool.pop():new TimerHandler).repeat=repeat,handler.userFrame=useFrame,handler.delay=delay,handler.caller=caller,handler.method=method,handler.args=args,handler.exeTime=delay+(useFrame?this.currFrame:this.currTimer+Browser.now()-this._lastTimer),this._indexHandler(handler),this._handlers.push(handler),handler},__proto._indexHandler=function(handler){var caller=handler.caller,method=handler.method,cid=caller?caller.$_GID||(caller.$_GID=Utils.getGID()):0,mid=method.$_TID||(method.$_TID=1e5*Timer._mid++);handler.key=cid+mid,this._map[handler.key]=handler},__proto.once=function(delay,caller,method,args,coverBefore){void 0===coverBefore&&(coverBefore=!0),this._create(!1,!1,delay,caller,method,args,coverBefore)},__proto.loop=function(delay,caller,method,args,coverBefore,jumpFrame){void 0===coverBefore&&(coverBefore=!0),void 0===jumpFrame&&(jumpFrame=!1);var handler=this._create(!1,!0,delay,caller,method,args,coverBefore);handler&&(handler.jumpFrame=jumpFrame)},__proto.frameOnce=function(delay,caller,method,args,coverBefore){void 0===coverBefore&&(coverBefore=!0),this._create(!0,!1,delay,caller,method,args,coverBefore)},__proto.frameLoop=function(delay,caller,method,args,coverBefore){void 0===coverBefore&&(coverBefore=!0),this._create(!0,!0,delay,caller,method,args,coverBefore)},__proto.toString=function(){return" handlers:"+this._handlers.length+" pool:"+Timer._pool.length},__proto.clear=function(caller,method){var handler=this._getHandler(caller,method);handler&&(this._map[handler.key]=null,handler.key=0,handler.clear())},__proto.clearAll=function(caller){if(caller)for(var i=0,n=this._handlers.length;i<n;i++){var handler=this._handlers[i];handler.caller===caller&&(this._map[handler.key]=null,handler.key=0,handler.clear())}},__proto._getHandler=function(caller,method){var cid=caller?caller.$_GID||(caller.$_GID=Utils.getGID()):0,mid=method.$_TID||(method.$_TID=1e5*Timer._mid++);return this._map[cid+mid]},__proto.callLater=function(caller,method,args){CallLater.I.callLater(caller,method,args)},__proto.runCallLater=function(caller,method){CallLater.I.runCallLater(caller,method)},__proto.runTimer=function(caller,method){var handler=this._getHandler(caller,method);handler&&null!=handler.method&&(this._map[handler.key]=null,handler.run(!0))},__proto.pause=function(){this.scale=0},__proto.resume=function(){this.scale=1},__getset(0,__proto,"delta",function(){return this._delta}),Timer._pool=[],Timer._mid=1,Timer.__init$=function(){TimerHandler=function(){function TimerHandler(){this.key=0,this.repeat=!1,this.delay=0,this.userFrame=!1,this.exeTime=0,this.caller=null,this.method=null,this.args=null,this.jumpFrame=!1}__class(TimerHandler,"");var __proto=TimerHandler.prototype;return __proto.clear=function(){this.caller=null,this.method=null,this.args=null},__proto.run=function(withClear){var caller=this.caller;if(caller&&caller.destroyed)return this.clear();var method=this.method,args=this.args;withClear&&this.clear(),null!=method&&(args?method.apply(caller,args):method.call(caller))},TimerHandler}()},Timer}()),CacheStyle=function(){function CacheStyle(){this.reset()}__class(CacheStyle,"laya.display.css.CacheStyle");var __proto=CacheStyle.prototype;return __proto.needBitmapCache=function(){return this.cacheForFilters||!!this.mask},__proto.needEnableCanvasRender=function(){return"none"!=this.userSetCache||this.cacheForFilters||!!this.mask},__proto.releaseContext=function(){this.canvas&&this.canvas.size&&(Pool.recover("CacheCanvas",this.canvas),this.canvas.size(0,0),this.canvas.width=0,this.canvas.height=0),this.canvas=null},__proto.createContext=function(){if(!this.canvas){this.canvas=Pool.getItem("CacheCanvas")||new HTMLCanvas(!1);var tx=this.canvas.context;tx||(tx=this.canvas.getContext("2d"))}},__proto.releaseFilterCache=function(){var fc=this.filterCache;fc&&(fc.destroy(),fc.recycle(),this.filterCache=null)},__proto.recover=function(){this!==CacheStyle.EMPTY&&Pool.recover("SpriteCache",this.reset())},__proto.reset=function(){return this.releaseContext(),this.releaseFilterCache(),this.cacheAs="none",this.enableCanvasRender=!1,this.userSetCache="none",this.cacheForFilters=!1,this.staticCache=!1,this.reCache=!0,this.mask=null,this.maskParent=null,this.filterCache=null,this.filters=null,this.hasGlowFilter=!1,this.cacheRect&&this.cacheRect.recover(),this.cacheRect=null,this},__proto._calculateCacheRect=function(sprite,tCacheType,x,y){var tRec,_cacheStyle=sprite._cacheStyle;if(_cacheStyle.cacheRect||(_cacheStyle.cacheRect=Rectangle.create()),"bitmap"===tCacheType?((tRec=sprite.getSelfBounds()).width=tRec.width+32,tRec.height=tRec.height+32,tRec.x=tRec.x-sprite.pivotX,tRec.y=tRec.y-sprite.pivotY,tRec.x=tRec.x-16,tRec.y=tRec.y-16,tRec.x=Math.floor(tRec.x+x)-x,tRec.y=Math.floor(tRec.y+y)-y,tRec.width=Math.floor(tRec.width),tRec.height=Math.floor(tRec.height),_cacheStyle.cacheRect.copyFrom(tRec)):_cacheStyle.cacheRect.setTo(-sprite._style.pivotX,-sprite._style.pivotY,1,1),tRec=_cacheStyle.cacheRect,sprite._style.scrollRect){var scrollRect=sprite._style.scrollRect;tRec.x-=scrollRect.x,tRec.y-=scrollRect.y}return CacheStyle._scaleInfo.setTo(1,1),CacheStyle._scaleInfo},CacheStyle.create=function(){return Pool.getItemByClass("SpriteCache",CacheStyle)},CacheStyle.EMPTY=new CacheStyle,CacheStyle.CANVAS_EXTEND_EDGE=16,__static(CacheStyle,["_scaleInfo",function(){return this._scaleInfo=new Point}]),CacheStyle}(),SaveTranslate=function(){function SaveTranslate(){this._mat=new Matrix}__class(SaveTranslate,"laya.webgl.canvas.save.SaveTranslate");var __proto=SaveTranslate.prototype;return Laya.imps(__proto,{"laya.webgl.canvas.save.ISaveData":!0}),__proto.isSaveMark=function(){return!1},__proto.restore=function(context){this._mat.copyTo(context._curMat),SaveTranslate.POOL[SaveTranslate.POOL._length++]=this},SaveTranslate.save=function(context){var no=SaveTranslate.POOL,o=no._length>0?no[--no._length]:new SaveTranslate;context._curMat.copyTo(o._mat);var _save=context._save;_save[_save._length++]=o},SaveTranslate.POOL=SaveBase._createArray(),SaveTranslate}(),DrawLineCmd=function(){function DrawLineCmd(){}__class(DrawLineCmd,"laya.display.cmd.DrawLineCmd");var __proto=DrawLineCmd.prototype;return __proto.recover=function(){Pool.recover("DrawLineCmd",this)},__proto.run=function(context,gx,gy){context._drawLine(gx,gy,this.fromX,this.fromY,this.toX,this.toY,this.lineColor,this.lineWidth,this.vid)},__getset(0,__proto,"cmdID",function(){return"DrawLine"}),DrawLineCmd.create=function(fromX,fromY,toX,toY,lineColor,lineWidth,vid){var cmd=Pool.getItemByClass("DrawLineCmd",DrawLineCmd);return cmd.fromX=fromX,cmd.fromY=fromY,cmd.toX=toX,cmd.toY=toY,cmd.lineColor=lineColor,cmd.lineWidth=lineWidth,cmd.vid=vid,cmd},DrawLineCmd.ID="DrawLine",DrawLineCmd}(),WebGLContext=function(){function WebGLContext(){}__class(WebGLContext,"laya.webgl.WebGLContext");var __proto=WebGLContext.prototype;return __proto.getContextAttributes=function(){return null},__proto.isContextLost=function(){},__proto.getSupportedExtensions=function(){return null},__proto.getExtension=function(name){return null},__proto.activeTexture=function(texture){},__proto.attachShader=function(program,shader){},__proto.bindAttribLocation=function(program,index,name){},__proto.bindBuffer=function(target,buffer){},__proto.bindFramebuffer=function(target,framebuffer){},__proto.bindRenderbuffer=function(target,renderbuffer){},__proto.bindTexture=function(target,texture){},__proto.useTexture=function(value){},__proto.blendColor=function(red,green,blue,alpha){},__proto.blendEquation=function(mode){},__proto.blendEquationSeparate=function(modeRGB,modeAlpha){},__proto.blendFunc=function(sfactor,dfactor){},__proto.blendFuncSeparate=function(srcRGB,dstRGB,srcAlpha,dstAlpha){},__proto.bufferData=function(target,size,usage){},__proto.bufferSubData=function(target,offset,data){},__proto.checkFramebufferStatus=function(target){return null},__proto.clear=function(mask){},__proto.clearColor=function(red,green,blue,alpha){},__proto.clearDepth=function(depth){},__proto.clearStencil=function(s){},__proto.colorMask=function(red,green,blue,alpha){},__proto.compileShader=function(shader){},__proto.copyTexImage2D=function(target,level,internalformat,x,y,width,height,border){},__proto.copyTexSubImage2D=function(target,level,xoffset,yoffset,x,y,width,height){},__proto.createBuffer=function(){},__proto.createFramebuffer=function(){},__proto.createProgram=function(){},__proto.createRenderbuffer=function(){},__proto.createShader=function(type){},__proto.createTexture=function(){return null},__proto.cullFace=function(mode){},__proto.deleteBuffer=function(buffer){},__proto.deleteFramebuffer=function(framebuffer){},__proto.deleteProgram=function(program){},__proto.deleteRenderbuffer=function(renderbuffer){},__proto.deleteShader=function(shader){},__proto.deleteTexture=function(texture){},__proto.depthFunc=function(func){},__proto.depthMask=function(flag){},__proto.depthRange=function(zNear,zFar){},__proto.detachShader=function(program,shader){},__proto.disable=function(cap){},__proto.disableVertexAttribArray=function(index){},__proto.drawArrays=function(mode,first,count){},__proto.drawElements=function(mode,count,type,offset){},__proto.enable=function(cap){},__proto.enableVertexAttribArray=function(index){},__proto.finish=function(){},__proto.flush=function(){},__proto.framebufferRenderbuffer=function(target,attachment,renderbuffertarget,renderbuffer){},__proto.framebufferTexture2D=function(target,attachment,textarget,texture,level){},__proto.frontFace=function(mode){return null},__proto.generateMipmap=function(target){return null},__proto.getActiveAttrib=function(program,index){return null},__proto.getActiveUniform=function(program,index){return null},__proto.getAttribLocation=function(program,name){return 0},__proto.getParameter=function(pname){return null},__proto.getBufferParameter=function(target,pname){return null},__proto.getError=function(){return null},__proto.getFramebufferAttachmentParameter=function(target,attachment,pname){},__proto.getProgramParameter=function(program,pname){return 0},__proto.getProgramInfoLog=function(program){return null},__proto.getRenderbufferParameter=function(target,pname){return null},__proto.getShaderPrecisionFormat=function(__arg){return null},__proto.getShaderParameter=function(shader,pname){},__proto.getShaderInfoLog=function(shader){return null},__proto.getShaderSource=function(shader){return null},__proto.getTexParameter=function(target,pname){},__proto.getUniform=function(program,location){},__proto.getUniformLocation=function(program,name){return null},__proto.getVertexAttrib=function(index,pname){return null},__proto.getVertexAttribOffset=function(index,pname){return null},__proto.hint=function(target,mode){},__proto.isBuffer=function(buffer){},__proto.isEnabled=function(cap){},__proto.isFramebuffer=function(framebuffer){},__proto.isProgram=function(program){},__proto.isRenderbuffer=function(renderbuffer){},__proto.isShader=function(shader){},__proto.isTexture=function(texture){},__proto.lineWidth=function(width){},__proto.linkProgram=function(program){},__proto.pixelStorei=function(pname,param){},__proto.polygonOffset=function(factor,units){},__proto.readPixels=function(x,y,width,height,format,type,pixels){},__proto.renderbufferStorage=function(target,internalformat,width,height){},__proto.sampleCoverage=function(value,invert){},__proto.scissor=function(x,y,width,height){},__proto.shaderSource=function(shader,source){},__proto.stencilFunc=function(func,ref,mask){},__proto.stencilFuncSeparate=function(face,func,ref,mask){},__proto.stencilMask=function(mask){},__proto.stencilMaskSeparate=function(face,mask){},__proto.stencilOp=function(fail,zfail,zpass){},__proto.stencilOpSeparate=function(face,fail,zfail,zpass){},__proto.texImage2D=function(__args){},__proto.texParameterf=function(target,pname,param){},__proto.texParameteri=function(target,pname,param){},__proto.texSubImage2D=function(__args){},__proto.uniform1f=function(location,x){},__proto.uniform1fv=function(location,v){},__proto.uniform1i=function(location,x){},__proto.uniform1iv=function(location,v){},__proto.uniform2f=function(location,x,y){},__proto.uniform2fv=function(location,v){},__proto.uniform2i=function(location,x,y){},__proto.uniform2iv=function(location,v){},__proto.uniform3f=function(location,x,y,z){},__proto.uniform3fv=function(location,v){},__proto.uniform3i=function(location,x,y,z){},__proto.uniform3iv=function(location,v){},__proto.uniform4f=function(location,x,y,z,w){},__proto.uniform4fv=function(location,v){},__proto.uniform4i=function(location,x,y,z,w){},__proto.uniform4iv=function(location,v){},__proto.uniformMatrix2fv=function(location,transpose,value){},__proto.uniformMatrix3fv=function(location,transpose,value){},__proto.uniformMatrix4fv=function(location,transpose,value){},__proto.useProgram=function(program){},__proto.validateProgram=function(program){},__proto.vertexAttrib1f=function(indx,x){},__proto.vertexAttrib1fv=function(indx,values){},__proto.vertexAttrib2f=function(indx,x,y){},__proto.vertexAttrib2fv=function(indx,values){},__proto.vertexAttrib3f=function(indx,x,y,z){},__proto.vertexAttrib3fv=function(indx,values){},__proto.vertexAttrib4f=function(indx,x,y,z,w){},__proto.vertexAttrib4fv=function(indx,values){},__proto.vertexAttribPointer=function(indx,size,type,normalized,stride,offset){},__proto.viewport=function(x,y,width,height){},__proto.configureBackBuffer=function(width,height,antiAlias,enableDepthAndStencil,wantsBestResolution){void 0===enableDepthAndStencil&&(enableDepthAndStencil=!0),void 0===wantsBestResolution&&(wantsBestResolution=!1)},__proto.compressedTexImage2D=function(__args){},__proto.createVertexArray=function(){throw"not implemented"},__proto.bindVertexArray=function(vao){throw"not implemented"},__proto.deleteVertexArray=function(vao){throw"not implemented"},__proto.isVertexArray=function(vao){throw"not implemented"},WebGLContext._forceSupportVAOPlatform=function(){return Browser.onMiniGame&&Browser.onIOS||Browser.onBDMiniGame||Browser.onQGMiniGame},WebGLContext.__init__=function(gl){if(laya.webgl.WebGLContext._checkExtensions(gl),!WebGL._isWebGL2&&!Render.isConchApp){window._setupVertexArrayObject&&(WebGLContext._forceSupportVAOPlatform()?window._forceSetupVertexArrayObject(gl):window._setupVertexArrayObject(gl));var ext=(gl.rawgl||gl).getExtension("OES_vertex_array_object");if(ext){var glContext=gl;glContext.createVertexArray=function(){return ext.createVertexArrayOES()},glContext.bindVertexArray=function(vao){ext.bindVertexArrayOES(vao)},glContext.deleteVertexArray=function(vao){ext.deleteVertexArrayOES(vao)},glContext.isVertexArray=function(vao){ext.isVertexArrayOES(vao)}}}},WebGLContext._getExtension=function(gl,name){var prefixes=WebGLContext._extentionVendorPrefixes;for(var k in prefixes){var ext=gl.getExtension(prefixes[k]+name);if(ext)return ext}return null},WebGLContext._checkExtensions=function(gl){WebGLContext._extTextureFilterAnisotropic=WebGLContext._getExtension(gl,"EXT_texture_filter_anisotropic"),WebGLContext._compressedTextureS3tc=WebGLContext._getExtension(gl,"WEBGL_compressed_texture_s3tc"),WebGLContext._compressedTexturePvrtc=WebGLContext._getExtension(gl,"WEBGL_compressed_texture_pvrtc"),WebGLContext._compressedTextureEtc1=WebGLContext._getExtension(gl,"WEBGL_compressed_texture_etc1"),WebGLContext._forceSupportVAOPlatform()||(WebGLContext._angleInstancedArrays=WebGLContext._getExtension(gl,"ANGLE_instanced_arrays"))},WebGLContext.__init_native=function(){if(Render.supportWebGLPlusRendering){var webGLContext=WebGLContext;webGLContext.activeTexture=webGLContext.activeTextureForNative,webGLContext.bindTexture=webGLContext.bindTextureForNative}},WebGLContext.useProgram=function(gl,program){return WebGLContext._useProgram!==program&&(gl.useProgram(program),WebGLContext._useProgram=program,!0)},WebGLContext.setDepthTest=function(gl,value){value!==WebGLContext._depthTest&&(WebGLContext._depthTest=value,value?gl.enable(2929):gl.disable(2929))},WebGLContext.setDepthMask=function(gl,value){value!==WebGLContext._depthMask&&(WebGLContext._depthMask=value,gl.depthMask(value))},WebGLContext.setDepthFunc=function(gl,value){value!==WebGLContext._depthFunc&&(WebGLContext._depthFunc=value,gl.depthFunc(value))},WebGLContext.setBlend=function(gl,value){value!==WebGLContext._blend&&(WebGLContext._blend=value,value?gl.enable(3042):gl.disable(3042))},WebGLContext.setBlendFunc=function(gl,sFactor,dFactor){(sFactor!==WebGLContext._sFactor||dFactor!==WebGLContext._dFactor)&&(WebGLContext._sFactor=WebGLContext._srcAlpha=sFactor,WebGLContext._dFactor=WebGLContext._dstAlpha=dFactor,gl.blendFunc(sFactor,dFactor))},WebGLContext.setBlendFuncSeperate=function(gl,srcRGB,dstRGB,srcAlpha,dstAlpha){srcRGB===WebGLContext._sFactor&&dstRGB===WebGLContext._dFactor&&srcAlpha===WebGLContext._srcAlpha&&dstAlpha===WebGLContext._dstAlpha||(WebGLContext._sFactor=srcRGB,WebGLContext._dFactor=dstRGB,WebGLContext._srcAlpha=srcAlpha,WebGLContext._dstAlpha=dstAlpha,gl.blendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha))},WebGLContext.setCullFace=function(gl,value){value!==WebGLContext._cullFace&&(WebGLContext._cullFace=value,value?gl.enable(2884):gl.disable(2884))},WebGLContext.setFrontFace=function(gl,value){value!==WebGLContext._frontFace&&(WebGLContext._frontFace=value,gl.frontFace(value))},WebGLContext.activeTexture=function(gl,textureID){WebGLContext._activedTextureID!==textureID&&(gl.activeTexture(textureID),WebGLContext._activedTextureID=textureID)},WebGLContext.bindTexture=function(gl,target,texture){WebGLContext._activeTextures[WebGLContext._activedTextureID-33984]!==texture&&(gl.bindTexture(target,texture),WebGLContext._activeTextures[WebGLContext._activedTextureID-33984]=texture)},WebGLContext.useProgramForNative=function(gl,program){return gl.useProgram(program),!0},WebGLContext.setDepthTestForNative=function(gl,value){value?gl.enable(2929):gl.disable(2929)},WebGLContext.setDepthMaskForNative=function(gl,value){gl.depthMask(value)},WebGLContext.setDepthFuncForNative=function(gl,value){gl.depthFunc(value)},WebGLContext.setBlendForNative=function(gl,value){value?gl.enable(3042):gl.disable(3042)},WebGLContext.setBlendFuncForNative=function(gl,sFactor,dFactor){gl.blendFunc(sFactor,dFactor)},WebGLContext.setCullFaceForNative=function(gl,value){value?gl.enable(2884):gl.disable(2884)},WebGLContext.setFrontFaceForNative=function(gl,value){gl.frontFace(value)},WebGLContext.activeTextureForNative=function(gl,textureID){gl.activeTexture(textureID)},WebGLContext.bindTextureForNative=function(gl,target,texture){gl.bindTexture(target,texture)},WebGLContext.bindVertexArrayForNative=function(gl,vertexArray){gl.bindVertexArray(vertexArray)},WebGLContext.DEPTH_BUFFER_BIT=256,WebGLContext.STENCIL_BUFFER_BIT=1024,WebGLContext.COLOR_BUFFER_BIT=16384,WebGLContext.POINTS=0,WebGLContext.LINES=1,WebGLContext.LINE_LOOP=2,WebGLContext.LINE_STRIP=3,WebGLContext.TRIANGLES=4,WebGLContext.TRIANGLE_STRIP=5,WebGLContext.TRIANGLE_FAN=6,WebGLContext.ZERO=0,WebGLContext.ONE=1,WebGLContext.SRC_COLOR=768,WebGLContext.ONE_MINUS_SRC_COLOR=769,WebGLContext.SRC_ALPHA=770,WebGLContext.ONE_MINUS_SRC_ALPHA=771,WebGLContext.DST_ALPHA=772,WebGLContext.ONE_MINUS_DST_ALPHA=773,WebGLContext.DST_COLOR=774,WebGLContext.ONE_MINUS_DST_COLOR=775,WebGLContext.SRC_ALPHA_SATURATE=776,WebGLContext.FUNC_ADD=32774,WebGLContext.BLEND_EQUATION=32777,WebGLContext.BLEND_EQUATION_RGB=32777,WebGLContext.BLEND_EQUATION_ALPHA=34877,WebGLContext.FUNC_SUBTRACT=32778,WebGLContext.FUNC_REVERSE_SUBTRACT=32779,WebGLContext.BLEND_DST_RGB=32968,WebGLContext.BLEND_SRC_RGB=32969,WebGLContext.BLEND_DST_ALPHA=32970,WebGLContext.BLEND_SRC_ALPHA=32971,WebGLContext.CONSTANT_COLOR=32769,WebGLContext.ONE_MINUS_CONSTANT_COLOR=32770,WebGLContext.CONSTANT_ALPHA=32771,WebGLContext.ONE_MINUS_CONSTANT_ALPHA=32772,WebGLContext.BLEND_COLOR=32773,WebGLContext.ARRAY_BUFFER=34962,WebGLContext.ELEMENT_ARRAY_BUFFER=34963,WebGLContext.ARRAY_BUFFER_BINDING=34964,WebGLContext.ELEMENT_ARRAY_BUFFER_BINDING=34965,WebGLContext.STREAM_DRAW=35040,WebGLContext.STATIC_DRAW=35044,WebGLContext.DYNAMIC_DRAW=35048,WebGLContext.BUFFER_SIZE=34660,WebGLContext.BUFFER_USAGE=34661,WebGLContext.CURRENT_VERTEX_ATTRIB=34342,WebGLContext.FRONT=1028,WebGLContext.BACK=1029,WebGLContext.CULL_FACE=2884,WebGLContext.FRONT_AND_BACK=1032,WebGLContext.BLEND=3042,WebGLContext.DITHER=3024,WebGLContext.STENCIL_TEST=2960,WebGLContext.DEPTH_TEST=2929,WebGLContext.SCISSOR_TEST=3089,WebGLContext.POLYGON_OFFSET_FILL=32823,WebGLContext.SAMPLE_ALPHA_TO_COVERAGE=32926,WebGLContext.SAMPLE_COVERAGE=32928,WebGLContext.NO_ERROR=0,WebGLContext.INVALID_ENUM=1280,WebGLContext.INVALID_VALUE=1281,WebGLContext.INVALID_OPERATION=1282,WebGLContext.OUT_OF_MEMORY=1285,WebGLContext.CW=2304,WebGLContext.CCW=2305,WebGLContext.LINE_WIDTH=2849,WebGLContext.ALIASED_POINT_SIZE_RANGE=33901,WebGLContext.ALIASED_LINE_WIDTH_RANGE=33902,WebGLContext.CULL_FACE_MODE=2885,WebGLContext.FRONT_FACE=2886,WebGLContext.DEPTH_RANGE=2928,WebGLContext.DEPTH_WRITEMASK=2930,WebGLContext.DEPTH_CLEAR_VALUE=2931,WebGLContext.DEPTH_FUNC=2932,WebGLContext.STENCIL_CLEAR_VALUE=2961,WebGLContext.STENCIL_FUNC=2962,WebGLContext.STENCIL_FAIL=2964,WebGLContext.STENCIL_PASS_DEPTH_FAIL=2965,WebGLContext.STENCIL_PASS_DEPTH_PASS=2966,WebGLContext.STENCIL_REF=2967,WebGLContext.STENCIL_VALUE_MASK=2963,WebGLContext.STENCIL_WRITEMASK=2968,WebGLContext.STENCIL_BACK_FUNC=34816,WebGLContext.STENCIL_BACK_FAIL=34817,WebGLContext.STENCIL_BACK_PASS_DEPTH_FAIL=34818,WebGLContext.STENCIL_BACK_PASS_DEPTH_PASS=34819,WebGLContext.STENCIL_BACK_REF=36003,WebGLContext.STENCIL_BACK_VALUE_MASK=36004,WebGLContext.STENCIL_BACK_WRITEMASK=36005,WebGLContext.VIEWPORT=2978,WebGLContext.SCISSOR_BOX=3088,WebGLContext.COLOR_CLEAR_VALUE=3106,WebGLContext.COLOR_WRITEMASK=3107,WebGLContext.UNPACK_ALIGNMENT=3317,WebGLContext.PACK_ALIGNMENT=3333,WebGLContext.MAX_TEXTURE_SIZE=3379,WebGLContext.MAX_VIEWPORT_DIMS=3386,WebGLContext.SUBPIXEL_BITS=3408,WebGLContext.RED_BITS=3410,WebGLContext.GREEN_BITS=3411,WebGLContext.BLUE_BITS=3412,WebGLContext.ALPHA_BITS=3413,WebGLContext.DEPTH_BITS=3414,WebGLContext.STENCIL_BITS=3415,WebGLContext.POLYGON_OFFSET_UNITS=10752,WebGLContext.POLYGON_OFFSET_FACTOR=32824,WebGLContext.TEXTURE_BINDING_2D=32873,WebGLContext.SAMPLE_BUFFERS=32936,WebGLContext.SAMPLES=32937,WebGLContext.SAMPLE_COVERAGE_VALUE=32938,WebGLContext.SAMPLE_COVERAGE_INVERT=32939,WebGLContext.NUM_COMPRESSED_TEXTURE_FORMATS=34466,WebGLContext.COMPRESSED_TEXTURE_FORMATS=34467,WebGLContext.DONT_CARE=4352,WebGLContext.FASTEST=4353,WebGLContext.NICEST=4354,WebGLContext.GENERATE_MIPMAP_HINT=33170,WebGLContext.BYTE=5120,WebGLContext.UNSIGNED_BYTE=5121,WebGLContext.SHORT=5122,WebGLContext.UNSIGNED_SHORT=5123,WebGLContext.INT=5124,WebGLContext.UNSIGNED_INT=5125,WebGLContext.FLOAT=5126,WebGLContext.DEPTH_COMPONENT=6402,WebGLContext.ALPHA=6406,WebGLContext.RGB=6407,WebGLContext.RGBA=6408,WebGLContext.LUMINANCE=6409,WebGLContext.LUMINANCE_ALPHA=6410,WebGLContext.UNSIGNED_SHORT_4_4_4_4=32819,WebGLContext.UNSIGNED_SHORT_5_5_5_1=32820,WebGLContext.UNSIGNED_SHORT_5_6_5=33635,WebGLContext.FRAGMENT_SHADER=35632,WebGLContext.VERTEX_SHADER=35633,WebGLContext.MAX_VERTEX_ATTRIBS=34921,WebGLContext.MAX_VERTEX_UNIFORM_VECTORS=36347,WebGLContext.MAX_VARYING_VECTORS=36348,WebGLContext.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661,WebGLContext.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660,WebGLContext.MAX_TEXTURE_IMAGE_UNITS=34930,WebGLContext.MAX_FRAGMENT_UNIFORM_VECTORS=36349,WebGLContext.SHADER_TYPE=35663,WebGLContext.DELETE_STATUS=35712,WebGLContext.LINK_STATUS=35714,WebGLContext.VALIDATE_STATUS=35715,WebGLContext.ATTACHED_SHADERS=35717,WebGLContext.ACTIVE_UNIFORMS=35718,WebGLContext.ACTIVE_ATTRIBUTES=35721,WebGLContext.SHADING_LANGUAGE_VERSION=35724,WebGLContext.CURRENT_PROGRAM=35725,WebGLContext.NEVER=512,WebGLContext.LESS=513,WebGLContext.EQUAL=514,WebGLContext.LEQUAL=515,WebGLContext.GREATER=516,WebGLContext.NOTEQUAL=517,WebGLContext.GEQUAL=518,WebGLContext.ALWAYS=519,WebGLContext.KEEP=7680,WebGLContext.REPLACE=7681,WebGLContext.INCR=7682,WebGLContext.DECR=7683,WebGLContext.INVERT=5386,WebGLContext.INCR_WRAP=34055,WebGLContext.DECR_WRAP=34056,WebGLContext.VENDOR=7936,WebGLContext.RENDERER=7937,WebGLContext.VERSION=7938,WebGLContext.NEAREST=9728,WebGLContext.LINEAR=9729,WebGLContext.NEAREST_MIPMAP_NEAREST=9984,WebGLContext.LINEAR_MIPMAP_NEAREST=9985,WebGLContext.NEAREST_MIPMAP_LINEAR=9986,WebGLContext.LINEAR_MIPMAP_LINEAR=9987,WebGLContext.TEXTURE_MAG_FILTER=10240,WebGLContext.TEXTURE_MIN_FILTER=10241,WebGLContext.TEXTURE_WRAP_S=10242,WebGLContext.TEXTURE_WRAP_T=10243,WebGLContext.TEXTURE_2D=3553,WebGLContext.TEXTURE_3D=32879,WebGLContext.TEXTURE=5890,WebGLContext.TEXTURE_CUBE_MAP=34067,WebGLContext.TEXTURE_BINDING_CUBE_MAP=34068,WebGLContext.TEXTURE_CUBE_MAP_POSITIVE_X=34069,WebGLContext.TEXTURE_CUBE_MAP_NEGATIVE_X=34070,WebGLContext.TEXTURE_CUBE_MAP_POSITIVE_Y=34071,WebGLContext.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072,WebGLContext.TEXTURE_CUBE_MAP_POSITIVE_Z=34073,WebGLContext.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074,WebGLContext.MAX_CUBE_MAP_TEXTURE_SIZE=34076,WebGLContext.TEXTURE0=33984,WebGLContext.TEXTURE1=33985,WebGLContext.TEXTURE2=33986,WebGLContext.TEXTURE3=33987,WebGLContext.TEXTURE4=33988,WebGLContext.TEXTURE5=33989,WebGLContext.TEXTURE6=33990,WebGLContext.TEXTURE7=33991,WebGLContext.TEXTURE8=33992,WebGLContext.TEXTURE9=33993,WebGLContext.TEXTURE10=33994,WebGLContext.TEXTURE11=33995,WebGLContext.TEXTURE12=33996,WebGLContext.TEXTURE13=33997,WebGLContext.TEXTURE14=33998,WebGLContext.TEXTURE15=33999,WebGLContext.TEXTURE16=34e3,WebGLContext.TEXTURE17=34001,WebGLContext.TEXTURE18=34002,WebGLContext.TEXTURE19=34003,WebGLContext.TEXTURE20=34004,WebGLContext.TEXTURE21=34005,WebGLContext.TEXTURE22=34006,WebGLContext.TEXTURE23=34007,WebGLContext.TEXTURE24=34008,WebGLContext.TEXTURE25=34009,WebGLContext.TEXTURE26=34010,WebGLContext.TEXTURE27=34011,WebGLContext.TEXTURE28=34012,WebGLContext.TEXTURE29=34013,WebGLContext.TEXTURE30=34014,WebGLContext.TEXTURE31=34015,WebGLContext.ACTIVE_TEXTURE=34016,WebGLContext.REPEAT=10497,WebGLContext.CLAMP_TO_EDGE=33071,WebGLContext.MIRRORED_REPEAT=33648,WebGLContext.FLOAT_VEC2=35664,WebGLContext.FLOAT_VEC3=35665,WebGLContext.FLOAT_VEC4=35666,WebGLContext.INT_VEC2=35667,WebGLContext.INT_VEC3=35668,WebGLContext.INT_VEC4=35669,WebGLContext.BOOL=35670,WebGLContext.BOOL_VEC2=35671,WebGLContext.BOOL_VEC3=35672,WebGLContext.BOOL_VEC4=35673,WebGLContext.FLOAT_MAT2=35674,WebGLContext.FLOAT_MAT3=35675,WebGLContext.FLOAT_MAT4=35676,WebGLContext.SAMPLER_2D=35678,WebGLContext.SAMPLER_CUBE=35680,WebGLContext.VERTEX_ATTRIB_ARRAY_ENABLED=34338,WebGLContext.VERTEX_ATTRIB_ARRAY_SIZE=34339,WebGLContext.VERTEX_ATTRIB_ARRAY_STRIDE=34340,WebGLContext.VERTEX_ATTRIB_ARRAY_TYPE=34341,WebGLContext.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922,WebGLContext.VERTEX_ATTRIB_ARRAY_POINTER=34373,WebGLContext.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975,WebGLContext.COMPILE_STATUS=35713,WebGLContext.LOW_FLOAT=36336,WebGLContext.MEDIUM_FLOAT=36337,WebGLContext.HIGH_FLOAT=36338,WebGLContext.LOW_INT=36339,WebGLContext.MEDIUM_INT=36340,WebGLContext.HIGH_INT=36341,WebGLContext.FRAMEBUFFER=36160,WebGLContext.RENDERBUFFER=36161,WebGLContext.RGBA4=32854,WebGLContext.RGB5_A1=32855,WebGLContext.RGB565=36194,WebGLContext.DEPTH_COMPONENT16=33189,WebGLContext.STENCIL_INDEX=6401,WebGLContext.STENCIL_INDEX8=36168,WebGLContext.DEPTH_STENCIL=34041,WebGLContext.RENDERBUFFER_WIDTH=36162,WebGLContext.RENDERBUFFER_HEIGHT=36163,WebGLContext.RENDERBUFFER_INTERNAL_FORMAT=36164,WebGLContext.RENDERBUFFER_RED_SIZE=36176,WebGLContext.RENDERBUFFER_GREEN_SIZE=36177,WebGLContext.RENDERBUFFER_BLUE_SIZE=36178,WebGLContext.RENDERBUFFER_ALPHA_SIZE=36179,WebGLContext.RENDERBUFFER_DEPTH_SIZE=36180,WebGLContext.RENDERBUFFER_STENCIL_SIZE=36181,WebGLContext.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048,WebGLContext.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049,WebGLContext.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050,WebGLContext.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051,WebGLContext.COLOR_ATTACHMENT0=36064,WebGLContext.DEPTH_ATTACHMENT=36096,WebGLContext.STENCIL_ATTACHMENT=36128,WebGLContext.DEPTH_STENCIL_ATTACHMENT=33306,WebGLContext.NONE=0,WebGLContext.FRAMEBUFFER_COMPLETE=36053,WebGLContext.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054,WebGLContext.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055,WebGLContext.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057,WebGLContext.FRAMEBUFFER_UNSUPPORTED=36061,WebGLContext.FRAMEBUFFER_BINDING=36006,WebGLContext.RENDERBUFFER_BINDING=36007,WebGLContext.MAX_RENDERBUFFER_SIZE=34024,WebGLContext.INVALID_FRAMEBUFFER_OPERATION=1286,WebGLContext.UNPACK_FLIP_Y_WEBGL=37440,WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441,WebGLContext.CONTEXT_LOST_WEBGL=37442,WebGLContext.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443,WebGLContext.BROWSER_DEFAULT_WEBGL=37444,WebGLContext._extTextureFilterAnisotropic=null,WebGLContext._compressedTextureS3tc=null,WebGLContext._compressedTexturePvrtc=null,WebGLContext._compressedTextureEtc1=null,WebGLContext._angleInstancedArrays=null,WebGLContext._glTextureIDs=[33984,33985,33986,33987,33988,33989,33990,33991],WebGLContext._useProgram=null,WebGLContext._depthTest=!0,WebGLContext._depthMask=!0,WebGLContext._blend=!1,WebGLContext._cullFace=!1,WebGLContext._activedTextureID=33984,__static(WebGLContext,["_extentionVendorPrefixes",function(){return this._extentionVendorPrefixes=["","WEBKIT_","MOZ_"]},"_activeTextures",function(){return this._activeTextures=new Array(8)},"_depthFunc",function(){return this._depthFunc=513},"_sFactor",function(){return this._sFactor=1},"_dFactor",function(){return this._dFactor=0},"_srcAlpha",function(){return this._srcAlpha=1},"_dstAlpha",function(){return this._dstAlpha=0},"_frontFace",function(){return this._frontFace=2305}]),WebGLContext}(),FillWordsCmd=(function(){function ResourceVersion(){}__class(ResourceVersion,"laya.net.ResourceVersion"),ResourceVersion.enable=function(manifestFile,callback,type){void 0===type&&(type=2),laya.net.ResourceVersion.type=type,Laya.loader.load(manifestFile,Handler.create(null,ResourceVersion.onManifestLoaded,[callback]),null,"json"),URL.customFormat=ResourceVersion.addVersionPrefix},ResourceVersion.onManifestLoaded=function(callback,data){ResourceVersion.manifest=data,callback.run(),data||console.warn("资源版本清单文件不存在,不使用资源版本管理。忽略ERR_FILE_NOT_FOUND错误。")},ResourceVersion.addVersionPrefix=function(originURL){return originURL=URL.getAdptedFilePath(originURL),ResourceVersion.manifest&&ResourceVersion.manifest[originURL]?2==ResourceVersion.type?ResourceVersion.manifest[originURL]:ResourceVersion.manifest[originURL]+"/"+originURL:originURL},ResourceVersion.FOLDER_VERSION=1,ResourceVersion.FILENAME_VERSION=2,ResourceVersion.manifest=null,ResourceVersion.type=1}(),function(){function FillWordsCmd(){}__class(FillWordsCmd,"laya.display.cmd.FillWordsCmd");var __proto=FillWordsCmd.prototype;return __proto.recover=function(){this.words=null,Pool.recover("FillWordsCmd",this)},__proto.run=function(context,gx,gy){context.fillWords(this.words,this.x+gx,this.y+gy,this.font,this.color)},__getset(0,__proto,"cmdID",function(){return"FillWords"}),FillWordsCmd.create=function(words,x,y,font,color){var cmd=Pool.getItemByClass("FillWordsCmd",FillWordsCmd);return cmd.words=words,cmd.x=x,cmd.y=y,cmd.font=font,cmd.color=color,cmd},FillWordsCmd.ID="FillWords",FillWordsCmd}()),Matrix=function(){function Matrix(a,b,c,d,tx,ty,nums){if(this._bTransform=!1,void 0===a&&(a=1),void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=1),void 0===tx&&(tx=0),void 0===ty&&(ty=0),void 0===nums&&(nums=0),null!=Matrix._createFun)return Matrix._createFun(a,b,c,d,tx,ty,nums);this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty,this._checkTransform()}__class(Matrix,"laya.maths.Matrix");var __proto=Matrix.prototype;return __proto.identity=function(){return this.a=this.d=1,this.b=this.tx=this.ty=this.c=0,this._bTransform=!1,this},__proto._checkTransform=function(){return this._bTransform=1!==this.a||0!==this.b||0!==this.c||1!==this.d},__proto.setTranslate=function(x,y){return this.tx=x,this.ty=y,this},__proto.translate=function(x,y){return this.tx+=x,this.ty+=y,this},__proto.scale=function(x,y){return this.a*=x,this.d*=y,this.c*=x,this.b*=y,this.tx*=x,this.ty*=y,this._bTransform=!0,this},__proto.rotate=function(angle){var cos=Math.cos(angle),sin=Math.sin(angle),a1=this.a,c1=this.c,tx1=this.tx;return this.a=a1*cos-this.b*sin,this.b=a1*sin+this.b*cos,this.c=c1*cos-this.d*sin,this.d=c1*sin+this.d*cos,this.tx=tx1*cos-this.ty*sin,this.ty=tx1*sin+this.ty*cos,this._bTransform=!0,this},__proto.skew=function(x,y){var tanX=Math.tan(x),tanY=Math.tan(y),a1=this.a,b1=this.b;return this.a+=tanY*this.c,this.b+=tanY*this.d,this.c+=tanX*a1,this.d+=tanX*b1,this},__proto.invertTransformPoint=function(out){var a1=this.a,b1=this.b,c1=this.c,d1=this.d,tx1=this.tx,n=a1*d1-b1*c1,a2=d1/n,b2=-b1/n,c2=-c1/n,d2=a1/n,tx2=(c1*this.ty-d1*tx1)/n,ty2=-(a1*this.ty-b1*tx1)/n;return out.setTo(a2*out.x+c2*out.y+tx2,b2*out.x+d2*out.y+ty2)},__proto.transformPoint=function(out){return out.setTo(this.a*out.x+this.c*out.y+this.tx,this.b*out.x+this.d*out.y+this.ty)},__proto.transformPointN=function(out){return out.setTo(this.a*out.x+this.c*out.y,this.b*out.x+this.d*out.y)},__proto.getScaleX=function(){return 0===this.b?this.a:Math.sqrt(this.a*this.a+this.b*this.b)},__proto.getScaleY=function(){return 0===this.c?this.d:Math.sqrt(this.c*this.c+this.d*this.d)},__proto.invert=function(){var a1=this.a,b1=this.b,c1=this.c,d1=this.d,tx1=this.tx,n=a1*d1-b1*c1;return this.a=d1/n,this.b=-b1/n,this.c=-c1/n,this.d=a1/n,this.tx=(c1*this.ty-d1*tx1)/n,this.ty=-(a1*this.ty-b1*tx1)/n,this},__proto.setTo=function(a,b,c,d,tx,ty){return this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty,this},__proto.concat=function(matrix){var a=this.a,c=this.c,tx=this.tx;return this.a=a*matrix.a+this.b*matrix.c,this.b=a*matrix.b+this.b*matrix.d,this.c=c*matrix.a+this.d*matrix.c,this.d=c*matrix.b+this.d*matrix.d,this.tx=tx*matrix.a+this.ty*matrix.c+matrix.tx,this.ty=tx*matrix.b+this.ty*matrix.d+matrix.ty,this},__proto.scaleEx=function(x,y){var ba=this.a,bb=this.b,bc=this.c,bd=this.d;0!==bb||0!==bc?(this.a=x*ba,this.b=x*bb,this.c=y*bc,this.d=y*bd):(this.a=x*ba,this.b=0*bd,this.c=0*ba,this.d=y*bd),this._bTransform=!0},__proto.rotateEx=function(angle){var cos=Math.cos(angle),sin=Math.sin(angle),ba=this.a,bb=this.b,bc=this.c,bd=this.d;0!==bb||0!==bc?(this.a=cos*ba+sin*bc,this.b=cos*bb+sin*bd,this.c=-sin*ba+cos*bc,this.d=-sin*bb+cos*bd):(this.a=cos*ba,this.b=sin*bd,this.c=-sin*ba,this.d=cos*bd),this._bTransform=!0},__proto.clone=function(){var dec=Matrix.create();return dec.a=this.a,dec.b=this.b,dec.c=this.c,dec.d=this.d,dec.tx=this.tx,dec.ty=this.ty,dec._bTransform=this._bTransform,dec},__proto.copyTo=function(dec){return dec.a=this.a,dec.b=this.b,dec.c=this.c,dec.d=this.d,dec.tx=this.tx,dec.ty=this.ty,dec._bTransform=this._bTransform,dec},__proto.toString=function(){return this.a+","+this.b+","+this.c+","+this.d+","+this.tx+","+this.ty},__proto.destroy=function(){this.recover()},__proto.recover=function(){Pool.recover("Matrix",this.identity())},Matrix.mul=function(m1,m2,out){var aa=m1.a,ab=m1.b,ac=m1.c,ad=m1.d,atx=m1.tx,aty=m1.ty,ba=m2.a,bb=m2.b,bc=m2.c,bd=m2.d,btx=m2.tx,bty=m2.ty;return 0!==bb||0!==bc?(out.a=aa*ba+ab*bc,out.b=aa*bb+ab*bd,out.c=ac*ba+ad*bc,out.d=ac*bb+ad*bd,out.tx=ba*atx+bc*aty+btx,out.ty=bb*atx+bd*aty+bty):(out.a=aa*ba,out.b=ab*bd,out.c=ac*ba,out.d=ad*bd,out.tx=ba*atx+btx,out.ty=bd*aty+bty),out},Matrix.mul16=function(m1,m2,out){var aa=m1.a,ab=m1.b,ac=m1.c,ad=m1.d,atx=m1.tx,aty=m1.ty,ba=m2.a,bb=m2.b,bc=m2.c,bd=m2.d,btx=m2.tx,bty=m2.ty;return 0!==bb||0!==bc?(out[0]=aa*ba+ab*bc,out[1]=aa*bb+ab*bd,out[4]=ac*ba+ad*bc,out[5]=ac*bb+ad*bd,out[12]=ba*atx+bc*aty+btx,out[13]=bb*atx+bd*aty+bty):(out[0]=aa*ba,out[1]=ab*bd,out[4]=ac*ba,out[5]=ad*bd,out[12]=ba*atx+btx,out[13]=bd*aty+bty),out},Matrix.create=function(){return Pool.getItemByClass("Matrix",Matrix)},Matrix.EMPTY=new Matrix,Matrix.TEMP=new Matrix,Matrix._createFun=null,Matrix}(),PerfData=function(){function PerfData(id,color,name,scale){this.id=0,this.name=null,this.color=0,this.scale=1,this.datapos=0,this.datas=new Array(PerfHUD.DATANUM),this.id=id,this.color=color,this.name=name,this.scale=scale}return __class(PerfData,"laya.utils.PerfData"),PerfData.prototype.addData=function(v){this.datas[this.datapos]=v,this.datapos++,this.datapos%=PerfHUD.DATANUM},PerfData}(),TransformCmd=function(){function TransformCmd(){}__class(TransformCmd,"laya.display.cmd.TransformCmd");var __proto=TransformCmd.prototype;return __proto.recover=function(){this.matrix=null,Pool.recover("TransformCmd",this)},__proto.run=function(context,gx,gy){context._transform(this.matrix,this.pivotX+gx,this.pivotY+gy)},__getset(0,__proto,"cmdID",function(){return"Transform"}),TransformCmd.create=function(matrix,pivotX,pivotY){var cmd=Pool.getItemByClass("TransformCmd",TransformCmd);return cmd.matrix=matrix,cmd.pivotX=pivotX,cmd.pivotY=pivotY,cmd},TransformCmd.ID="Transform",TransformCmd}(),DrawTexturesCmd=function(){function DrawTexturesCmd(){}__class(DrawTexturesCmd,"laya.display.cmd.DrawTexturesCmd");var __proto=DrawTexturesCmd.prototype;return __proto.recover=function(){this.texture._removeReference(),this.texture=null,this.pos=null,Pool.recover("DrawTexturesCmd",this)},__proto.run=function(context,gx,gy){context.drawTextures(this.texture,this.pos,gx,gy)},__getset(0,__proto,"cmdID",function(){return"DrawTextures"}),DrawTexturesCmd.create=function(texture,pos){var cmd=Pool.getItemByClass("DrawTexturesCmd",DrawTexturesCmd);return cmd.texture=texture,texture._addReference(),cmd.pos=pos,cmd},DrawTexturesCmd.ID="DrawTextures",DrawTexturesCmd}(),DrawCircleCmd=function(){function DrawCircleCmd(){}__class(DrawCircleCmd,"laya.display.cmd.DrawCircleCmd");var __proto=DrawCircleCmd.prototype;return __proto.recover=function(){this.fillColor=null,this.lineColor=null,Pool.recover("DrawCircleCmd",this)},__proto.run=function(context,gx,gy){context._drawCircle(this.x+gx,this.y+gy,this.radius,this.fillColor,this.lineColor,this.lineWidth,this.vid)},__getset(0,__proto,"cmdID",function(){return"DrawCircle"}),DrawCircleCmd.create=function(x,y,radius,fillColor,lineColor,lineWidth,vid){var cmd=Pool.getItemByClass("DrawCircleCmd",DrawCircleCmd);return cmd.x=x,cmd.y=y,cmd.radius=radius,cmd.fillColor=fillColor,cmd.lineColor=lineColor,cmd.lineWidth=lineWidth,cmd.vid=vid,cmd},DrawCircleCmd.ID="DrawCircle",DrawCircleCmd}(),Context=function(){var ContextParams;function Context(){if(this._drawTriUseAbsMatrix=!1,this._id=++Context._COUNT,this._other=null,this._renderNextSubmitIndex=0,this._path=null,this._drawCount=1,this._renderCount=0,this._isConvexCmd=!0,this._submits=null,this._curSubmit=null,this._mesh=null,this._pathMesh=null,this._triangleMesh=null,this.meshlist=[],this._clipInCache=!1,this._clipInfoID=0,this._curMat=null,this._lastMatScaleX=1,this._lastMatScaleY=1,this._lastMat_a=1,this._lastMat_b=0,this._lastMat_c=0,this._lastMat_d=1,this._nBlendType=0,this._save=null,this._targets=null,this._charSubmitCache=null,this._saveMark=null,this.sprite=null,this._italicDeg=0,this._lastTex=null,this._fillColor=0,this._flushCnt=0,this.defTexture=null,this._colorFiler=null,this.drawTexAlign=!1,this._incache=!1,this.isMain=!1,this._tmpMatrix=new Matrix,this._drawTexToDrawTri_Vert=new Float32Array(8),this._drawTexToDrawTri_Index=new Uint16Array([0,1,2,0,2,3]),this._tempUV=new Float32Array(8),this._width=99999999,this._height=99999999,this._submitKey=new SubmitKey,this._transedPoints=new Array(8),this._temp4Points=new Array(8),this._clipRect=Context.MAXCLIPRECT,this._globalClipMatrix=new Matrix(99999999,0,0,99999999,0,0),this._shader2D=new Shader2D,Context._contextcount++,!this.defTexture){var defTex2d=new Texture2D(2,2);defTex2d.setPixels(new Uint8Array(16)),defTex2d.lock=!0,this.defTexture=new Texture(defTex2d)}this._lastTex=this.defTexture,this.clear()}__class(Context,"laya.resource.Context");var __proto=Context.prototype;return __proto.drawImage=function(__args){},__proto.getImageData=function(__args){},__proto.measureText=function(text){return null},__proto.setTransform=function(__args){},__proto.$transform=function(a,b,c,d,tx,ty){},__proto.clearRect=function(x,y,width,height){},__proto._drawRect=function(x,y,width,height,style){Stat.renderBatches++,style&&(this.fillStyle=style),this.fillRect(x,y,width,height)},__proto.drawTexture2=function(x,y,pivotX,pivotY,m,args2){},__proto.transformByMatrix=function(matrix,tx,ty){this.transform(matrix.a,matrix.b,matrix.c,matrix.d,matrix.tx+tx,matrix.ty+ty)},__proto.saveTransform=function(matrix){this.save()},__proto.restoreTransform=function(matrix){this.restore()},__proto.drawRect=function(x,y,width,height,fillColor,lineColor,lineWidth){null!=fillColor&&(this.fillStyle=fillColor,this.fillRect(x,y,width,height)),null!=lineColor&&(this.strokeStyle=lineColor,this.lineWidth=lineWidth,this.strokeRect(x,y,width,height))},__proto.alpha=function(value){this.globalAlpha*=value},__proto._transform=function(mat,pivotX,pivotY){this.translate(pivotX,pivotY),this.transform(mat.a,mat.b,mat.c,mat.d,mat.tx,mat.ty),this.translate(-pivotX,-pivotY)},__proto._rotate=function(angle,pivotX,pivotY){this.translate(pivotX,pivotY),this.rotate(angle),this.translate(-pivotX,-pivotY)},__proto._scale=function(scaleX,scaleY,pivotX,pivotY){this.translate(pivotX,pivotY),this.scale(scaleX,scaleY),this.translate(-pivotX,-pivotY)},__proto._drawLine=function(x,y,fromX,fromY,toX,toY,lineColor,lineWidth,vid){this.beginPath(),this.strokeStyle=lineColor,this.lineWidth=lineWidth,this.moveTo(x+fromX,y+fromY),this.lineTo(x+toX,y+toY),this.stroke()},__proto._drawLines=function(x,y,points,lineColor,lineWidth,vid){this.beginPath(),this.strokeStyle=lineColor,this.lineWidth=lineWidth;points.length;this.addPath(points.slice(),!1,!1,x,y),this.stroke()},__proto.drawCurves=function(x,y,points,lineColor,lineWidth){this.beginPath(),this.strokeStyle=lineColor,this.lineWidth=lineWidth,this.moveTo(x+points[0],y+points[1]);for(var i=2,n=points.length;i<n;)this.quadraticCurveTo(x+points[i++],y+points[i++],x+points[i++],y+points[i++]);this.stroke()},__proto._fillAndStroke=function(fillColor,strokeColor,lineWidth,isConvexPolygon){void 0===isConvexPolygon&&(isConvexPolygon=!1),null!=fillColor&&(this.fillStyle=fillColor,this.fill()),null!=strokeColor&&lineWidth>0&&(this.strokeStyle=strokeColor,this.lineWidth=lineWidth,this.stroke())},__proto._drawCircle=function(x,y,radius,fillColor,lineColor,lineWidth,vid){Stat.renderBatches++,this.beginPath(!0),this.arc(x,y,radius,0,Context.PI2),this.closePath(),this._fillAndStroke(fillColor,lineColor,lineWidth)},__proto._drawPie=function(x,y,radius,startAngle,endAngle,fillColor,lineColor,lineWidth,vid){this.beginPath(),this.moveTo(x,y),this.arc(x,y,radius,startAngle,endAngle),this.closePath(),this._fillAndStroke(fillColor,lineColor,lineWidth)},__proto._drawPoly=function(x,y,points,fillColor,lineColor,lineWidth,isConvexPolygon,vid){points.length;this.beginPath(),this.addPath(points.slice(),!0,isConvexPolygon,x,y),this.closePath(),this._fillAndStroke(fillColor,lineColor,lineWidth,isConvexPolygon)},__proto._drawPath=function(x,y,paths,brush,pen){this.beginPath();for(var i=0,n=paths.length;i<n;i++){var path=paths[i];switch(path[0]){case"moveTo":this.moveTo(x+path[1],y+path[2]);break;case"lineTo":this.lineTo(x+path[1],y+path[2]);break;case"arcTo":this.arcTo(x+path[1],y+path[2],x+path[3],y+path[4],path[5]);break;case"closePath":this.closePath()}}null!=brush&&(this.fillStyle=brush.fillStyle,this.fill()),null!=pen&&(this.strokeStyle=pen.strokeStyle,this.lineWidth=pen.lineWidth||1,this.lineJoin=pen.lineJoin,this.lineCap=pen.lineCap,this.miterLimit=pen.miterLimit,this.stroke())},__proto.clearBG=function(r,g,b,a){var gl=WebGL.mainContext;gl.clearColor(r,g,b,a),gl.clear(16384)},__proto._getSubmits=function(){return this._submits},__proto._releaseMem=function(keepRT){if(void 0===keepRT&&(keepRT=!1),this._submits){this._curMat.destroy(),this._curMat=null,this._shader2D.destroy(),this._shader2D=null,this._charSubmitCache.clear();for(var i=0,n=this._submits._length;i<n;i++)this._submits[i].releaseRender();this._submits.length=0,this._submits._length=0,this._submits=null,this._curSubmit=null,this._path=null,this._save=null;var sz;for(i=0,sz=this.meshlist.length;i<sz;i++){this.meshlist[i].destroy()}this.meshlist.length=0,this.sprite=null,keepRT||(this._targets&&this._targets.destroy(),this._targets=null)}},__proto.destroy=function(keepRT){void 0===keepRT&&(keepRT=!1),--Context._contextcount,this.sprite=null,this._releaseMem(keepRT),this._charSubmitCache.destroy(),this._mesh.destroy(),keepRT||(this._targets&&this._targets.destroy(),this._targets=null)},__proto.clear=function(){this._submits||(this._other=ContextParams.DEFAULT,this._curMat=Matrix.create(),this._charSubmitCache=new CharSubmitCache,this._mesh=MeshQuadTexture.getAMesh(this.isMain),this.meshlist.push(this._mesh),this._pathMesh=MeshVG.getAMesh(this.isMain),this.meshlist.push(this._pathMesh),this._triangleMesh=MeshTexture.getAMesh(this.isMain),this.meshlist.push(this._triangleMesh),this._submits=[],this._save=[SaveMark.Create(this)],this._save.length=10,this._shader2D=new Shader2D),this._submitKey.clear(),this._mesh.clearVB(),this._renderCount++,this._drawCount=1,this._other=ContextParams.DEFAULT,this._other.lineWidth=this._shader2D.ALPHA=1,this._nBlendType=0,this._clipRect=Context.MAXCLIPRECT,this._curSubmit=Submit.RENDERBASE,Submit.RENDERBASE._ref=16777215,Submit.RENDERBASE._numEle=0,this._shader2D.fillStyle=this._shader2D.strokeStyle=DrawStyle.DEFAULT;for(var i=0,n=this._submits._length;i<n;i++)this._submits[i].releaseRender();this._submits._length=0,this._curMat.identity(),this._other.clear(),this._saveMark=this._save[0],this._save._length=1},__proto.size=function(w,h){this._width==w&&this._height==h||(this._width=w,this._height=h,this._targets&&(this._targets.destroy(),this._targets=new RenderTexture2D(w,h,1,-1)),Render._context==this&&(WebGL.mainContext.viewport(0,0,w,h),RenderState2D.width=w,RenderState2D.height=h)),0===w&&0===h&&this._releaseMem()},__proto.getMatScaleX=function(){return this._lastMat_a==this._curMat.a&&this._lastMat_b==this._curMat.b?this._lastMatScaleX:(this._lastMatScaleX=this._curMat.getScaleX(),this._lastMat_a=this._curMat.a,this._lastMat_b=this._curMat.b,this._lastMatScaleX)},__proto.getMatScaleY=function(){return this._lastMat_c==this._curMat.c&&this._lastMat_d==this._curMat.d?this._lastMatScaleY:(this._lastMatScaleY=this._curMat.getScaleY(),this._lastMat_c=this._curMat.c,this._lastMat_d=this._curMat.d,this._lastMatScaleY)},__proto.setFillColor=function(color){this._fillColor=color},__proto.getFillColor=function(){return this._fillColor},__proto.translate=function(x,y){0===x&&0===y||(SaveTranslate.save(this),this._curMat._bTransform?(SaveTransform.save(this),this._curMat.tx+=x*this._curMat.a+y*this._curMat.c,this._curMat.ty+=x*this._curMat.b+y*this._curMat.d):(this._curMat.tx=x,this._curMat.ty=y))},__proto.save=function(){this._save[this._save._length++]=SaveMark.Create(this)},__proto.restore=function(){var sz=this._save._length,lastBlend=this._nBlendType;if(!(sz<1)){for(var i=sz-1;i>=0;i--){var o=this._save[i];if(o.restore(this),o.isSaveMark())return void(this._save._length=i)}lastBlend!=this._nBlendType&&(this._curSubmit=Submit.RENDERBASE)}},__proto.fillText=function(txt,x,y,fontStr,color,align){this._fillText(txt,null,x,y,fontStr,color,null,0,null)},__proto._fillText=function(txt,words,x,y,fontStr,color,strokeColor,lineWidth,textAlign,underLine){void 0===underLine&&(underLine=0),txt?Context._textRender.filltext(this,txt,x,y,fontStr,color,strokeColor,lineWidth,textAlign,underLine):words&&Context._textRender.fillWords(this,words,x,y,fontStr,color,strokeColor,lineWidth)},__proto._fast_filltext=function(data,x,y,fontObj,color,strokeColor,lineWidth,textAlign,underLine){void 0===underLine&&(underLine=0),Context._textRender._fast_filltext(this,data,null,x,y,fontObj,color,strokeColor,lineWidth,textAlign,underLine)},__proto.fillWords=function(words,x,y,fontStr,color){this._fillText(null,words,x,y,fontStr,color,null,-1,null,0)},__proto.fillBorderWords=function(words,x,y,font,color,borderColor,lineWidth){this._fillBorderText(null,words,x,y,font,color,borderColor,lineWidth,null)},__proto.drawText=function(text,x,y,font,color,textAlign){this._fillText(text,null,x,y,font,ColorUtils.create(color).strColor,null,-1,textAlign)},__proto.strokeWord=function(text,x,y,font,color,lineWidth,textAlign){this._fillText(text,null,x,y,font,null,ColorUtils.create(color).strColor,lineWidth||1,textAlign)},__proto.fillBorderText=function(txt,x,y,fontStr,fillColor,borderColor,lineWidth,textAlign){this._fillBorderText(txt,null,x,y,fontStr,ColorUtils.create(fillColor).strColor,ColorUtils.create(borderColor).strColor,lineWidth,textAlign)},__proto._fillBorderText=function(txt,words,x,y,fontStr,fillColor,borderColor,lineWidth,textAlign){this._fillText(txt,words,x,y,fontStr,fillColor,borderColor,lineWidth||1,textAlign)},__proto._fillRect=function(x,y,width,height,rgba){var submit=this._curSubmit,sameKey=submit&&2===submit._key.submitType&&submit._key.blendShader===this._nBlendType;this._mesh.vertNum+4>65535&&(this._mesh=MeshQuadTexture.getAMesh(this.isMain),this.meshlist.push(this._mesh),sameKey=!1),sameKey&&(sameKey=sameKey&&this.isSameClipInfo(submit)),this.transformQuad(x,y,width,height,0,this._curMat,this._transedPoints),this.clipedOff(this._transedPoints)||(this._mesh.addQuad(this._transedPoints,Texture.NO_UV,rgba,!1),sameKey||(submit=this._curSubmit=SubmitTexture.create(this,this._mesh,Value2D.create(1,0)),this._submits[this._submits._length++]=submit,this._copyClipInfo(submit,this._globalClipMatrix),submit.shaderValue.textureHost=this._lastTex,submit._key.other=this._lastTex&&this._lastTex.bitmap?this._lastTex.bitmap.id:-1,submit._renderType=10016),this._curSubmit._numEle+=6,this._mesh.indexNum+=6,this._mesh.vertNum+=4)},__proto.fillRect=function(x,y,width,height,fillStyle){var drawstyle=fillStyle?DrawStyle.create(fillStyle):this._shader2D.fillStyle,rgba=this.mixRGBandAlpha(drawstyle.toInt());this._fillRect(x,y,width,height,rgba)},__proto.fillTexture=function(texture,x,y,width,height,type,offset,other){texture._getSource()?this._fillTexture(texture,texture.width,texture.height,texture.uvrect,x,y,width,height,type,offset.x,offset.y):this.sprite&&Laya.systemTimer.callLater(this,this._repaintSprite)},__proto._fillTexture=function(texture,texw,texh,texuvRect,x,y,width,height,type,offsetx,offsety){var submit=this._curSubmit;this._mesh.vertNum+4>65535&&(this._mesh=MeshQuadTexture.getAMesh(this.isMain),this.meshlist.push(this._mesh));var repeatx=!0,repeaty=!0;switch(type){case"repeat":break;case"repeat-x":repeaty=!1;break;case"repeat-y":repeatx=!1;break;case"no-repeat":repeatx=repeaty=!1}var uv=this._temp4Points,stu=0,stv=0,stx=0,sty=0,edx=0,edy=0;if(offsetx<0?(stx=x,stu=-offsetx%texw/texw):stx=x+offsetx,offsety<0?(sty=y,stv=-offsety%texh/texh):sty=y+offsety,edx=x+width,edy=y+height,!repeatx&&(edx=Math.min(edx,x+offsetx+texw)),!repeaty&&(edy=Math.min(edy,y+offsety+texh)),!(edx<x||edy<y||stx>edx||sty>edy)){var edu=(edx-x-offsetx)/texw,edv=(edy-y-offsety)/texh;if(this.transformQuad(stx,sty,edx-stx,edy-sty,0,this._curMat,this._transedPoints),uv[0]=stu,uv[1]=stv,uv[2]=edu,uv[3]=stv,uv[4]=edu,uv[5]=edv,uv[6]=stu,uv[7]=edv,!this.clipedOff(this._transedPoints)){var rgba=this._mixRGBandAlpha(4294967295,this._shader2D.ALPHA);this._mesh.addQuad(this._transedPoints,uv,rgba,!0);var sv=Value2D.create(1,0);sv.defines.add(256),sv.u_TexRange=texuvRect,submit=this._curSubmit=SubmitTexture.create(this,this._mesh,sv),this._submits[this._submits._length++]=submit,this._copyClipInfo(submit,this._globalClipMatrix),submit.shaderValue.textureHost=texture,submit._renderType=10016,this._curSubmit._numEle+=6,this._mesh.indexNum+=6,this._mesh.vertNum+=4}this.breakNextMerge()}},__proto.setColorFilter=function(filter){SaveBase.save(this,8388608,this,!0),this._colorFiler=filter,this._curSubmit=Submit.RENDERBASE},__proto.drawTexture=function(tex,x,y,width,height){this._drawTextureM(tex,x,y,width,height,null,1,null)},__proto.drawTextures=function(tex,pos,tx,ty){if(tex._getSource())for(var n=pos.length/2,ipos=0,bmpid=tex.bitmap.id,i=0;i<n;i++)this._inner_drawTexture(tex,bmpid,pos[ipos++]+tx,pos[ipos++]+ty,0,0,null,null,1,!1);else this.sprite&&Laya.systemTimer.callLater(this,this._repaintSprite)},__proto._drawTextureAddSubmit=function(imgid,tex){var submit=null;submit=SubmitTexture.create(this,this._mesh,Value2D.create(1,0)),this._submits[this._submits._length++]=submit,submit.shaderValue.textureHost=tex,submit._key.other=imgid,submit._renderType=10016,this._curSubmit=submit},__proto._drawTextureM=function(tex,x,y,width,height,m,alpha,uv){var cs=this.sprite;return!!tex._getSource(function(){cs&&cs.repaint()})&&this._inner_drawTexture(tex,tex.bitmap.id,x,y,width,height,m,uv,alpha,!1)},__proto._drawRenderTexture=function(tex,x,y,width,height,m,alpha,uv){return this._inner_drawTexture(tex,-1,x,y,width,height,m,uv,1,!1)},__proto.submitDebugger=function(){this._submits[this._submits._length++]=SubmitCMD.create([],function(){},this)},__proto._copyClipInfo=function(submit,clipInfo){var cm=submit.shaderValue.clipMatDir;cm[0]=clipInfo.a,cm[1]=clipInfo.b,cm[2]=clipInfo.c,cm[3]=clipInfo.d;var cmp=submit.shaderValue.clipMatPos;cmp[0]=clipInfo.tx,cmp[1]=clipInfo.ty,submit.clipInfoID=this._clipInfoID,this._clipInCache&&(submit.shaderValue.clipOff[0]=1)},__proto.isSameClipInfo=function(submit){return submit.clipInfoID===this._clipInfoID},__proto._useNewTex2DSubmit=function(tex,minVertNum){this._mesh.vertNum+minVertNum>65535&&(this._mesh=MeshQuadTexture.getAMesh(this.isMain),this.meshlist.push(this._mesh));var submit=SubmitTexture.create(this,this._mesh,Value2D.create(1,0));this._submits[this._submits._length++]=this._curSubmit=submit,submit.shaderValue.textureHost=tex,this._copyClipInfo(submit,this._globalClipMatrix)},__proto._drawTexRect=function(x,y,w,h,uv){this.transformQuad(x,y,w,h,this._italicDeg,this._curMat,this._transedPoints);var ops=this._transedPoints;ops[0]=ops[0]+.5|0,ops[1]=ops[1]+.5|0,ops[2]=ops[2]+.5|0,ops[3]=ops[3]+.5|0,ops[4]=ops[4]+.5|0,ops[5]=ops[5]+.5|0,ops[6]=ops[6]+.5|0,ops[7]=ops[7]+.5|0,this.clipedOff(this._transedPoints)||(this._mesh.addQuad(this._transedPoints,uv,this._fillColor,!0),this._curSubmit._numEle+=6,this._mesh.indexNum+=6,this._mesh.vertNum+=4)},__proto.drawCallOptimize=function(enbale){return this._charSubmitCache.enable(enbale,this),enbale},__proto._inner_drawTexture=function(tex,imgid,x,y,width,height,m,uv,alpha,lastRender){var preKey=this._curSubmit._key;if(uv=uv||tex._uv,4===preKey.submitType&&preKey.other===imgid){var tv=this._drawTexToDrawTri_Vert;tv[0]=x,tv[1]=y,tv[2]=x+width,tv[3]=y,tv[4]=x+width,tv[5]=y+height,tv[6]=x,tv[7]=y+height,this._drawTriUseAbsMatrix=!0;var tuv=this._tempUV;return tuv[0]=uv[0],tuv[1]=uv[1],tuv[2]=uv[2],tuv[3]=uv[3],tuv[4]=uv[4],tuv[5]=uv[5],tuv[6]=uv[6],tuv[7]=uv[7],this.drawTriangles(tex,0,0,tv,tuv,this._drawTexToDrawTri_Index,m,alpha,null,null),this._drawTriUseAbsMatrix=!1,!0}var mesh=this._mesh,submit=this._curSubmit,ops=lastRender?this._charSubmitCache.getPos():this._transedPoints;if(this.transformQuad(x,y,width||tex.width,height||tex.height,this._italicDeg,m||this._curMat,ops),this.drawTexAlign){var round=Math.round;ops[0]=round(ops[0]),ops[1]=round(ops[1]),ops[2]=round(ops[2]),ops[3]=round(ops[3]),ops[4]=round(ops[4]),ops[5]=round(ops[5]),ops[6]=round(ops[6]),ops[7]=round(ops[7]),this.drawTexAlign=!1}var rgba=this._mixRGBandAlpha(4294967295,this._shader2D.ALPHA*alpha);if(lastRender)return this._charSubmitCache.add(this,tex,imgid,ops,uv,rgba),!0;this._drawCount++;var sameKey=imgid>=0&&2===preKey.submitType&&preKey.other===imgid;return sameKey&&(sameKey=sameKey&&this.isSameClipInfo(submit)),this._lastTex=tex,mesh.vertNum+4>65535&&(mesh=this._mesh=MeshQuadTexture.getAMesh(this.isMain),this.meshlist.push(mesh),sameKey=!1),mesh.addQuad(ops,uv,rgba,!0),sameKey||(this._submits[this._submits._length++]=this._curSubmit=submit=SubmitTexture.create(this,mesh,Value2D.create(1,0)),submit.shaderValue.textureHost=tex,submit._key.other=imgid,this._copyClipInfo(submit,this._globalClipMatrix)),submit._numEle+=6,mesh.indexNum+=6,mesh.vertNum+=4,!0},__proto.transform4Points=function(a,m,out){var tx=m.tx,ty=m.ty,ma=m.a,mb=m.b,mc=m.c,md=m.d,a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7];m._bTransform?(out[0]=a0*ma+a1*mc+tx,out[1]=a0*mb+a1*md+ty,out[2]=a2*ma+a3*mc+tx,out[3]=a2*mb+a3*md+ty,out[4]=a4*ma+a5*mc+tx,out[5]=a4*mb+a5*md+ty,out[6]=a6*ma+a7*mc+tx,out[7]=a6*mb+a7*md+ty):(out[0]=a0+tx,out[1]=a1+ty,out[2]=a2+tx,out[3]=a3+ty,out[4]=a4+tx,out[5]=a5+ty,out[6]=a6+tx,out[7]=a7+ty)},__proto.clipedOff=function(pt){return this._clipRect.width<=0||this._clipRect.height<=0},__proto.transformQuad=function(x,y,w,h,italicDeg,m,out){var xoff=0;0!=italicDeg&&(xoff=Math.tan(italicDeg*Math.PI/180)*h);var maxx=x+w,maxy=y+h,tx=m.tx,ty=m.ty,ma=m.a,mb=m.b,mc=m.c,md=m.d,a0=x+xoff,a1=y,a2=maxx+xoff,a3=y,a4=maxx,a5=maxy,a6=x,a7=maxy;m._bTransform?(out[0]=a0*ma+a1*mc+tx,out[1]=a0*mb+a1*md+ty,out[2]=a2*ma+a3*mc+tx,out[3]=a2*mb+a3*md+ty,out[4]=a4*ma+a5*mc+tx,out[5]=a4*mb+a5*md+ty,out[6]=a6*ma+a7*mc+tx,out[7]=a6*mb+a7*md+ty):(out[0]=a0+tx,out[1]=a1+ty,out[2]=a2+tx,out[3]=a3+ty,out[4]=a4+tx,out[5]=a5+ty,out[6]=a6+tx,out[7]=a7+ty)},__proto.pushRT=function(){this.addRenderObject(SubmitCMD.create(null,RenderTexture2D.pushRT,this))},__proto.popRT=function(){this.addRenderObject(SubmitCMD.create(null,RenderTexture2D.popRT,this)),this.breakNextMerge()},__proto.useRT=function(rt){this.addRenderObject(SubmitCMD.create([rt],function(rt){if(!rt)throw"error useRT";rt.start(),rt.clear(0,0,0,0)},this)),this.breakNextMerge()},__proto.RTRestore=function(rt){this.addRenderObject(SubmitCMD.create([rt],function(rt){rt.restore()},this)),this.breakNextMerge()},__proto.breakNextMerge=function(){this._curSubmit=Submit.RENDERBASE},__proto._repaintSprite=function(){this.sprite&&this.sprite.repaint()},__proto.drawTextureWithTransform=function(tex,x,y,width,height,transform,tx,ty,alpha,blendMode,colorfilter){var oldcomp=null,curMat=this._curMat;blendMode&&(oldcomp=this.globalCompositeOperation,this.globalCompositeOperation=blendMode);var oldColorFilter=this._colorFiler;if(colorfilter&&this.setColorFilter(colorfilter),!transform)return this._drawTextureM(tex,x+tx,y+ty,width,height,curMat,alpha,null),blendMode&&(this.globalCompositeOperation=oldcomp),void(colorfilter&&this.setColorFilter(oldColorFilter));var tmpMat=this._tmpMatrix;tmpMat.a=transform.a,tmpMat.b=transform.b,tmpMat.c=transform.c,tmpMat.d=transform.d,tmpMat.tx=transform.tx+tx,tmpMat.ty=transform.ty+ty,tmpMat._bTransform=transform._bTransform,transform&&curMat._bTransform?(Matrix.mul(tmpMat,curMat,tmpMat),(transform=tmpMat)._bTransform=!0):(tmpMat.tx+=curMat.tx,tmpMat.ty+=curMat.ty,transform=tmpMat),this._drawTextureM(tex,x,y,width,height,transform,alpha,null),blendMode&&(this.globalCompositeOperation=oldcomp),colorfilter&&this.setColorFilter(oldColorFilter)},__proto._flushToTarget=function(context,target){RenderState2D.worldScissorTest=!1,WebGL.mainContext.disable(3089);var preAlpha=RenderState2D.worldAlpha,preMatrix4=RenderState2D.worldMatrix4,preMatrix=RenderState2D.worldMatrix;RenderState2D.worldShaderDefines;RenderState2D.worldMatrix=Matrix.EMPTY,RenderState2D.restoreTempArray(),RenderState2D.worldMatrix4=RenderState2D.TEMPMAT4_ARRAY,RenderState2D.worldAlpha=1,BaseShader.activeShader=null,target.start(),context._submits._length>0&&target.clear(0,0,0,0),context._curSubmit=Submit.RENDERBASE,context.flush(),context.clear(),target.restore(),context._curSubmit=Submit.RENDERBASE,BaseShader.activeShader=null,RenderState2D.worldAlpha=preAlpha,RenderState2D.worldMatrix4=preMatrix4,RenderState2D.worldMatrix=preMatrix},__proto.drawCanvas=function(canvas,x,y,width,height){if(canvas){var submit,src=canvas.context;if(src._targets)src._submits._length>0&&(submit=SubmitCMD.create([src,src._targets],this._flushToTarget,this),this._submits[this._submits._length++]=submit),this._drawRenderTexture(src._targets,x,y,width,height,null,1,RenderTexture2D.flipyuv),this._curSubmit=Submit.RENDERBASE;else{var canv=canvas;canv.touches&&canv.touches.forEach(function(v){v.touch()}),submit=SubmitCanvas.create(canvas,this._shader2D.ALPHA,this._shader2D.filters),this._submits[this._submits._length++]=submit,submit._key.clear();var mat=submit._matrix;this._curMat.copyTo(mat);var tx=mat.tx,ty=mat.ty;mat.tx=mat.ty=0,mat.transformPoint(Point.TEMP.setTo(x,y)),mat.translate(Point.TEMP.x+tx,Point.TEMP.y+ty),Matrix.mul(canv.invMat,mat,mat),this._curSubmit=Submit.RENDERBASE}}},__proto.drawTarget=function(rt,x,y,width,height,m,shaderValue,uv,blend){void 0===blend&&(blend=-1),this._drawCount++;if(this._mesh.vertNum+4>65535&&(this._mesh=MeshQuadTexture.getAMesh(this.isMain),this.meshlist.push(this._mesh)),this.transformQuad(x,y,width,height,0,m||this._curMat,this._transedPoints),!this.clipedOff(this._transedPoints)){this._mesh.addQuad(this._transedPoints,uv||Texture.DEF_UV,4294967295,!0);var submit=this._curSubmit=SubmitTarget.create(this,this._mesh,shaderValue,rt);return submit.blendType=-1==blend?this._nBlendType:blend,this._copyClipInfo(submit,this._globalClipMatrix),submit._numEle=6,this._mesh.indexNum+=6,this._mesh.vertNum+=4,this._submits[this._submits._length++]=submit,this._curSubmit=Submit.RENDERBASE,!0}return this._curSubmit=Submit.RENDERBASE,!1},__proto.drawTriangles=function(tex,x,y,vertices,uvs,indices,matrix,alpha,color,blendMode){if(tex._getSource()){this._drawCount++;var tmpMat=this._tmpMatrix,triMesh=this._triangleMesh,oldColorFilter=null,needRestorFilter=!1;color&&(oldColorFilter=this._colorFiler,this._colorFiler=color,this._curSubmit=Submit.RENDERBASE,needRestorFilter=oldColorFilter!=color);var webGLImg=tex.bitmap,preKey=this._curSubmit._key,sameKey=4===preKey.submitType&&preKey.other===webGLImg.id&&preKey.blendShader==this._nBlendType;if(triMesh.vertNum+vertices.length/2>65535&&(triMesh=this._triangleMesh=MeshTexture.getAMesh(this.isMain),this.meshlist.push(triMesh),sameKey=!1),!sameKey){var submit=this._curSubmit=SubmitTexture.create(this,triMesh,Value2D.create(1,0));submit.shaderValue.textureHost=tex,submit._renderType=10016,submit._key.submitType=4,submit._key.other=webGLImg.id,this._copyClipInfo(submit,this._globalClipMatrix),this._submits[this._submits._length++]=submit}var rgba=this._mixRGBandAlpha(4294967295,this._shader2D.ALPHA*alpha);this._drawTriUseAbsMatrix?triMesh.addData(vertices,uvs,indices,matrix,rgba):(matrix?(tmpMat.a=matrix.a,tmpMat.b=matrix.b,tmpMat.c=matrix.c,tmpMat.d=matrix.d,tmpMat.tx=matrix.tx+x,tmpMat.ty=matrix.ty+y):(tmpMat.a=1,tmpMat.b=0,tmpMat.c=0,tmpMat.d=1,tmpMat.tx=x,tmpMat.ty=y),Matrix.mul(tmpMat,this._curMat,tmpMat),triMesh.addData(vertices,uvs,indices,tmpMat,rgba)),this._curSubmit._numEle+=indices.length,needRestorFilter&&(this._colorFiler=oldColorFilter,this._curSubmit=Submit.RENDERBASE)}else this.sprite&&Laya.systemTimer.callLater(this,this._repaintSprite)},__proto.transform=function(a,b,c,d,tx,ty){SaveTransform.save(this),Matrix.mul(Matrix.TEMP.setTo(a,b,c,d,tx,ty),this._curMat,this._curMat),this._curMat._checkTransform()},__proto._transformByMatrix=function(matrix,tx,ty){matrix.setTranslate(tx,ty),Matrix.mul(matrix,this._curMat,this._curMat),matrix.setTranslate(0,0),this._curMat._bTransform=!0},__proto.setTransformByMatrix=function(value){value.copyTo(this._curMat)},__proto.rotate=function(angle){SaveTransform.save(this),this._curMat.rotateEx(angle)},__proto.scale=function(scaleX,scaleY){SaveTransform.save(this),this._curMat.scaleEx(scaleX,scaleY)},__proto.clipRect=function(x,y,width,height){SaveClipRect.save(this),this._clipRect==Context.MAXCLIPRECT?this._clipRect=new Rectangle(x,y,width,height):(this._clipRect.width=width,this._clipRect.height=height,this._clipRect.x=x,this._clipRect.y=y),Context._clipID_Gen++,Context._clipID_Gen%=1e4,this._clipInfoID=Context._clipID_Gen;var cm=this._globalClipMatrix,minx=cm.tx,miny=cm.ty,maxx=minx+cm.a,maxy=miny+cm.d;if(this._clipRect.width>=99999999?(cm.a=cm.d=99999999,cm.b=cm.c=cm.tx=cm.ty=0):(this._curMat._bTransform?(cm.tx=this._clipRect.x*this._curMat.a+this._clipRect.y*this._curMat.c+this._curMat.tx,cm.ty=this._clipRect.x*this._curMat.b+this._clipRect.y*this._curMat.d+this._curMat.ty,cm.a=this._clipRect.width*this._curMat.a,cm.b=this._clipRect.width*this._curMat.b,cm.c=this._clipRect.height*this._curMat.c,cm.d=this._clipRect.height*this._curMat.d):(cm.tx=this._clipRect.x+this._curMat.tx,cm.ty=this._clipRect.y+this._curMat.ty,cm.a=this._clipRect.width,cm.b=cm.c=0,cm.d=this._clipRect.height),this._incache&&(this._clipInCache=!0)),cm.a>0&&cm.d>0){var cmaxx=cm.tx+cm.a,cmaxy=cm.ty+cm.d;cmaxx<=minx||cmaxy<=miny||cm.tx>=maxx||cm.ty>=maxy?(cm.a=-.1,cm.d=-.1):(cm.tx<minx&&(cm.a-=minx-cm.tx,cm.tx=minx),cmaxx>maxx&&(cm.a-=cmaxx-maxx),cm.ty<miny&&(cm.d-=miny-cm.ty,cm.ty=miny),cmaxy>maxy&&(cm.d-=cmaxy-maxy),cm.a<=0&&(cm.a=-.1),cm.d<=0&&(cm.d=-.1))}},__proto.drawMesh=function(x,y,ib,vb,numElement,mat,shader,shaderValues,startIndex){void 0===startIndex&&(startIndex=0)},__proto.addRenderObject=function(o){this._submits[this._submits._length++]=o},__proto.submitElement=function(start,end){Render._context;var renderList=this._submits,ret=renderList._length;end<0&&(end=renderList._length);for(var submit=Submit.RENDERBASE;start<end;)this._renderNextSubmitIndex=start+1,renderList[start]!==Submit.RENDERBASE?(Submit.preRender=submit,start+=(submit=renderList[start]).renderSubmit()):start++;return ret},__proto.flush=function(){var ret=this.submitElement(0,this._submits._length);this._path&&this._path.reset(),SkinMeshBuffer.instance&&SkinMeshBuffer.getInstance().reset(),this._curSubmit=Submit.RENDERBASE;for(var i=0,sz=this.meshlist.length;i<sz;i++){var curm=this.meshlist[i];curm.canReuse?curm.releaseMesh():curm.destroy()}return this.meshlist.length=0,this._mesh=MeshQuadTexture.getAMesh(this.isMain),this._pathMesh=MeshVG.getAMesh(this.isMain),this._triangleMesh=MeshTexture.getAMesh(this.isMain),this.meshlist.push(this._mesh,this._pathMesh,this._triangleMesh),this._flushCnt++,this._flushCnt%60==0&&Render._context==this&&TextRender.textRenderInst&&TextRender.textRenderInst.GC(),ret},__proto.beginPath=function(convex){void 0===convex&&(convex=!1),this._getPath().beginPath(convex)},__proto.closePath=function(){this._path.closePath()},__proto.addPath=function(points,close,convex,dx,dy){for(var ci=0,i=0,sz=points.length/2;i<sz;i++){var x1=points[ci]+dx,y1=points[ci+1]+dy;points[ci]=x1,points[ci+1]=y1,ci+=2}this._getPath().push(points,convex)},__proto.fill=function(){var m=this._curMat,tPath=this._getPath(),submit=this._curSubmit,sameKey=3===submit._key.submitType&&submit._key.blendShader===this._nBlendType;sameKey&&(sameKey=sameKey&&this.isSameClipInfo(submit)),sameKey||(this._curSubmit=this.addVGSubmit(this._pathMesh));for(var idx,rgba=this.mixRGBandAlpha(this.fillStyle.toInt()),curEleNum=0,i=0,sz=tPath.paths.length;i<sz;i++){var p=tPath.paths[i],vertNum=p.path.length/2;if(!(vertNum<3||3==vertNum&&!p.convex)){var cpath=p.path.concat(),pi=0,xp=0,yp=0,_x=NaN,_y=NaN;if(m._bTransform)for(pi=0;pi<vertNum;pi++)yp=(xp=pi<<1)+1,_x=cpath[xp],_y=cpath[yp],cpath[xp]=m.a*_x+m.c*_y+m.tx,cpath[yp]=m.b*_x+m.d*_y+m.ty;else for(pi=0;pi<vertNum;pi++)yp=(xp=pi<<1)+1,_x=cpath[xp],_y=cpath[yp],cpath[xp]=_x+m.tx,cpath[yp]=_y+m.ty;this._pathMesh.vertNum+vertNum>65535&&(this._curSubmit._numEle+=curEleNum,curEleNum=0,this._pathMesh=MeshVG.getAMesh(this.isMain),this._curSubmit=this.addVGSubmit(this._pathMesh));var curvert=this._pathMesh.vertNum;if(p.convex){var faceNum=vertNum-2;idx=new Array(3*faceNum);for(var idxpos=0,fi=0;fi<faceNum;fi++)idx[idxpos++]=curvert,idx[idxpos++]=fi+1+curvert,idx[idxpos++]=fi+2+curvert}else if(idx=Earcut.earcut(cpath,null,2),curvert>0)for(var ii=0;ii<idx.length;ii++)idx[ii]+=curvert;this._pathMesh.addVertAndIBToMesh(this,cpath,rgba,idx),curEleNum+=idx.length}}this._curSubmit._numEle+=curEleNum},__proto.addVGSubmit=function(mesh){var submit=Submit.createShape(this,mesh,0,Value2D.create(4,0));return submit._key.submitType=3,this._submits[this._submits._length++]=submit,this._copyClipInfo(submit,this._globalClipMatrix),submit},__proto.stroke=function(){if(this.lineWidth>0){var rgba=this.mixRGBandAlpha(this.strokeStyle._color.numColor),tPath=this._getPath(),submit=this._curSubmit,sameKey=3===submit._key.submitType&&submit._key.blendShader===this._nBlendType;sameKey&&(sameKey=sameKey&&this.isSameClipInfo(submit)),sameKey||(this._curSubmit=this.addVGSubmit(this._pathMesh));for(var curEleNum=0,i=0,sz=tPath.paths.length;i<sz;i++){var p=tPath.paths[i];if(!(p.path.length<=0)){var idx=[],vertex=[],maxVertexNum=2*p.path.length;if(!(maxVertexNum<2)){this._pathMesh.vertNum+maxVertexNum>65535&&(this._curSubmit._numEle+=curEleNum,curEleNum=0,this._pathMesh=MeshVG.getAMesh(this.isMain),this.meshlist.push(this._pathMesh),this._curSubmit=this.addVGSubmit(this._pathMesh)),BasePoly.createLine2(p.path,idx,this.lineWidth,this._pathMesh.vertNum,vertex,p.loop);var ptnum=vertex.length/2,m=this._curMat,pi=0,xp=0,yp=0,_x=NaN,_y=NaN;if(m._bTransform)for(pi=0;pi<ptnum;pi++)yp=(xp=pi<<1)+1,_x=vertex[xp],_y=vertex[yp],vertex[xp]=m.a*_x+m.c*_y+m.tx,vertex[yp]=m.b*_x+m.d*_y+m.ty;else for(pi=0;pi<ptnum;pi++)yp=(xp=pi<<1)+1,_x=vertex[xp],_y=vertex[yp],vertex[xp]=_x+m.tx,vertex[yp]=_y+m.ty;this._pathMesh.addVertAndIBToMesh(this,vertex,rgba,idx),curEleNum+=idx.length}}}this._curSubmit._numEle+=curEleNum}},__proto.moveTo=function(x,y){var tPath=this._getPath();tPath.newPath(),tPath._lastOriX=x,tPath._lastOriY=y,tPath.addPoint(x,y)},__proto.lineTo=function(x,y){var tPath=this._getPath();Math.abs(x-tPath._lastOriX)<.001&&Math.abs(y-tPath._lastOriY)<.001||(tPath._lastOriX=x,tPath._lastOriY=y,tPath.addPoint(x,y))},__proto.arcTo=function(x1,y1,x2,y2,r){var i=0,x=0,y=0,dx=this._path._lastOriX-x1,dy=this._path._lastOriY-y1,len1=Math.sqrt(dx*dx+dy*dy);if(!(len1<=1e-6)){var ndx=dx/len1,ndy=dy/len1,dx2=x2-x1,dy2=y2-y1,len22=dx2*dx2+dy2*dy2,len2=Math.sqrt(len22);if(!(len2<=1e-6)){var ndx2=dx2/len2,ndy2=dy2/len2,odx=ndx+ndx2,ody=ndy+ndy2,olen=Math.sqrt(odx*odx+ody*ody);if(!(olen<=1e-6)){var nOdx=odx/olen,nOdy=ody/olen,alpha=Math.acos(nOdx*ndx+nOdy*ndy),halfAng=Math.PI/2-alpha,ptx1=(len1=r/Math.tan(halfAng))*ndx+x1,pty1=len1*ndy+y1,orilen=Math.sqrt(len1*len1+r*r),orix=x1+nOdx*orilen,oriy=y1+nOdy*orilen,sinx=0,cosx=0;if(ndx*ndy2-ndy*ndx2>=0){var fda=2*halfAng/Context.SEGNUM;sinx=Math.sin(fda),cosx=Math.cos(fda)}else fda=2*-halfAng/Context.SEGNUM,sinx=Math.sin(fda),cosx=Math.cos(fda);var lastx=this._path._lastOriX,lasty=this._path._lastOriY,_x1=ptx1,_y1=pty1;(Math.abs(_x1-this._path._lastOriX)>.1||Math.abs(_y1-this._path._lastOriY)>.1)&&(x=_x1,y=_y1,lastx=_x1,lasty=_y1,this._path.addPoint(x,y));var cvx=ptx1-orix,cvy=pty1-oriy;for(i=0;i<Context.SEGNUM;i++){var cx=cvx*cosx+cvy*sinx,cy=-cvx*sinx+cvy*cosx;x=cx+orix,y=cy+oriy,(Math.abs(lastx-x)>.1||Math.abs(lasty-y)>.1)&&(this._path.addPoint(x,y),lastx=x,lasty=y),cvx=cx,cvy=cy}}}}},__proto.arc=function(cx,cy,r,startAngle,endAngle,counterclockwise,b){void 0===counterclockwise&&(counterclockwise=!1),void 0===b&&(b=!0);var hda,ndivs,a=0,da=0,kappa=0,dx=0,x=0,y=0,i=0;if(da=endAngle-startAngle,counterclockwise)if(Math.abs(da)>=2*Math.PI)da=2*-Math.PI;else for(;da>0;)da-=2*Math.PI;else if(Math.abs(da)>=2*Math.PI)da=2*Math.PI;else for(;da<0;)da+=2*Math.PI;var sx=this.getMatScaleX(),sy=this.getMatScaleY(),sr=r*(sx>sy?sx:sy),cl=2*Math.PI*sr;hda=da/(ndivs=0|Math.max(cl/10,10))/2,kappa=Math.abs(4/3*(1-Math.cos(hda))/Math.sin(hda)),counterclockwise&&(kappa=-kappa);var tPath=this._getPath();for(i=0;i<=ndivs;i++)a=startAngle+da*(i/ndivs),dx=Math.cos(a),y=cy+Math.sin(a)*r,(x=cx+dx*r)==this._path._lastOriX&&y==this._path._lastOriY||tPath.addPoint(x,y);dx=Math.cos(endAngle),y=cy+Math.sin(endAngle)*r,(x=cx+dx*r)==this._path._lastOriX&&y==this._path._lastOriY||tPath.addPoint(x,y)},__proto.quadraticCurveTo=function(cpx,cpy,x,y){for(var tArray=Bezier.I.getBezierPoints([this._path._lastOriX,this._path._lastOriY,cpx,cpy,x,y],30,2),i=0,n=tArray.length/2;i<n;i++)this.lineTo(tArray[2*i],tArray[2*i+1]);this.lineTo(x,y)},__proto.mixRGBandAlpha=function(color){return this._mixRGBandAlpha(color,this._shader2D.ALPHA)},__proto._mixRGBandAlpha=function(color,alpha){if(alpha>=1)return color;var a=(4278190080&color)>>>24;return 0!=a?a*=alpha:a=255*alpha,16777215&color|a<<24},__proto.strokeRect=function(x,y,width,height,parameterLineWidth){if(this.lineWidth>0){var rgba=this.mixRGBandAlpha(this.strokeStyle._color.numColor),hw=this.lineWidth/2;this._fillRect(x-hw,y-hw,width+this.lineWidth,this.lineWidth,rgba),this._fillRect(x-hw,y-hw+height,width+this.lineWidth,this.lineWidth,rgba),this._fillRect(x-hw,y+hw,this.lineWidth,height-this.lineWidth,rgba),this._fillRect(x-hw+width,y+hw,this.lineWidth,height-this.lineWidth,rgba)}},__proto.clip=function(){},__proto.drawParticle=function(x,y,pt){pt.x=x,pt.y=y,this._submits[this._submits._length++]=pt},__proto._getPath=function(){return this._path||(this._path=new Path)},__proto._fillTexture_h=function(tex,imgid,uv,oriw,orih,x,y,w){for(var stx=x,num=Math.floor(w/oriw),left=w%oriw,i=0;i<num;i++)this._inner_drawTexture(tex,imgid,stx,y,oriw,orih,this._curMat,uv,1,!1),stx+=oriw;if(left>0){var du=uv[2]-uv[0],uvr=uv[0]+du*(left/oriw),tuv=Context.tmpuv1;tuv[0]=uv[0],tuv[1]=uv[1],tuv[2]=uvr,tuv[3]=uv[3],tuv[4]=uvr,tuv[5]=uv[5],tuv[6]=uv[6],tuv[7]=uv[7],this._inner_drawTexture(tex,imgid,stx,y,left,orih,this._curMat,tuv,1,!1)}},__proto._fillTexture_v=function(tex,imgid,uv,oriw,orih,x,y,h){for(var sty=y,num=Math.floor(h/orih),left=h%orih,i=0;i<num;i++)this._inner_drawTexture(tex,imgid,x,sty,oriw,orih,this._curMat,uv,1,!1),sty+=orih;if(left>0){var dv=uv[7]-uv[1],uvb=uv[1]+dv*(left/orih),tuv=Context.tmpuv1;tuv[0]=uv[0],tuv[1]=uv[1],tuv[2]=uv[2],tuv[3]=uv[3],tuv[4]=uv[4],tuv[5]=uvb,tuv[6]=uv[6],tuv[7]=uvb,this._inner_drawTexture(tex,imgid,x,sty,oriw,left,this._curMat,tuv,1,!1)}},__proto.drawTextureWithSizeGrid=function(tex,tx,ty,width,height,sizeGrid,gx,gy){if(tex._getSource()){tx+=gx,ty+=gy;var uv=tex.uv,w=tex.bitmap.width,h=tex.bitmap.height,top=sizeGrid[0],left=sizeGrid[3],d_top=top/h,d_left=left/w,right=sizeGrid[1],bottom=sizeGrid[2],d_right=right/w,d_bottom=bottom/h,repeat=sizeGrid[4],needClip=!1;if(width==w&&(left=right=0),height==h&&(top=bottom=0),left+right>width){var clipWidth=width;needClip=!0,width=left+right,this.save(),this.clipRect(0+tx,0+ty,clipWidth,height)}var imgid=tex.bitmap.id,mat=this._curMat,tuv=this._tempUV,uvl=uv[0],uvt=uv[1],uvr=uv[4],uvb=uv[5],uvl_=uvl,uvt_=uvt,uvr_=uvr,uvb_=uvb;if(left&&top&&(uvr_=uvl+d_left,uvb_=uvt+d_top,tuv[0]=uvl,tuv[1]=uvt,tuv[2]=uvr_,tuv[3]=uvt,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl,tuv[7]=uvb_,this._inner_drawTexture(tex,imgid,tx,ty,left,top,mat,tuv,1,!1)),right&&top&&(uvl_=uvr-d_right,uvt_=uvt,uvr_=uvr,uvb_=uvt+d_top,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,this._inner_drawTexture(tex,imgid,width-right+tx,0+ty,right,top,mat,tuv,1,!1)),left&&bottom&&(uvl_=uvl,uvt_=uvb-d_bottom,uvr_=uvl+d_left,uvb_=uvb,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,this._inner_drawTexture(tex,imgid,0+tx,height-bottom+ty,left,bottom,mat,tuv,1,!1)),right&&bottom&&(uvl_=uvr-d_right,uvt_=uvb-d_bottom,uvr_=uvr,uvb_=uvb,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,this._inner_drawTexture(tex,imgid,width-right+tx,height-bottom+ty,right,bottom,mat,tuv,1,!1)),top&&(uvl_=uvl+d_left,uvt_=uvt,uvr_=uvr-d_right,uvb_=uvt+d_top,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,repeat?this._fillTexture_h(tex,imgid,tuv,tex.width-left-right,top,left+tx,ty,width-left-right):this._inner_drawTexture(tex,imgid,left+tx,ty,width-left-right,top,mat,tuv,1,!1)),bottom&&(uvl_=uvl+d_left,uvt_=uvb-d_bottom,uvr_=uvr-d_right,uvb_=uvb,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,repeat?this._fillTexture_h(tex,imgid,tuv,tex.width-left-right,bottom,left+tx,height-bottom+ty,width-left-right):this._inner_drawTexture(tex,imgid,left+tx,height-bottom+ty,width-left-right,bottom,mat,tuv,1,!1)),left&&(uvl_=uvl,uvt_=uvt+d_top,uvr_=uvl+d_left,uvb_=uvb-d_bottom,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,repeat?this._fillTexture_v(tex,imgid,tuv,left,tex.height-top-bottom,tx,top+ty,height-top-bottom):this._inner_drawTexture(tex,imgid,tx,top+ty,left,height-top-bottom,mat,tuv,1,!1)),right&&(uvl_=uvr-d_right,uvt_=uvt+d_top,uvr_=uvr,uvb_=uvb-d_bottom,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,repeat?this._fillTexture_v(tex,imgid,tuv,right,tex.height-top-bottom,width-right+tx,top+ty,height-top-bottom):this._inner_drawTexture(tex,imgid,width-right+tx,top+ty,right,height-top-bottom,mat,tuv,1,!1)),uvl_=uvl+d_left,uvt_=uvt+d_top,uvr_=uvr-d_right,uvb_=uvb-d_bottom,tuv[0]=uvl_,tuv[1]=uvt_,tuv[2]=uvr_,tuv[3]=uvt_,tuv[4]=uvr_,tuv[5]=uvb_,tuv[6]=uvl_,tuv[7]=uvb_,repeat){var tuvr=Context.tmpUVRect;tuvr[0]=uvl_,tuvr[1]=uvt_,tuvr[2]=uvr_-uvl_,tuvr[3]=uvb_-uvt_,this._fillTexture(tex,tex.width-left-right,tex.height-top-bottom,tuvr,left+tx,top+ty,width-left-right,height-top-bottom,"repeat",0,0)}else this._inner_drawTexture(tex,imgid,left+tx,top+ty,width-left-right,height-top-bottom,mat,tuv,1,!1);needClip&&this.restore()}},__getset(0,__proto,"textAlign",function(){return this._other.textAlign},function(value){this._other.textAlign===value||(this._other=this._other.make(),SaveBase.save(this,32768,this._other,!1),this._other.textAlign=value)}),__getset(0,__proto,"lineJoin",function(){return null},function(value){}),__getset(0,__proto,"fillStyle",function(){return this._shader2D.fillStyle},function(value){this._shader2D.fillStyle.equal(value)||(SaveBase.save(this,2,this._shader2D,!1),this._shader2D.fillStyle=DrawStyle.create(value),this._submitKey.other=-this._shader2D.fillStyle.toInt())}),__getset(0,__proto,"lineCap",function(){return null},function(value){}),__getset(0,__proto,"miterLimit",function(){return null},function(value){}),__getset(0,__proto,"strokeStyle",function(){return this._shader2D.strokeStyle},function(value){this._shader2D.strokeStyle.equal(value)||(SaveBase.save(this,512,this._shader2D,!1),this._shader2D.strokeStyle=DrawStyle.create(value),this._submitKey.other=-this._shader2D.strokeStyle.toInt())}),__getset(0,__proto,"globalCompositeOperation",function(){return BlendMode.NAMES[this._nBlendType]},function(value){var n=BlendMode.TOINT[value];null==n||this._nBlendType===n||(SaveBase.save(this,65536,this,!0),this._curSubmit=Submit.RENDERBASE,this._nBlendType=n)}),__getset(0,__proto,"globalAlpha",function(){return this._shader2D.ALPHA},function(value){(value=Math.floor(1e3*value)/1e3)!=this._shader2D.ALPHA&&(SaveBase.save(this,1,this._shader2D,!1),this._shader2D.ALPHA=value)}),__getset(0,__proto,"asBitmap",null,function(value){if(value){if(this._targets||(this._targets=new RenderTexture2D(this._width,this._height,1,-1)),!this._width||!this._height)throw Error("asBitmap no size!")}else this._targets&&this._targets.destroy(),this._targets=null}),__getset(0,__proto,"textBaseline",function(){return this._other.textBaseline},function(value){this._other.textBaseline===value||(this._other=this._other.make(),SaveBase.save(this,16384,this._other,!1),this._other.textBaseline=value)}),__getset(0,__proto,"lineWidth",function(){return this._other.lineWidth},function(value){this._other.lineWidth===value||(this._other=this._other.make(),SaveBase.save(this,256,this._other,!1),this._other.lineWidth=value)}),__getset(0,__proto,"font",null,function(str){this._other=this._other.make(),SaveBase.save(this,8,this._other,!1)}),__getset(0,__proto,"canvas",function(){return this._canvas}),Context.__init__=function(){Context.MAXCLIPRECT=new Rectangle(0,0,99999999,99999999),ContextParams.DEFAULT=new ContextParams},Context.set2DRenderConfig=function(){var gl=LayaGL.instance;WebGLContext.setBlend(gl,!0),WebGLContext.setBlendFunc(gl,1,771),WebGLContext.setDepthTest(gl,!1),WebGLContext.setCullFace(gl,!1),WebGLContext.setDepthMask(gl,!0),WebGLContext.setFrontFace(gl,2305),gl.viewport(0,0,RenderState2D.width,RenderState2D.height)},Context.ENUM_TEXTALIGN_DEFAULT=0,Context.ENUM_TEXTALIGN_CENTER=1,Context.ENUM_TEXTALIGN_RIGHT=2,Context._SUBMITVBSIZE=32e3,Context._MAXSIZE=99999999,Context._MAXVERTNUM=65535,Context.MAXCLIPRECT=null,Context._COUNT=0,Context.SEGNUM=32,Context._contextcount=0,Context.PI2=2*Math.PI,Context._clipID_Gen=0,__static(Context,["_textRender",function(){return this._textRender=new TextRender},"tmpuv1",function(){return this.tmpuv1=[0,0,0,0,0,0,0,0]},"tmpUV",function(){return this.tmpUV=[0,0,0,0,0,0,0,0]},"tmpUVRect",function(){return this.tmpUVRect=[0,0,0,0]}]),Context.__init$=function(){ContextParams=function(){function ContextParams(){this.lineWidth=1,this.textAlign=null,this.textBaseline=null}__class(ContextParams,"");var __proto=ContextParams.prototype;return __proto.clear=function(){this.lineWidth=1,this.textAlign=this.textBaseline=null},__proto.make=function(){return this===ContextParams.DEFAULT?new ContextParams:this},ContextParams.DEFAULT=null,ContextParams}()},Context}(),BlurFilterGLRender=function(){function BlurFilterGLRender(){}__class(BlurFilterGLRender,"laya.filters.BlurFilterGLRender");var __proto=BlurFilterGLRender.prototype;return __proto.render=function(rt,ctx,width,height,filter){var shaderValue=Value2D.create(1,0);this.setShaderInfo(shaderValue,filter,rt.width,rt.height),ctx.drawTarget(rt,0,0,width,height,Matrix.EMPTY.identity(),shaderValue)},__proto.setShaderInfo=function(shader,filter,w,h){shader.defines.add(16);var sv=shader;BlurFilterGLRender.blurinfo[0]=w,BlurFilterGLRender.blurinfo[1]=h,sv.blurInfo=BlurFilterGLRender.blurinfo;var sigma=filter.strength/3,sigma2=sigma*sigma;filter.strength_sig2_2sig2_gauss1[0]=filter.strength,filter.strength_sig2_2sig2_gauss1[1]=sigma2,filter.strength_sig2_2sig2_gauss1[2]=2*sigma2,filter.strength_sig2_2sig2_gauss1[3]=1/(2*Math.PI*sigma2),sv.strength_sig2_2sig2_gauss1=filter.strength_sig2_2sig2_gauss1},__static(BlurFilterGLRender,["blurinfo",function(){return this.blurinfo=new Array(2)}]),BlurFilterGLRender}(),CONST3D2D=function(){function CONST3D2D(){}return __class(CONST3D2D,"laya.webgl.utils.CONST3D2D"),CONST3D2D.BYTES_PE=4,CONST3D2D.BYTES_PIDX=2,CONST3D2D.defaultMatrix4=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],CONST3D2D.defaultMinusYMatrix4=[1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1],CONST3D2D.uniformMatrix3=[1,0,0,0,0,1,0,0,0,0,1,0],CONST3D2D._TMPARRAY=[],CONST3D2D._OFFSETX=0,CONST3D2D._OFFSETY=0,CONST3D2D}(),CharRenderInfo=function(){function CharRenderInfo(){this.char="",this.tex=null,this.deleted=!1,this.pos=0,this.width=0,this.height=0,this.bmpWidth=0,this.bmpHeight=0,this.orix=0,this.oriy=0,this.touchTick=0,this.isSpace=!1,this.uv=new Array(8)}return __class(CharRenderInfo,"laya.webgl.text.CharRenderInfo"),CharRenderInfo.prototype.touch=function(){var curLoop=Stat.loopCount;this.touchTick!=curLoop&&this.tex.touchRect(this,curLoop),this.touchTick=curLoop},CharRenderInfo}(),RenderState2D=(function(){function QuickTestTool(){this._renderType=0,this._repaint=0,this._x=NaN,this._y=NaN}__class(QuickTestTool,"laya.layagl.QuickTestTool");var __proto=QuickTestTool.prototype;__proto.render=function(context,x,y){QuickTestTool._addType(this._renderType),QuickTestTool.showRenderTypeInfo(this._renderType),RenderSprite.renders[this._renderType]._fun(this,context,x+this._x,y+this._y),this._repaint=0},__proto._stageRender=function(context,x,y){QuickTestTool._countStart(),QuickTestTool._PreStageRender.call(Laya.stage,context,x,y),QuickTestTool._countEnd()},QuickTestTool.getMCDName=function(type){return QuickTestTool._typeToNameDic[type]},QuickTestTool.showRenderTypeInfo=function(type,force){if(void 0===force&&(force=!1),force||!QuickTestTool.showedDic[type]){if(QuickTestTool.showedDic[type]=!0,!QuickTestTool._rendertypeToStrDic[type]){var arr=[],tType=0;for(tType=1;tType<=type;)tType&type&&arr.push(QuickTestTool.getMCDName(tType&type)),tType<<=1;QuickTestTool._rendertypeToStrDic[type]=arr.join(",")}console.log("cmd:",QuickTestTool._rendertypeToStrDic[type])}},QuickTestTool.__init__=function(){QuickTestTool._typeToNameDic[1]="ALPHA",QuickTestTool._typeToNameDic[2]="TRANSFORM",QuickTestTool._typeToNameDic[256]="TEXTURE",QuickTestTool._typeToNameDic[512]="GRAPHICS",QuickTestTool._typeToNameDic[4096]="ONECHILD",QuickTestTool._typeToNameDic[8192]="CHILDS",QuickTestTool._typeToNameDic[3]="TRANSFORM|ALPHA",QuickTestTool._typeToNameDic[8]="CANVAS",QuickTestTool._typeToNameDic[4]="BLEND",QuickTestTool._typeToNameDic[16]="FILTERS",QuickTestTool._typeToNameDic[32]="MASK",QuickTestTool._typeToNameDic[64]="CLIP",QuickTestTool._typeToNameDic[1024]="LAYAGL3D"},QuickTestTool._countStart=function(){var key;for(key in QuickTestTool._countDic)QuickTestTool._countDic[key]=0},QuickTestTool._countEnd=function(){QuickTestTool._i++,QuickTestTool._i>60&&(QuickTestTool.showCountInfo(),QuickTestTool._i=0)},QuickTestTool._addType=function(type){QuickTestTool._countDic[type]?QuickTestTool._countDic[type]+=1:QuickTestTool._countDic[type]=1},QuickTestTool.showCountInfo=function(){var key;for(key in console.log("==================="),QuickTestTool._countDic)console.log("count:"+QuickTestTool._countDic[key]),QuickTestTool.showRenderTypeInfo(key,!0)},QuickTestTool.enableQuickTest=function(){QuickTestTool.__init__(),Sprite.prototype.render=QuickTestTool.prototype.render,QuickTestTool._PreStageRender=Stage.prototype.render,Stage.prototype.render=QuickTestTool.prototype._stageRender},QuickTestTool.showedDic={},QuickTestTool._rendertypeToStrDic={},QuickTestTool._typeToNameDic={},QuickTestTool._PreStageRender=null,QuickTestTool._countDic={},QuickTestTool._i=0}(),function(){function RenderState2D(){}return __class(RenderState2D,"laya.webgl.utils.RenderState2D"),RenderState2D.mat2MatArray=function(mat,matArray){var m=mat,m4=matArray;return m4[0]=m.a,m4[1]=m.b,m4[2]=RenderState2D.EMPTYMAT4_ARRAY[2],m4[3]=RenderState2D.EMPTYMAT4_ARRAY[3],m4[4]=m.c,m4[5]=m.d,m4[6]=RenderState2D.EMPTYMAT4_ARRAY[6],m4[7]=RenderState2D.EMPTYMAT4_ARRAY[7],m4[8]=RenderState2D.EMPTYMAT4_ARRAY[8],m4[9]=RenderState2D.EMPTYMAT4_ARRAY[9],m4[10]=RenderState2D.EMPTYMAT4_ARRAY[10],m4[11]=RenderState2D.EMPTYMAT4_ARRAY[11],m4[12]=m.tx,m4[13]=m.ty,m4[14]=RenderState2D.EMPTYMAT4_ARRAY[14],m4[15]=RenderState2D.EMPTYMAT4_ARRAY[15],matArray},RenderState2D.restoreTempArray=function(){RenderState2D.TEMPMAT4_ARRAY[0]=1,RenderState2D.TEMPMAT4_ARRAY[1]=0,RenderState2D.TEMPMAT4_ARRAY[4]=0,RenderState2D.TEMPMAT4_ARRAY[5]=1,RenderState2D.TEMPMAT4_ARRAY[12]=0,RenderState2D.TEMPMAT4_ARRAY[13]=0},RenderState2D.clear=function(){RenderState2D.worldScissorTest=!1,RenderState2D.worldAlpha=1},RenderState2D._MAXSIZE=99999999,RenderState2D.EMPTYMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],RenderState2D.TEMPMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],RenderState2D.worldMatrix4=RenderState2D.TEMPMAT4_ARRAY,RenderState2D.matWVP=null,RenderState2D.worldAlpha=1,RenderState2D.worldScissorTest=!1,RenderState2D.worldShaderDefines=null,RenderState2D.worldFilters=null,RenderState2D.width=0,RenderState2D.height=0,__static(RenderState2D,["worldMatrix",function(){return this.worldMatrix=new Matrix}]),RenderState2D}()),SceneUtils=function(){var DataWatcher,InitTool;function SceneUtils(){}return __class(SceneUtils,"laya.utils.SceneUtils"),SceneUtils.getBindFun=function(value){var fun=SceneUtils._funMap.get(value);if(null==fun){var temp='"'+value+'"',str="(function(data){if(data==null)return;with(data){try{\nreturn "+(temp=temp.replace(/^"\${|}"$/g,"").replace(/\${/g,'"+').replace(/}/g,'+"'))+"\n}catch(e){}}})";fun=Laya._runScript(str),SceneUtils._funMap.set(value,fun)}return fun},SceneUtils.createByData=function(root,uiView){var tInitTool=InitTool.create();if((root=SceneUtils.createComp(uiView,root,root,null,tInitTool))._setBit(8,!0),root.hasOwnProperty("_idMap")&&(root._idMap=tInitTool._idMap),uiView.animations){var tAni,tAniO,anilist=[],animations=uiView.animations,i=0,len=animations.length;for(i=0;i<len;i++){switch(tAni=new FrameAnimation,tAniO=animations[i],tAni._setUp(tInitTool._idMap,tAniO),root[tAniO.name]=tAni,tAni._setControlNode(root),tAniO.action){case 1:tAni.play(0,!1);break;case 2:tAni.play(0,!0)}anilist.push(tAni)}root._aniList=anilist}return"Scene"===root._$componentType&&root._width>0&&null==uiView.props.hitTestPrior&&!root.mouseThrough&&(root.hitTestPrior=!0),tInitTool.beginLoad(root),root},SceneUtils.createInitTool=function(){return InitTool.create()},SceneUtils.createComp=function(uiView,comp,view,dataMap,initTool){if("Scene3D"==uiView.type||"Sprite3D"==uiView.type){var outBatchSprits=[],scene3D=Laya.Utils3D._createSceneByJsonForMaker(uiView,outBatchSprits,initTool);return"Sprite3D"==uiView.type?Laya.StaticBatchManager.combine(scene3D,outBatchSprits):Laya.StaticBatchManager.combine(null,outBatchSprits),scene3D}if(!(comp=comp||SceneUtils.getCompInstance(uiView)))return uiView.props&&uiView.props.runtime?console.warn("runtime not found:"+uiView.props.runtime):console.warn("can not create:"+uiView.type),null;var child=uiView.child;if(child)for(var isList="List"==comp._$componentType,i=0,n=child.length;i<n;i++){var node=child[i];if(!comp.hasOwnProperty("itemRender")||"render"!=node.props.name&&"render"!==node.props.renderType)if("Graphic"==node.type)ClassUtils._addGraphicsToSprite(node,comp);else if(ClassUtils._isDrawType(node.type))ClassUtils._addGraphicToSprite(node,comp,!0);else{if(isList){var arr=[],tChild=SceneUtils.createComp(node,null,view,arr,initTool);arr.length&&(tChild._$bindData=arr)}else tChild=SceneUtils.createComp(node,null,view,dataMap,initTool);"Script"==node.type?tChild instanceof laya.components.Component?comp._addComponentInstance(tChild):"owner"in tChild?tChild.owner=comp:"target"in tChild&&(tChild.target=comp):"mask"==node.props.renderType||"mask"==node.props.name?comp.mask=tChild:tChild instanceof laya.display.Node&&comp.addChild(tChild)}else comp.itemRender=node}var props=uiView.props;for(var prop in props){var value=props[prop];"string"==typeof value&&(value.indexOf("@node:")>=0||value.indexOf("@Prefab:")>=0)?initTool&&initTool.addNodeRef(comp,prop,value):SceneUtils.setCompValue(comp,prop,value,view,dataMap)}return comp._afterInited&&comp._afterInited(),uiView.compId&&initTool&&initTool._idMap&&(initTool._idMap[uiView.compId]=comp),comp},SceneUtils.setCompValue=function(comp,prop,value,view,dataMap){if("string"==typeof value&&value.indexOf("${")>-1){if(SceneUtils._sheet||(SceneUtils._sheet=ClassUtils.getClass("laya.data.Table")),!SceneUtils._sheet)return void console.warn("Can not find class Sheet");if(dataMap)dataMap.push(comp,prop,value);else if(view){-1==value.indexOf("].")&&(value=value.replace(".","[0]."));var one,temp,watcher=new DataWatcher(comp,prop,value);watcher.exe(view);for(var str=value.replace(/\[.*?\]\./g,".");null!=(one=SceneUtils._parseWatchData.exec(str));){for(var key1=one[1];null!=(temp=SceneUtils._parseKeyWord.exec(key1));){var key2=temp[0],arr=view._watchMap[key2]||(view._watchMap[key2]=[]);arr.push(watcher),SceneUtils._sheet.I.notifer.on(key2,view,view.changeData,[key2])}(arr=view._watchMap[key1]||(view._watchMap[key1]=[])).push(watcher),SceneUtils._sheet.I.notifer.on(key1,view,view.changeData,[key1])}}}else"var"===prop&&view?view[value]=comp:comp[prop]="true"===value||"false"!==value&&value},SceneUtils.getCompInstance=function(json){if("UIView"==json.type&&json.props&&json.props.pageData)return SceneUtils.createByData(null,json.props.pageData);var runtime=json.props&&json.props.runtime||json.type,compClass=ClassUtils.getClass(runtime);if(!compClass)throw"Can not find class "+runtime;if("Script"===json.type&&compClass.prototype._doAwake){var comp=Pool.createByClass(compClass);return comp._destroyed=!1,comp}return json.props&&json.props.hasOwnProperty("renderType")&&"instance"==json.props.renderType?(compClass.instance||(compClass.instance=new compClass),compClass.instance):new compClass},SceneUtils._sheet=null,__static(SceneUtils,["_funMap",function(){return this._funMap=new WeakObject},"_parseWatchData",function(){return this._parseWatchData=/\${(.*?)}/g},"_parseKeyWord",function(){return this._parseKeyWord=/[a-zA-Z_][a-zA-Z0-9_]*(?:(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+)/g}]),SceneUtils.__init$=function(){DataWatcher=function(){function DataWatcher(comp,prop,value){this.comp=null,this.prop=null,this.value=null,this.comp=comp,this.prop=prop,this.value=value}return __class(DataWatcher,""),DataWatcher.prototype.exe=function(view){var fun=SceneUtils.getBindFun(this.value);this.comp[this.prop]=fun.call(this,view)},DataWatcher}(),InitTool=function(){function InitTool(){this._nodeRefList=null,this._initList=null,this._loadList=null,this._idMap=null,this._scene=null}__class(InitTool,"");var __proto=InitTool.prototype;return __proto.reset=function(){this._nodeRefList=null,this._initList=null,this._idMap=null,this._loadList=null,this._scene=null},__proto.recover=function(){this.reset(),Pool.recover("InitTool",this)},__proto.addLoadRes=function(url,type){this._loadList||(this._loadList=[]),type?this._loadList.push({url:url,type:type}):this._loadList.push(url)},__proto.addNodeRef=function(node,prop,referStr){this._nodeRefList||(this._nodeRefList=[]),this._nodeRefList.push([node,prop,referStr]),referStr.indexOf("@Prefab:")>=0&&this.addLoadRes(referStr.replace("@Prefab:",""),"prefab")},__proto.setNodeRef=function(){if(this._nodeRefList)if(this._idMap){var len,tRefInfo,i=0;for(len=this._nodeRefList.length,i=0;i<len;i++)(tRefInfo=this._nodeRefList[i])[0][tRefInfo[1]]=this.getReferData(tRefInfo[2]);this._nodeRefList=null}else this._nodeRefList=null},__proto.getReferData=function(referStr){if(referStr.indexOf("@Prefab:")>=0)return Loader.getRes(referStr.replace("@Prefab:",""));if(referStr.indexOf("@arr:")>=0){var list,len,tStr,i=0;for(len=(list=(referStr=referStr.replace("@arr:","")).split(",")).length,i=0;i<len;i++)tStr=list[i],list[i]=tStr?this._idMap[tStr.replace("@node:","")]:null;return list}return this._idMap[referStr.replace("@node:","")]},__proto.addInitItem=function(item){this._initList||(this._initList=[]),this._initList.push(item)},__proto.doInits=function(){this._initList&&(this._initList=null)},__proto.finish=function(){this.setNodeRef(),this.doInits(),this._scene._setBit(8,!1),this._scene.parent&&this._scene.parent.activeInHierarchy&&this._scene.active&&this._scene._processActive(),this._scene.event("onViewCreated"),this.recover()},__proto.beginLoad=function(scene){this._scene=scene,!this._loadList||this._loadList.length<1?this.finish():Laya.loader.load(this._loadList,Handler.create(this,this.finish))},InitTool.create=function(){var tool=Pool.getItemByClass("InitTool",InitTool);return tool._idMap=[],tool},InitTool}()},SceneUtils}(),Rectangle=function(){function Rectangle(x,y,width,height){void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),this.x=x,this.y=y,this.width=width,this.height=height}__class(Rectangle,"laya.maths.Rectangle");var __proto=Rectangle.prototype;return __proto.setTo=function(x,y,width,height){return this.x=x,this.y=y,this.width=width,this.height=height,this},__proto.reset=function(){return this.x=this.y=this.width=this.height=0,this},__proto.recover=function(){this!=Rectangle.TEMP&&this!=Rectangle.EMPTY?Pool.recover("Rectangle",this.reset()):console.log("recover Temp or Empty:",this)},__proto.copyFrom=function(source){return this.x=source.x,this.y=source.y,this.width=source.width,this.height=source.height,this},__proto.contains=function(x,y){return!(this.width<=0||this.height<=0)&&(x>=this.x&&x<this.right&&y>=this.y&&y<this.bottom)},__proto.intersects=function(rect){return!(rect.x>this.x+this.width||rect.x+rect.width<this.x||rect.y>this.y+this.height||rect.y+rect.height<this.y)},__proto.intersection=function(rect,out){return this.intersects(rect)?(out||(out=new Rectangle),out.x=Math.max(this.x,rect.x),out.y=Math.max(this.y,rect.y),out.width=Math.min(this.right,rect.right)-out.x,out.height=Math.min(this.bottom,rect.bottom)-out.y,out):null},__proto.union=function(source,out){return out||(out=new Rectangle),this.clone(out),source.width<=0||source.height<=0?out:(out.addPoint(source.x,source.y),out.addPoint(source.right,source.bottom),this)},__proto.clone=function(out){return out||(out=new Rectangle),out.x=this.x,out.y=this.y,out.width=this.width,out.height=this.height,out},__proto.toString=function(){return this.x+","+this.y+","+this.width+","+this.height},__proto.equals=function(rect){return!(!rect||rect.x!==this.x||rect.y!==this.y||rect.width!==this.width||rect.height!==this.height)},__proto.addPoint=function(x,y){return this.x>x&&(this.width+=this.x-x,this.x=x),this.y>y&&(this.height+=this.y-y,this.y=y),this.width<x-this.x&&(this.width=x-this.x),this.height<y-this.y&&(this.height=y-this.y),this},__proto._getBoundPoints=function(){var rst=Rectangle._temB;return rst.length=0,0==this.width||0==this.height?rst:(rst.push(this.x,this.y,this.x+this.width,this.y,this.x,this.y+this.height,this.x+this.width,this.y+this.height),rst)},__proto.isEmpty=function(){return this.width<=0||this.height<=0},__getset(0,__proto,"right",function(){return this.x+this.width}),__getset(0,__proto,"bottom",function(){return this.y+this.height}),Rectangle.create=function(){return Pool.getItemByClass("Rectangle",Rectangle)},Rectangle._getBoundPointS=function(x,y,width,height){var rst=Rectangle._temA;return rst.length=0,0==width||0==height?rst:(rst.push(x,y,x+width,y,x,y+height,x+width,y+height),rst)},Rectangle._getWrapRec=function(pointList,rst){if(!pointList||pointList.length<1)return rst?rst.setTo(0,0,0,0):Rectangle.TEMP.setTo(0,0,0,0);rst=rst||laya.maths.Rectangle.create();var i,minX,maxX,minY,maxY,len=pointList.length,tPoint=Point.TEMP;for(maxX=maxY=-(minX=minY=99999),i=0;i<len;i+=2)tPoint.x=pointList[i],tPoint.y=pointList[i+1],minX=minX<tPoint.x?minX:tPoint.x,minY=minY<tPoint.y?minY:tPoint.y,maxX=maxX>tPoint.x?maxX:tPoint.x,maxY=maxY>tPoint.y?maxY:tPoint.y;return rst.setTo(minX,minY,maxX-minX,maxY-minY)},Rectangle.EMPTY=new Rectangle,Rectangle.TEMP=new Rectangle,Rectangle._temB=[],Rectangle._temA=[],Rectangle}(),KeyBoardManager=function(){function KeyBoardManager(){}return __class(KeyBoardManager,"laya.events.KeyBoardManager"),KeyBoardManager.__init__=function(){KeyBoardManager._addEvent("keydown"),KeyBoardManager._addEvent("keypress"),KeyBoardManager._addEvent("keyup")},KeyBoardManager._addEvent=function(type){Browser.document.addEventListener(type,function(e){laya.events.KeyBoardManager._dispatch(e,type)},!0)},KeyBoardManager._dispatch=function(e,type){if(KeyBoardManager.enabled){KeyBoardManager._event._stoped=!1,KeyBoardManager._event.nativeEvent=e,KeyBoardManager._event.keyCode=e.keyCode||e.which||e.charCode,"keydown"===type?KeyBoardManager._pressKeys[KeyBoardManager._event.keyCode]=!0:"keyup"===type&&(KeyBoardManager._pressKeys[KeyBoardManager._event.keyCode]=null);for(var target=Laya.stage.focus&&null!=Laya.stage.focus.event&&Laya.stage.focus.displayedInStage?Laya.stage.focus:Laya.stage,ct=target;ct;)ct.event(type,KeyBoardManager._event.setTo(type,ct,target)),ct=ct.parent}},KeyBoardManager.hasKeyDown=function(key){return KeyBoardManager._pressKeys[key]},KeyBoardManager._pressKeys={},KeyBoardManager.enabled=!0,__static(KeyBoardManager,["_event",function(){return this._event=new Event}]),KeyBoardManager}(),LayaGLRunner=function(){function LayaGLRunner(){}return __class(LayaGLRunner,"laya.layagl.LayaGLRunner"),LayaGLRunner.uploadShaderUniforms=function(layaGL,commandEncoder,shaderData,uploadUnTexture){for(var data=shaderData._data,shaderUniform=commandEncoder.getArrayData(),shaderCall=0,i=0,n=shaderUniform.length;i<n;i++){var one=shaderUniform[i];if(uploadUnTexture||-1!==one.textureID){var value=data[one.dataOffset];null!=value&&(shaderCall+=one.fun.call(one.caller,one,value))}}return shaderCall},LayaGLRunner.uploadCustomUniform=function(layaGL,custom,index,data){var shaderCall=0,one=custom[index];return one&&null!=data&&(shaderCall+=one.fun.call(one.caller,one,data)),shaderCall},LayaGLRunner.uploadShaderUniformsForNative=function(layaGL,commandEncoder,shaderData){var nType=0;shaderData._runtimeCopyValues.length>0&&(nType=1);var data=shaderData._data;return layaGL.uploadShaderUniforms(commandEncoder,data,nType)},LayaGLRunner}(),DrawPathCmd=function(){function DrawPathCmd(){}__class(DrawPathCmd,"laya.display.cmd.DrawPathCmd");var __proto=DrawPathCmd.prototype;return __proto.recover=function(){this.paths=null,this.brush=null,this.pen=null,Pool.recover("DrawPathCmd",this)},__proto.run=function(context,gx,gy){context._drawPath(this.x+gx,this.y+gy,this.paths,this.brush,this.pen)},__getset(0,__proto,"cmdID",function(){return"DrawPath"}),DrawPathCmd.create=function(x,y,paths,brush,pen){var cmd=Pool.getItemByClass("DrawPathCmd",DrawPathCmd);return cmd.x=x,cmd.y=y,cmd.paths=paths,cmd.brush=brush,cmd.pen=pen,cmd},DrawPathCmd.ID="DrawPath",DrawPathCmd}(),BufferStateBase=function(){function BufferStateBase(){this._nativeVertexArrayObject=null,this._bindedIndexBuffer=null,this._nativeVertexArrayObject=LayaGL.instance.createVertexArray()}__class(BufferStateBase,"laya.webgl.BufferStateBase");var __proto=BufferStateBase.prototype;return __proto.bind=function(){BufferStateBase._curBindedBufferState!==this&&(LayaGL.instance.bindVertexArray(this._nativeVertexArrayObject),BufferStateBase._curBindedBufferState=this)},__proto.unBind=function(){if(BufferStateBase._curBindedBufferState!==this)throw"BufferState: must call bind() function first.";LayaGL.instance.bindVertexArray(null),BufferStateBase._curBindedBufferState=null},__proto.bindForNative=function(){LayaGL.instance.bindVertexArray(this._nativeVertexArrayObject),BufferStateBase._curBindedBufferState=this},__proto.unBindForNative=function(){LayaGL.instance.bindVertexArray(null),BufferStateBase._curBindedBufferState=null},__proto.destroy=function(){LayaGL.instance.deleteVertexArray(this._nativeVertexArrayObject)},BufferStateBase._curBindedBufferState=null,BufferStateBase}(),SaveCmd=function(){function SaveCmd(){}__class(SaveCmd,"laya.display.cmd.SaveCmd");var __proto=SaveCmd.prototype;return __proto.recover=function(){Pool.recover("SaveCmd",this)},__proto.run=function(context,gx,gy){context.save()},__getset(0,__proto,"cmdID",function(){return"Save"}),SaveCmd.create=function(){return Pool.getItemByClass("SaveCmd",SaveCmd)},SaveCmd.ID="Save",SaveCmd}(),LocalStorage=function(){var Storage;function LocalStorage(){}return __class(LocalStorage,"laya.net.LocalStorage"),LocalStorage.__init__=function(){return LocalStorage._baseClass||(LocalStorage._baseClass=Storage,Storage.init()),LocalStorage.items=LocalStorage._baseClass.items,LocalStorage.support=LocalStorage._baseClass.support,LocalStorage.support},LocalStorage.setItem=function(key,value){LocalStorage._baseClass.setItem(key,value)},LocalStorage.getItem=function(key){return LocalStorage._baseClass.getItem(key)},LocalStorage.setJSON=function(key,value){LocalStorage._baseClass.setJSON(key,value)},LocalStorage.getJSON=function(key){return LocalStorage._baseClass.getJSON(key)},LocalStorage.removeItem=function(key){LocalStorage._baseClass.removeItem(key)},LocalStorage.clear=function(){LocalStorage._baseClass.clear()},LocalStorage._baseClass=null,LocalStorage.items=null,LocalStorage.support=!1,LocalStorage.__init$=function(){Storage=function(){function Storage(){}return __class(Storage,""),Storage.init=function(){try{Storage.support=!0,Storage.items=window.localStorage,Storage.setItem("laya","1"),Storage.removeItem("laya")}catch(e){Storage.support=!1}Storage.support||console.log("LocalStorage is not supprot or browser is private mode.")},Storage.setItem=function(key,value){try{Storage.support&&Storage.items.setItem(key,value)}catch(e){console.warn("set localStorage failed",e)}},Storage.getItem=function(key){return Storage.support?Storage.items.getItem(key):null},Storage.setJSON=function(key,value){try{Storage.support&&Storage.items.setItem(key,JSON.stringify(value))}catch(e){console.warn("set localStorage failed",e)}},Storage.getJSON=function(key){return JSON.parse(Storage.support?Storage.items.getItem(key):null)},Storage.removeItem=function(key){Storage.support&&Storage.items.removeItem(key)},Storage.clear=function(){Storage.support&&Storage.items.clear()},Storage.items=null,Storage.support=!1,Storage}()},LocalStorage}(),WebGL=function(){function WebGL(){}return __class(WebGL,"laya.webgl.WebGL"),WebGL._uint8ArraySlice=function(){for(var sz=this.length,dec=new Uint8Array(this.length),i=0;i<sz;i++)dec[i]=this[i];return dec},WebGL._float32ArraySlice=function(){for(var sz=this.length,dec=new Float32Array(this.length),i=0;i<sz;i++)dec[i]=this[i];return dec},WebGL._uint16ArraySlice=function(__arg){var dec,arg=arguments,sz=0,i=0;if(0===arg.length)for(sz=this.length,dec=new Uint16Array(sz),i=0;i<sz;i++)dec[i]=this[i];else if(2===arg.length){var start=arg[0],end=arg[1];if(end>start)for(sz=end-start,dec=new Uint16Array(sz),i=start;i<end;i++)dec[i-start]=this[i];else dec=new Uint16Array(0)}return dec},WebGL._nativeRender_enable=function(){WebGL.isNativeRender_enable||(WebGL.isNativeRender_enable=!0,WebGLContext.__init_native(),Shader.prototype.uploadTexture2D=function(value){var CTX=WebGLContext;CTX.bindTexture(laya.webgl.WebGL.mainContext,CTX.TEXTURE_2D,value)},RenderState2D.width=Browser.window.innerWidth,RenderState2D.height=Browser.window.innerHeight,RunDriver.measureText=function(txt,font){return window.conchTextCanvas.font=font,window.conchTextCanvas.measureText(txt)},RunDriver.enableNative=function(){Render.supportWebGLPlusRendering&&(LayaGLRunner.uploadShaderUniforms=LayaGLRunner.uploadShaderUniformsForNative,CommandEncoder=window.GLCommandEncoder,LayaGL=window.LayaGLContext);var stage=Stage;stage.prototype.render=stage.prototype.renderToNative},RunDriver.clear=function(color){Context.set2DRenderConfig();var c=ColorUtils.create(color).arrColor,gl=LayaGL.instance;c&&gl.clearColor(c[0],c[1],c[2],c[3]),gl.clear(17664),RenderState2D.clear()},RunDriver.drawToCanvas=RunDriver.drawToTexture=function(sprite,_renderType,canvasWidth,canvasHeight,offsetX,offsetY){offsetX-=sprite.x,offsetY-=sprite.y,offsetX|=0,offsetY|=0,canvasWidth|=0,canvasHeight|=0;var canv=new HTMLCanvas(!1),ctx=canv.getContext("2d");return canv.size(canvasWidth,canvasHeight),ctx.asBitmap=!0,ctx._targets.start(),RenderSprite.renders[_renderType]._fun(sprite,ctx,offsetX,offsetY),ctx.flush(),ctx._targets.end(),ctx._targets.restore(),canv},RenderTexture2D.prototype._uv=RenderTexture2D.flipyuv,Object.defineProperty(RenderTexture2D.prototype,"uv",{get:function(){return this._uv},set:function(v){this._uv=v}}),HTMLCanvas.prototype.getTexture=function(){return this._texture||(this._texture=this.context._targets,this._texture.uv=RenderTexture2D.flipyuv,this._texture.bitmap=this._texture),this._texture})},WebGL.enable=function(){return!0},WebGL.inner_enable=function(){return Float32Array.prototype.slice||(Float32Array.prototype.slice=WebGL._float32ArraySlice),Uint16Array.prototype.slice||(Uint16Array.prototype.slice=WebGL._uint16ArraySlice),Uint8Array.prototype.slice||(Uint8Array.prototype.slice=WebGL._uint8ArraySlice),Render.isConchApp&&WebGL._nativeRender_enable(),!0},WebGL.onStageResize=function(width,height){null!=WebGL.mainContext&&(WebGL.mainContext.viewport(0,0,width,height),RenderState2D.width=width,RenderState2D.height=height)},WebGL.mainContext=null,WebGL.shaderHighPrecision=!1,WebGL._isWebGL2=!1,WebGL.isNativeRender_enable=!1,WebGL}(),WeakObject=function(){function WeakObject(){this._obj=null,this._obj=WeakObject.supportWeakMap?new Browser.window.WeakMap:{},WeakObject.supportWeakMap||WeakObject._maps.push(this)}__class(WeakObject,"laya.utils.WeakObject");var __proto=WeakObject.prototype;return __proto.set=function(key,value){if(null!=key)if(WeakObject.supportWeakMap){var objKey=key;"string"!=typeof key&&"number"!=typeof key||(objKey=WeakObject._keys[key])||(objKey=WeakObject._keys[key]={k:key}),this._obj.set(objKey,value)}else"string"==typeof key||"number"==typeof key?this._obj[key]=value:(key.$_GID||(key.$_GID=Utils.getGID()),this._obj[key.$_GID]=value)},__proto.get=function(key){if(null==key)return null;if(WeakObject.supportWeakMap){var objKey="string"==typeof key||"number"==typeof key?WeakObject._keys[key]:key;return objKey?this._obj.get(objKey):null}return"string"==typeof key||"number"==typeof key?this._obj[key]:this._obj[key.$_GID]},__proto.del=function(key){if(null!=key)if(WeakObject.supportWeakMap){var objKey="string"==typeof key||"number"==typeof key?WeakObject._keys[key]:key;if(!objKey)return;this._obj.delete(objKey)}else"string"==typeof key||"number"==typeof key?delete this._obj[key]:delete this._obj[this._obj.$_GID]},__proto.has=function(key){if(null==key)return!1;if(WeakObject.supportWeakMap){var objKey="string"==typeof key||"number"==typeof key?WeakObject._keys[key]:key;return this._obj.has(objKey)}return"string"==typeof key||"number"==typeof key?null!=this._obj[key]:null!=this._obj[this._obj.$_GID]},WeakObject.__init__=function(){WeakObject.supportWeakMap=null!=Browser.window.WeakMap,WeakObject.supportWeakMap||Laya.systemTimer.loop(WeakObject.delInterval,null,WeakObject.clearCache)},WeakObject.clearCache=function(){for(var i=0,n=WeakObject._maps.length;i<n;i++){WeakObject._maps[i]._obj={}}},WeakObject.supportWeakMap=!1,WeakObject.delInterval=6e5,WeakObject._keys={},WeakObject._maps=[],__static(WeakObject,["I",function(){return this.I=new WeakObject}]),WeakObject}(),BoundsStyle=function(){function BoundsStyle(){}__class(BoundsStyle,"laya.display.css.BoundsStyle");var __proto=BoundsStyle.prototype;return __proto.reset=function(){return this.bounds&&this.bounds.recover(),this.userBounds&&this.userBounds.recover(),this.bounds=null,this.userBounds=null,this.temBM=null,this},__proto.recover=function(){Pool.recover("BoundsStyle",this.reset())},BoundsStyle.create=function(){return Pool.getItemByClass("BoundsStyle",BoundsStyle)},BoundsStyle}(),DrawStyle=function(){function DrawStyle(value){this._color=null,this.setValue(value)}__class(DrawStyle,"laya.webgl.canvas.DrawStyle");var __proto=DrawStyle.prototype;return __proto.setValue=function(value){this._color=value?value instanceof laya.utils.ColorUtils?value:ColorUtils.create(value):ColorUtils.create("#000000")},__proto.reset=function(){this._color=ColorUtils.create("#000000")},__proto.toInt=function(){return this._color.numColor},__proto.equal=function(value){return"string"==typeof value?this._color.strColor===value:value instanceof laya.utils.ColorUtils&&this._color.numColor===value.numColor},__proto.toColorStr=function(){return this._color.strColor},DrawStyle.create=function(value){if(value){var color=value instanceof laya.utils.ColorUtils?value:ColorUtils.create(value);return color._drawStyle||(color._drawStyle=new DrawStyle(value))}return DrawStyle.DEFAULT},__static(DrawStyle,["DEFAULT",function(){return this.DEFAULT=new DrawStyle("#000000")}]),DrawStyle}(),System=function(){function System(){}return __class(System,"laya.system.System"),System.changeDefinition=function(name,classObj){Laya[name]=classObj;var str=name+"=classObj";Laya._runScript(str)},System.__init__=function(){},System}(),Render=(function(){function DrawParticleCmd(){}__class(DrawParticleCmd,"laya.display.cmd.DrawParticleCmd");var __proto=DrawParticleCmd.prototype;__proto.recover=function(){this._templ=null,Pool.recover("DrawParticleCmd",this)},__proto.run=function(context,gx,gy){context.drawParticle(gx,gy,this._templ)},__getset(0,__proto,"cmdID",function(){return"DrawParticleCmd"}),DrawParticleCmd.create=function(_temp){var cmd=Pool.getItemByClass("DrawParticleCmd",DrawParticleCmd);return cmd._templ=_temp,cmd},DrawParticleCmd.ID="DrawParticleCmd"}(),function(){function Render(width,height){this._timeId=0,Render._mainCanvas.source.id="layaCanvas",Render._mainCanvas.source.width=width,Render._mainCanvas.source.height=height,laya.renders.Render.isConchApp?Browser.document.body.appendChild(Render._mainCanvas.source):Browser.onKGMiniGame||Browser.container.appendChild(Render._mainCanvas.source),this.initRender(Render._mainCanvas,width,height),Browser.window.requestAnimationFrame(function loop(stamp){Laya.stage._loop();Browser.window.requestAnimationFrame(loop)}),Laya.stage.on("visibilitychange",this,this._onVisibilitychange)}__class(Render,"laya.renders.Render");var __proto=Render.prototype;return __proto._onVisibilitychange=function(){Laya.stage.isVisibility?0!=this._timeId&&Browser.window.clearInterval(this._timeId):this._timeId=Browser.window.setInterval(this._enterFrame,1e3)},__proto.initRender=function(canvas,w,h){var gl=LayaGL.instance=WebGL.mainContext=function(canvas){var gl,names=["webgl2","webgl","experimental-webgl","webkit-3d","moz-webgl"];Config.useWebGL2||names.shift();for(var i=0;i<names.length;i++){try{gl=canvas.getContext(names[i],{stencil:Config.isStencil,alpha:Config.isAlpha,antialias:Config.isAntialias,premultipliedAlpha:Config.premultipliedAlpha,preserveDrawingBuffer:Config.preserveDrawingBuffer})}catch(e){}if(gl)return"webgl2"===names[i]&&(WebGL._isWebGL2=!0),new LayaGL,gl}return null}(laya.renders.Render._mainCanvas.source);if(!gl)return!1;canvas.size(w,h),WebGLContext.__init__(gl),Context.__init__(),Submit.__init__();var ctx=new Context;ctx.isMain=!0,laya.renders.Render._context=ctx,canvas._setContext(ctx),WebGL.shaderHighPrecision=!1;try{gl.getShaderPrecisionFormat(35632,36338).precision?WebGL.shaderHighPrecision=!0:WebGL.shaderHighPrecision=!1}catch(e){}return LayaGL.instance=gl,System.__init__(),ShaderDefines2D.__init__(),Value2D.__init__(),Shader2D.__init__(),Buffer2D.__int__(gl),BlendMode._init_(gl),!0},__proto._enterFrame=function(e){Laya.stage._loop()},__getset(1,Render,"context",function(){return Render._context}),__getset(1,Render,"canvas",function(){return Render._mainCanvas.source}),Render._context=null,Render._mainCanvas=null,Render.supportWebGLPlusCulling=!1,Render.supportWebGLPlusAnimation=!1,Render.supportWebGLPlusRendering=!1,Render.isConchApp=!1,Render.is3DMode=!1,Render.__init$=function(){Render.isConchApp=null!=window.conch,Render.isConchApp&&(Render.supportWebGLPlusCulling=!0,Render.supportWebGLPlusAnimation=!0,Render.supportWebGLPlusRendering=!0)},Render}()),ClassUtils=function(){function ClassUtils(){}return __class(ClassUtils,"laya.utils.ClassUtils"),ClassUtils.regClass=function(className,classDef){ClassUtils._classMap[className]=classDef},ClassUtils.regShortClassName=function(classes){for(var i=0;i<classes.length;i++){var classDef=classes[i],className=classDef.name;ClassUtils._classMap[className]=classDef}},ClassUtils.getRegClass=function(className){return ClassUtils._classMap[className]},ClassUtils.getClass=function(className){var classObject=ClassUtils._classMap[className]||className;return"string"==typeof classObject?Laya.__classmap[classObject]||Laya[className]:classObject},ClassUtils.getInstance=function(className){var compClass=ClassUtils.getClass(className);return compClass?new compClass:(console.warn("[error] Undefined class:",className),null)},ClassUtils.createByJson=function(json,node,root,customHandler,instanceHandler){"string"==typeof json&&(json=JSON.parse(json));var props=json.props;if(!node&&!(node=instanceHandler?instanceHandler.runWith(json):ClassUtils.getInstance(props.runtime||json.type)))return null;var child=json.child;if(child)for(var i=0,n=child.length;i<n;i++){var data=child[i];if("render"!==data.props.name&&"render"!==data.props.renderType||!node._$set_itemRender)if("Graphic"==data.type)ClassUtils._addGraphicsToSprite(data,node);else if(ClassUtils._isDrawType(data.type))ClassUtils._addGraphicToSprite(data,node,!0);else{var tChild=ClassUtils.createByJson(data,null,root,customHandler,instanceHandler);"Script"===data.type?tChild.hasOwnProperty("owner")?tChild.owner=node:tChild.hasOwnProperty("target")&&(tChild.target=node):"mask"==data.props.renderType?node.mask=tChild:node.addChild(tChild)}else node.itemRender=data}if(props)for(var prop in props){var value=props[prop];"var"===prop&&root?root[value]=node:value instanceof Array&&"function"==typeof node[prop]?node[prop].apply(node,value):node[prop]=value}return customHandler&&json.customProps&&customHandler.runWith([node,json]),node.created&&node.created(),node},ClassUtils._addGraphicsToSprite=function(graphicO,sprite){var graphics=graphicO.child;if(graphics&&!(graphics.length<1)){var g=ClassUtils._getGraphicsFromSprite(graphicO,sprite),ox=0,oy=0;graphicO.props&&(ox=ClassUtils._getObjVar(graphicO.props,"x",0),oy=ClassUtils._getObjVar(graphicO.props,"y",0)),0!=ox&&0!=oy&&g.translate(ox,oy);var len,i=0;for(len=graphics.length,i=0;i<len;i++)ClassUtils._addGraphicToGraphics(graphics[i],g);0!=ox&&0!=oy&&g.translate(-ox,-oy)}},ClassUtils._addGraphicToSprite=function(graphicO,sprite,isChild){void 0===isChild&&(isChild=!1);var g=isChild?ClassUtils._getGraphicsFromSprite(graphicO,sprite):sprite.graphics;ClassUtils._addGraphicToGraphics(graphicO,g)},ClassUtils._getGraphicsFromSprite=function(dataO,sprite){if(!dataO||!dataO.props)return sprite.graphics;var propsName=dataO.props.renderType;if("hit"===propsName||"unHit"===propsName){var hitArea=sprite._style.hitArea||(sprite.hitArea=new HitArea);hitArea[propsName]||(hitArea[propsName]=new Graphics);var g=hitArea[propsName]}return g||(g=sprite.graphics),g},ClassUtils._getTransformData=function(propsO){var m;(propsO.hasOwnProperty("pivotX")||propsO.hasOwnProperty("pivotY"))&&(m=m||new Matrix).translate(-ClassUtils._getObjVar(propsO,"pivotX",0),-ClassUtils._getObjVar(propsO,"pivotY",0));var sx=ClassUtils._getObjVar(propsO,"scaleX",1),sy=ClassUtils._getObjVar(propsO,"scaleY",1),rotate=ClassUtils._getObjVar(propsO,"rotation",0);ClassUtils._getObjVar(propsO,"skewX",0),ClassUtils._getObjVar(propsO,"skewY",0);return 1==sx&&1==sy&&0==rotate||((m=m||new Matrix).scale(sx,sy),m.rotate(.0174532922222222*rotate)),m},ClassUtils._addGraphicToGraphics=function(graphicO,graphic){var propsO,drawConfig;if((propsO=graphicO.props)&&(drawConfig=ClassUtils.DrawTypeDic[graphicO.type])){var g=graphic,params=ClassUtils._getParams(propsO,drawConfig[1],drawConfig[2],drawConfig[3]),m=ClassUtils._tM;(m||1!=ClassUtils._alpha)&&(g.save(),m&&g.transform(m),1!=ClassUtils._alpha&&g.alpha(ClassUtils._alpha)),g[drawConfig[0]].apply(g,params),(m||1!=ClassUtils._alpha)&&g.restore()}},ClassUtils._adptLineData=function(params){return params[2]=parseFloat(params[0])+parseFloat(params[2]),params[3]=parseFloat(params[1])+parseFloat(params[3]),params},ClassUtils._adptTextureData=function(params){return params[0]=Loader.getRes(params[0]),params},ClassUtils._adptLinesData=function(params){return params[2]=ClassUtils._getPointListByStr(params[2]),params},ClassUtils._isDrawType=function(type){return"Image"!==type&&ClassUtils.DrawTypeDic.hasOwnProperty(type)},ClassUtils._getParams=function(obj,params,xPos,adptFun){void 0===xPos&&(xPos=0);var rst=ClassUtils._temParam;rst.length=params.length;var len,m,i=0;for(len=params.length,i=0;i<len;i++)rst[i]=ClassUtils._getObjVar(obj,params[i][0],params[i][1]);return ClassUtils._alpha=ClassUtils._getObjVar(obj,"alpha",1),(m=ClassUtils._getTransformData(obj))?(xPos||(xPos=0),m.translate(rst[xPos],rst[xPos+1]),rst[xPos]=rst[xPos+1]=0,ClassUtils._tM=m):ClassUtils._tM=null,adptFun&&ClassUtils[adptFun]&&(rst=ClassUtils[adptFun](rst)),rst},ClassUtils._getPointListByStr=function(str){var len,pointArr=str.split(","),i=0;for(len=pointArr.length,i=0;i<len;i++)pointArr[i]=parseFloat(pointArr[i]);return pointArr},ClassUtils._getObjVar=function(obj,key,noValue){return obj.hasOwnProperty(key)?obj[key]:noValue},ClassUtils._temParam=[],ClassUtils._classMap={Sprite:Sprite,Scene:Scene,Text:Text,Animation:"laya.display.Animation",Skeleton:"laya.ani.bone.Skeleton",Particle2D:"laya.particle.Particle2D",div:"laya.html.dom.HTMLDivParser",p:"laya.html.dom.HTMLElement",img:"laya.html.dom.HTMLImageElement",span:"laya.html.dom.HTMLElement",br:"laya.html.dom.HTMLBrElement",style:"laya.html.dom.HTMLStyleElement",font:"laya.html.dom.HTMLElement",a:"laya.html.dom.HTMLElement","#text":"laya.html.dom.HTMLElement",link:"laya.html.dom.HTMLLinkElement"},ClassUtils._tM=null,ClassUtils._alpha=NaN,__static(ClassUtils,["DrawTypeDic",function(){return this.DrawTypeDic={Rect:["drawRect",[["x",0],["y",0],["width",0],["height",0],["fillColor",null],["lineColor",null],["lineWidth",1]]],Circle:["drawCircle",[["x",0],["y",0],["radius",0],["fillColor",null],["lineColor",null],["lineWidth",1]]],Pie:["drawPie",[["x",0],["y",0],["radius",0],["startAngle",0],["endAngle",0],["fillColor",null],["lineColor",null],["lineWidth",1]]],Image:["drawTexture",[["x",0],["y",0],["width",0],["height",0]]],Texture:["drawTexture",[["skin",null],["x",0],["y",0],["width",0],["height",0]],1,"_adptTextureData"],FillTexture:["fillTexture",[["skin",null],["x",0],["y",0],["width",0],["height",0],["repeat",null]],1,"_adptTextureData"],FillText:["fillText",[["text",""],["x",0],["y",0],["font",null],["color",null],["textAlign",null]],1],Line:["drawLine",[["x",0],["y",0],["toX",0],["toY",0],["lineColor",null],["lineWidth",0]],0,"_adptLineData"],Lines:["drawLines",[["x",0],["y",0],["points",""],["lineColor",null],["lineWidth",0]],0,"_adptLinesData"],Curves:["drawCurves",[["x",0],["y",0],["points",""],["lineColor",null],["lineWidth",0]],0,"_adptLinesData"],Poly:["drawPoly",[["x",0],["y",0],["points",""],["fillColor",null],["lineColor",null],["lineWidth",1]],0,"_adptLinesData"]}}]),ClassUtils}(),GraphicsBounds=function(){function GraphicsBounds(){this._cacheBoundsType=!1}__class(GraphicsBounds,"laya.display.GraphicsBounds");var __proto=GraphicsBounds.prototype;return __proto.destroy=function(){this._graphics=null,this._cacheBoundsType=!1,this._temp&&(this._temp.length=0),this._rstBoundPoints&&(this._rstBoundPoints.length=0),this._bounds&&this._bounds.recover(),this._bounds=null,Pool.recover("GraphicsBounds",this)},__proto.reset=function(){this._temp&&(this._temp.length=0)},__proto.getBounds=function(realSize){return void 0===realSize&&(realSize=!1),(!this._bounds||!this._temp||this._temp.length<1||realSize!=this._cacheBoundsType)&&(this._bounds=Rectangle._getWrapRec(this.getBoundPoints(realSize),this._bounds)),this._cacheBoundsType=realSize,this._bounds},__proto.getBoundPoints=function(realSize){return void 0===realSize&&(realSize=!1),(!this._temp||this._temp.length<1||realSize!=this._cacheBoundsType)&&(this._temp=this._getCmdPoints(realSize)),this._cacheBoundsType=realSize,this._rstBoundPoints=Utils.copyArray(this._rstBoundPoints,this._temp)},__proto._getCmdPoints=function(realSize){void 0===realSize&&(realSize=!1);Render._context;var rst,cmds=this._graphics.cmds;if((rst=this._temp||(this._temp=[])).length=0,cmds||null==this._graphics._one||(GraphicsBounds._tempCmds.length=0,GraphicsBounds._tempCmds.push(this._graphics._one),cmds=GraphicsBounds._tempCmds),!cmds)return rst;var matrixs=GraphicsBounds._tempMatrixArrays;matrixs.length=0;var tMatrix=GraphicsBounds._initMatrix;tMatrix.identity();for(var cmd,tex,tempMatrix=GraphicsBounds._tempMatrix,i=0,n=cmds.length;i<n;i++)switch((cmd=cmds[i]).cmdID){case"Alpha":matrixs.push(tMatrix),tMatrix=tMatrix.clone();break;case"Restore":tMatrix=matrixs.pop();break;case"Scale":tempMatrix.identity(),tempMatrix.translate(-cmd.pivotX,-cmd.pivotY),tempMatrix.scale(cmd.scaleX,cmd.scaleY),tempMatrix.translate(cmd.pivotX,cmd.pivotY),this._switchMatrix(tMatrix,tempMatrix);break;case"Rotate":tempMatrix.identity(),tempMatrix.translate(-cmd.pivotX,-cmd.pivotY),tempMatrix.rotate(cmd.angle),tempMatrix.translate(cmd.pivotX,cmd.pivotY),this._switchMatrix(tMatrix,tempMatrix);break;case"Translate":tempMatrix.identity(),tempMatrix.translate(cmd.tx,cmd.ty),this._switchMatrix(tMatrix,tempMatrix);break;case"Transform":tempMatrix.identity(),tempMatrix.translate(-cmd.pivotX,-cmd.pivotY),tempMatrix.concat(cmd.matrix),tempMatrix.translate(cmd.pivotX,cmd.pivotY),this._switchMatrix(tMatrix,tempMatrix);break;case"DrawImage":case"FillTexture":GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,cmd.width,cmd.height),tMatrix);break;case"DrawTexture":tMatrix.copyTo(tempMatrix),cmd.matrix&&tempMatrix.concat(cmd.matrix),GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,cmd.width,cmd.height),tempMatrix);break;case"DrawImage":if(tex=cmd.texture,realSize)cmd.width&&cmd.height?GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,cmd.width,cmd.height),tMatrix):GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,tex.width,tex.height),tMatrix);else{var wRate=(cmd.width||tex.sourceWidth)/tex.width,hRate=(cmd.height||tex.sourceHeight)/tex.height,oWidth=wRate*tex.sourceWidth,oHeight=hRate*tex.sourceHeight,offX=tex.offsetX>0?tex.offsetX:0,offY=tex.offsetY>0?tex.offsetY:0;offX*=wRate,offY*=hRate,GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x-offX,cmd.y-offY,oWidth,oHeight),tMatrix)}break;case"FillTexture":cmd.width&&cmd.height?GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,cmd.width,cmd.height),tMatrix):(tex=cmd.texture,GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,tex.width,tex.height),tMatrix));break;case"DrawTexture":var drawMatrix;cmd.matrix?(tMatrix.copyTo(tempMatrix),tempMatrix.concat(cmd.matrix),drawMatrix=tempMatrix):drawMatrix=tMatrix,realSize?cmd.width&&cmd.height?GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,cmd.width,cmd.height),drawMatrix):(tex=cmd.texture,GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,tex.width,tex.height),drawMatrix)):(tex=cmd.texture,wRate=(cmd.width||tex.sourceWidth)/tex.width,hRate=(cmd.height||tex.sourceHeight)/tex.height,oWidth=wRate*tex.sourceWidth,oHeight=hRate*tex.sourceHeight,offX=tex.offsetX>0?tex.offsetX:0,offY=tex.offsetY>0?tex.offsetY:0,offX*=wRate,offY*=hRate,GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x-offX,cmd.y-offY,oWidth,oHeight),drawMatrix));break;case"DrawRect":GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x,cmd.y,cmd.width,cmd.height),tMatrix);break;case"DrawCircle":GraphicsBounds._addPointArrToRst(rst,Rectangle._getBoundPointS(cmd.x-cmd.radius,cmd.y-cmd.radius,cmd.radius+cmd.radius,cmd.radius+cmd.radius),tMatrix);break;case"DrawLine":GraphicsBounds._tempPoints.length=0;var lineWidth;lineWidth=.5*cmd.lineWidth,cmd.fromX==cmd.toX?GraphicsBounds._tempPoints.push(cmd.fromX+lineWidth,cmd.fromY,cmd.toX+lineWidth,cmd.toY,cmd.fromX-lineWidth,cmd.fromY,cmd.toX-lineWidth,cmd.toY):cmd.fromY==cmd.toY?GraphicsBounds._tempPoints.push(cmd.fromX,cmd.fromY+lineWidth,cmd.toX,cmd.toY+lineWidth,cmd.fromX,cmd.fromY-lineWidth,cmd.toX,cmd.toY-lineWidth):GraphicsBounds._tempPoints.push(cmd.fromX,cmd.fromY,cmd.toX,cmd.toY),GraphicsBounds._addPointArrToRst(rst,GraphicsBounds._tempPoints,tMatrix);break;case"DrawCurves":GraphicsBounds._addPointArrToRst(rst,Bezier.I.getBezierPoints(cmd.points),tMatrix,cmd.x,cmd.y);break;case"DrawLines":case"DrawPoly":GraphicsBounds._addPointArrToRst(rst,cmd.points,tMatrix,cmd.x,cmd.y);break;case"DrawPath":GraphicsBounds._addPointArrToRst(rst,this._getPathPoints(cmd.paths),tMatrix,cmd.x,cmd.y);break;case"DrawPie":GraphicsBounds._addPointArrToRst(rst,this._getPiePoints(cmd.x,cmd.y,cmd.radius,cmd.startAngle,cmd.endAngle),tMatrix)}return rst.length>200?rst=Utils.copyArray(rst,Rectangle._getWrapRec(rst)._getBoundPoints()):rst.length>8&&(rst=GrahamScan.scanPList(rst)),rst},__proto._switchMatrix=function(tMatix,tempMatrix){tempMatrix.concat(tMatix),tempMatrix.copyTo(tMatix)},__proto._getPiePoints=function(x,y,radius,startAngle,endAngle){var rst=GraphicsBounds._tempPoints;GraphicsBounds._tempPoints.length=0;var k=Math.PI/180,d1=endAngle-startAngle;if(d1>=360||d1<=-360)return rst.push(x-radius,y-radius),rst.push(x+radius,y-radius),rst.push(x+radius,y+radius),rst.push(x-radius,y+radius),rst;rst.push(x,y);var delta=d1%360;delta<0&&(delta+=360);var end1=startAngle+delta,st=startAngle*k,ed=end1*k;rst.push(x+radius*Math.cos(st),y+radius*Math.sin(st)),rst.push(x+radius*Math.cos(ed),y+radius*Math.sin(ed));for(var s1=90*Math.ceil(startAngle/90),s2=90*Math.floor(end1/90),cs=s1;cs<=s2;cs+=90){var csr=cs*k;rst.push(x+radius*Math.cos(csr),y+radius*Math.sin(csr))}return rst},__proto._getPathPoints=function(paths){var len,tCMD,i=0,rst=GraphicsBounds._tempPoints;for(rst.length=0,len=paths.length,i=0;i<len;i++)(tCMD=paths[i]).length>1&&(rst.push(tCMD[1],tCMD[2]),tCMD.length>3&&rst.push(tCMD[3],tCMD[4]));return rst},GraphicsBounds.create=function(){return Pool.getItemByClass("GraphicsBounds",GraphicsBounds)},GraphicsBounds._addPointArrToRst=function(rst,points,matrix,dx,dy){void 0===dx&&(dx=0),void 0===dy&&(dy=0);var len,i=0;for(len=points.length,i=0;i<len;i+=2)GraphicsBounds._addPointToRst(rst,points[i]+dx,points[i+1]+dy,matrix)},GraphicsBounds._addPointToRst=function(rst,x,y,matrix){var _tempPoint=Point.TEMP;_tempPoint.setTo(x||0,y||0),matrix.transformPoint(_tempPoint),rst.push(_tempPoint.x,_tempPoint.y)},GraphicsBounds._tempPoints=[],GraphicsBounds._tempMatrixArrays=[],GraphicsBounds._tempCmds=[],__static(GraphicsBounds,["_tempMatrix",function(){return this._tempMatrix=new Matrix},"_initMatrix",function(){return this._initMatrix=new Matrix}]),GraphicsBounds}(),LayaGL=function(){function LayaGL(){}__class(LayaGL,"laya.layagl.LayaGL");var __proto=LayaGL.prototype;return __proto.createCommandEncoder=function(reserveSize,adjustSize,isSyncToRenderThread){return void 0===reserveSize&&(reserveSize=128),void 0===adjustSize&&(adjustSize=64),void 0===isSyncToRenderThread&&(isSyncToRenderThread=!1),new CommandEncoder(this,reserveSize,adjustSize,isSyncToRenderThread)},__proto.beginCommandEncoding=function(commandEncoder){},__proto.endCommandEncoding=function(){},__proto.matrix4x4Multiply=function(m1,m2,out){},__proto.evaluateClipDatasRealTime=function(nodes,playCurTime,realTimeCurrentFrameIndexs,addtive){},LayaGL.getFrameCount=function(){return 0},LayaGL.syncBufferToRenderThread=function(value,index){void 0===index&&(index=0)},LayaGL.createArrayBufferRef=function(arrayBuffer,type,syncRender){},LayaGL.createArrayBufferRefs=function(arrayBuffer,type,syncRender,refType){},LayaGL.EXECUTE_JS_THREAD_BUFFER=0,LayaGL.EXECUTE_RENDER_THREAD_BUFFER=1,LayaGL.EXECUTE_COPY_TO_RENDER=2,LayaGL.EXECUTE_COPY_TO_RENDER3D=3,LayaGL.ARRAY_BUFFER_TYPE_DATA=0,LayaGL.ARRAY_BUFFER_TYPE_CMD=1,LayaGL.ARRAY_BUFFER_REF_REFERENCE=0,LayaGL.ARRAY_BUFFER_REF_COPY=1,LayaGL.UPLOAD_SHADER_UNIFORM_TYPE_ID=0,LayaGL.UPLOAD_SHADER_UNIFORM_TYPE_DATA=1,LayaGL.instance=null,LayaGL}(),Browser=function(){function Browser(){}return __class(Browser,"laya.utils.Browser"),__getset(1,Browser,"pixelRatio",function(){if(Browser._pixelRatio<0)if(Browser.__init__(),Browser.userAgent.indexOf("Mozilla/6.0(Linux; Android 6.0; HUAWEI NXT-AL10 Build/HUAWEINXT-AL10)")>-1)Browser._pixelRatio=2;else{var ctx=Browser.context,backingStore=ctx.backingStorePixelRatio||ctx.webkitBackingStorePixelRatio||ctx.mozBackingStorePixelRatio||ctx.msBackingStorePixelRatio||ctx.oBackingStorePixelRatio||ctx.backingStorePixelRatio||1;Browser._pixelRatio=(Browser._window.devicePixelRatio||1)/backingStore,Browser._pixelRatio<1&&(Browser._pixelRatio=1)}return Browser._pixelRatio}),__getset(1,Browser,"height",function(){return Browser.__init__(),(Laya.stage&&Laya.stage.canvasRotation?Browser.clientWidth:Browser.clientHeight)*Browser.pixelRatio}),__getset(1,Browser,"clientWidth",function(){return Browser.__init__(),Browser._window.innerWidth||Browser._document.body.clientWidth}),__getset(1,Browser,"window",function(){return Browser._window||Browser.__init__()}),__getset(1,Browser,"clientHeight",function(){return Browser.__init__(),Browser._window.innerHeight||Browser._document.body.clientHeight||Browser._document.documentElement.clientHeight}),__getset(1,Browser,"width",function(){return Browser.__init__(),(Laya.stage&&Laya.stage.canvasRotation?Browser.clientHeight:Browser.clientWidth)*Browser.pixelRatio}),__getset(1,Browser,"container",function(){return Browser._container||(Browser.__init__(),Browser._container=Browser.createElement("div"),Browser._container.id="layaContainer",Browser._document.body.appendChild(Browser._container)),Browser._container},function(value){Browser._container=value}),__getset(1,Browser,"document",function(){return Browser.__init__(),Browser._document}),Browser.__init__=function(){if(Browser._window)return Browser._window;var win=Browser._window=window,doc=Browser._document=win.document,u=Browser.userAgent=win.navigator.userAgent,libs=win._layalibs;if(libs){libs.sort(function(a,b){return a.i-b.i});for(var j=0;j<libs.length;j++)libs[j].f(win,doc,Laya)}u.indexOf("MiniGame")>-1&&Browser.window.hasOwnProperty("wx")&&(laya.utils.Browser.window.hasOwnProperty("bl")?Laya.BLMiniAdapter?Laya.BLMiniAdapter.enable():console.error("请先添加小游戏适配库,详细教程:https://ldc2.layabox.com/doc/?nav=zh-ts-5-0-0"):laya.utils.Browser.window.hasOwnProperty("qq")?Laya.QQMiniAdapter?Laya.QQMiniAdapter.enable():console.error("请先添加小游戏适配库,详细教程:https://ldc2.layabox.com/doc/?nav=zh-ts-5-0-0"):Laya.MiniAdpter?Laya.MiniAdpter.enable():console.error("请先添加小游戏适配库,详细教程:https://ldc2.layabox.com/doc/?nav=zh-ts-5-0-0")),u.indexOf("SwanGame")>-1&&(Laya.BMiniAdapter?Laya.BMiniAdapter.enable():console.error("请先添加百度小游戏适配库,详细教程:https://ldc2.layabox.com/doc/?nav=zh-ts-5-0-0")),"function"==typeof getApp&&(Laya.KGMiniAdapter?Laya.KGMiniAdapter.enable():console.error("请先添加小米小游戏适配库,详细教程:https://ldc2.layabox.com/doc/?nav=zh-ts-5-0-0")),u.indexOf("OPPO")>-1&&u.indexOf("MiniGame")>-1&&(Laya.QGMiniAdapter?Laya.QGMiniAdapter.enable():console.error("请先添加OPPO小游戏适配库")),u.indexOf("VVGame")>-1&&(Laya.VVMiniAdapter?Laya.VVMiniAdapter.enable():console.error("请先添加VIVO小游戏适配库")),u.indexOf("AlipayMiniGame")>-1&&(Laya.ALIMiniAdapter?Laya.ALIMiniAdapter.enable():console.error("请先添加VIVO小游戏适配库")),win.trace=console.log,win.requestAnimationFrame=win.requestAnimationFrame||win.webkitRequestAnimationFrame||win.mozRequestAnimationFrame||win.oRequestAnimationFrame||win.msRequestAnimationFrame||function(fun){return win.setTimeout(fun,1e3/60)};var bodyStyle=doc.body.style;bodyStyle.margin=0,bodyStyle.overflow="hidden",bodyStyle["-webkit-user-select"]="none",bodyStyle["-webkit-tap-highlight-color"]="rgba(200,200,200,0)";for(var metas=doc.getElementsByTagName("meta"),i=0,flag=!1,content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no";i<metas.length;){var meta=metas[i];if("viewport"==meta.name){meta.content=content,flag=!0;break}i++}flag||((meta=doc.createElement("meta")).name="viewport",meta.content=content,doc.getElementsByTagName("head")[0].appendChild(meta)),Browser.onMobile=!!window.isConchApp||u.indexOf("Mobile")>-1,Browser.onIOS=!!u.match(/\(i[^;]+;(U;)? CPU.+Mac OS X/),Browser.onIPhone=u.indexOf("iPhone")>-1,Browser.onMac=u.indexOf("Mac OS X")>-1,Browser.onIPad=u.indexOf("iPad")>-1,Browser.onAndroid=u.indexOf("Android")>-1||u.indexOf("Adr")>-1,Browser.onWP=u.indexOf("Windows Phone")>-1,Browser.onQQBrowser=u.indexOf("QQBrowser")>-1,Browser.onMQQBrowser=u.indexOf("MQQBrowser")>-1||u.indexOf("Mobile")>-1&&u.indexOf("QQ")>-1,Browser.onIE=!!win.ActiveXObject||"ActiveXObject"in win,Browser.onWeiXin=u.indexOf("MicroMessenger")>-1,Browser.onSafari=u.indexOf("Safari")>-1,Browser.onPC=!Browser.onMobile,Browser.onMiniGame=u.indexOf("MiniGame")>-1,Browser.onBDMiniGame=u.indexOf("SwanGame")>-1,u.indexOf("OPPO")>-1&&u.indexOf("MiniGame")>-1?(Browser.onQGMiniGame=!0,Browser.onMiniGame=!1):laya.utils.Browser.window.hasOwnProperty("bl")&&u.indexOf("MiniGame")>-1?(Browser.onBLMiniGame=!0,Browser.onMiniGame=!1):laya.utils.Browser.window.hasOwnProperty("qq")&&u.indexOf("MiniGame")>-1&&(Browser.onQQMiniGame=!0,Browser.onMiniGame=!1),Browser.onVVMiniGame=u.indexOf("VVGame")>-1,Browser.onLimixiu=u.indexOf("limixiu")>-1,Browser.onKGMiniGame=u.indexOf("QuickGame")>-1,u.indexOf("AlipayMiniGame")>-1&&(Browser.onAlipayMiniGame=!0,Browser.onMiniGame=!1),Browser.supportLocalStorage=LocalStorage.__init__(),Browser.supportWebAudio=SoundManager.__init__(),Render._mainCanvas=new HTMLCanvas(!0);var style=Render._mainCanvas.source.style;style.position="absolute",style.top=style.left="0px",style.background="#000000",Browser.canvas=new HTMLCanvas(!0),Browser.context=Browser.canvas.getContext("2d");var tmpCanv=new HTMLCanvas(!0);(laya.utils.Browser.onQGMiniGame||laya.utils.Browser.onVVMiniGame)&&(tmpCanv=Render._mainCanvas);var names=["webgl","experimental-webgl","webkit-3d","moz-webgl"],gl=null;for(i=0;i<names.length;i++){try{gl=tmpCanv.source.getContext(names[i])}catch(e){}if(gl){Browser._supportWebGL=!0;break}}return win},Browser.createElement=function(type){return Browser.__init__(),Browser._document.createElement(type)},Browser.getElementById=function(type){return Browser.__init__(),Browser._document.getElementById(type)},Browser.removeElement=function(ele){ele&&ele.parentNode&&ele.parentNode.removeChild(ele)},Browser.now=function(){return Date.now()},Browser.userAgent=null,Browser.onMobile=!1,Browser.onIOS=!1,Browser.onMac=!1,Browser.onIPhone=!1,Browser.onIPad=!1,Browser.onAndroid=!1,Browser.onWP=!1,Browser.onQQBrowser=!1,Browser.onMQQBrowser=!1,Browser.onSafari=!1,Browser.onIE=!1,Browser.onWeiXin=!1,Browser.onPC=!1,Browser.onMiniGame=!1,Browser.onBDMiniGame=!1,Browser.onVVMiniGame=!1,Browser.onKGMiniGame=!1,Browser.onQGMiniGame=!1,Browser.onBLMiniGame=!1,Browser.onAlipayMiniGame=!1,Browser.onQQMiniGame=!1,Browser.onLimixiu=!1,Browser.onFirefox=!1,Browser.onEdge=!1,Browser.supportWebAudio=!1,Browser.supportLocalStorage=!1,Browser.canvas=null,Browser.context=null,Browser._window=null,Browser._document=null,Browser._container=null,Browser._pixelRatio=-1,Browser._supportWebGL=!1,Browser}(),SaveTransform=function(){function SaveTransform(){this._matrix=new Matrix}__class(SaveTransform,"laya.webgl.canvas.save.SaveTransform");var __proto=SaveTransform.prototype;return Laya.imps(__proto,{"laya.webgl.canvas.save.ISaveData":!0}),__proto.isSaveMark=function(){return!1},__proto.restore=function(context){context._curMat=this._savematrix,SaveTransform.POOL[SaveTransform.POOL._length++]=this},SaveTransform.save=function(context){var _saveMark=context._saveMark;if(2048!=(2048&_saveMark._saveuse)){_saveMark._saveuse|=2048;var no=SaveTransform.POOL,o=no._length>0?no[--no._length]:new SaveTransform;o._savematrix=context._curMat,context._curMat=context._curMat.copyTo(o._matrix);var _save=context._save;_save[_save._length++]=o}},SaveTransform.POOL=SaveBase._createArray(),SaveTransform}(),CommandEncoder=function(){function CommandEncoder(layagl,reserveSize,adjustSize,isSyncToRenderThread){this._idata=[]}__class(CommandEncoder,"laya.layagl.CommandEncoder");var __proto=CommandEncoder.prototype;return __proto.getArrayData=function(){return this._idata},__proto.getPtrID=function(){return 0},__proto.beginEncoding=function(){},__proto.endEncoding=function(){},__proto.clearEncoding=function(){this._idata.length=0},__proto.getCount=function(){return this._idata.length},__proto.add_ShaderValue=function(o){this._idata.push(o)},__proto.addShaderUniform=function(one){this.add_ShaderValue(one)},CommandEncoder}(),FillBorderTextCmd=function(){function FillBorderTextCmd(){}__class(FillBorderTextCmd,"laya.display.cmd.FillBorderTextCmd");var __proto=FillBorderTextCmd.prototype;return __proto.recover=function(){Pool.recover("FillBorderTextCmd",this)},__proto.run=function(context,gx,gy){context.fillBorderText(this.text,this.x+gx,this.y+gy,this.font,this.fillColor,this.borderColor,this.lineWidth,this.textAlign)},__getset(0,__proto,"cmdID",function(){return"FillBorderText"}),FillBorderTextCmd.create=function(text,x,y,font,fillColor,borderColor,lineWidth,textAlign){var cmd=Pool.getItemByClass("FillBorderTextCmd",FillBorderTextCmd);return cmd.text=text,cmd.x=x,cmd.y=y,cmd.font=font,cmd.fillColor=fillColor,cmd.borderColor=borderColor,cmd.lineWidth=lineWidth,cmd.textAlign=textAlign,cmd},FillBorderTextCmd.ID="FillBorderText",FillBorderTextCmd}(),Bezier=function(){function Bezier(){this._controlPoints=[new Point,new Point,new Point],this._calFun=this.getPoint2}__class(Bezier,"laya.maths.Bezier");var __proto=Bezier.prototype;return __proto._switchPoint=function(x,y){var tPoint=this._controlPoints.shift();tPoint.setTo(x,y),this._controlPoints.push(tPoint)},__proto.getPoint2=function(t,rst){var p1=this._controlPoints[0],p2=this._controlPoints[1],p3=this._controlPoints[2],lineX=Math.pow(1-t,2)*p1.x+2*t*(1-t)*p2.x+Math.pow(t,2)*p3.x,lineY=Math.pow(1-t,2)*p1.y+2*t*(1-t)*p2.y+Math.pow(t,2)*p3.y;rst.push(lineX,lineY)},__proto.getPoint3=function(t,rst){var p1=this._controlPoints[0],p2=this._controlPoints[1],p3=this._controlPoints[2],p4=this._controlPoints[3],lineX=Math.pow(1-t,3)*p1.x+3*p2.x*t*(1-t)*(1-t)+3*p3.x*t*t*(1-t)+p4.x*Math.pow(t,3),lineY=Math.pow(1-t,3)*p1.y+3*p2.y*t*(1-t)*(1-t)+3*p3.y*t*t*(1-t)+p4.y*Math.pow(t,3);rst.push(lineX,lineY)},__proto.insertPoints=function(count,rst){var dLen,i=NaN;for(dLen=1/(count=count>0?count:5),i=0;i<=1;i+=dLen)this._calFun(i,rst)},__proto.getBezierPoints=function(pList,inSertCount,count){void 0===inSertCount&&(inSertCount=5),void 0===count&&(count=2);var len,i=0;if((len=pList.length)<2*(count+1))return[];var rst=[];switch(count){case 2:this._calFun=this.getPoint2;break;case 3:this._calFun=this.getPoint3;break;default:return[]}for(;this._controlPoints.length<=count;)this._controlPoints.push(Point.create());for(i=0;i<2*count;i+=2)this._switchPoint(pList[i],pList[i+1]);for(i=2*count;i<len;i+=2)this._switchPoint(pList[i],pList[i+1]),i/2%count==0&&this.insertPoints(inSertCount,rst);return rst},__static(Bezier,["I",function(){return this.I=new Bezier}]),Bezier}(),Draw9GridTexture=function(){function Draw9GridTexture(){}__class(Draw9GridTexture,"laya.display.cmd.Draw9GridTexture");var __proto=Draw9GridTexture.prototype;return __proto.recover=function(){this.texture._removeReference(),Pool.recover("Draw9GridTexture",this)},__proto.run=function(context,gx,gy){context.drawTextureWithSizeGrid(this.texture,this.x,this.y,this.width,this.height,this.sizeGrid,gx,gy)},__getset(0,__proto,"cmdID",function(){return"Draw9GridTexture"}),Draw9GridTexture.create=function(texture,x,y,width,height,sizeGrid){var cmd=Pool.getItemByClass("Draw9GridTexture",Draw9GridTexture);return cmd.texture=texture,texture._addReference(),cmd.x=x,cmd.y=y,cmd.width=width,cmd.height=height,cmd.sizeGrid=sizeGrid,cmd},Draw9GridTexture.ID="Draw9GridTexture",Draw9GridTexture}(),TextAtlas=function(){function TextAtlas(){this.texWidth=1024,this.texHeight=1024,this.atlasgrid=null,this.protectDist=1,this.texture=null,this.charMaps={},this.texHeight=this.texWidth=TextRender.atlasWidth,this.texture=TextTexture.getTextTexture(this.texWidth,this.texHeight),this.texWidth/TextAtlas.atlasGridW>256&&(TextAtlas.atlasGridW=Math.ceil(this.texWidth/256)),this.atlasgrid=new AtlasGrid(this.texWidth/TextAtlas.atlasGridW,this.texHeight/TextAtlas.atlasGridW,this.texture.id)}__class(TextAtlas,"laya.webgl.text.TextAtlas");var __proto=TextAtlas.prototype;return __proto.setProtecteDist=function(d){this.protectDist=d},__proto.getAEmpty=function(w,h,pt){var find=this.atlasgrid.addRect(1,Math.ceil(w/TextAtlas.atlasGridW),Math.ceil(h/TextAtlas.atlasGridW),pt);return find&&(pt.x*=TextAtlas.atlasGridW,pt.y*=TextAtlas.atlasGridW),find},__proto.destroy=function(){for(var k in this.charMaps){this.charMaps[k].deleted=!0}this.texture.discard()},__proto.printDebugInfo=function(){},__getset(0,__proto,"usedRate",function(){return this.atlasgrid._used}),TextAtlas.atlasGridW=16,TextAtlas}(),StringKey=function(){function StringKey(){this._strsToID={},this._idToStrs=[],this._length=0}__class(StringKey,"laya.utils.StringKey");var __proto=StringKey.prototype;return __proto.add=function(str){var index=this._strsToID[str];return null!=index?index:(this._idToStrs[this._length]=str,this._strsToID[str]=this._length++)},__proto.getID=function(str){var index=this._strsToID[str];return null==index?-1:index},__proto.getName=function(id){var str=this._idToStrs[id];return null==str?void 0:str},StringKey}(),Dragging=function(){function Dragging(){this.ratio=.92,this.maxOffset=60,this._dragging=!1,this._clickOnly=!0}__class(Dragging,"laya.utils.Dragging");var __proto=Dragging.prototype;return __proto.start=function(target,area,hasInertia,elasticDistance,elasticBackTime,data,disableMouseEvent,ratio){void 0===ratio&&(ratio=.92),this.clearTimer(),this.target=target,this.area=area,this.hasInertia=hasInertia,this.elasticDistance=area?elasticDistance:0,this.elasticBackTime=elasticBackTime,this.data=data,this._disableMouseEvent=disableMouseEvent,this.ratio=ratio,this._parent=target.parent,this._clickOnly=!0,this._dragging=!0,this._elasticRateX=this._elasticRateY=1,this._lastX=this._parent.mouseX,this._lastY=this._parent.mouseY,Laya.stage.on("mouseup",this,this.onStageMouseUp),Laya.stage.on("mouseout",this,this.onStageMouseUp),Laya.systemTimer.frameLoop(1,this,this.loop)},__proto.clearTimer=function(){Laya.systemTimer.clear(this,this.loop),Laya.systemTimer.clear(this,this.tweenMove),this._tween&&(this._tween.recover(),this._tween=null)},__proto.stop=function(){this._dragging&&(MouseManager.instance.disableMouseEvent=!1,Laya.stage.off("mouseup",this,this.onStageMouseUp),Laya.stage.off("mouseout",this,this.onStageMouseUp),this._dragging=!1,this.target&&this.area&&this.backToArea(),this.clear())},__proto.loop=function(){var point=this._parent.getMousePoint(),mouseX=point.x,mouseY=point.y,offsetX=mouseX-this._lastX,offsetY=mouseY-this._lastY;if(this._clickOnly){if(!(Math.abs(offsetX*Laya.stage._canvasTransform.getScaleX())>1||Math.abs(offsetY*Laya.stage._canvasTransform.getScaleY())>1))return;this._clickOnly=!1,this._offsets||(this._offsets=[]),this._offsets.length=0,this.target.event("dragstart",this.data),MouseManager.instance.disableMouseEvent=this._disableMouseEvent}else this._offsets.push(offsetX,offsetY);0===offsetX&&0===offsetY||(this._lastX=mouseX,this._lastY=mouseY,this.target.x+=offsetX*this._elasticRateX,this.target.y+=offsetY*this._elasticRateY,this.area&&this.checkArea(),this.target.event("dragmove",this.data))},__proto.checkArea=function(){if(this.elasticDistance<=0)this.backToArea();else{if(this.target._x<this.area.x)var offsetX=this.area.x-this.target._x;else offsetX=this.target._x>this.area.x+this.area.width?this.target._x-this.area.x-this.area.width:0;if(this._elasticRateX=Math.max(0,1-offsetX/this.elasticDistance),this.target._y<this.area.y)var offsetY=this.area.y-this.target.y;else offsetY=this.target._y>this.area.y+this.area.height?this.target._y-this.area.y-this.area.height:0;this._elasticRateY=Math.max(0,1-offsetY/this.elasticDistance)}},__proto.backToArea=function(){this.target.x=Math.min(Math.max(this.target._x,this.area.x),this.area.x+this.area.width),this.target.y=Math.min(Math.max(this.target._y,this.area.y),this.area.y+this.area.height)},__proto.onStageMouseUp=function(e){if(MouseManager.instance.disableMouseEvent=!1,Laya.stage.off("mouseup",this,this.onStageMouseUp),Laya.stage.off("mouseout",this,this.onStageMouseUp),Laya.systemTimer.clear(this,this.loop),!this._clickOnly&&this.target)if(this.hasInertia){this._offsets.length<1&&this._offsets.push(this._parent.mouseX-this._lastX,this._parent.mouseY-this._lastY),this._offsetX=this._offsetY=0;for(var len=this._offsets.length,n=Math.min(len,6),m=this._offsets.length-n,i=len-1;i>m;i--)this._offsetY+=this._offsets[i--],this._offsetX+=this._offsets[i];this._offsetX=this._offsetX/n*2,this._offsetY=this._offsetY/n*2,Math.abs(this._offsetX)>this.maxOffset&&(this._offsetX=this._offsetX>0?this.maxOffset:-this.maxOffset),Math.abs(this._offsetY)>this.maxOffset&&(this._offsetY=this._offsetY>0?this.maxOffset:-this.maxOffset),Laya.systemTimer.frameLoop(1,this,this.tweenMove)}else this.elasticDistance>0?this.checkElastic():this.clear()},__proto.checkElastic=function(){var tx=NaN,ty=NaN;if(this.target.x<this.area.x?tx=this.area.x:this.target._x>this.area.x+this.area.width&&(tx=this.area.x+this.area.width),this.target.y<this.area.y?ty=this.area.y:this.target._y>this.area.y+this.area.height&&(ty=this.area.y+this.area.height),isNaN(tx)&&isNaN(ty))this.clear();else{var obj={};isNaN(tx)||(obj.x=tx),isNaN(ty)||(obj.y=ty),this._tween=Tween.to(this.target,obj,this.elasticBackTime,Ease.sineOut,Handler.create(this,this.clear),0,!1,!1)}},__proto.tweenMove=function(){this._offsetX*=this.ratio*this._elasticRateX,this._offsetY*=this.ratio*this._elasticRateY,this.target.x+=this._offsetX,this.target.y+=this._offsetY,this.area&&this.checkArea(),this.target.event("dragmove",this.data),(Math.abs(this._offsetX)<1&&Math.abs(this._offsetY)<1||this._elasticRateX<.5||this._elasticRateY<.5)&&(Laya.systemTimer.clear(this,this.tweenMove),this.elasticDistance>0?this.checkElastic():this.clear())},__proto.clear=function(){if(this.target){this.clearTimer();var sp=this.target;this.target=null,this._parent=null,sp.event("dragend",this.data)}},Dragging}(),Earcut=function(){function Earcut(){}return __class(Earcut,"laya.webgl.shapes.Earcut"),Earcut.earcut=function(data,holeIndices,dim){dim=dim||2;var minX,minY,maxX,maxY,x,y,invSize,hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=Earcut.linkedList(data,0,outerLen,dim,!0),triangles=[];if(!outerNode)return triangles;if(hasHoles&&(outerNode=Earcut.eliminateHoles(data,holeIndices,outerNode,dim)),data.length>80*dim){minX=maxX=data[0],minY=maxY=data[1];for(var i=dim;i<outerLen;i+=dim)(x=data[i])<minX&&(minX=x),(y=data[i+1])<minY&&(minY=y),x>maxX&&(maxX=x),y>maxY&&(maxY=y);invSize=0!==(invSize=Math.max(maxX-minX,maxY-minY))?1/invSize:0}return Earcut.earcutLinked(outerNode,triangles,dim,minX,minY,invSize),triangles},Earcut.linkedList=function(data,start,end,dim,clockwise){var i,last;if(clockwise===Earcut.signedArea(data,start,end,dim)>0)for(i=start;i<end;i+=dim)last=Earcut.insertNode(i,data[i],data[i+1],last);else for(i=end-dim;i>=start;i-=dim)last=Earcut.insertNode(i,data[i],data[i+1],last);return last&&Earcut.equals(last,last.next)&&(Earcut.removeNode(last),last=last.next),last},Earcut.filterPoints=function(start,end){if(!start)return start;end||(end=start);var again,p=start;do{if(again=!1,p.steiner||!Earcut.equals(p,p.next)&&0!==Earcut.area(p.prev,p,p.next))p=p.next;else{if(Earcut.removeNode(p),(p=end=p.prev)===p.next)break;again=!0}}while(again||p!==end);return end},Earcut.earcutLinked=function(ear,triangles,dim,minX,minY,invSize,pass){if(ear){!pass&&invSize&&Earcut.indexCurve(ear,minX,minY,invSize);for(var prev,next,stop=ear;ear.prev!==ear.next;)if(prev=ear.prev,next=ear.next,invSize?Earcut.isEarHashed(ear,minX,minY,invSize):Earcut.isEar(ear))triangles.push(prev.i/dim),triangles.push(ear.i/dim),triangles.push(next.i/dim),Earcut.removeNode(ear),ear=next.next,stop=next.next;else if((ear=next)===stop){pass?1===pass?(ear=Earcut.cureLocalIntersections(ear,triangles,dim),Earcut.earcutLinked(ear,triangles,dim,minX,minY,invSize,2)):2===pass&&Earcut.splitEarcut(ear,triangles,dim,minX,minY,invSize):Earcut.earcutLinked(Earcut.filterPoints(ear,null),triangles,dim,minX,minY,invSize,1);break}}},Earcut.isEar=function(ear){var a=ear.prev,b=ear,c=ear.next;if(Earcut.area(a,b,c)>=0)return!1;for(var p=ear.next.next;p!==ear.prev;){if(Earcut.pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&Earcut.area(p.prev,p,p.next)>=0)return!1;p=p.next}return!0},Earcut.isEarHashed=function(ear,minX,minY,invSize){var a=ear.prev,b=ear,c=ear.next;if(Earcut.area(a,b,c)>=0)return!1;for(var minTX=a.x<b.x?a.x<c.x?a.x:c.x:b.x<c.x?b.x:c.x,minTY=a.y<b.y?a.y<c.y?a.y:c.y:b.y<c.y?b.y:c.y,maxTX=a.x>b.x?a.x>c.x?a.x:c.x:b.x>c.x?b.x:c.x,maxTY=a.y>b.y?a.y>c.y?a.y:c.y:b.y>c.y?b.y:c.y,minZ=Earcut.zOrder(minTX,minTY,minX,minY,invSize),maxZ=Earcut.zOrder(maxTX,maxTY,minX,minY,invSize),p=ear.nextZ;p&&p.z<=maxZ;){if(p!==ear.prev&&p!==ear.next&&Earcut.pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&Earcut.area(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=ear.prevZ;p&&p.z>=minZ;){if(p!==ear.prev&&p!==ear.next&&Earcut.pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&Earcut.area(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0},Earcut.cureLocalIntersections=function(start,triangles,dim){var p=start;do{var a=p.prev,b=p.next.next;!Earcut.equals(a,b)&&Earcut.intersects(a,p,p.next,b)&&Earcut.locallyInside(a,b)&&Earcut.locallyInside(b,a)&&(triangles.push(a.i/dim),triangles.push(p.i/dim),triangles.push(b.i/dim),Earcut.removeNode(p),Earcut.removeNode(p.next),p=start=b),p=p.next}while(p!==start);return p},Earcut.splitEarcut=function(start,triangles,dim,minX,minY,invSize){var a=start;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&Earcut.isValidDiagonal(a,b)){var c=Earcut.splitPolygon(a,b);return a=Earcut.filterPoints(a,a.next),c=Earcut.filterPoints(c,c.next),Earcut.earcutLinked(a,triangles,dim,minX,minY,invSize),void Earcut.earcutLinked(c,triangles,dim,minX,minY,invSize)}b=b.next}a=a.next}while(a!==start)},Earcut.eliminateHoles=function(data,holeIndices,outerNode,dim){var i,len,start,end,list,queue=[];for(i=0,len=holeIndices.length;i<len;i++)start=holeIndices[i]*dim,end=i<len-1?holeIndices[i+1]*dim:data.length,(list=Earcut.linkedList(data,start,end,dim,!1))===list.next&&(list.steiner=!0),queue.push(Earcut.getLeftmost(list));for(queue.sort(Earcut.compareX),i=0;i<queue.length;i++)Earcut.eliminateHole(queue[i],outerNode),outerNode=Earcut.filterPoints(outerNode,outerNode.next);return outerNode},Earcut.compareX=function(a,b){return a.x-b.x},Earcut.eliminateHole=function(hole,outerNode){if(outerNode=Earcut.findHoleBridge(hole,outerNode)){var b=Earcut.splitPolygon(outerNode,hole);Earcut.filterPoints(b,b.next)}},Earcut.findHoleBridge=function(hole,outerNode){var m,p=outerNode,hx=hole.x,hy=hole.y,qx=-1/0;do{if(hy<=p.y&&hy>=p.next.y&&p.next.y!==p.y){var x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx){if(qx=x,x===hx){if(hy===p.y)return p;if(hy===p.next.y)return p.next}m=p.x<p.next.x?p:p.next}}p=p.next}while(p!==outerNode);if(!m)return null;if(hx===qx)return m.prev;var tan,stop=m,mx=m.x,my=m.y,tanMin=1/0;for(p=m.next;p!==stop;)hx>=p.x&&p.x>=mx&&hx!==p.x&&Earcut.pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)&&((tan=Math.abs(hy-p.y)/(hx-p.x))<tanMin||tan===tanMin&&p.x>m.x)&&Earcut.locallyInside(p,hole)&&(m=p,tanMin=tan),p=p.next;return m},Earcut.indexCurve=function(start,minX,minY,invSize){var p=start;do{null===p.z&&(p.z=Earcut.zOrder(p.x,p.y,minX,minY,invSize)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next}while(p!==start);p.prevZ.nextZ=null,p.prevZ=null,Earcut.sortLinked(p)},Earcut.sortLinked=function(list){var i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{for(p=list,list=null,tail=null,numMerges=0;p;){for(numMerges++,q=p,pSize=0,i=0;i<inSize&&(pSize++,q=q.nextZ);i++);for(qSize=inSize;pSize>0||qSize>0&&q;)0!==pSize&&(0===qSize||!q||p.z<=q.z)?(e=p,p=p.nextZ,pSize--):(e=q,q=q.nextZ,qSize--),tail?tail.nextZ=e:list=e,e.prevZ=tail,tail=e;p=q}tail.nextZ=null,inSize*=2}while(numMerges>1);return list},Earcut.zOrder=function(x,y,minX,minY,invSize){return(x=1431655765&((x=858993459&((x=252645135&((x=16711935&((x=32767*(x-minX)*invSize)|x<<8))|x<<4))|x<<2))|x<<1))|(y=1431655765&((y=858993459&((y=252645135&((y=16711935&((y=32767*(y-minY)*invSize)|y<<8))|y<<4))|y<<2))|y<<1))<<1},Earcut.getLeftmost=function(start){var p=start,leftmost=start;do{p.x<leftmost.x&&(leftmost=p),p=p.next}while(p!==start);return leftmost},Earcut.pointInTriangle=function(ax,ay,bx,by,cx,cy,px,py){return(cx-px)*(ay-py)-(ax-px)*(cy-py)>=0&&(ax-px)*(by-py)-(bx-px)*(ay-py)>=0&&(bx-px)*(cy-py)-(cx-px)*(by-py)>=0},Earcut.isValidDiagonal=function(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!Earcut.intersectsPolygon(a,b)&&Earcut.locallyInside(a,b)&&Earcut.locallyInside(b,a)&&Earcut.middleInside(a,b)},Earcut.area=function(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)},Earcut.equals=function(p1,p2){return p1.x===p2.x&&p1.y===p2.y},Earcut.intersects=function(p1,q1,p2,q2){return!!(Earcut.equals(p1,q1)&&Earcut.equals(p2,q2)||Earcut.equals(p1,q2)&&Earcut.equals(p2,q1))||Earcut.area(p1,q1,p2)>0!=Earcut.area(p1,q1,q2)>0&&Earcut.area(p2,q2,p1)>0!=Earcut.area(p2,q2,q1)>0},Earcut.intersectsPolygon=function(a,b){var p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&Earcut.intersects(p,p.next,a,b))return!0;p=p.next}while(p!==a);return!1},Earcut.locallyInside=function(a,b){return Earcut.area(a.prev,a,a.next)<0?Earcut.area(a,b,a.next)>=0&&Earcut.area(a,a.prev,b)>=0:Earcut.area(a,b,a.prev)<0||Earcut.area(a,a.next,b)<0},Earcut.middleInside=function(a,b){var p=a,inside=!1,px=(a.x+b.x)/2,py=(a.y+b.y)/2;do{p.y>py!=p.next.y>py&&p.next.y!==p.y&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x&&(inside=!inside),p=p.next}while(p!==a);return inside},Earcut.splitPolygon=function(a,b){var a2=new EarcutNode(a.i,a.x,a.y),b2=new EarcutNode(b.i,b.x,b.y),an=a.next,bp=b.prev;return a.next=b,b.prev=a,a2.next=an,an.prev=a2,b2.next=a2,a2.prev=b2,bp.next=b2,b2.prev=bp,b2},Earcut.insertNode=function(i,x,y,last){var p=new EarcutNode(i,x,y);return last?(p.next=last.next,p.prev=last,last.next.prev=p,last.next=p):(p.prev=p,p.next=p),p},Earcut.removeNode=function(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)},Earcut.signedArea=function(data,start,end,dim){for(var sum=0,i=start,j=end-dim;i<end;i+=dim)sum+=(data[j]-data[i])*(data[i+1]+data[j+1]),j=i;return sum},Earcut}(),ShaderNode=function(){function ShaderNode(includefiles){this.childs=[],this.text="",this.parent=null,this.name=null,this.noCompile=!1,this.includefiles=null,this.condition=null,this.conditionType=0,this.useFuns="",this.z=0,this.src=null,this.includefiles=includefiles}__class(ShaderNode,"laya.webgl.utils.ShaderNode");var __proto=ShaderNode.prototype;return __proto.setParent=function(parent){parent.childs.push(this),this.z=parent.z+1,this.parent=parent},__proto.setCondition=function(condition,type){condition&&(this.conditionType=type,condition=condition.replace(/(\s*$)/g,""),this.condition=function(){return this[condition]},this.condition.__condition=condition)},__proto.toscript=function(def,out){return this._toscript(def,out,++ShaderNode.__id)},__proto._toscript=function(def,out,id){if(this.childs.length<1&&!this.text)return out;out.length;if(this.condition){var ifdef=!!this.condition.call(def);if(2===this.conditionType&&(ifdef=!ifdef),!ifdef)return out}if(this.text&&out.push(this.text),this.childs.length>0&&this.childs.forEach(function(o,index,arr){o._toscript(def,out,id)}),this.includefiles.length>0&&this.useFuns.length>0)for(var funsCode,i=0,n=this.includefiles.length;i<n;i++)this.includefiles[i].curUseID!=id&&(funsCode=this.includefiles[i].file.getFunsScript(this.useFuns)).length>0&&(this.includefiles[i].curUseID=id,out[0]=funsCode+out[0]);return out},ShaderNode.__id=1,ShaderNode}(),TranslateCmd=function(){function TranslateCmd(){}__class(TranslateCmd,"laya.display.cmd.TranslateCmd");var __proto=TranslateCmd.prototype;return __proto.recover=function(){Pool.recover("TranslateCmd",this)},__proto.run=function(context,gx,gy){context.translate(this.tx,this.ty)},__getset(0,__proto,"cmdID",function(){return"Translate"}),TranslateCmd.create=function(tx,ty){var cmd=Pool.getItemByClass("TranslateCmd",TranslateCmd);return cmd.tx=tx,cmd.ty=ty,cmd},TranslateCmd.ID="Translate",TranslateCmd}(),Point=function(){function Point(x,y){void 0===x&&(x=0),void 0===y&&(y=0),this.x=x,this.y=y}__class(Point,"laya.maths.Point");var __proto=Point.prototype;return __proto.setTo=function(x,y){return this.x=x,this.y=y,this},__proto.reset=function(){return this.x=this.y=0,this},__proto.recover=function(){Pool.recover("Point",this.reset())},__proto.distance=function(x,y){return Math.sqrt((this.x-x)*(this.x-x)+(this.y-y)*(this.y-y))},__proto.toString=function(){return this.x+","+this.y},__proto.normalize=function(){var d=Math.sqrt(this.x*this.x+this.y*this.y);if(d>0){var id=1/d;this.x*=id,this.y*=id}},__proto.copy=function(point){return this.setTo(point.x,point.y)},Point.create=function(){return Pool.getItemByClass("Point",Point)},Point.TEMP=new Point,Point.EMPTY=new Point,Point}(),BasePoly=(function(){function Const(){}__class(Const,"laya.Const"),Const.NOT_ACTIVE=1,Const.ACTIVE_INHIERARCHY=2,Const.AWAKED=4,Const.NOT_READY=8,Const.DISPLAY=16,Const.HAS_ZORDER=32,Const.HAS_MOUSE=64,Const.DISPLAYED_INSTAGE=128,Const.DRAWCALL_OPTIMIZE=256}(),function(){function BasePoly(){}return __class(BasePoly,"laya.webgl.shapes.BasePoly"),BasePoly.createLine2=function(p,indices,lineWidth,indexBase,outVertex,loop){if(p.length<4)return null;var points=BasePoly.tempData.length>p.length+2?BasePoly.tempData:new Array(p.length+2);points[0]=p[0],points[1]=p[1];var newlen=2,i=0,length=p.length;for(i=2;i<length;i+=2)Math.abs(p[i]-p[i-2])+Math.abs(p[i+1]-p[i-1])>.01&&(points[newlen++]=p[i],points[newlen++]=p[i+1]);loop&&Math.abs(p[0]-points[newlen-2])+Math.abs(p[1]-points[newlen-1])>.01&&(points[newlen++]=p[0],points[newlen++]=p[1]);var result=outVertex;length=newlen/2;var px,py,p1x,p1y,p2x,p2y,p3x,p3y,perpx,perpy,perp2x,perp2y,a1,b1,c1,a2,b2,c2,denom,dist,w=lineWidth/2;p1x=points[0],p1y=points[1],perpy=p1x-(p2x=points[2]);perpx=(perpx=-(p1y-(p2y=points[3])))/(dist=Math.sqrt(perpx*perpx+perpy*perpy))*w,perpy=perpy/dist*w;for(result.push(p1x-perpx,p1y-perpy,p1x+perpx,p1y+perpy),i=1;i<length-1;i++)p1x=points[2*(i-1)],p1y=points[2*(i-1)+1],p2x=points[2*i],p2y=points[2*i+1],p3x=points[2*(i+1)],p3y=points[2*(i+1)+1],perpy=p1x-p2x,perp2y=p2x-p3x,c1=(-(perpx=(perpx=-(p1y-p2y))/(dist=Math.sqrt(perpx*perpx+perpy*perpy))*w)+p1x)*(-(perpy=perpy/dist*w)+p2y)-(-perpx+p2x)*(-perpy+p1y),c2=(-(perp2x=(perp2x=-(p2y-p3y))/(dist=Math.sqrt(perp2x*perp2x+perp2y*perp2y))*w)+p3x)*(-(perp2y=perp2y/dist*w)+p2y)-(-perp2x+p2x)*(-perp2y+p3y),denom=(a1=-perpy+p1y-(-perpy+p2y))*(b2=-perp2x+p2x-(-perp2x+p3x))-(a2=-perp2y+p3y-(-perp2y+p2y))*(b1=-perpx+p2x-(-perpx+p1x)),Math.abs(denom)<.1?(denom+=10.1,result.push(p2x-perpx,p2y-perpy,p2x+perpx,p2y+perpy)):(((px=(b1*c2-b2*c1)/denom)-p2x)*(px-p2x)+((py=(a2*c1-a1*c2)/denom)-p2y)+(py-p2y),result.push(px,py,p2x-(px-p2x),p2y-(py-p2y)));for(p1x=points[newlen-4],p1y=points[newlen-3],perpy=p1x-(p2x=points[newlen-2]),perpx=(perpx=-(p1y-(p2y=points[newlen-1])))/(dist=Math.sqrt(perpx*perpx+perpy*perpy))*w,perpy=perpy/dist*w,result.push(p2x-perpx,p2y-perpy,p2x+perpx,p2y+perpy),i=1;i<length;i++)indices.push(indexBase+2*(i-1),indexBase+2*(i-1)+1,indexBase+2*i+1,indexBase+2*i+1,indexBase+2*i,indexBase+2*(i-1));return result},BasePoly.createLineTriangle=function(path,color,width,loop,outvb,vbstride,outib){var points=path.slice(),ptlen=points.length,p1x=points[0],p1y=points[1],p2x=points[2],len=(points[2],0),rp=0,dx=0,dy=0,pointnum=ptlen/2;if(!(pointnum<=1)&&2!=pointnum){for(var tmpData=new Array(4*pointnum),realPtNum=0,ci=0,i=0;i<pointnum-1;i++)p1x=points[ci++],p1y=points[ci++],p2x=points[ci++],dy=points[ci++]-p1y,0!=(dx=p2x-p1x)&&0!=dy&&(len=Math.sqrt(dx*dx+dy*dy))>.001&&(tmpData[rp=4*realPtNum]=p1x,tmpData[rp+1]=p1y,tmpData[rp+2]=dx/len,tmpData[rp+3]=dy/len,realPtNum++);for(loop?(p1x=points[ptlen-2],p1y=points[ptlen-1],p2x=points[0],dy=points[1]-p1y,0!=(dx=p2x-p1x)&&0!=dy&&(len=Math.sqrt(dx*dx+dy*dy))>.001&&(tmpData[rp=4*realPtNum]=p1x,tmpData[rp+1]=p1y,tmpData[rp+2]=dx/len,tmpData[rp+3]=dy/len,realPtNum++)):(tmpData[rp=4*realPtNum]=p1x,tmpData[rp+1]=p1y,tmpData[rp+2]=dx/len,tmpData[rp+3]=dy/len,realPtNum++),ci=0,i=0;i<pointnum;i++){p1x=points[ci],p1y=points[ci+1],p2x=points[ci+2],points[ci+3];points[ci+4],points[ci+5]}}},__static(BasePoly,["tempData",function(){return this.tempData=new Array(256)}]),BasePoly}()),ScaleCmd=function(){function ScaleCmd(){}__class(ScaleCmd,"laya.display.cmd.ScaleCmd");var __proto=ScaleCmd.prototype;return __proto.recover=function(){Pool.recover("ScaleCmd",this)},__proto.run=function(context,gx,gy){context._scale(this.scaleX,this.scaleY,this.pivotX+gx,this.pivotY+gy)},__getset(0,__proto,"cmdID",function(){return"Scale"}),ScaleCmd.create=function(scaleX,scaleY,pivotX,pivotY){var cmd=Pool.getItemByClass("ScaleCmd",ScaleCmd);return cmd.scaleX=scaleX,cmd.scaleY=scaleY,cmd.pivotX=pivotX,cmd.pivotY=pivotY,cmd},ScaleCmd.ID="Scale",ScaleCmd}(),AlphaCmd=function(){function AlphaCmd(){}__class(AlphaCmd,"laya.display.cmd.AlphaCmd");var __proto=AlphaCmd.prototype;return __proto.recover=function(){Pool.recover("AlphaCmd",this)},__proto.run=function(context,gx,gy){context.alpha(this.alpha)},__getset(0,__proto,"cmdID",function(){return"Alpha"}),AlphaCmd.create=function(alpha){var cmd=Pool.getItemByClass("AlphaCmd",AlphaCmd);return cmd.alpha=alpha,cmd},AlphaCmd.ID="Alpha",AlphaCmd}(),Byte=function(){function Byte(data){this._xd_=!0,this._allocated_=8,this._pos_=0,this._length=0,data?(this._u8d_=new Uint8Array(data),this._d_=new DataView(this._u8d_.buffer),this._length=this._d_.byteLength):this._resizeBuffer(this._allocated_)}__class(Byte,"laya.utils.Byte");var __proto=Byte.prototype;return __proto._resizeBuffer=function(len){try{var newByteView=new Uint8Array(len);null!=this._u8d_&&(this._u8d_.length<=len?newByteView.set(this._u8d_):newByteView.set(this._u8d_.subarray(0,len))),this._u8d_=newByteView,this._d_=new DataView(newByteView.buffer)}catch(err){throw"Invalid typed array length:"+len}},__proto.getString=function(){return this.readString()},__proto.readString=function(){return this._rUTF(this.getUint16())},__proto.getFloat32Array=function(start,len){return this.readFloat32Array(start,len)},__proto.readFloat32Array=function(start,len){var end=start+len;end=end>this._length?this._length:end;var v=new Float32Array(this._d_.buffer.slice(start,end));return this._pos_=end,v},__proto.getUint8Array=function(start,len){return this.readUint8Array(start,len)},__proto.readUint8Array=function(start,len){var end=start+len;end=end>this._length?this._length:end;var v=new Uint8Array(this._d_.buffer.slice(start,end));return this._pos_=end,v},__proto.getInt16Array=function(start,len){return this.readInt16Array(start,len)},__proto.readInt16Array=function(start,len){var end=start+len;end=end>this._length?this._length:end;var v=new Int16Array(this._d_.buffer.slice(start,end));return this._pos_=end,v},__proto.getFloat32=function(){return this.readFloat32()},__proto.readFloat32=function(){if(this._pos_+4>this._length)throw"getFloat32 error - Out of bounds";var v=this._d_.getFloat32(this._pos_,this._xd_);return this._pos_+=4,v},__proto.getFloat64=function(){return this.readFloat64()},__proto.readFloat64=function(){if(this._pos_+8>this._length)throw"getFloat64 error - Out of bounds";var v=this._d_.getFloat64(this._pos_,this._xd_);return this._pos_+=8,v},__proto.writeFloat32=function(value){this._ensureWrite(this._pos_+4),this._d_.setFloat32(this._pos_,value,this._xd_),this._pos_+=4},__proto.writeFloat64=function(value){this._ensureWrite(this._pos_+8),this._d_.setFloat64(this._pos_,value,this._xd_),this._pos_+=8},__proto.getInt32=function(){return this.readInt32()},__proto.readInt32=function(){if(this._pos_+4>this._length)throw"getInt32 error - Out of bounds";var float=this._d_.getInt32(this._pos_,this._xd_);return this._pos_+=4,float},__proto.getUint32=function(){return this.readUint32()},__proto.readUint32=function(){if(this._pos_+4>this._length)throw"getUint32 error - Out of bounds";var v=this._d_.getUint32(this._pos_,this._xd_);return this._pos_+=4,v},__proto.writeInt32=function(value){this._ensureWrite(this._pos_+4),this._d_.setInt32(this._pos_,value,this._xd_),this._pos_+=4},__proto.writeUint32=function(value){this._ensureWrite(this._pos_+4),this._d_.setUint32(this._pos_,value,this._xd_),this._pos_+=4},__proto.getInt16=function(){return this.readInt16()},__proto.readInt16=function(){if(this._pos_+2>this._length)throw"getInt16 error - Out of bounds";var us=this._d_.getInt16(this._pos_,this._xd_);return this._pos_+=2,us},__proto.getUint16=function(){return this.readUint16()},__proto.readUint16=function(){if(this._pos_+2>this._length)throw"getUint16 error - Out of bounds";var us=this._d_.getUint16(this._pos_,this._xd_);return this._pos_+=2,us},__proto.writeUint16=function(value){this._ensureWrite(this._pos_+2),this._d_.setUint16(this._pos_,value,this._xd_),this._pos_+=2},__proto.writeInt16=function(value){this._ensureWrite(this._pos_+2),this._d_.setInt16(this._pos_,value,this._xd_),this._pos_+=2},__proto.getUint8=function(){return this.readUint8()},__proto.readUint8=function(){if(this._pos_+1>this._length)throw"getUint8 error - Out of bounds";return this._u8d_[this._pos_++]},__proto.writeUint8=function(value){this._ensureWrite(this._pos_+1),this._d_.setUint8(this._pos_,value),this._pos_++},__proto._getUInt8=function(pos){return this._readUInt8(pos)},__proto._readUInt8=function(pos){return this._d_.getUint8(pos)},__proto._getUint16=function(pos){return this._readUint16(pos)},__proto._readUint16=function(pos){return this._d_.getUint16(pos,this._xd_)},__proto._getMatrix=function(){return this._readMatrix()},__proto._readMatrix=function(){return new Matrix(this.getFloat32(),this.getFloat32(),this.getFloat32(),this.getFloat32(),this.getFloat32(),this.getFloat32())},__proto._rUTF=function(len){var max=this._pos_+len,c=0,c2=0,c3=0,f=String.fromCharCode,u=this._u8d_,strs=[],n=0;for(strs.length=1e3;this._pos_<max;)(c=u[this._pos_++])<128?0!=c&&(strs[n++]=f(c)):c<224?strs[n++]=f((63&c)<<6|127&u[this._pos_++]):c<240?(c2=u[this._pos_++],strs[n++]=f((31&c)<<12|(127&c2)<<6|127&u[this._pos_++])):(c2=u[this._pos_++],c3=u[this._pos_++],strs[n++]=f((15&c)<<18|(127&c2)<<12|c3<<6&127|127&u[this._pos_++])),0;return strs.length=n,strs.join("")},__proto.getCustomString=function(len){return this.readCustomString(len)},__proto.readCustomString=function(len){for(var v="",ulen=0,c=0,f=String.fromCharCode,u=this._u8d_;len>0;)if((c=u[this._pos_])<128)v+=f(c),this._pos_++,len--;else for(ulen=c-128,this._pos_++,len-=ulen;ulen>0;)c=u[this._pos_++],v+=f(u[this._pos_++]<<8|c),ulen--;return v},__proto.clear=function(){this._pos_=0,this.length=0},__proto.__getBuffer=function(){return this._d_.buffer},__proto.writeUTFBytes=function(value){for(var i=0,sz=(value+="").length;i<sz;i++){var c=value.charCodeAt(i);c<=127?this.writeByte(c):c<=2047?(this._ensureWrite(this._pos_+2),this._u8d_.set([192|c>>6,128|63&c],this._pos_),this._pos_+=2):c<=65535?(this._ensureWrite(this._pos_+3),this._u8d_.set([224|c>>12,128|c>>6&63,128|63&c],this._pos_),this._pos_+=3):(this._ensureWrite(this._pos_+4),this._u8d_.set([240|c>>18,128|c>>12&63,128|c>>6&63,128|63&c],this._pos_),this._pos_+=4)}},__proto.writeUTFString=function(value){var tPos=this.pos;this.writeUint16(1),this.writeUTFBytes(value);var dPos=this.pos-tPos-2;this._d_.setUint16(tPos,dPos,this._xd_)},__proto.readUTFString=function(){return this.readUTFBytes(this.getUint16())},__proto.getUTFString=function(){return this.readUTFString()},__proto.readUTFBytes=function(len){if(void 0===len&&(len=-1),0===len)return"";var lastBytes=this.bytesAvailable;if(len>lastBytes)throw"readUTFBytes error - Out of bounds";return len=len>0?len:lastBytes,this._rUTF(len)},__proto.getUTFBytes=function(len){return void 0===len&&(len=-1),this.readUTFBytes(len)},__proto.writeByte=function(value){this._ensureWrite(this._pos_+1),this._d_.setInt8(this._pos_,value),this._pos_+=1},__proto.readByte=function(){if(this._pos_+1>this._length)throw"readByte error - Out of bounds";return this._d_.getInt8(this._pos_++)},__proto.getByte=function(){return this.readByte()},__proto._ensureWrite=function(lengthToEnsure){this._length<lengthToEnsure&&(this._length=lengthToEnsure),this._allocated_<lengthToEnsure&&(this.length=lengthToEnsure)},__proto.writeArrayBuffer=function(arraybuffer,offset,length){if(void 0===offset&&(offset=0),void 0===length&&(length=0),offset<0||length<0)throw"writeArrayBuffer error - Out of bounds";0==length&&(length=arraybuffer.byteLength-offset),this._ensureWrite(this._pos_+length);var uint8array=new Uint8Array(arraybuffer);this._u8d_.set(uint8array.subarray(offset,offset+length),this._pos_),this._pos_+=length},__proto.readArrayBuffer=function(length){var rst;return rst=this._u8d_.buffer.slice(this._pos_,this._pos_+length),this._pos_=this._pos_+length,rst},__getset(0,__proto,"buffer",function(){var rstBuffer=this._d_.buffer;return rstBuffer.byteLength===this._length?rstBuffer:rstBuffer.slice(0,this._length)}),__getset(0,__proto,"endian",function(){return this._xd_?"littleEndian":"bigEndian"},function(value){this._xd_="littleEndian"===value}),__getset(0,__proto,"length",function(){return this._length},function(value){this._allocated_<value?this._resizeBuffer(this._allocated_=Math.floor(Math.max(value,2*this._allocated_))):this._allocated_>value&&this._resizeBuffer(this._allocated_=value),this._length=value}),__getset(0,__proto,"pos",function(){return this._pos_},function(value){this._pos_=value}),__getset(0,__proto,"bytesAvailable",function(){return this._length-this._pos_}),Byte.getSystemEndian=function(){if(!Byte._sysEndian){var buffer=new ArrayBuffer(2);new DataView(buffer).setInt16(0,256,!0),Byte._sysEndian=256===new Int16Array(buffer)[0]?"littleEndian":"bigEndian"}return Byte._sysEndian},Byte.BIG_ENDIAN="bigEndian",Byte.LITTLE_ENDIAN="littleEndian",Byte._sysEndian=null,Byte}(),CallLater=function(){var LaterHandler;function CallLater(){this._pool=[],this._map=[],this._laters=[]}__class(CallLater,"laya.utils.CallLater");var __proto=CallLater.prototype;return __proto._update=function(){var laters=this._laters,len=laters.length;if(len>0){for(var i=0,n=len-1;i<=n;i++){var handler=laters[i];this._map[handler.key]=null,null!==handler.method&&(handler.run(),handler.clear()),this._pool.push(handler),i===n&&(n=laters.length-1)}laters.length=0}},__proto._getHandler=function(caller,method){var cid=caller?caller.$_GID||(caller.$_GID=Utils.getGID()):0,mid=method.$_TID||(method.$_TID=1e5*Timer._mid++);return this._map[cid+mid]},__proto.callLater=function(caller,method,args){if(null==this._getHandler(caller,method)){if(this._pool.length)var handler=this._pool.pop();else handler=new LaterHandler;handler.caller=caller,handler.method=method,handler.args=args;var cid=caller?caller.$_GID:0,mid=method.$_TID;handler.key=cid+mid,this._map[handler.key]=handler,this._laters.push(handler)}},__proto.runCallLater=function(caller,method){var handler=this._getHandler(caller,method);handler&&null!=handler.method&&(this._map[handler.key]=null,handler.run(),handler.clear())},CallLater.I=new CallLater,CallLater.__init$=function(){LaterHandler=function(){function LaterHandler(){this.key=0,this.caller=null,this.method=null,this.args=null}__class(LaterHandler,"");var __proto=LaterHandler.prototype;return __proto.clear=function(){this.caller=null,this.method=null,this.args=null},__proto.run=function(){var caller=this.caller;if(caller&&caller.destroyed)return this.clear();var method=this.method,args=this.args;null!=method&&(args?method.apply(caller,args):method.call(caller))},LaterHandler}()},CallLater}(),Graphics=function(){function Graphics(){this._sp=null,this._one=null,this._cmds=null,this._vectorgraphArray=null,this._graphicBounds=null,this.autoDestroy=!1,this._render=this._renderEmpty,this._createData()}__class(Graphics,"laya.display.Graphics");var __proto=Graphics.prototype;return __proto._createData=function(){},__proto._clearData=function(){},__proto._destroyData=function(){},__proto.destroy=function(){this.clear(!0),this._graphicBounds&&this._graphicBounds.destroy(),this._graphicBounds=null,this._vectorgraphArray=null,this._sp&&(this._sp._renderType=0,this._sp._setRenderType(0),this._sp=null),this._destroyData()},__proto.clear=function(recoverCmds){if(void 0===recoverCmds&&(recoverCmds=!0),recoverCmds){var tCmd=this._one;if(this._cmds){var i=0,len=this._cmds.length;for(i=0;i<len;i++)(tCmd=this._cmds[i]).recover();this._cmds.length=0}else tCmd&&tCmd.recover()}else this._cmds=null;if(this._one=null,this._render=this._renderEmpty,this._clearData(),this._sp&&(this._sp._renderType&=-513,this._sp._setRenderType(this._sp._renderType)),this._repaint(),this._vectorgraphArray){for(i=0,len=this._vectorgraphArray.length;i<len;i++)VectorGraphManager.getInstance().deleteShape(this._vectorgraphArray[i]);this._vectorgraphArray.length=0}},__proto._clearBoundsCache=function(){this._graphicBounds&&this._graphicBounds.reset()},__proto._initGraphicBounds=function(){this._graphicBounds||(this._graphicBounds=GraphicsBounds.create(),this._graphicBounds._graphics=this)},__proto._repaint=function(){this._clearBoundsCache(),this._sp&&this._sp.repaint()},__proto._isOnlyOne=function(){return!this._cmds||0===this._cmds.length},__proto.getBounds=function(realSize){return void 0===realSize&&(realSize=!1),this._initGraphicBounds(),this._graphicBounds.getBounds(realSize)},__proto.getBoundPoints=function(realSize){return void 0===realSize&&(realSize=!1),this._initGraphicBounds(),this._graphicBounds.getBoundPoints(realSize)},__proto.drawImage=function(texture,x,y,width,height){if(void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),!texture)return null;if(width||(width=texture.sourceWidth),height||(height=texture.sourceHeight),texture.getIsReady()){var wRate=width/texture.sourceWidth,hRate=height/texture.sourceHeight;if(width=texture.width*wRate,height=texture.height*hRate,width<=0||height<=0)return null;x+=texture.offsetX*wRate,y+=texture.offsetY*hRate}this._sp&&(this._sp._renderType|=512,this._sp._setRenderType(this._sp._renderType));var args=DrawImageCmd.create.call(this,texture,x,y,width,height);return null==this._one?(this._one=args,this._render=this._renderOneImg):this._saveToCmd(null,args),this._repaint(),args},__proto.drawTexture=function(texture,x,y,width,height,matrix,alpha,color,blendMode){if(void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),void 0===alpha&&(alpha=1),!texture||alpha<.01)return null;if(!texture.getIsReady())return null;if(width||(width=texture.sourceWidth),height||(height=texture.sourceHeight),texture.getIsReady()){var wRate=width/texture.sourceWidth,hRate=height/texture.sourceHeight;if(width=texture.width*wRate,height=texture.height*hRate,width<=0||height<=0)return null;x+=texture.offsetX*wRate,y+=texture.offsetY*hRate}this._sp&&(this._sp._renderType|=512,this._sp._setRenderType(this._sp._renderType));var args=DrawTextureCmd.create.call(this,texture,x,y,width,height,matrix,alpha,color,blendMode);return this._repaint(),this._saveToCmd(null,args)},__proto.drawTextures=function(texture,pos){return texture?this._saveToCmd(Render._context.drawTextures,DrawTexturesCmd.create.call(this,texture,pos)):null},__proto.drawTriangles=function(texture,x,y,vertices,uvs,indices,matrix,alpha,color,blendMode){return void 0===alpha&&(alpha=1),this._saveToCmd(Render._context.drawTriangles,DrawTrianglesCmd.create.call(this,texture,x,y,vertices,uvs,indices,matrix,alpha,color,blendMode))},__proto.fillTexture=function(texture,x,y,width,height,type,offset){return void 0===width&&(width=0),void 0===height&&(height=0),void 0===type&&(type="repeat"),texture&&texture.getIsReady()?this._saveToCmd(Render._context._fillTexture,FillTextureCmd.create.call(this,texture,x,y,width,height,type,offset||Point.EMPTY,{})):null},__proto._saveToCmd=function(fun,args){return this._sp&&(this._sp._renderType|=512,this._sp._setRenderType(this._sp._renderType)),null==this._one?(this._one=args,this._render=this._renderOne):(this._render=this._renderAll,0===(this._cmds||(this._cmds=[])).length&&this._cmds.push(this._one),this._cmds.push(args)),this._repaint(),args},__proto.clipRect=function(x,y,width,height){return this._saveToCmd(Render._context.clipRect,ClipRectCmd.create.call(this,x,y,width,height))},__proto.fillText=function(text,x,y,font,color,textAlign){return this._saveToCmd(Render._context.fillText,FillTextCmd.create.call(this,text,x,y,font||Text.defaultFontStr(),color,textAlign))},__proto.fillBorderText=function(text,x,y,font,fillColor,borderColor,lineWidth,textAlign){return this._saveToCmd(Render._context.fillBorderText,FillBorderTextCmd.create.call(this,text,x,y,font||Text.defaultFontStr(),fillColor,borderColor,lineWidth,textAlign))},__proto.fillWords=function(words,x,y,font,color){return this._saveToCmd(Render._context.fillWords,FillWordsCmd.create.call(this,words,x,y,font||Text.defaultFontStr(),color))},__proto.fillBorderWords=function(words,x,y,font,fillColor,borderColor,lineWidth){return this._saveToCmd(Render._context.fillBorderWords,FillBorderWordsCmd.create.call(this,words,x,y,font||Text.defaultFontStr(),fillColor,borderColor,lineWidth))},__proto.strokeText=function(text,x,y,font,color,lineWidth,textAlign){return this._saveToCmd(Render._context.fillBorderText,StrokeTextCmd.create.call(this,text,x,y,font||Text.defaultFontStr(),null,color,lineWidth,textAlign))},__proto.alpha=function(alpha){return this._saveToCmd(Render._context.alpha,AlphaCmd.create.call(this,alpha))},__proto.transform=function(matrix,pivotX,pivotY){return void 0===pivotX&&(pivotX=0),void 0===pivotY&&(pivotY=0),this._saveToCmd(Render._context._transform,TransformCmd.create.call(this,matrix,pivotX,pivotY))},__proto.rotate=function(angle,pivotX,pivotY){return void 0===pivotX&&(pivotX=0),void 0===pivotY&&(pivotY=0),this._saveToCmd(Render._context._rotate,RotateCmd.create.call(this,angle,pivotX,pivotY))},__proto.scale=function(scaleX,scaleY,pivotX,pivotY){return void 0===pivotX&&(pivotX=0),void 0===pivotY&&(pivotY=0),this._saveToCmd(Render._context._scale,ScaleCmd.create.call(this,scaleX,scaleY,pivotX,pivotY))},__proto.translate=function(tx,ty){return this._saveToCmd(Render._context.translate,TranslateCmd.create.call(this,tx,ty))},__proto.save=function(){return this._saveToCmd(Render._context._save,SaveCmd.create.call(this))},__proto.restore=function(){return this._saveToCmd(Render._context.restore,RestoreCmd.create.call(this))},__proto.replaceText=function(text){this._repaint();var cmds=this._cmds;if(cmds){for(var i=cmds.length-1;i>-1;i--)if(this._isTextCmd(cmds[i]))return cmds[i].text=text,!0}else if(this._one&&this._isTextCmd(this._one))return this._one.text=text,!0;return!1},__proto._isTextCmd=function(cmd){var cmdID=cmd.cmdID;return"FillText"==cmdID||"StrokeText"==cmdID||"FillBorderText"==cmdID},__proto.replaceTextColor=function(color){this._repaint();var cmds=this._cmds;if(cmds)for(var i=cmds.length-1;i>-1;i--)this._isTextCmd(cmds[i])&&this._setTextCmdColor(cmds[i],color);else this._one&&this._isTextCmd(this._one)&&this._setTextCmdColor(this._one,color)},__proto._setTextCmdColor=function(cmdO,color){switch(cmdO.cmdID){case"FillText":case"StrokeText":cmdO.color=color;break;case"FillBorderText":case"FillBorderWords":case"FillBorderText":cmdO.fillColor=color}},__proto.loadImage=function(url,x,y,width,height,complete){void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0);var tex=Loader.getRes(url);tex?tex.getIsReady()?this.drawImage(tex,x,y,width,height):tex.once("ready",this,this.drawImage,[tex,x,y,width,height]):((tex=new Texture).load(url),Loader.cacheRes(url,tex),tex.once("ready",this,this.drawImage,[tex,x,y,width,height])),null!=complete&&(tex.getIsReady()?complete.call(this._sp):tex.on("ready",this._sp,complete))},__proto._renderEmpty=function(sprite,context,x,y){},__proto._renderAll=function(sprite,context,x,y){for(var cmds=this._cmds,i=0,n=cmds.length;i<n;i++)cmds[i].run(context,x,y)},__proto._renderOne=function(sprite,context,x,y){context.sprite=sprite,this._one.run(context,x,y)},__proto._renderOneImg=function(sprite,context,x,y){context.sprite=sprite,this._one.run(context,x,y)},__proto.drawLine=function(fromX,fromY,toX,toY,lineColor,lineWidth){void 0===lineWidth&&(lineWidth=1);var offset=lineWidth<1||lineWidth%2==0?0:.5;return this._saveToCmd(Render._context._drawLine,DrawLineCmd.create.call(this,fromX+offset,fromY+offset,toX+offset,toY+offset,lineColor,lineWidth,0))},__proto.drawLines=function(x,y,points,lineColor,lineWidth){if(void 0===lineWidth&&(lineWidth=1),!points||points.length<4)return null;var offset=lineWidth<1||lineWidth%2==0?0:.5;return this._saveToCmd(Render._context._drawLines,DrawLinesCmd.create.call(this,x+offset,y+offset,points,lineColor,lineWidth,0))},__proto.drawCurves=function(x,y,points,lineColor,lineWidth){return void 0===lineWidth&&(lineWidth=1),this._saveToCmd(Render._context.drawCurves,DrawCurvesCmd.create.call(this,x,y,points,lineColor,lineWidth))},__proto.drawRect=function(x,y,width,height,fillColor,lineColor,lineWidth){void 0===lineWidth&&(lineWidth=1);var offset=lineWidth>=1&&lineColor?lineWidth/2:0,lineOffset=lineColor?lineWidth:0;return this._saveToCmd(Render._context.drawRect,DrawRectCmd.create.call(this,x+offset,y+offset,width-lineOffset,height-lineOffset,fillColor,lineColor,lineWidth))},__proto.drawCircle=function(x,y,radius,fillColor,lineColor,lineWidth){void 0===lineWidth&&(lineWidth=1);var offset=lineWidth>=1&&lineColor?lineWidth/2:0;return this._saveToCmd(Render._context._drawCircle,DrawCircleCmd.create.call(this,x,y,radius-offset,fillColor,lineColor,lineWidth,0))},__proto.drawPie=function(x,y,radius,startAngle,endAngle,fillColor,lineColor,lineWidth){void 0===lineWidth&&(lineWidth=1);var offset=lineWidth>=1&&lineColor?lineWidth/2:0,lineOffset=lineColor?lineWidth:0;return this._saveToCmd(Render._context._drawPie,DrawPieCmd.create.call(this,x+offset,y+offset,radius-lineOffset,Utils.toRadian(startAngle),Utils.toRadian(endAngle),fillColor,lineColor,lineWidth,0))},__proto.drawPoly=function(x,y,points,fillColor,lineColor,lineWidth){void 0===lineWidth&&(lineWidth=1);var tIsConvexPolygon=!1;tIsConvexPolygon=!(points.length>6);var offset=lineWidth>=1&&lineColor?lineWidth%2==0?0:.5:0;return this._saveToCmd(Render._context._drawPoly,DrawPolyCmd.create.call(this,x+offset,y+offset,points,fillColor,lineColor,lineWidth,tIsConvexPolygon,0))},__proto.drawPath=function(x,y,paths,brush,pen){return this._saveToCmd(Render._context._drawPath,DrawPathCmd.create.call(this,x,y,paths,brush,pen))},__proto.draw9Grid=function(texture,x,y,width,height,sizeGrid){void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),this._saveToCmd(null,Draw9GridTexture.create(texture,x,y,width,height,sizeGrid))},__getset(0,__proto,"cmds",function(){return this._cmds},function(value){this._sp&&(this._sp._renderType|=512,this._sp._setRenderType(this._sp._renderType)),this._cmds=value,this._render=this._renderAll,this._repaint()}),Graphics}(),AtlasGrid=(function(){function HTMLChar(){this.reset()}__class(HTMLChar,"laya.utils.HTMLChar");var __proto=HTMLChar.prototype;__proto.setData=function(char,w,h,style){return this.char=char,this.charNum=char.charCodeAt(0),this.x=this.y=0,this.width=w,this.height=h,this.style=style,this.isWord=!HTMLChar._isWordRegExp.test(char),this},__proto.reset=function(){return this.x=this.y=this.width=this.height=0,this.isWord=!1,this.char=null,this.charNum=0,this.style=null,this},__proto.recover=function(){Pool.recover("HTMLChar",this.reset())},__proto._isChar=function(){return!0},__proto._getCSSStyle=function(){return this.style},HTMLChar.create=function(){return Pool.getItemByClass("HTMLChar",HTMLChar)},HTMLChar._isWordRegExp=new RegExp("[\\w.]","")}(),function(){function AtlasGrid(width,height,id){this.atlasID=0,this._width=0,this._height=0,this._texCount=0,this._rowInfo=null,this._cells=null,this._used=0,void 0===width&&(width=0),void 0===height&&(height=0),void 0===id&&(id=0),this._cells=null,this._rowInfo=null,this.atlasID=id,this._init(width,height)}__class(AtlasGrid,"laya.webgl.text.AtlasGrid");var __proto=AtlasGrid.prototype;return __proto.addRect=function(type,width,height,pt){return!!this._get(width,height,pt)&&(this._fill(pt.x,pt.y,width,height,type),this._texCount++,!0)},__proto._release=function(){this._cells=null,this._rowInfo=null},__proto._init=function(width,height){return this._width=width,this._height=height,this._release(),0!=this._width&&(this._cells=new Uint8Array(this._width*this._height*3),this._rowInfo=new Uint8Array(this._height),this._used=0,this._clear(),!0)},__proto._get=function(width,height,pt){if(width>this._width||height>this._height)return!1;for(var rx=-1,ry=-1,nWidth=this._width,nHeight=this._height,pCellBox=this._cells,y=0;y<nHeight;y++)if(!(this._rowInfo[y]<width))for(var x=0;x<nWidth;){var tm=3*(y*nWidth+x);if(0!=pCellBox[tm]||pCellBox[tm+1]<width||pCellBox[tm+2]<height)x+=pCellBox[tm+1];else{rx=x,ry=y;for(var xx=0;xx<width;xx++)if(pCellBox[3*xx+tm+2]<height){rx=-1;break}if(!(rx<0))return pt.x=rx,pt.y=ry,!0;x+=pCellBox[tm+1]}}return!1},__proto._fill=function(x,y,w,h,type){var nWidth=this._width,nHeghit=this._height;this._check(x+w<=nWidth&&y+h<=nHeghit);for(var yy=y;yy<h+y;++yy){this._check(this._rowInfo[yy]>=w),this._rowInfo[yy]-=w;for(var xx=0;xx<w;xx++){var tm=3*(x+yy*nWidth+xx);this._check(0==this._cells[tm]),this._cells[tm]=type,this._cells[tm+1]=w,this._cells[tm+2]=h}}if(x>0)for(yy=0;yy<h;++yy){var s=0;for(xx=x-1;xx>=0&&0==this._cells[3*((y+yy)*nWidth+xx)];--xx,++s);for(xx=s;xx>0;--xx)this._cells[3*((y+yy)*nWidth+x-xx)+1]=xx,this._check(xx>0)}if(y>0)for(xx=x;xx<x+w;++xx){for(s=0,yy=y-1;yy>=0&&0==this._cells[3*(xx+yy*nWidth)];--yy,s++);for(yy=s;yy>0;--yy)this._cells[3*(xx+(y-yy)*nWidth)+2]=yy,this._check(yy>0)}this._used+=w*h/(this._width*this._height)},__proto._check=function(ret){0==ret&&console.log("xtexMerger 错误啦")},__proto._clear=function(){this._texCount=0;for(var y=0;y<this._height;y++)this._rowInfo[y]=this._width;for(var i=0;i<this._height;i++)for(var j=0;j<this._width;j++){var tm=3*(i*this._width+j);this._cells[tm]=0,this._cells[tm+1]=this._width-j,this._cells[tm+2]=this._width-i}},AtlasGrid}()),StrokeTextCmd=function(){function StrokeTextCmd(){}__class(StrokeTextCmd,"laya.display.cmd.StrokeTextCmd");var __proto=StrokeTextCmd.prototype;return __proto.recover=function(){Pool.recover("StrokeTextCmd",this)},__proto.run=function(context,gx,gy){context.strokeWord(this.text,this.x+gx,this.y+gy,this.font,this.color,this.lineWidth,this.textAlign)},__getset(0,__proto,"cmdID",function(){return"StrokeText"}),StrokeTextCmd.create=function(text,x,y,font,color,lineWidth,textAlign){var cmd=Pool.getItemByClass("StrokeTextCmd",StrokeTextCmd);return cmd.text=text,cmd.x=x,cmd.y=y,cmd.font=font,cmd.color=color,cmd.lineWidth=lineWidth,cmd.textAlign=textAlign,cmd},StrokeTextCmd.ID="StrokeText",StrokeTextCmd}(),ICharRender=function(){function ICharRender(){}__class(ICharRender,"laya.webgl.text.ICharRender");var __proto=ICharRender.prototype;return __proto.getWidth=function(font,str){return 0},__proto.scale=function(sx,sy){},__proto.getCharBmp=function(char,font,lineWidth,colStr,strokeColStr,size,margin_left,margin_top,margin_right,margin_bottom,rect){return null},__getset(0,__proto,"canvasWidth",function(){return 0},function(w){}),ICharRender}(),Ease=function(){function Ease(){}return __class(Ease,"laya.utils.Ease"),Ease.linearNone=function(t,b,c,d){return c*t/d+b},Ease.linearIn=function(t,b,c,d){return c*t/d+b},Ease.linearInOut=function(t,b,c,d){return c*t/d+b},Ease.linearOut=function(t,b,c,d){return c*t/d+b},Ease.bounceIn=function(t,b,c,d){return c-Ease.bounceOut(d-t,0,c,d)+b},Ease.bounceInOut=function(t,b,c,d){return t<.5*d?.5*Ease.bounceIn(2*t,0,c,d)+b:.5*Ease.bounceOut(2*t-d,0,c,d)+.5*c+b},Ease.bounceOut=function(t,b,c,d){return(t/=d)<1/2.75?c*(7.5625*t*t)+b:t<2/2.75?c*(7.5625*(t-=1.5/2.75)*t+.75)+b:t<2.5/2.75?c*(7.5625*(t-=2.25/2.75)*t+.9375)+b:c*(7.5625*(t-=2.625/2.75)*t+.984375)+b},Ease.backIn=function(t,b,c,d,s){return void 0===s&&(s=1.70158),c*(t/=d)*t*((s+1)*t-s)+b},Ease.backInOut=function(t,b,c,d,s){return void 0===s&&(s=1.70158),(t/=.5*d)<1?.5*c*(t*t*((1+(s*=1.525))*t-s))+b:c/2*((t-=2)*t*((1+(s*=1.525))*t+s)+2)+b},Ease.backOut=function(t,b,c,d,s){return void 0===s&&(s=1.70158),c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},Ease.elasticIn=function(t,b,c,d,a,p){var s;return void 0===a&&(a=0),void 0===p&&(p=0),0==t?b:1==(t/=d)?b+c:(p||(p=.3*d),!a||c>0&&a<c||c<0&&a<-c?(a=c,s=p/4):s=p/Ease.PI2*Math.asin(c/a),-a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*Ease.PI2/p)+b)},Ease.elasticInOut=function(t,b,c,d,a,p){var s;return void 0===a&&(a=0),void 0===p&&(p=0),0==t?b:2==(t/=.5*d)?b+c:(p||(p=d*(.3*1.5)),!a||c>0&&a<c||c<0&&a<-c?(a=c,s=p/4):s=p/Ease.PI2*Math.asin(c/a),t<1?a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*Ease.PI2/p)*-.5+b:a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*Ease.PI2/p)*.5+c+b)},Ease.elasticOut=function(t,b,c,d,a,p){var s;return void 0===a&&(a=0),void 0===p&&(p=0),0==t?b:1==(t/=d)?b+c:(p||(p=.3*d),!a||c>0&&a<c||c<0&&a<-c?(a=c,s=p/4):s=p/Ease.PI2*Math.asin(c/a),a*Math.pow(2,-10*t)*Math.sin((t*d-s)*Ease.PI2/p)+c+b)},Ease.strongIn=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b},Ease.strongInOut=function(t,b,c,d){return(t/=.5*d)<1?.5*c*t*t*t*t*t+b:.5*c*((t-=2)*t*t*t*t+2)+b},Ease.strongOut=function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},Ease.sineInOut=function(t,b,c,d){return.5*-c*(Math.cos(Math.PI*t/d)-1)+b},Ease.sineIn=function(t,b,c,d){return-c*Math.cos(t/d*Ease.HALF_PI)+c+b},Ease.sineOut=function(t,b,c,d){return c*Math.sin(t/d*Ease.HALF_PI)+b},Ease.quintIn=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b},Ease.quintInOut=function(t,b,c,d){return(t/=.5*d)<1?.5*c*t*t*t*t*t+b:.5*c*((t-=2)*t*t*t*t+2)+b},Ease.quintOut=function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},Ease.quartIn=function(t,b,c,d){return c*(t/=d)*t*t*t+b},Ease.quartInOut=function(t,b,c,d){return(t/=.5*d)<1?.5*c*t*t*t*t+b:.5*-c*((t-=2)*t*t*t-2)+b},Ease.quartOut=function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},Ease.cubicIn=function(t,b,c,d){return c*(t/=d)*t*t+b},Ease.cubicInOut=function(t,b,c,d){return(t/=.5*d)<1?.5*c*t*t*t+b:.5*c*((t-=2)*t*t+2)+b},Ease.cubicOut=function(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},Ease.quadIn=function(t,b,c,d){return c*(t/=d)*t+b},Ease.quadInOut=function(t,b,c,d){return(t/=.5*d)<1?.5*c*t*t+b:.5*-c*(--t*(t-2)-1)+b},Ease.quadOut=function(t,b,c,d){return-c*(t/=d)*(t-2)+b},Ease.expoIn=function(t,b,c,d){return 0==t?b:c*Math.pow(2,10*(t/d-1))+b-.001*c},Ease.expoInOut=function(t,b,c,d){return 0==t?b:t==d?b+c:(t/=.5*d)<1?.5*c*Math.pow(2,10*(t-1))+b:.5*c*(2-Math.pow(2,-10*--t))+b},Ease.expoOut=function(t,b,c,d){return t==d?b+c:c*(1-Math.pow(2,-10*t/d))+b},Ease.circIn=function(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},Ease.circInOut=function(t,b,c,d){return(t/=.5*d)<1?.5*-c*(Math.sqrt(1-t*t)-1)+b:.5*c*(Math.sqrt(1-(t-=2)*t)+1)+b},Ease.circOut=function(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},Ease.HALF_PI=.5*Math.PI,Ease.PI2=2*Math.PI,Ease}(),WebGLRTMgr=(function(){function PoolCache(){this.sign=null,this.maxCount=1e3}__class(PoolCache,"laya.utils.PoolCache");var __proto=PoolCache.prototype;__proto.getCacheList=function(){return Pool.getPoolBySign(this.sign)},__proto.tryDispose=function(force){var list;(list=Pool.getPoolBySign(this.sign)).length>this.maxCount&&list.splice(this.maxCount,list.length-this.maxCount)},PoolCache.addPoolCacheManager=function(sign,maxCount){var cache;void 0===maxCount&&(maxCount=100),(cache=new PoolCache).sign=sign,cache.maxCount=maxCount,CacheManger.regCacheByFunction(Utils.bind(cache.tryDispose,cache),Utils.bind(cache.getCacheList,cache))}}(),function(){function MatirxArray(){}__class(MatirxArray,"laya.webgl.utils.MatirxArray"),MatirxArray.ArrayMul=function(a,b,o){if(a)if(b)for(var ai0=NaN,ai1=NaN,ai2=NaN,ai3=NaN,i=0;i<4;i++)ai0=a[i],ai1=a[i+4],ai2=a[i+8],ai3=a[i+12],o[i]=ai0*b[0]+ai1*b[1]+ai2*b[2]+ai3*b[3],o[i+4]=ai0*b[4]+ai1*b[5]+ai2*b[6]+ai3*b[7],o[i+8]=ai0*b[8]+ai1*b[9]+ai2*b[10]+ai3*b[11],o[i+12]=ai0*b[12]+ai1*b[13]+ai2*b[14]+ai3*b[15];else MatirxArray.copyArray(a,o);else MatirxArray.copyArray(b,o)},MatirxArray.copyArray=function(f,t){if(f&&t)for(var i=0;i<f.length;i++)t[i]=f[i]}}(),function(){function Mouse(){}__class(Mouse,"laya.utils.Mouse"),__getset(1,Mouse,"cursor",function(){return Mouse._style.cursor},function(cursorStr){Mouse._style.cursor=cursorStr}),Mouse.hide=function(){"none"!=Mouse.cursor&&(Mouse._preCursor=Mouse.cursor,Mouse.cursor="none")},Mouse.show=function(){"none"==Mouse.cursor&&(Mouse._preCursor?Mouse.cursor=Mouse._preCursor:Mouse.cursor="auto")},Mouse._preCursor=null,__static(Mouse,["_style",function(){return this._style=Browser.document.body.style}])}(),function(){function VertexArrayObject(){}return __class(VertexArrayObject,"laya.webgl.VertexArrayObject"),VertexArrayObject}()(function(){var glErrorShadow={};function synthesizeGLError(err,opt_msg){var msg;glErrorShadow[err]=!0,void 0!==opt_msg&&(msg=opt_msg,window.console&&window.console.error&&window.console.error(msg))}var WebGLVertexArrayObjectOES=function WebGLVertexArrayObjectOES(ext){var gl=ext.gl;this.ext=ext,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(ext.maxVertexAttribs);for(var n=0;n<this.attribs.length;n++){var attrib=new WebGLVertexArrayObjectOES.VertexAttrib(gl);this.attribs[n]=attrib}this.maxAttrib=0};(WebGLVertexArrayObjectOES.VertexAttrib=function(gl){this.enabled=!1,this.buffer=null,this.size=4,this.type=gl.FLOAT,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()}).prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var OESVertexArrayObject=function(gl){var self=this;this.gl=gl,function(gl){var f=gl.getError;gl.getError=function(){do{(err=f.apply(gl))!=gl.NO_ERROR&&(glErrorShadow[err]=!0)}while(err!=gl.NO_ERROR);for(var err in glErrorShadow)if(glErrorShadow[err])return delete glErrorShadow[err],parseInt(err);return gl.NO_ERROR}}(gl);var original=this.original={getParameter:gl.getParameter,enableVertexAttribArray:gl.enableVertexAttribArray,disableVertexAttribArray:gl.disableVertexAttribArray,bindBuffer:gl.bindBuffer,getVertexAttrib:gl.getVertexAttrib,vertexAttribPointer:gl.vertexAttribPointer};gl.getParameter=function(pname){return pname==self.VERTEX_ARRAY_BINDING_OES?self.currentVertexArrayObject==self.defaultVertexArrayObject?null:self.currentVertexArrayObject:original.getParameter.apply(this,arguments)},gl.enableVertexAttribArray=function(index){var vao=self.currentVertexArrayObject;return vao.maxAttrib=Math.max(vao.maxAttrib,index),vao.attribs[index].enabled=!0,original.enableVertexAttribArray.apply(this,arguments)},gl.disableVertexAttribArray=function(index){var vao=self.currentVertexArrayObject;return vao.maxAttrib=Math.max(vao.maxAttrib,index),vao.attribs[index].enabled=!1,original.disableVertexAttribArray.apply(this,arguments)},gl.bindBuffer=function(target,buffer){switch(target){case gl.ARRAY_BUFFER:self.currentArrayBuffer=buffer;break;case gl.ELEMENT_ARRAY_BUFFER:self.currentVertexArrayObject.elementArrayBuffer=buffer}return original.bindBuffer.apply(this,arguments)},gl.getVertexAttrib=function(index,pname){var attrib=self.currentVertexArrayObject.attribs[index];switch(pname){case gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:return attrib.buffer;case gl.VERTEX_ATTRIB_ARRAY_ENABLED:return attrib.enabled;case gl.VERTEX_ATTRIB_ARRAY_SIZE:return attrib.size;case gl.VERTEX_ATTRIB_ARRAY_STRIDE:return attrib.stride;case gl.VERTEX_ATTRIB_ARRAY_TYPE:return attrib.type;case gl.VERTEX_ATTRIB_ARRAY_NORMALIZED:return attrib.normalized;default:return original.getVertexAttrib.apply(this,arguments)}},gl.vertexAttribPointer=function(indx,size,type,normalized,stride,offset){var vao=self.currentVertexArrayObject;vao.maxAttrib=Math.max(vao.maxAttrib,indx);var attrib=vao.attribs[indx];return attrib.buffer=self.currentArrayBuffer,attrib.size=size,attrib.type=type,attrib.normalized=normalized,attrib.stride=stride,attrib.offset=offset,attrib.recache(),original.vertexAttribPointer.apply(this,arguments)},gl.instrumentExtension&&gl.instrumentExtension(this,"OES_vertex_array_object"),gl.canvas&&gl.canvas.addEventListener&&gl.canvas.addEventListener("webglcontextrestored",function(){var msg;msg="OESVertexArrayObject emulation library context restored",window.console&&window.console.log&&window.console.log(msg),self.reset_()},!0),this.reset_()};OESVertexArrayObject.prototype.VERTEX_ARRAY_BINDING_OES=34229,OESVertexArrayObject.prototype.reset_=function(){if(void 0!==this.vertexArrayObjects)for(var ii=0;ii<this.vertexArrayObjects.length;++ii)this.vertexArrayObjects.isAlive=!1;var gl=this.gl;this.maxVertexAttribs=gl.getParameter(gl.MAX_VERTEX_ATTRIBS),this.defaultVertexArrayObject=new WebGLVertexArrayObjectOES(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)},OESVertexArrayObject.prototype.createVertexArrayOES=function(){var arrayObject=new WebGLVertexArrayObjectOES(this);return this.vertexArrayObjects.push(arrayObject),arrayObject},OESVertexArrayObject.prototype.deleteVertexArrayOES=function(arrayObject){arrayObject.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(arrayObject),1),this.currentVertexArrayObject==arrayObject&&this.bindVertexArrayOES(null)},OESVertexArrayObject.prototype.isVertexArrayOES=function(arrayObject){return!!(arrayObject&&arrayObject instanceof WebGLVertexArrayObjectOES&&arrayObject.hasBeenBound&&arrayObject.ext==this)},OESVertexArrayObject.prototype.bindVertexArrayOES=function(arrayObject){var gl=this.gl;if(!arrayObject||arrayObject.isAlive){var original=this.original,oldVAO=this.currentVertexArrayObject;this.currentVertexArrayObject=arrayObject||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;var newVAO=this.currentVertexArrayObject;if(oldVAO!=newVAO){oldVAO&&newVAO.elementArrayBuffer==oldVAO.elementArrayBuffer||original.bindBuffer.call(gl,gl.ELEMENT_ARRAY_BUFFER,newVAO.elementArrayBuffer);for(var currentBinding=this.currentArrayBuffer,maxAttrib=Math.max(oldVAO?oldVAO.maxAttrib:0,newVAO.maxAttrib),n=0;n<=maxAttrib;n++){var attrib=newVAO.attribs[n],oldAttrib=oldVAO?oldVAO.attribs[n]:null;if(oldVAO&&attrib.enabled==oldAttrib.enabled||(attrib.enabled?original.enableVertexAttribArray.call(gl,n):original.disableVertexAttribArray.call(gl,n)),attrib.enabled){var bufferChanged=!1;oldVAO&&attrib.buffer==oldAttrib.buffer||(currentBinding!=attrib.buffer&&(original.bindBuffer.call(gl,gl.ARRAY_BUFFER,attrib.buffer),currentBinding=attrib.buffer),bufferChanged=!0),(bufferChanged||attrib.cached!=oldAttrib.cached)&&original.vertexAttribPointer.call(gl,n,attrib.size,attrib.type,attrib.normalized,attrib.stride,attrib.offset)}}this.currentArrayBuffer!=currentBinding&&original.bindBuffer.call(gl,gl.ARRAY_BUFFER,this.currentArrayBuffer)}}else synthesizeGLError(gl.INVALID_OPERATION,"bindVertexArrayOES: attempt to bind deleted arrayObject")},window._setupVertexArrayObject=function(gl){var original_getSupportedExtensions=gl.getSupportedExtensions;gl.getSupportedExtensions=function(){var list=original_getSupportedExtensions.call(this)||[];return list.indexOf("OES_vertex_array_object")<0&&list.push("OES_vertex_array_object"),list};var original_getExtension=gl.getExtension;gl.getExtension=function(name){var ext=original_getExtension.call(this,name);return ext||("OES_vertex_array_object"!==name?null:(this.__OESVertexArrayObject||(console.log("Setup OES_vertex_array_object polyfill"),this.__OESVertexArrayObject=new OESVertexArrayObject(this)),this.__OESVertexArrayObject))}},window._forceSetupVertexArrayObject=function(gl){var original_getSupportedExtensions=gl.getSupportedExtensions;gl.getSupportedExtensions=function(){var list=original_getSupportedExtensions.call(this)||[];return list.indexOf("OES_vertex_array_object")<0&&list.push("OES_vertex_array_object"),list};var original_getExtension=gl.getExtension;gl.getExtension=function(name){if("OES_vertex_array_object"===name)return this.__OESVertexArrayObject||(console.log("Setup OES_vertex_array_object polyfill"),this.__OESVertexArrayObject=new OESVertexArrayObject(this)),this.__OESVertexArrayObject;var ext=original_getExtension.call(this,name);return ext||null}}}()),function(){function WebGLRTMgr(){}return __class(WebGLRTMgr,"laya.resource.WebGLRTMgr"),WebGLRTMgr.getRT=function(w,h){h|=0,(w|=0)>=1e4&&console.error("getRT error! w too big");var ret,key=1e4*h+w,sw=WebGLRTMgr.dict[key];return sw&&sw.length>0?((ret=sw.pop())._mgrKey=key,ret):((ret=new RenderTexture2D(w,h,1,-1))._mgrKey=key,ret)},WebGLRTMgr.releaseRT=function(rt){if(!(rt._mgrKey<=0)){var sw=WebGLRTMgr.dict[rt._mgrKey];!sw&&(sw=[],WebGLRTMgr.dict[rt._mgrKey]=sw),rt._mgrKey=0,sw.push(rt)}},WebGLRTMgr.dict={},WebGLRTMgr}()),Utils=function(){function Utils(){}return __class(Utils,"laya.utils.Utils"),Utils.toRadian=function(angle){return angle*Utils._pi2},Utils.toAngle=function(radian){return radian*Utils._pi},Utils.toHexColor=function(color){if(color<0||isNaN(color))return null;for(var str=color.toString(16);str.length<6;)str="0"+str;return"#"+str},Utils.getGID=function(){return Utils._gid++},Utils.concatArray=function(source,array){if(!array)return source;if(!source)return array;var i=0,len=array.length;for(i=0;i<len;i++)source.push(array[i]);return source},Utils.clearArray=function(array){return array?(array.length=0,array):array},Utils.copyArray=function(source,array){if(source||(source=[]),!array)return source;source.length=array.length;var i=0,len=array.length;for(i=0;i<len;i++)source[i]=array[i];return source},Utils.getGlobalRecByPoints=function(sprite,x0,y0,x1,y1){var newLTPoint,newRBPoint;newLTPoint=Point.create().setTo(x0,y0),newLTPoint=sprite.localToGlobal(newLTPoint),newRBPoint=Point.create().setTo(x1,y1),newRBPoint=sprite.localToGlobal(newRBPoint);var rst=Rectangle._getWrapRec([newLTPoint.x,newLTPoint.y,newRBPoint.x,newRBPoint.y]);return newLTPoint.recover(),newRBPoint.recover(),rst},Utils.getGlobalPosAndScale=function(sprite){return Utils.getGlobalRecByPoints(sprite,0,0,1,1)},Utils.bind=function(fun,scope){return fun.bind(scope)},Utils.measureText=function(txt,font){return RunDriver.measureText(txt,font)},Utils.updateOrder=function(array){if(!array||array.length<2)return!1;for(var c,i=1,j=0,len=array.length,key=NaN;i<len;){for(c=array[j=i],key=array[j]._zOrder;--j>-1&&array[j]._zOrder>key;)array[j+1]=array[j];array[j+1]=c,i++}return!0},Utils.transPointList=function(points,x,y){var i=0,len=points.length;for(i=0;i<len;i+=2)points[i]+=x,points[i+1]+=y},Utils.parseInt=function(str,radix){void 0===radix&&(radix=0);var result=Browser.window.parseInt(str,radix);return isNaN(result)?0:result},Utils.getFileExtension=function(path){Utils._extReg.lastIndex=path.lastIndexOf(".");var result=Utils._extReg.exec(path);return result&&result.length>1?result[1].toLowerCase():null},Utils.getTransformRelativeToWindow=function(coordinateSpace,x,y){var stage=Laya.stage,globalTransform=laya.utils.Utils.getGlobalPosAndScale(coordinateSpace),canvasMatrix=stage._canvasTransform.clone(),canvasLeft=canvasMatrix.tx,canvasTop=canvasMatrix.ty;canvasMatrix.rotate(-Math.PI/180*Laya.stage.canvasDegree),canvasMatrix.scale(Laya.stage.clientScaleX,Laya.stage.clientScaleY);var perpendicular=Laya.stage.canvasDegree%180!=0,tx=NaN,ty=NaN;perpendicular?(tx=y+globalTransform.y,ty=x+globalTransform.x,tx*=canvasMatrix.d,ty*=canvasMatrix.a,90==Laya.stage.canvasDegree?(tx=canvasLeft-tx,ty+=canvasTop):(tx+=canvasLeft,ty=canvasTop-ty)):(tx=x+globalTransform.x,ty=y+globalTransform.y,tx*=canvasMatrix.a,ty*=canvasMatrix.d,tx+=canvasLeft,ty+=canvasTop),ty+=Laya.stage._safariOffsetY;var domScaleX=NaN,domScaleY=NaN;return perpendicular?(domScaleX=canvasMatrix.d*globalTransform.height,domScaleY=canvasMatrix.a*globalTransform.width):(domScaleX=canvasMatrix.a*globalTransform.width,domScaleY=canvasMatrix.d*globalTransform.height),{x:tx,y:ty,scaleX:domScaleX,scaleY:domScaleY}},Utils.fitDOMElementInArea=function(dom,coordinateSpace,x,y,width,height){dom._fitLayaAirInitialized||(dom._fitLayaAirInitialized=!0,dom.style.transformOrigin=dom.style.webKittransformOrigin="left top",dom.style.position="absolute");var transform=Utils.getTransformRelativeToWindow(coordinateSpace,x,y);dom.style.transform=dom.style.webkitTransform="scale("+transform.scaleX+","+transform.scaleY+") rotate("+Laya.stage.canvasDegree+"deg)",dom.style.width=width+"px",dom.style.height=height+"px",dom.style.left=transform.x+"px",dom.style.top=transform.y+"px"},Utils.isOkTextureList=function(textureList){if(!textureList)return!1;var tTexture,i=0,len=textureList.length;for(i=0;i<len;i++)if(!(tTexture=textureList[i])||!tTexture._getSource())return!1;return!0},Utils.isOKCmdList=function(cmds){if(!cmds)return!1;var i=0,len=cmds.length;for(i=0;i<len;i++)cmds[i];return!0},Utils.getQueryString=function(name){if(Browser.onMiniGame)return null;if(!window.location||!window.location.search)return null;var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)"),r=window.location.search.substr(1).match(reg);return null!=r?unescape(r[2]):null},Utils._gid=1,Utils._pi=180/Math.PI,Utils._pi2=Math.PI/180,Utils._extReg=/\.(\w+)\??/g,Utils.parseXMLFromString=function(value){var rst;if(value=value.replace(/>\s+</g,"><"),(rst=(new DOMParser).parseFromString(value,"text/xml")).firstChild.textContent.indexOf("This page contains the following errors")>-1)throw new Error(rst.firstChild.firstChild.textContent);return rst},Utils}(),DrawLinesCmd=(function(){function ArabicReshaper(){}__class(ArabicReshaper,"laya.webgl.text.ArabicReshaper");var __proto=ArabicReshaper.prototype;__proto.characterMapContains=function(c){for(var i=0;i<ArabicReshaper.charsMap.length;++i)if(ArabicReshaper.charsMap[i][0]===c)return!0;return!1},__proto.getCharRep=function(c){for(var i=0;i<ArabicReshaper.charsMap.length;++i)if(ArabicReshaper.charsMap[i][0]===c)return ArabicReshaper.charsMap[i];return!1},__proto.getCombCharRep=function(c1,c2){for(var i=0;i<ArabicReshaper.combCharsMap.length;++i)if(ArabicReshaper.combCharsMap[i][0][0]===c1&&ArabicReshaper.combCharsMap[i][0][1]===c2)return ArabicReshaper.combCharsMap[i];return!1},__proto.isTransparent=function(c){for(var i=0;i<ArabicReshaper.transChars.length;++i)if(ArabicReshaper.transChars[i]===c)return!0;return!1},__proto.getOriginalCharsFromCode=function(code){var j=0;for(j=0;j<ArabicReshaper.charsMap.length;++j)if(ArabicReshaper.charsMap[j].indexOf(code)>-1)return String.fromCharCode(ArabicReshaper.charsMap[j][0]);for(j=0;j<ArabicReshaper.combCharsMap.length;++j)if(ArabicReshaper.combCharsMap[j].indexOf(code)>-1)return String.fromCharCode(ArabicReshaper.combCharsMap[j][0][0])+String.fromCharCode(ArabicReshaper.combCharsMap[j][0][1]);return String.fromCharCode(code)},__proto.convertArabic=function(normal){for(var crep,combcrep,shaped="",i=0;i<normal.length;++i){var current=normal.charCodeAt(i);if(this.characterMapContains(current)){for(var prev=null,next=null,prevID=i-1,nextID=i+1;prevID>=0&&this.isTransparent(normal.charCodeAt(prevID));--prevID);for((!(crep=!!(prev=prevID>=0?normal.charCodeAt(prevID):null)&&this.getCharRep(prev))||null==crep[2]&&null==crep[3])&&(prev=null);nextID<normal.length&&this.isTransparent(normal.charCodeAt(nextID));++nextID);if((!(crep=!!(next=nextID<normal.length?normal.charCodeAt(nextID):null)&&this.getCharRep(next))||null==crep[3]&&null==crep[4])&&(next=null),1604===current&&null!=next&&(1570===next||1571===next||1573===next||1575===next)){combcrep=this.getCombCharRep(current,next),shaped+=null!=prev?String.fromCharCode(combcrep[4]):String.fromCharCode(combcrep[1]),++i;continue}if(crep=this.getCharRep(current),null!=prev&&null!=next&&null!=crep[3]){shaped+=String.fromCharCode(crep[3]);continue}if(null!=prev&&null!=crep[4]){shaped+=String.fromCharCode(crep[4]);continue}if(null!=next&&null!=crep[2]){shaped+=String.fromCharCode(crep[2]);continue}shaped+=String.fromCharCode(crep[1])}else shaped+=String.fromCharCode(current)}return shaped},__proto.convertArabicBack=function(apfb){var toReturn="",selectedChar=0,i=0;for(i=0;i<apfb.length;++i)selectedChar=apfb.charCodeAt(i),toReturn+=this.getOriginalCharsFromCode(selectedChar);return toReturn},__static(ArabicReshaper,["charsMap",function(){return this.charsMap=[[1569,65152,null,null,null],[1570,65153,null,null,65154],[1571,65155,null,null,65156],[1572,65157,null,null,65158],[1573,65159,null,null,65160],[1574,65161,65163,65164,65162],[1575,65165,null,null,65166],[1576,65167,65169,65170,65168],[1577,65171,null,null,65172],[1578,65173,65175,65176,65174],[1579,65177,65179,65180,65178],[1580,65181,65183,65184,65182],[1581,65185,65187,65188,65186],[1582,65189,65191,65192,65190],[1583,65193,null,null,65194],[1584,65195,null,null,65196],[1585,65197,null,null,65198],[1586,65199,null,null,65200],[1587,65201,65203,65204,65202],[1588,65205,65207,65208,65206],[1589,65209,65211,65212,65210],[1590,65213,65215,65216,65214],[1591,65217,65219,65220,65218],[1592,65221,65223,65224,65222],[1593,65225,65227,65228,65226],[1594,65229,65231,65232,65230],[1600,1600,1600,1600,1600],[1601,65233,65235,65236,65234],[1602,65237,65239,65240,65238],[1603,65241,65243,65244,65242],[1604,65245,65247,65248,65246],[1605,65249,65251,65252,65250],[1606,65253,65255,65256,65254],[1607,65257,65259,65260,65258],[1608,65261,null,null,65262],[1609,65263,null,null,65264],[1610,65265,65267,65268,65266],[1662,64342,64344,64345,64343],[1740,64508,64510,64511,64509],[1670,64378,64380,64381,64379],[1705,64398,64400,64401,64399],[1711,64402,64404,64405,64403],[1688,64394,null,null,64395]]},"combCharsMap",function(){return this.combCharsMap=[[[1604,1570],65269,null,null,65270],[[1604,1571],65271,null,null,65272],[[1604,1573],65273,null,null,65274],[[1604,1575],65275,null,null,65276]]},"transChars",function(){return this.transChars=[1552,1554,1555,1556,1557,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1648,1750,1751,1752,1753,1754,1755,1756,1759,1760,1761,1762,1763,1764,1767,1768,1770,1771,1772,1773]}])}(),function(){function DrawLinesCmd(){}__class(DrawLinesCmd,"laya.display.cmd.DrawLinesCmd");var __proto=DrawLinesCmd.prototype;return __proto.recover=function(){this.points=null,this.lineColor=null,Pool.recover("DrawLinesCmd",this)},__proto.run=function(context,gx,gy){context._drawLines(this.x+gx,this.y+gy,this.points,this.lineColor,this.lineWidth,this.vid)},__getset(0,__proto,"cmdID",function(){return"DrawLines"}),DrawLinesCmd.create=function(x,y,points,lineColor,lineWidth,vid){var cmd=Pool.getItemByClass("DrawLinesCmd",DrawLinesCmd);return cmd.x=x,cmd.y=y,cmd.points=points,cmd.lineColor=lineColor,cmd.lineWidth=lineWidth,cmd.vid=vid,cmd},DrawLinesCmd.ID="DrawLines",DrawLinesCmd}()),CharSubmitCache=function(){function CharSubmitCache(){this._data=[],this._ndata=0,this._tex=null,this._imgId=0,this._clipid=-1,this._enbale=!1,this._colorFiler=null,this._clipMatrix=new Matrix}__class(CharSubmitCache,"laya.webgl.text.CharSubmitCache");var __proto=CharSubmitCache.prototype;return __proto.clear=function(){this._tex=null,this._imgId=-1,this._ndata=0,this._enbale=!1,this._colorFiler=null},__proto.destroy=function(){this.clear(),this._data.length=0,this._data=null},__proto.add=function(ctx,tex,imgid,pos,uv,color){this._ndata>0&&(this._tex!=tex||this._imgId!=imgid||this._clipid>=0&&this._clipid!=ctx._clipInfoID)&&this.submit(ctx),this._clipid=ctx._clipInfoID,ctx._globalClipMatrix.copyTo(this._clipMatrix),this._tex=tex,this._imgId=imgid,this._colorFiler=ctx._colorFiler,this._data[this._ndata]=pos,this._data[this._ndata+1]=uv,this._data[this._ndata+2]=color,this._ndata+=3},__proto.getPos=function(){return 0==CharSubmitCache.__nPosPool?new Array(8):CharSubmitCache.__posPool[--CharSubmitCache.__nPosPool]},__proto.enable=function(value,ctx){value!==this._enbale&&(this._enbale=value,this._enbale||this.submit(ctx))},__proto.submit=function(ctx){var n=this._ndata;if(n){var _mesh=ctx._mesh,colorFiler=ctx._colorFiler;ctx._colorFiler=this._colorFiler;var submit=SubmitTexture.create(ctx,_mesh,Value2D.create(1,0));ctx._submits[ctx._submits._length++]=ctx._curSubmit=submit,submit.shaderValue.textureHost=this._tex,submit._key.other=this._imgId,ctx._colorFiler=colorFiler,ctx._copyClipInfo(submit,this._clipMatrix),submit.clipInfoID=this._clipid;for(var i=0;i<n;i+=3)_mesh.addQuad(this._data[i],this._data[i+1],this._data[i+2],!0),CharSubmitCache.__posPool[CharSubmitCache.__nPosPool++]=this._data[i];n/=3,submit._numEle+=6*n,_mesh.indexNum+=6*n,_mesh.vertNum+=4*n,ctx._drawCount+=n,this._ndata=0,Stat.loopCount%100==0&&(this._data.length=0)}},CharSubmitCache.__posPool=[],CharSubmitCache.__nPosPool=0,CharSubmitCache}(),Config=function(){function Config(){}return __class(Config,"Config"),Config.animationInterval=50,Config.isAntialias=!1,Config.isAlpha=!1,Config.premultipliedAlpha=!0,Config.isStencil=!0,Config.preserveDrawingBuffer=!1,Config.webGL2D_MeshAllocMaxMem=!0,Config.is2DPixelArtGame=!1,Config.useWebGL2=!1,Config.useRetinalCanvas=!1,Config}(),DrawCurvesCmd=function(){function DrawCurvesCmd(){}__class(DrawCurvesCmd,"laya.display.cmd.DrawCurvesCmd");var __proto=DrawCurvesCmd.prototype;return __proto.recover=function(){this.points=null,this.lineColor=null,Pool.recover("DrawCurvesCmd",this)},__proto.run=function(context,gx,gy){context.drawCurves(this.x+gx,this.y+gy,this.points,this.lineColor,this.lineWidth)},__getset(0,__proto,"cmdID",function(){return"DrawCurves"}),DrawCurvesCmd.create=function(x,y,points,lineColor,lineWidth){var cmd=Pool.getItemByClass("DrawCurvesCmd",DrawCurvesCmd);return cmd.x=x,cmd.y=y,cmd.points=points,cmd.lineColor=lineColor,cmd.lineWidth=lineWidth,cmd},DrawCurvesCmd.ID="DrawCurves",DrawCurvesCmd}(),FillTextCmd=function(){function FillTextCmd(){this._textIsWorldText=!1,this._fontColor=4294967295,this._strokeColor=0,this._nTexAlign=0,this._fontObj=FillTextCmd._defFontObj}__class(FillTextCmd,"laya.display.cmd.FillTextCmd");var __proto=FillTextCmd.prototype;return __proto.recover=function(){Pool.recover("FillTextCmd",this)},__proto.run=function(context,gx,gy){Laya.stage.isGlobalRepaint()&&this._textIsWorldText&&this._text.cleanCache(),this._textIsWorldText?context._fast_filltext(this._text,this.x+gx,this.y+gy,this._fontObj,this._color,null,0,this._nTexAlign,0):context.drawText(this._text,this.x+gx,this.y+gy,this._font,this._color,this._textAlign)},__getset(0,__proto,"text",function(){return this._text},function(value){this._text=value,this._textIsWorldText=value instanceof laya.utils.WordText,this._textIsWorldText&&this._text.cleanCache()}),__getset(0,__proto,"cmdID",function(){return"FillText"}),__getset(0,__proto,"color",function(){return this._color},function(value){this._color=value,this._fontColor=ColorUtils.create(value).numColor,this._textIsWorldText&&this._text.cleanCache()}),__getset(0,__proto,"font",function(){return this._font},function(value){this._font=value,this._fontObj=FontInfo.Parse(value),this._textIsWorldText&&this._text.cleanCache()}),__getset(0,__proto,"textAlign",function(){return this._textAlign},function(value){switch(this._textAlign=value,value){case"center":this._nTexAlign=Context.ENUM_TEXTALIGN_CENTER;break;case"right":this._nTexAlign=Context.ENUM_TEXTALIGN_RIGHT;break;default:this._nTexAlign=Context.ENUM_TEXTALIGN_DEFAULT}this._textIsWorldText&&this._text.cleanCache()}),FillTextCmd.create=function(text,x,y,font,color,textAlign){var cmd=Pool.getItemByClass("FillTextCmd",FillTextCmd);return cmd.text=text,cmd._textIsWorldText=text instanceof laya.utils.WordText,cmd.x=x,cmd.y=y,cmd.font=font,cmd.color=color,cmd.textAlign=textAlign,cmd},FillTextCmd.ID="FillText",__static(FillTextCmd,["_defFontObj",function(){return this._defFontObj=new FontInfo(null)}]),FillTextCmd}(),SaveClipRect=(function(){function ShaderValue(){}__class(ShaderValue,"laya.webgl.shader.ShaderValue")}(),function(){function KeyLocation(){}__class(KeyLocation,"laya.events.KeyLocation"),KeyLocation.STANDARD=0,KeyLocation.LEFT=1,KeyLocation.RIGHT=2,KeyLocation.NUM_PAD=3}(),function(){function SaveClipRect(){this._clipInfoID=-1,this.incache=!1,this._globalClipMatrix=new Matrix,this._clipRect=new Rectangle}__class(SaveClipRect,"laya.webgl.canvas.save.SaveClipRect");var __proto=SaveClipRect.prototype;return Laya.imps(__proto,{"laya.webgl.canvas.save.ISaveData":!0}),__proto.isSaveMark=function(){return!1},__proto.restore=function(context){this._globalClipMatrix.copyTo(context._globalClipMatrix),this._clipRect.clone(context._clipRect),context._clipInfoID=this._clipInfoID,SaveClipRect.POOL[SaveClipRect.POOL._length++]=this,context._clipInCache=this.incache},SaveClipRect.save=function(context){if(131072!=(131072&context._saveMark._saveuse)){context._saveMark._saveuse|=131072;var cache=SaveClipRect.POOL,o=cache._length>0?cache[--cache._length]:new SaveClipRect;context._globalClipMatrix.copyTo(o._globalClipMatrix),context._clipRect.clone(o._clipRect),o._clipInfoID=context._clipInfoID,o.incache=context._clipInCache;var _save=context._save;_save[_save._length++]=o}},SaveClipRect.POOL=SaveBase._createArray(),SaveClipRect}()),GlowFilterGLRender=function(){function GlowFilterGLRender(){}__class(GlowFilterGLRender,"laya.filters.GlowFilterGLRender");var __proto=GlowFilterGLRender.prototype;return __proto.setShaderInfo=function(shader,w,h,data){shader.defines.add(data.type);var sv=shader;sv.u_blurInfo1=data._sv_blurInfo1;var info2=data._sv_blurInfo2;info2[0]=w,info2[1]=h,sv.u_blurInfo2=info2,sv.u_color=data.getColor()},__proto.render=function(rt,ctx,width,height,filter){var w=width,h=height,svBlur=Value2D.create(1,0);this.setShaderInfo(svBlur,w,h,filter);var svCP=Value2D.create(1,0),matI=Matrix.TEMP.identity();ctx.drawTarget(rt,0,0,w,h,matI,svBlur),ctx.drawTarget(rt,0,0,w,h,matI,svCP)},GlowFilterGLRender}(),RunDriver=function(){function RunDriver(){}return __class(RunDriver,"laya.utils.RunDriver"),RunDriver.createShaderCondition=function(conditionScript){var fn="(function() {return "+conditionScript+";})";return Laya._runScript(fn)},RunDriver.fontMap=[],RunDriver.measureText=function(txt,font){var isChinese=RunDriver.hanzi.test(txt);if(isChinese&&RunDriver.fontMap[font])return RunDriver.fontMap[font];var ctx=Browser.context;ctx.font=font;var r=ctx.measureText(txt);return isChinese&&(RunDriver.fontMap[font]=r),r},RunDriver.drawToCanvas=function(sprite,_renderType,canvasWidth,canvasHeight,offsetX,offsetY){offsetX-=sprite.x,offsetY-=sprite.y,offsetX|=0,offsetY|=0,canvasWidth|=0,canvasHeight|=0;var ctx=new Context;ctx.size(canvasWidth,canvasHeight),ctx.asBitmap=!0,ctx._targets.start(),RenderSprite.renders[_renderType]._fun(sprite,ctx,offsetX,offsetY),ctx.flush(),ctx._targets.end(),ctx._targets.restore();var dt=ctx._targets.getData(0,0,canvasWidth,canvasHeight);ctx.destroy();for(var imgdata=new ImageData(canvasWidth,canvasHeight),lineLen=4*canvasWidth,dst=(new Uint8Array(lineLen),imgdata.data),y=canvasHeight-1,off=y*lineLen,srcoff=0;y>=0;y--)dst.set(dt.subarray(srcoff,srcoff+lineLen),off),off-=lineLen,srcoff+=lineLen;var canv=new HTMLCanvas(!0);return canv.size(canvasWidth,canvasHeight),canv.getContext("2d").putImageData(imgdata,0,0),canv},RunDriver.drawToTexture=function(sprite,_renderType,canvasWidth,canvasHeight,offsetX,offsetY){offsetX-=sprite.x,offsetY-=sprite.y,offsetX|=0,offsetY|=0,canvasWidth|=0,canvasHeight|=0;var ctx=new Context;ctx.size(canvasWidth,canvasHeight),ctx.asBitmap=!0,ctx._targets.start(),RenderSprite.renders[_renderType]._fun(sprite,ctx,offsetX,offsetY),ctx.flush(),ctx._targets.end(),ctx._targets.restore();var rtex=new Texture(ctx._targets,Texture.INV_UV);return ctx.destroy(!0),rtex},RunDriver.changeWebGLSize=function(w,h){WebGL.onStageResize(w,h)},RunDriver.clear=function(value){Context.set2DRenderConfig(),RenderState2D.worldScissorTest&&WebGL.mainContext.disable(3089);var ctx=Render.context,c=0==ctx._submits._length||Config.preserveDrawingBuffer?ColorUtils.create(value).arrColor:Laya.stage._wgColor;c?ctx.clearBG(c[0],c[1],c[2],c[3]):ctx.clearBG(0,0,0,0),RenderState2D.clear()},RunDriver.enableNative=null,__static(RunDriver,["hanzi",function(){return this.hanzi=new RegExp("^[一-龥]$")}]),RunDriver}(),AtlasInfoManager=function(){function AtlasInfoManager(){}return __class(AtlasInfoManager,"laya.net.AtlasInfoManager"),AtlasInfoManager.enable=function(infoFile,callback){Laya.loader.load(infoFile,Handler.create(null,AtlasInfoManager._onInfoLoaded,[callback]),null,"json")},AtlasInfoManager._onInfoLoaded=function(callback,data){var tKey,tPrefix,tArr,i=0,len=0;for(tKey in data)for(tPrefix=(tArr=data[tKey])[0],len=(tArr=tArr[1]).length,i=0;i<len;i++)AtlasInfoManager._fileLoadDic[tPrefix+tArr[i]]=tKey;callback&&callback.run()},AtlasInfoManager.getFileLoadPath=function(file){return AtlasInfoManager._fileLoadDic[file]||file},AtlasInfoManager._fileLoadDic={},AtlasInfoManager}(),BlendMode=function(){function BlendMode(){}return __class(BlendMode,"laya.webgl.canvas.BlendMode"),BlendMode._init_=function(gl){BlendMode.fns=[BlendMode.BlendNormal,BlendMode.BlendAdd,BlendMode.BlendMultiply,BlendMode.BlendScreen,BlendMode.BlendOverlay,BlendMode.BlendLight,BlendMode.BlendMask,BlendMode.BlendDestinationOut],BlendMode.targetFns=[BlendMode.BlendNormalTarget,BlendMode.BlendAddTarget,BlendMode.BlendMultiplyTarget,BlendMode.BlendScreenTarget,BlendMode.BlendOverlayTarget,BlendMode.BlendLightTarget,BlendMode.BlendMask,BlendMode.BlendDestinationOut]},BlendMode.BlendNormal=function(gl){WebGLContext.setBlendFunc(gl,1,771)},BlendMode.BlendAdd=function(gl){WebGLContext.setBlendFunc(gl,1,772)},BlendMode.BlendMultiply=function(gl){WebGLContext.setBlendFunc(gl,774,771)},BlendMode.BlendScreen=function(gl){WebGLContext.setBlendFunc(gl,1,1)},BlendMode.BlendOverlay=function(gl){WebGLContext.setBlendFunc(gl,1,769)},BlendMode.BlendLight=function(gl){WebGLContext.setBlendFunc(gl,1,1)},BlendMode.BlendNormalTarget=function(gl){WebGLContext.setBlendFunc(gl,1,771)},BlendMode.BlendAddTarget=function(gl){WebGLContext.setBlendFunc(gl,1,772)},BlendMode.BlendMultiplyTarget=function(gl){WebGLContext.setBlendFunc(gl,774,771)},BlendMode.BlendScreenTarget=function(gl){WebGLContext.setBlendFunc(gl,1,1)},BlendMode.BlendOverlayTarget=function(gl){WebGLContext.setBlendFunc(gl,1,769)},BlendMode.BlendLightTarget=function(gl){WebGLContext.setBlendFunc(gl,1,1)},BlendMode.BlendMask=function(gl){WebGLContext.setBlendFunc(gl,0,770)},BlendMode.BlendDestinationOut=function(gl){WebGLContext.setBlendFunc(gl,0,0)},BlendMode.activeBlendFunction=null,BlendMode.NAMES=["normal","add","multiply","screen","overlay","light","mask","destination-out"],BlendMode.TOINT={normal:0,add:1,multiply:2,screen:3,overlay:4,light:5,mask:6,"destination-out":7,lighter:1},BlendMode.NORMAL="normal",BlendMode.ADD="add",BlendMode.MULTIPLY="multiply",BlendMode.SCREEN="screen",BlendMode.OVERLAY="overlay",BlendMode.LIGHT="light",BlendMode.MASK="mask",BlendMode.DESTINATIONOUT="destination-out",BlendMode.LIGHTER="lighter",BlendMode.fns=[],BlendMode.targetFns=[],BlendMode}(),RotateCmd=function(){function RotateCmd(){}__class(RotateCmd,"laya.display.cmd.RotateCmd");var __proto=RotateCmd.prototype;return __proto.recover=function(){Pool.recover("RotateCmd",this)},__proto.run=function(context,gx,gy){context._rotate(this.angle,this.pivotX+gx,this.pivotY+gy)},__getset(0,__proto,"cmdID",function(){return"Rotate"}),RotateCmd.create=function(angle,pivotX,pivotY){var cmd=Pool.getItemByClass("RotateCmd",RotateCmd);return cmd.angle=angle,cmd.pivotX=pivotX,cmd.pivotY=pivotY,cmd},RotateCmd.ID="Rotate",RotateCmd}(),FontInfo=function(){function FontInfo(font){this._font="14px Arial",this._family="Arial",this._size=14,this._italic=!1,this._bold=!1,this._id=FontInfo._gfontID++,this.setFont(font||this._font)}return __class(FontInfo,"laya.utils.FontInfo"),FontInfo.prototype.setFont=function(value){this._font=value;var _words=value.split(" "),l=_words.length;if(l<2)1==l&&_words[0].indexOf("px")>0&&(this._size=parseInt(_words[0]));else{for(var szpos=-1,i=0;i<l;i++)if(_words[i].indexOf("px")>0||_words[i].indexOf("pt")>0){szpos=i,this._size=parseInt(_words[i]),this._size<=0&&(console.error("font parse error:"+value),this._size=14);break}var fpos=szpos+1,familys=_words[fpos];for(fpos++;fpos<l;fpos++)familys+=" "+_words[fpos];this._family=familys.split(",")[0],this._italic=_words.indexOf("italic")>=0,this._bold=_words.indexOf("bold")>=0}},FontInfo.Parse=function(font){if(font===FontInfo._lastFont)return FontInfo._lastFontInfo;var r=FontInfo._cache[font];return r||(r=FontInfo._cache[font]=new FontInfo(font)),FontInfo._lastFont=font,FontInfo._lastFontInfo=r,r},FontInfo.EMPTY=new FontInfo(null),FontInfo._cache={},FontInfo._gfontID=0,FontInfo._lastFont="",FontInfo._lastFontInfo=null,FontInfo}(),ShaderCompile=function(){function ShaderCompile(vs,ps,nameMap,defs){this._clearCR=new RegExp("\r","g");var _$this=this;function _compile(script){script=script.replace(_$this._clearCR,"");var includefiles=[],top=new ShaderNode(includefiles);return _$this._compileToTree(top,script.split("\n"),0,includefiles,defs),top}var startTime=Browser.now();this._VS=_compile(vs),this._PS=_compile(ps),this._nameMap=nameMap,Browser.now()-startTime>2&&console.log("ShaderCompile use time:"+(Browser.now()-startTime)+" size:"+vs.length+"/"+ps.length)}__class(ShaderCompile,"laya.webgl.utils.ShaderCompile");var __proto=ShaderCompile.prototype;return __proto._compileToTree=function(parent,lines,start,includefiles,defs){var node,preNode,text,name,fname,words,noUseNode,ofs=0,i=0,n=0,j=0;for(i=start;i<lines.length;i++)if(!((text=lines[i]).length<1)&&0!==(ofs=text.indexOf("//"))){if(ofs>=0&&(text=text.substr(0,ofs)),node=noUseNode||new ShaderNode(includefiles),noUseNode=null,node.text=text,node.noCompile=!0,(ofs=text.indexOf("#"))>=0){for(name="#",j=ofs+1,n=text.length;j<n;j++){var c=text.charAt(j);if(" "===c||"\t"===c||"?"===c)break;name+=c}switch(node.name=name,name){case"#ifdef":case"#ifndef":if(node.src=text,node.noCompile=null!=text.match(/[!&|()=<>]/),node.noCompile?console.log("function():Boolean{return "+text.substr(ofs+node.name.length)+"}"):(words=text.replace(/^\s*/,"").split(/\s+/),node.setCondition(words[1],"#ifdef"===name?1:2),node.text="//"+node.text),node.setParent(parent),parent=node,defs)for(words=text.substr(j).split(ShaderCompile._splitToWordExps3),j=0;j<words.length;j++)(text=words[j]).length&&(defs[text]=!0);continue;case"#if":if(node.src=text,node.noCompile=!0,node.setParent(parent),parent=node,defs)for(words=text.substr(j).split(ShaderCompile._splitToWordExps3),j=0;j<words.length;j++)(text=words[j]).length&&"defined"!=text&&(defs[text]=!0);continue;case"#else":node.src=text,preNode=(parent=parent.parent).childs[parent.childs.length-1],node.noCompile=preNode.noCompile,node.noCompile||(node.condition=preNode.condition,node.conditionType=1==preNode.conditionType?2:1,node.text="//"+node.text+" "+preNode.text+" "+node.conditionType),node.setParent(parent),parent=node;continue;case"#endif":preNode=(parent=parent.parent).childs[parent.childs.length-1],node.noCompile=preNode.noCompile,node.noCompile||(node.text="//"+node.text),node.setParent(parent);continue;case"#include":words=ShaderCompile.splitToWords(text,null);var inlcudeFile=ShaderCompile.includes[words[1]];if(!inlcudeFile)throw"ShaderCompile error no this include file:"+words[1];if((ofs=words[0].indexOf("?"))<0){node.setParent(parent),text=inlcudeFile.getWith("with"==words[2]?words[3]:null),this._compileToTree(node,text.split("\n"),0,includefiles,defs),node.text="";continue}node.setCondition(words[0].substr(ofs+1),1),node.text=inlcudeFile.getWith("with"==words[2]?words[3]:null);break;case"#import":fname=(words=ShaderCompile.splitToWords(text,null))[1],includefiles.push({node:node,file:ShaderCompile.includes[fname],ofs:node.text.length});continue}}else{if((preNode=parent.childs[parent.childs.length-1])&&!preNode.name){includefiles.length>0&&ShaderCompile.splitToWords(text,preNode),noUseNode=node,preNode.text+="\n"+text;continue}includefiles.length>0&&ShaderCompile.splitToWords(text,node)}node.setParent(parent)}},__proto.createShader=function(define,shaderName,createShader,bindAttrib){var defMap={},defineStr="";if(define)for(var i in define)defineStr+="#define "+i+"\n",defMap[i]=!0;var vs=this._VS.toscript(defMap,[]),ps=this._PS.toscript(defMap,[]);return(createShader||Shader.create)(defineStr+vs.join("\n"),defineStr+ps.join("\n"),shaderName,this._nameMap,bindAttrib)},ShaderCompile._parseOne=function(attributes,uniforms,words,i,word,b){var one={type:ShaderCompile.shaderParamsMap[words[i+1]],name:words[i+2],size:isNaN(parseInt(words[i+3]))?1:parseInt(words[i+3])};return b&&("attribute"==word?attributes.push(one):uniforms.push(one)),":"==words[i+3]&&(one.type=words[i+4],i+=2),i+=2},ShaderCompile.addInclude=function(fileName,txt){if(!txt||0===txt.length)throw new Error("add shader include file err:"+fileName);if(ShaderCompile.includes[fileName])throw new Error("add shader include file err, has add:"+fileName);ShaderCompile.includes[fileName]=new InlcudeFile(txt)},ShaderCompile.preGetParams=function(vs,ps){var text=[vs,ps],result={},attributes=[],uniforms=[],definesInfo={},definesName=[];result.attributes=attributes,result.uniforms=uniforms,result.defines=definesInfo;for(var i=0,n=0,s=0;s<2;s++){text[s]=text[s].replace(ShaderCompile._removeAnnotation,"");var tempelse,words=text[s].match(ShaderCompile._reg);for(i=0,n=words.length;i<n;i++){var word=words[i];if("attribute"==word||"uniform"==word)i=ShaderCompile._parseOne(attributes,uniforms,words,i,word,!0);else{if("#define"==word){definesName[word=words[++i]]=1;continue}if("#ifdef"==word){definesInfo[tempelse=words[++i]]=definesInfo[tempelse]||[];for(i++;i<n;i++)if("attribute"==(word=words[i])||"uniform"==word)i=ShaderCompile._parseOne(attributes,uniforms,words,i,word,definesName[tempelse]);else if("#else"==word)for(i++;i<n;i++)if("attribute"==(word=words[i])||"uniform"==word)i=ShaderCompile._parseOne(attributes,uniforms,words,i,word,!definesName[tempelse]);else if("#endif"==word)break}}}}return result},ShaderCompile.splitToWords=function(str,block){for(var c,word,out=[],ofs=-1,i=0,n=str.length;i<n;i++)if(c=str.charAt(i)," \t=+-*/&%!<>()'\",;".indexOf(c)>=0){if(ofs>=0&&i-ofs>1&&(word=str.substr(ofs,i-ofs),out.push(word)),'"'==c||"'"==c){var ofs2=str.indexOf(c,i+1);if(ofs2<0)throw"Sharder err:"+str;out.push(str.substr(i+1,ofs2-i-1)),i=ofs2,ofs=-1;continue}"("==c&&block&&out.length>0&&(word=out[out.length-1]+";","vec4;main;".indexOf(word)<0&&(block.useFuns+=word)),ofs=-1}else ofs<0&&(ofs=i);return ofs<n&&n-ofs>1&&(word=str.substr(ofs,n-ofs),out.push(word)),out},ShaderCompile.IFDEF_NO=0,ShaderCompile.IFDEF_YES=1,ShaderCompile.IFDEF_ELSE=2,ShaderCompile.IFDEF_PARENT=3,ShaderCompile._removeAnnotation=new RegExp("(/\\*([^*]|[\\r\\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)|(//.*)","g"),ShaderCompile._reg=new RegExp("(\".*\")|('.*')|([#\\w\\*-\\.+/()=<>{}\\\\]+)|([,;:\\\\])","g"),ShaderCompile._splitToWordExps=new RegExp("[(\".*\")]+|[('.*')]+|([ \\t=\\+\\-*/&%!<>!%(),;])","g"),ShaderCompile.includes={},__static(ShaderCompile,["shaderParamsMap",function(){return this.shaderParamsMap={float:5126,int:5124,bool:35670,vec2:35664,vec3:35665,vec4:35666,ivec2:35667,ivec3:35668,ivec4:35669,bvec2:35671,bvec3:35672,bvec4:35673,mat2:35674,mat3:35675,mat4:35676,sampler2D:35678,samplerCube:35680}},"_splitToWordExps3",function(){return this._splitToWordExps3=new RegExp("[ \\t=\\+\\-*/&%!<>!%(),;\\|]","g")}]),ShaderCompile}(),Prefab=function(){function Prefab(){this.json=null}return __class(Prefab,"laya.components.Prefab"),Prefab.prototype.create=function(){return this.json?SceneUtils.createByData(null,this.json):null},Prefab}(),FillBorderWordsCmd=function(){function FillBorderWordsCmd(){}__class(FillBorderWordsCmd,"laya.display.cmd.FillBorderWordsCmd");var __proto=FillBorderWordsCmd.prototype;return __proto.recover=function(){this.words=null,Pool.recover("FillBorderWordsCmd",this)},__proto.run=function(context,gx,gy){context.fillBorderWords(this.words,this.x+gx,this.y+gy,this.font,this.fillColor,this.borderColor,this.lineWidth)},__getset(0,__proto,"cmdID",function(){return"FillBorderWords"}),FillBorderWordsCmd.create=function(words,x,y,font,fillColor,borderColor,lineWidth){var cmd=Pool.getItemByClass("FillBorderWordsCmd",FillBorderWordsCmd);return cmd.words=words,cmd.x=x,cmd.y=y,cmd.font=font,cmd.fillColor=fillColor,cmd.borderColor=borderColor,cmd.lineWidth=lineWidth,cmd},FillBorderWordsCmd.ID="FillBorderWords",FillBorderWordsCmd}(),HitArea=function(){function HitArea(){this._hit=null,this._unHit=null}__class(HitArea,"laya.utils.HitArea");var __proto=HitArea.prototype;return __proto.contains=function(x,y){return!!HitArea._isHitGraphic(x,y,this.hit)&&!HitArea._isHitGraphic(x,y,this.unHit)},__getset(0,__proto,"hit",function(){return this._hit||(this._hit=new Graphics),this._hit},function(value){this._hit=value}),__getset(0,__proto,"unHit",function(){return this._unHit||(this._unHit=new Graphics),this._unHit},function(value){this._unHit=value}),HitArea._isHitGraphic=function(x,y,graphic){if(!graphic)return!1;var cmds=graphic.cmds;if(!cmds&&graphic._one&&((cmds=HitArea._cmds).length=1,cmds[0]=graphic._one),!cmds)return!1;var len,cmd,i=0;for(len=cmds.length,i=0;i<len;i++)if(cmd=cmds[i]){switch(cmd.cmdID){case"Translate":x-=cmd.tx,y-=cmd.ty}if(HitArea._isHitCmd(x,y,cmd))return!0}return!1},HitArea._isHitCmd=function(x,y,cmd){if(!cmd)return!1;var rst=!1;switch(cmd.cmdID){case"DrawRect":HitArea._rect.setTo(cmd.x,cmd.y,cmd.width,cmd.height),rst=HitArea._rect.contains(x,y);break;case"DrawCircle":rst=(x-=cmd.x)*x+(y-=cmd.y)*y<cmd.radius*cmd.radius;break;case"DrawPoly":x-=cmd.x,y-=cmd.y,rst=HitArea._ptInPolygon(x,y,cmd.points)}return rst},HitArea._ptInPolygon=function(x,y,areaPoints){var p=HitArea._ptPoint;p.setTo(x,y);var len,nCross=0,p1x=NaN,p1y=NaN,p2x=NaN,p2y=NaN;len=areaPoints.length;for(var i=0;i<len;i+=2){if(p1x=areaPoints[i],p1y=areaPoints[i+1],p2x=areaPoints[(i+2)%len],p1y!=(p2y=areaPoints[(i+3)%len]))if(!(p.y<Math.min(p1y,p2y)))if(!(p.y>=Math.max(p1y,p2y)))(p.y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x>p.x&&nCross++}return nCross%2==1},HitArea._cmds=[],__static(HitArea,["_rect",function(){return this._rect=new Rectangle},"_ptPoint",function(){return this._ptPoint=new Point}]),HitArea}(),SoundManager=function(){function SoundManager(){}return __class(SoundManager,"laya.media.SoundManager"),__getset(1,SoundManager,"useAudioMusic",function(){return SoundManager._useAudioMusic},function(value){SoundManager._useAudioMusic=value,SoundManager._musicClass=value?AudioSound:null}),__getset(1,SoundManager,"autoStopMusic",function(){return SoundManager._autoStopMusic},function(v){Laya.stage.off("blur",null,SoundManager._stageOnBlur),Laya.stage.off("focus",null,SoundManager._stageOnFocus),Laya.stage.off("visibilitychange",null,SoundManager._visibilityChange),SoundManager._autoStopMusic=v,v&&(Laya.stage.on("blur",null,SoundManager._stageOnBlur),Laya.stage.on("focus",null,SoundManager._stageOnFocus),Laya.stage.on("visibilitychange",null,SoundManager._visibilityChange))}),__getset(1,SoundManager,"muted",function(){return SoundManager._muted},function(value){value!=SoundManager._muted&&(value&&SoundManager.stopAllSound(),SoundManager.musicMuted=value,SoundManager._muted=value)}),__getset(1,SoundManager,"musicMuted",function(){return SoundManager._musicMuted},function(value){value!=SoundManager._musicMuted&&(value?(SoundManager._bgMusic&&SoundManager._musicChannel&&!SoundManager._musicChannel.isStopped?Render.isConchApp?SoundManager._musicChannel._audio&&(SoundManager._musicChannel._audio.muted=!0):SoundManager._musicChannel.pause():SoundManager._musicChannel=null,SoundManager._musicMuted=value):(SoundManager._musicMuted=value,SoundManager._bgMusic&&SoundManager._musicChannel&&(Render.isConchApp?SoundManager._musicChannel._audio&&(SoundManager._musicChannel._audio.muted=!1):SoundManager._musicChannel.resume())))}),__getset(1,SoundManager,"soundMuted",function(){return SoundManager._soundMuted},function(value){SoundManager._soundMuted=value}),SoundManager.__init__=function(){var win=Browser.window,supportWebAudio=!!(win.AudioContext||win.webkitAudioContext||win.mozAudioContext);return supportWebAudio&&WebAudioSound.initWebAudio(),SoundManager._soundClass=supportWebAudio?WebAudioSound:AudioSound,AudioSound._initMusicAudio(),SoundManager._musicClass=AudioSound,supportWebAudio},SoundManager.addChannel=function(channel){SoundManager._channels.indexOf(channel)>=0||SoundManager._channels.push(channel)},SoundManager.removeChannel=function(channel){var i=0;for(i=SoundManager._channels.length-1;i>=0;i--)SoundManager._channels[i]==channel&&SoundManager._channels.splice(i,1)},SoundManager.disposeSoundLater=function(url){SoundManager._lastSoundUsedTimeDic[url]=Browser.now(),SoundManager._isCheckingDispose||(SoundManager._isCheckingDispose=!0,Laya.timer.loop(5e3,null,SoundManager._checkDisposeSound))},SoundManager._checkDisposeSound=function(){var key,tTime=Browser.now(),hasCheck=!1;for(key in SoundManager._lastSoundUsedTimeDic)tTime-SoundManager._lastSoundUsedTimeDic[key]>3e4?(delete SoundManager._lastSoundUsedTimeDic[key],SoundManager.disposeSoundIfNotUsed(key)):hasCheck=!0;hasCheck||(SoundManager._isCheckingDispose=!1,Laya.timer.clear(null,SoundManager._checkDisposeSound))},SoundManager.disposeSoundIfNotUsed=function(url){var i=0;for(i=SoundManager._channels.length-1;i>=0;i--)if(SoundManager._channels[i].url==url)return;SoundManager.destroySound(url)},SoundManager._visibilityChange=function(){Laya.stage.isVisibility?SoundManager._stageOnFocus():SoundManager._stageOnBlur()},SoundManager._stageOnBlur=function(){SoundManager._isActive=!1,SoundManager._musicChannel&&(SoundManager._musicChannel.isStopped||(SoundManager._blurPaused=!0,SoundManager._musicChannel.pause())),SoundManager.stopAllSound(),Laya.stage.once("mousedown",null,SoundManager._stageOnFocus)},SoundManager._recoverWebAudio=function(){WebAudioSound.ctx&&"running"!=WebAudioSound.ctx.state&&WebAudioSound.ctx.resume&&WebAudioSound.ctx.resume()},SoundManager._stageOnFocus=function(){SoundManager._isActive=!0,SoundManager._recoverWebAudio(),Laya.stage.off("mousedown",null,SoundManager._stageOnFocus),SoundManager._blurPaused&&SoundManager._musicChannel&&SoundManager._musicChannel.isStopped&&(SoundManager._blurPaused=!1,SoundManager._musicChannel.resume())},SoundManager.playSound=function(url,loops,complete,soundClass,startTime){if(void 0===loops&&(loops=1),void 0===startTime&&(startTime=0),!SoundManager._isActive||!url)return null;if(SoundManager._muted)return null;if(SoundManager._recoverWebAudio(),(url=URL.formatURL(url))==SoundManager._bgMusic){if(SoundManager._musicMuted)return null}else{if(Render.isConchApp){var ext=Utils.getFileExtension(url);if("wav"!=ext&&"ogg"!=ext)return alert("The sound only supports wav or ogg format,for optimal performance reason,please refer to the official website document."),null}if(SoundManager._soundMuted)return null}var tSound,channel;return Browser.onMiniGame||Browser.onBLMiniGame||Browser.onQQMiniGame||Browser.onQGMiniGame||Browser.onVVMiniGame||Browser.onBDMiniGame||Browser.onKGMiniGame||(tSound=Laya.loader.getRes(url)),soundClass||(soundClass=SoundManager._soundClass),tSound||((tSound=new soundClass).load(url),Browser.onMiniGame||Browser.onBLMiniGame||Browser.onQQMiniGame||Browser.onQGMiniGame||Browser.onVVMiniGame||Browser.onBDMiniGame||Browser.onKGMiniGame||Loader.cacheRes(url,tSound)),(channel=tSound.play(startTime,loops))?(channel.url=url,channel.volume=url==SoundManager._bgMusic?SoundManager.musicVolume:SoundManager.soundVolume,channel.completeHandler=complete,channel):null},SoundManager.destroySound=function(url){var tSound=Laya.loader.getRes(url);tSound&&(Loader.clearRes(url),tSound.dispose())},SoundManager.playMusic=function(url,loops,complete,startTime){return void 0===loops&&(loops=0),void 0===startTime&&(startTime=0),url=URL.formatURL(url),SoundManager._bgMusic=url,SoundManager._musicChannel&&SoundManager._musicChannel.stop(),SoundManager._musicChannel=SoundManager.playSound(url,loops,complete,SoundManager._musicClass,startTime)},SoundManager.stopSound=function(url){url=URL.formatURL(url);var channel,i=0;for(i=SoundManager._channels.length-1;i>=0;i--)(channel=SoundManager._channels[i]).url==url&&channel.stop()},SoundManager.stopAll=function(){SoundManager._bgMusic=null;var i=0;for(i=SoundManager._channels.length-1;i>=0;i--)SoundManager._channels[i].stop()},SoundManager.stopAllSound=function(){var channel,i=0;for(i=SoundManager._channels.length-1;i>=0;i--)(channel=SoundManager._channels[i]).url!=SoundManager._bgMusic&&channel.stop()},SoundManager.stopMusic=function(){SoundManager._musicChannel&&SoundManager._musicChannel.stop(),SoundManager._bgMusic=null},SoundManager.setSoundVolume=function(volume,url){if(url)url=URL.formatURL(url),SoundManager._setVolume(url,volume);else{SoundManager.soundVolume=volume;var channel,i=0;for(i=SoundManager._channels.length-1;i>=0;i--)(channel=SoundManager._channels[i]).url!=SoundManager._bgMusic&&(channel.volume=volume)}},SoundManager.setMusicVolume=function(volume){SoundManager.musicVolume=volume,SoundManager._setVolume(SoundManager._bgMusic,volume)},SoundManager._setVolume=function(url,volume){url=URL.formatURL(url);var channel,i=0;for(i=SoundManager._channels.length-1;i>=0;i--)(channel=SoundManager._channels[i]).url==url&&(channel.volume=volume)},SoundManager.musicVolume=1,SoundManager.soundVolume=1,SoundManager.playbackRate=1,SoundManager._useAudioMusic=!0,SoundManager._muted=!1,SoundManager._soundMuted=!1,SoundManager._musicMuted=!1,SoundManager._bgMusic=null,SoundManager._musicChannel=null,SoundManager._channels=[],SoundManager._autoStopMusic=!1,SoundManager._blurPaused=!1,SoundManager._isActive=!0,SoundManager._soundClass=null,SoundManager._musicClass=null,SoundManager._lastSoundUsedTimeDic={},SoundManager._isCheckingDispose=!1,SoundManager.autoReleaseSound=!0,SoundManager}(),SubmitTexture=function(_super){function SubmitTexture(renderType){void 0===renderType&&(renderType=1e4),SubmitTexture.__super.call(this,renderType)}__class(SubmitTexture,"laya.webgl.submit.SubmitTexture",Submit);var __proto=SubmitTexture.prototype;return __proto.clone=function(context,mesh,pos){var o=SubmitTexture._poolSize?SubmitTexture.POOL[--SubmitTexture._poolSize]:new SubmitTexture;return this._cloneInit(o,context,mesh,pos),o},__proto.releaseRender=function(){--this._ref<1&&(SubmitTexture.POOL[SubmitTexture._poolSize++]=this,this.shaderValue.release(),this._mesh=null,this._parent&&(this._parent.releaseRender(),this._parent=null))},__proto.renderSubmit=function(){if(0===this._numEle)return 1;var tex=this.shaderValue.textureHost;if(tex){var source=tex?tex._getSource():null;if(!source)return 1}var gl=WebGL.mainContext;this._mesh.useMesh(gl);var lastSubmit=Submit.preRender,prekey=Submit.preRender._key;return 0===this._key.blendShader&&this._key.submitType===prekey.submitType&&this._key.blendShader===prekey.blendShader&&BaseShader.activeShader&&Submit.preRender.clipInfoID==this.clipInfoID&&lastSubmit.shaderValue.defines._value===this.shaderValue.defines._value&&0==(this.shaderValue.defines._value&ShaderDefines2D.NOOPTMASK)?BaseShader.activeShader.uploadTexture2D(source):(BlendMode.activeBlendFunction!==this._blendFn&&(WebGLContext.setBlend(gl,!0),this._blendFn(gl),BlendMode.activeBlendFunction=this._blendFn),this.shaderValue.texture=source,this.shaderValue.upload()),gl.drawElements(4,this._numEle,5123,this._startIdx),Stat.renderBatches++,Stat.trianglesFaces+=this._numEle/3,1},SubmitTexture.create=function(context,mesh,sv){var o=SubmitTexture._poolSize?SubmitTexture.POOL[--SubmitTexture._poolSize]:new SubmitTexture(10016);o._mesh=mesh,o._key.clear(),o._key.submitType=2,o._ref=1,o._startIdx=mesh.indexNum*CONST3D2D.BYTES_PIDX,o._numEle=0;var blendType=context._nBlendType;if(o._key.blendShader=blendType,o._blendFn=context._targets?BlendMode.targetFns[blendType]:BlendMode.fns[blendType],o.shaderValue=sv,context._colorFiler){var ft=context._colorFiler;sv.defines.add(ft.type),sv.colorMat=ft._mat,sv.colorAlpha=ft._alpha}return o},SubmitTexture._poolSize=0,SubmitTexture.POOL=[],SubmitTexture}(),ColorFilter=function(_super){function ColorFilter(mat){ColorFilter.__super.call(this),mat||(mat=this._copyMatrix(ColorFilter.IDENTITY_MATRIX)),this._mat=new Float32Array(16),this._alpha=new Float32Array(4),this.setByMatrix(mat)}__class(ColorFilter,"laya.filters.ColorFilter",Filter);var __proto=ColorFilter.prototype;return Laya.imps(__proto,{"laya.filters.IFilter":!0}),__proto.gray=function(){return this.setByMatrix(ColorFilter.GRAY_MATRIX)},__proto.color=function(red,green,blue,alpha){return void 0===red&&(red=0),void 0===green&&(green=0),void 0===blue&&(blue=0),void 0===alpha&&(alpha=1),this.setByMatrix([1,0,0,0,red,0,1,0,0,green,0,0,1,0,blue,0,0,0,1,alpha])},__proto.setColor=function(color){var arr=ColorUtils.create(color).arrColor,mt=[0,0,0,0,256*arr[0],0,0,0,0,256*arr[1],0,0,0,0,256*arr[2],0,0,0,1,0];return this.setByMatrix(mt)},__proto.setByMatrix=function(matrix){this._matrix!=matrix&&this._copyMatrix(matrix);for(var j=0,z=0,i=0;i<20;i++)i%5!=4?this._mat[j++]=matrix[i]:this._alpha[z++]=matrix[i];return this},__proto.adjustColor=function(brightness,contrast,saturation,hue){return this.adjustHue(hue),this.adjustContrast(contrast),this.adjustBrightness(brightness),this.adjustSaturation(saturation),this},__proto.adjustBrightness=function(brightness){return 0==(brightness=this._clampValue(brightness,100))||isNaN(brightness)?this:this._multiplyMatrix([1,0,0,0,brightness,0,1,0,0,brightness,0,0,1,0,brightness,0,0,0,1,0,0,0,0,0,1])},__proto.adjustContrast=function(contrast){if(0==(contrast=this._clampValue(contrast,100))||isNaN(contrast))return this;var x=NaN,x1=(x=contrast<0?127+contrast/100*127:127*(x=0==(x=contrast%1)?ColorFilter.DELTA_INDEX[contrast]:ColorFilter.DELTA_INDEX[contrast<<0]*(1-x)+ColorFilter.DELTA_INDEX[1+(contrast<<0)]*x)+127)/127,x2=.5*(127-x);return this._multiplyMatrix([x1,0,0,0,x2,0,x1,0,0,x2,0,0,x1,0,x2,0,0,0,1,0,0,0,0,0,1])},__proto.adjustSaturation=function(saturation){if(0==(saturation=this._clampValue(saturation,100))||isNaN(saturation))return this;var x=1+(saturation>0?3*saturation/100:saturation/100),dx=1-x,r=.3086*dx,g=.6094*dx,b=.082*dx;return this._multiplyMatrix([r+x,g,b,0,0,r,g+x,b,0,0,r,g,b+x,0,0,0,0,0,1,0,0,0,0,0,1])},__proto.adjustHue=function(hue){if(0==(hue=this._clampValue(hue,180)/180*Math.PI)||isNaN(hue))return this;var cos=Math.cos(hue),sin=Math.sin(hue),r=.213,g=.715,b=.072;return this._multiplyMatrix([r+cos*(1-r)+sin*-r,g+cos*-g+sin*-g,b+cos*-b+sin*(1-b),0,0,r+cos*-r+.143*sin,g+cos*(1-g)+.14*sin,b+cos*-b+-.283*sin,0,0,r+cos*-r+-.787*sin,g+cos*-g+sin*g,b+cos*(1-b)+sin*b,0,0,0,0,0,1,0,0,0,0,0,1])},__proto.reset=function(){return this.setByMatrix(this._copyMatrix(ColorFilter.IDENTITY_MATRIX))},__proto._multiplyMatrix=function(matrix){var col=[];this._matrix=this._fixMatrix(this._matrix);for(var i=0;i<5;i++){for(var j=0;j<5;j++)col[j]=this._matrix[j+5*i];for(j=0;j<5;j++){for(var val=0,k=0;k<5;k++)val+=matrix[j+5*k]*col[k];this._matrix[j+5*i]=val}}return this.setByMatrix(this._matrix)},__proto._clampValue=function(val,limit){return Math.min(limit,Math.max(-limit,val))},__proto._fixMatrix=function(matrix){return null==matrix?ColorFilter.IDENTITY_MATRIX:(matrix.length<25?matrix=matrix.slice(0,matrix.length).concat(ColorFilter.IDENTITY_MATRIX.slice(matrix.length,25)):matrix.length>25&&(matrix=matrix.slice(0,25)),matrix)},__proto._copyMatrix=function(matrix){this._matrix||(this._matrix=[]);for(var i=0;i<25;i++)this._matrix[i]=matrix[i];return this._matrix},__getset(0,__proto,"type",function(){return 32}),ColorFilter.LENGTH=25,__static(ColorFilter,["DELTA_INDEX",function(){return this.DELTA_INDEX=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10]},"GRAY_MATRIX",function(){return this.GRAY_MATRIX=[.3086,.6094,.082,0,0,.3086,.6094,.082,0,0,.3086,.6094,.082,0,0,0,0,0,1,0]},"IDENTITY_MATRIX",function(){return this.IDENTITY_MATRIX=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]}]),ColorFilter}(),SubmitCanvas=function(_super){function SubmitCanvas(){this._matrix=new Matrix,this._matrix4=CONST3D2D.defaultMatrix4.concat(),SubmitCanvas.__super.call(this,1e4),this.shaderValue=new Value2D(0,0)}__class(SubmitCanvas,"laya.webgl.submit.SubmitCanvas",Submit);var __proto=SubmitCanvas.prototype;return __proto.renderSubmit=function(){var preAlpha=RenderState2D.worldAlpha,preMatrix4=RenderState2D.worldMatrix4,preMatrix=RenderState2D.worldMatrix,preFilters=RenderState2D.worldFilters,preWorldShaderDefines=RenderState2D.worldShaderDefines,v=this.shaderValue,m=this._matrix,m4=this._matrix4,mout=Matrix.TEMP;return Matrix.mul(m,preMatrix,mout),m4[0]=mout.a,m4[1]=mout.b,m4[4]=mout.c,m4[5]=mout.d,m4[12]=mout.tx,m4[13]=mout.ty,RenderState2D.worldMatrix=mout.clone(),RenderState2D.worldMatrix4=m4,RenderState2D.worldAlpha=RenderState2D.worldAlpha*v.alpha,v.filters&&v.filters.length&&(RenderState2D.worldFilters=v.filters,RenderState2D.worldShaderDefines=v.defines),this.canv.flushsubmit(),RenderState2D.worldAlpha=preAlpha,RenderState2D.worldMatrix4=preMatrix4,RenderState2D.worldMatrix.destroy(),RenderState2D.worldMatrix=preMatrix,RenderState2D.worldFilters=preFilters,RenderState2D.worldShaderDefines=preWorldShaderDefines,1},__proto.releaseRender=function(){if(--this._ref<1){var cache=SubmitCanvas.POOL;this._mesh=null,cache[cache._length++]=this}},__proto.clone=function(context,mesh,pos){return null},__proto.getRenderType=function(){return 10003},SubmitCanvas.create=function(canvas,alpha,filters){var o=SubmitCanvas.POOL._length?SubmitCanvas.POOL[--SubmitCanvas.POOL._length]:new SubmitCanvas;o.canv=canvas,o._ref=1,o._numEle=0;var v=o.shaderValue;return v.alpha=alpha,v.defines.setValue(0),filters&&filters.length&&v.setFilters(filters),o},SubmitCanvas.POOL=[],SubmitCanvas.__init$=function(){SubmitCanvas.POOL._length=0},SubmitCanvas}(),AudioSound=(function(_super){function Script(){Script.__super.call(this)}__class(Script,"laya.components.Script",Component);var __proto=Script.prototype;__proto._onAwake=function(){this.onAwake(),this.onStart!==laya.components.Script.prototype.onStart&&Laya.startTimer.callLater(this,this.onStart)},__proto._onEnable=function(){var proto=laya.components.Script.prototype;this.onTriggerEnter!==proto.onTriggerEnter&&this.owner.on("triggerenter",this,this.onTriggerEnter),this.onTriggerStay!==proto.onTriggerStay&&this.owner.on("triggerstay",this,this.onTriggerStay),this.onTriggerExit!==proto.onTriggerExit&&this.owner.on("triggerexit",this,this.onTriggerExit),this.onMouseDown!==proto.onMouseDown&&this.owner.on("mousedown",this,this.onMouseDown),this.onMouseUp!==proto.onMouseUp&&this.owner.on("mouseup",this,this.onMouseUp),this.onClick!==proto.onClick&&this.owner.on("click",this,this.onClick),this.onStageMouseDown!==proto.onStageMouseDown&&Laya.stage.on("mousedown",this,this.onStageMouseDown),this.onStageMouseUp!==proto.onStageMouseUp&&Laya.stage.on("mouseup",this,this.onStageMouseUp),this.onStageClick!==proto.onStageClick&&Laya.stage.on("click",this,this.onStageClick),this.onStageMouseMove!==proto.onStageMouseMove&&Laya.stage.on("mousemove",this,this.onStageMouseMove),this.onDoubleClick!==proto.onDoubleClick&&this.owner.on("doubleclick",this,this.onDoubleClick),this.onRightClick!==proto.onRightClick&&this.owner.on("rightclick",this,this.onRightClick),this.onMouseMove!==proto.onMouseMove&&this.owner.on("mousemove",this,this.onMouseMove),this.onMouseOver!==proto.onMouseOver&&this.owner.on("mouseover",this,this.onMouseOver),this.onMouseOut!==proto.onMouseOut&&this.owner.on("mouseout",this,this.onMouseOut),this.onKeyDown!==proto.onKeyDown&&Laya.stage.on("keydown",this,this.onKeyDown),this.onKeyPress!==proto.onKeyPress&&Laya.stage.on("keypress",this,this.onKeyPress),this.onKeyUp!==proto.onKeyUp&&Laya.stage.on("keyup",this,this.onKeyUp),this.onUpdate!==proto.onUpdate&&Laya.updateTimer.frameLoop(1,this,this.onUpdate),this.onLateUpdate!==proto.onLateUpdate&&Laya.lateTimer.frameLoop(1,this,this.onLateUpdate),this.onPreRender!==proto.onPreRender&&Laya.lateTimer.frameLoop(1,this,this.onPreRender)},__proto._onDisable=function(){this.owner.offAllCaller(this),Laya.stage.offAllCaller(this),Laya.startTimer.clearAll(this),Laya.updateTimer.clearAll(this),Laya.lateTimer.clearAll(this)},__proto._isScript=function(){return!0},__proto._onDestroy=function(){this.onDestroy()},__proto.onAwake=function(){},__proto.onEnable=function(){},__proto.onStart=function(){},__proto.onTriggerEnter=function(other,self,contact){},__proto.onTriggerStay=function(other,self,contact){},__proto.onTriggerExit=function(other,self,contact){},__proto.onMouseDown=function(e){},__proto.onMouseUp=function(e){},__proto.onClick=function(e){},__proto.onStageMouseDown=function(e){},__proto.onStageMouseUp=function(e){},__proto.onStageClick=function(e){},__proto.onStageMouseMove=function(e){},__proto.onDoubleClick=function(e){},__proto.onRightClick=function(e){},__proto.onMouseMove=function(e){},__proto.onMouseOver=function(e){},__proto.onMouseOut=function(e){},__proto.onKeyDown=function(e){},__proto.onKeyPress=function(e){},__proto.onKeyUp=function(e){},__proto.onUpdate=function(){},__proto.onLateUpdate=function(){},__proto.onPreRender=function(){},__proto.onPostRender=function(){},__proto.onDisable=function(){},__proto.onDestroy=function(){},__getset(0,__proto,"isSingleton",function(){return!1})}(),function(_super){function AudioSound(){this.url=null,this.audio=null,this.loaded=!1,AudioSound.__super.call(this)}__class(AudioSound,"laya.media.h5audio.AudioSound",EventDispatcher);var __proto=AudioSound.prototype;return __proto.dispose=function(){var ad=AudioSound._audioCache[this.url];Pool.clearBySign("audio:"+this.url),ad&&(Render.isConchApp||(ad.src=""),delete AudioSound._audioCache[this.url])},__proto.load=function(url){var ad;if(url=URL.formatURL(url),this.url=url,url==SoundManager._bgMusic?(AudioSound._initMusicAudio(),(ad=AudioSound._musicAudio).src!=url&&(AudioSound._audioCache[ad.src]=null,ad=null)):ad=AudioSound._audioCache[url],ad&&ad.readyState>=2)this.event("complete");else{ad||(url==SoundManager._bgMusic?(AudioSound._initMusicAudio(),ad=AudioSound._musicAudio):ad=Browser.createElement("audio"),AudioSound._audioCache[url]=ad,ad.src=url),ad.addEventListener("canplaythrough",onLoaded),ad.addEventListener("error",onErr);var me=this;this.audio=ad,ad.load?ad.load():onErr()}function onLoaded(){offs(),me.loaded=!0,me.event("complete")}function onErr(){ad.load=null,offs(),me.event("error")}function offs(){ad.removeEventListener("canplaythrough",onLoaded),ad.removeEventListener("error",onErr)}},__proto.play=function(startTime,loops){if(void 0===startTime&&(startTime=0),void 0===loops&&(loops=0),!this.url)return null;var ad,tAd;if(!(ad=this.url==SoundManager._bgMusic?AudioSound._musicAudio:AudioSound._audioCache[this.url]))return null;tAd=Pool.getItem("audio:"+this.url),Render.isConchApp?tAd||((tAd=Browser.createElement("audio")).src=this.url):this.url==SoundManager._bgMusic?(AudioSound._initMusicAudio(),(tAd=AudioSound._musicAudio).src=this.url):tAd=tAd||ad.cloneNode(!0);var channel=new AudioSoundChannel(tAd);return channel.url=this.url,channel.loops=loops,channel.startTime=startTime,channel.play(),SoundManager.addChannel(channel),channel},__getset(0,__proto,"duration",function(){var ad;return(ad=AudioSound._audioCache[this.url])?ad.duration:0}),AudioSound._initMusicAudio=function(){AudioSound._musicAudio||(AudioSound._musicAudio||(AudioSound._musicAudio=Browser.createElement("audio")),Render.isConchApp||Browser.document.addEventListener("mousedown",AudioSound._makeMusicOK))},AudioSound._makeMusicOK=function(){Browser.document.removeEventListener("mousedown",AudioSound._makeMusicOK),AudioSound._musicAudio.src?AudioSound._musicAudio.play():(AudioSound._musicAudio.src="",AudioSound._musicAudio.load())},AudioSound._audioCache={},AudioSound._musicAudio=null,AudioSound}()),Node=(function(_super){function Sound(){Sound.__super.call(this)}__class(Sound,"laya.media.Sound",EventDispatcher);var __proto=Sound.prototype;__proto.load=function(url){},__proto.play=function(startTime,loops){return void 0===startTime&&(startTime=0),void 0===loops&&(loops=0),null},__proto.dispose=function(){},__getset(0,__proto,"duration",function(){return 0})}(),function(_super){function MeshParticle2D(maxNum){MeshParticle2D.__super.call(this,116,4*maxNum*116,4),this.canReuse=!0,this.setAttributes(laya.webgl.utils.MeshParticle2D._fixattriInfo),this.createQuadIB(maxNum),this._quadNum=maxNum}__class(MeshParticle2D,"laya.webgl.utils.MeshParticle2D",Mesh2D);var __proto=MeshParticle2D.prototype;__proto.setMaxParticleNum=function(maxNum){this._vb._resizeBuffer(4*maxNum*116,!1),this.createQuadIB(maxNum)},__proto.releaseMesh=function(){this._vb.setByteLength(0),this.vertNum=0,this.indexNum=0,laya.webgl.utils.MeshParticle2D._POOL.push(this)},__proto.destroy=function(){this._ib.destroy(),this._vb.destroy(),this._vb.deleteBuffer()},MeshParticle2D.getAMesh=function(maxNum){if(laya.webgl.utils.MeshParticle2D._POOL.length){var ret=laya.webgl.utils.MeshParticle2D._POOL.pop();return ret.setMaxParticleNum(maxNum),ret}return new MeshParticle2D(maxNum)},MeshParticle2D.const_stride=116,MeshParticle2D._POOL=[],__static(MeshParticle2D,["_fixattriInfo",function(){return this._fixattriInfo=[5126,4,0,5126,3,16,5126,3,28,5126,4,40,5126,4,56,5126,3,72,5126,2,84,5126,4,92,5126,1,108,5126,1,112]}])}(),function(_super){function Node(){this._bits=0,this._parent=null,this.name="",this.destroyed=!1,this._conchData=null,this._components=null,this._activeChangeScripts=null,this._scene=null,Node.__super.call(this),this._children=Node.ARRAY_EMPTY,this._extUIChild=Node.ARRAY_EMPTY,this.createGLBuffer()}__class(Node,"laya.display.Node",EventDispatcher);var __proto=Node.prototype;return __proto.createGLBuffer=function(){},__proto._setBit=function(type,value){16===type&&(this._getBit(type)!=value&&this._updateDisplayedInstage());value?this._bits|=type:this._bits&=~type},__proto._getBit=function(type){return 0!=(this._bits&type)},__proto._setUpNoticeChain=function(){this._getBit(16)&&this._setBitUp(16)},__proto._setBitUp=function(type){var ele=this;for(ele._setBit(type,!0),ele=ele._parent;ele;){if(ele._getBit(type))return;ele._setBit(type,!0),ele=ele._parent}},__proto.on=function(type,caller,listener,args){return"display"!==type&&"undisplay"!==type||this._getBit(16)||this._setBitUp(16),this._createListener(type,caller,listener,args,!1)},__proto.once=function(type,caller,listener,args){return"display"!==type&&"undisplay"!==type||this._getBit(16)||this._setBitUp(16),this._createListener(type,caller,listener,args,!0)},__proto.destroy=function(destroyChild){void 0===destroyChild&&(destroyChild=!0),this.destroyed=!0,this._destroyAllComponent(),this._parent&&this._parent.removeChild(this),this._children&&(destroyChild?this.destroyChildren():this.removeChildren()),this.onDestroy(),this._children=null,this.offAll()},__proto.onDestroy=function(){},__proto.destroyChildren=function(){if(this._children)for(var i=0,n=this._children.length;i<n;i++)this._children[0].destroy(!0)},__proto.addChild=function(node){if(!node||this.destroyed||node===this)return node;if(node._zOrder&&this._setBit(32,!0),node._parent===this){var index=this.getChildIndex(node);index!==this._children.length-1&&(this._children.splice(index,1),this._children.push(node),this._childChanged())}else node._parent&&node._parent.removeChild(node),this._children===Node.ARRAY_EMPTY&&(this._children=[]),this._children.push(node),node._setParent(this),this._childChanged();return node},__proto.addInputChild=function(node){if(this._extUIChild==Node.ARRAY_EMPTY)this._extUIChild=[node];else{if(this._extUIChild.indexOf(node)>=0)return null;this._extUIChild.push(node)}return null},__proto.removeInputChild=function(node){var idx=this._extUIChild.indexOf(node);idx>=0&&this._extUIChild.splice(idx,1)},__proto.addChildren=function(__args){for(var args=arguments,i=0,n=args.length;i<n;)this.addChild(args[i++])},__proto.addChildAt=function(node,index){if(!node||this.destroyed||node===this)return node;if(node._zOrder&&this._setBit(32,!0),index>=0&&index<=this._children.length){if(node._parent===this){var oldIndex=this.getChildIndex(node);this._children.splice(oldIndex,1),this._children.splice(index,0,node),this._childChanged()}else node._parent&&node._parent.removeChild(node),this._children===Node.ARRAY_EMPTY&&(this._children=[]),this._children.splice(index,0,node),node._setParent(this);return node}throw new Error("appendChildAt:The index is out of bounds")},__proto.getChildIndex=function(node){return this._children.indexOf(node)},__proto.getChildByName=function(name){var nodes=this._children;if(nodes)for(var i=0,n=nodes.length;i<n;i++){var node=nodes[i];if(node.name===name)return node}return null},__proto.getChildAt=function(index){return this._children[index]||null},__proto.setChildIndex=function(node,index){var childs=this._children;if(index<0||index>=childs.length)throw new Error("setChildIndex:The index is out of bounds.");var oldIndex=this.getChildIndex(node);if(oldIndex<0)throw new Error("setChildIndex:node is must child of this object.");return childs.splice(oldIndex,1),childs.splice(index,0,node),this._childChanged(),node},__proto._childChanged=function(child){},__proto.removeChild=function(node){if(!this._children)return node;var index=this._children.indexOf(node);return this.removeChildAt(index)},__proto.removeSelf=function(){return this._parent&&this._parent.removeChild(this),this},__proto.removeChildByName=function(name){var node=this.getChildByName(name);return node&&this.removeChild(node),node},__proto.removeChildAt=function(index){var node=this.getChildAt(index);return node&&(this._children.splice(index,1),node._setParent(null)),node},__proto.removeChildren=function(beginIndex,endIndex){if(void 0===beginIndex&&(beginIndex=0),void 0===endIndex&&(endIndex=2147483647),this._children&&this._children.length>0){var childs=this._children;if(0===beginIndex&&endIndex>=childs.length-1){var arr=childs;this._children=Node.ARRAY_EMPTY}else arr=childs.splice(beginIndex,endIndex-beginIndex);for(var i=0,n=arr.length;i<n;i++)arr[i]._setParent(null)}return this},__proto.replaceChild=function(newNode,oldNode){var index=this._children.indexOf(oldNode);return index>-1?(this._children.splice(index,1,newNode),oldNode._setParent(null),newNode._setParent(this),newNode):null},__proto._setParent=function(value){this._parent!==value&&(value?(this._parent=value,this._onAdded(),this.event("added"),this._getBit(16)&&(this._setUpNoticeChain(),value.displayedInStage&&this._displayChild(this,!0)),value._childChanged(this)):(this._onRemoved(),this.event("removed"),this._parent._childChanged(),this._getBit(16)&&this._displayChild(this,!1),this._parent=value))},__proto._updateDisplayedInstage=function(){var ele;ele=this;for(var stage=Laya.stage,displayedInStage=!1;ele;){if(ele._getBit(16)){displayedInStage=ele._getBit(128);break}if(ele===stage||ele._getBit(128)){displayedInStage=!0;break}ele=ele._parent}this._setBit(128,displayedInStage)},__proto._setDisplay=function(value){this._getBit(128)!==value&&(this._setBit(128,value),value?this.event("display"):this.event("undisplay"))},__proto._displayChild=function(node,display){var childs=node._children;if(childs)for(var i=0,n=childs.length;i<n;i++){var child=childs[i];child._getBit(16)&&(child._children.length>0?this._displayChild(child,display):child._setDisplay(display))}node._setDisplay(display)},__proto.contains=function(node){if(node===this)return!0;for(;node;){if(node._parent===this)return!0;node=node._parent}return!1},__proto.timerLoop=function(delay,caller,method,args,coverBefore,jumpFrame){void 0===coverBefore&&(coverBefore=!0),void 0===jumpFrame&&(jumpFrame=!1),(this.scene?this.scene.timer:Laya.timer).loop(delay,caller,method,args,coverBefore,jumpFrame)},__proto.timerOnce=function(delay,caller,method,args,coverBefore){void 0===coverBefore&&(coverBefore=!0),(this.scene?this.scene.timer:Laya.timer)._create(!1,!1,delay,caller,method,args,coverBefore)},__proto.frameLoop=function(delay,caller,method,args,coverBefore){void 0===coverBefore&&(coverBefore=!0),(this.scene?this.scene.timer:Laya.timer)._create(!0,!0,delay,caller,method,args,coverBefore)},__proto.frameOnce=function(delay,caller,method,args,coverBefore){void 0===coverBefore&&(coverBefore=!0),(this.scene?this.scene.timer:Laya.timer)._create(!0,!1,delay,caller,method,args,coverBefore)},__proto.clearTimer=function(caller,method){(this.scene?this.scene.timer:Laya.timer).clear(caller,method)},__proto.callLater=function(method,args){(this.scene?this.scene.timer:Laya.timer).callLater(this,method,args)},__proto.runCallLater=function(method){(this.scene?this.scene.timer:Laya.timer).runCallLater(this,method)},__proto._onActive=function(){Stat.spriteCount++},__proto._onInActive=function(){Stat.spriteCount--},__proto._onActiveInScene=function(){},__proto._onInActiveInScene=function(){},__proto._parse=function(data,spriteMap){},__proto._setBelongScene=function(scene){if(!this._scene){if(this._scene=scene,this._components)for(var i=0,n=this._components.length;i<n;i++)this._components[i]._setActiveInScene(!0);for(this._onActiveInScene(),i=0,n=this._children.length;i<n;i++)this._children[i]._setBelongScene(scene)}},__proto._setUnBelongScene=function(){if(this._scene!==this){if(this._onInActiveInScene(),this._components)for(var i=0,n=this._components.length;i<n;i++)this._components[i]._setActiveInScene(!1);for(this._scene=null,i=0,n=this._children.length;i<n;i++)this._children[i]._setUnBelongScene()}},__proto.onAwake=function(){},__proto.onEnable=function(){},__proto._processActive=function(){this._activeChangeScripts||(this._activeChangeScripts=[]),this._activeHierarchy(this._activeChangeScripts),this._activeScripts()},__proto._activeHierarchy=function(activeChangeScripts){if(this._setBit(2,!0),this._components)for(var i=0,n=this._components.length;i<n;i++){var comp=this._components[i];comp._setActive(!0),comp._isScript()&&comp._enabled&&activeChangeScripts.push(comp)}for(this._onActive(),i=0,n=this._children.length;i<n;i++){var child=this._children[i];!child._getBit(1)&&child._activeHierarchy(activeChangeScripts)}this._getBit(4)||(this._setBit(4,!0),this.onAwake()),this.onEnable()},__proto._activeScripts=function(){for(var i=0,n=this._activeChangeScripts.length;i<n;i++)this._activeChangeScripts[i].onEnable();this._activeChangeScripts.length=0},__proto._processInActive=function(){this._activeChangeScripts||(this._activeChangeScripts=[]),this._inActiveHierarchy(this._activeChangeScripts),this._inActiveScripts()},__proto._inActiveHierarchy=function(activeChangeScripts){if(this._onInActive(),this._components)for(var i=0,n=this._components.length;i<n;i++){var comp=this._components[i];comp._setActive(!1),comp._isScript()&&comp._enabled&&activeChangeScripts.push(comp)}for(this._setBit(2,!1),i=0,n=this._children.length;i<n;i++){var child=this._children[i];child&&!child._getBit(1)&&child._inActiveHierarchy(activeChangeScripts)}this.onDisable()},__proto._inActiveScripts=function(){for(var i=0,n=this._activeChangeScripts.length;i<n;i++)this._activeChangeScripts[i].onDisable();this._activeChangeScripts.length=0},__proto.onDisable=function(){},__proto._onAdded=function(){if(this._activeChangeScripts&&0!==this._activeChangeScripts.length)throw"Node: can't set the main inActive node active in hierarchy,if the operate is in main inActive node or it's children script's onDisable Event.";var parentScene=this._parent.scene;parentScene&&this._setBelongScene(parentScene),this._parent.activeInHierarchy&&this.active&&this._processActive()},__proto._onRemoved=function(){if(this._activeChangeScripts&&0!==this._activeChangeScripts.length)throw"Node: can't set the main active node inActive in hierarchy,if the operate is in main active node or it's children script's onEnable Event.";this._parent.activeInHierarchy&&this.active&&this._processInActive(),this._parent.scene&&this._setUnBelongScene()},__proto._addComponentInstance=function(comp){this._components=this._components||[],this._components.push(comp),comp.owner=this,comp._onAdded(),this.activeInHierarchy&&(comp._setActive(!0),comp._isScript()&&comp._enabled&&comp.onEnable()),this._scene&&comp._setActiveInScene(!0)},__proto._destroyComponent=function(comp){if(this._components)for(var i=0,n=this._components.length;i<n;i++){var item=this._components[i];if(item===comp){item._destroy(),this._components.splice(i,1);break}}},__proto._destroyAllComponent=function(){if(this._components){for(var i=0,n=this._components.length;i<n;i++){this._components[i]._destroy()}this._components.length=0}},__proto._cloneTo=function(destObject,srcRoot,dstRoot){var destNode=destObject;if(this._components)for(var i=0,n=this._components.length;i<n;i++){var destComponent=destNode.addComponent(this._components[i].constructor);this._components[i]._cloneTo(destComponent)}},__proto.addComponentIntance=function(comp){if(comp.owner)throw"Node:the component has belong to other node.";if(comp.isSingleton&&this.getComponent(comp.constructor))throw"Node:the component is singleton,can't add the second one.";return this._addComponentInstance(comp),comp},__proto.addComponent=function(type){var comp=Pool.createByClass(type);if(comp._destroyed=!1,comp.isSingleton&&this.getComponent(type))throw"无法实例"+type+"组件,"+type+"组件已存在!";return this._addComponentInstance(comp),comp},__proto.getComponent=function(clas){if(this._components)for(var i=0,n=this._components.length;i<n;i++){var comp=this._components[i];if(Laya.__typeof(comp,clas))return comp}return null},__proto.getComponents=function(clas){var arr;if(this._components)for(var i=0,n=this._components.length;i<n;i++){var comp=this._components[i];Laya.__typeof(comp,clas)&&(arr=arr||[]).push(comp)}return arr},__getset(0,__proto,"numChildren",function(){return this._children.length}),__getset(0,__proto,"parent",function(){return this._parent}),__getset(0,__proto,"activeInHierarchy",function(){return this._getBit(2)}),__getset(0,__proto,"active",function(){return!this._getBit(8)&&!this._getBit(1)},function(value){if(value=!!value,!this._getBit(1)!==value){if(this._activeChangeScripts&&0!==this._activeChangeScripts.length)throw value?"Node: can't set the main inActive node active in hierarchy,if the operate is in main inActive node or it's children script's onDisable Event.":"Node: can't set the main active node inActive in hierarchy,if the operate is in main active node or it's children script's onEnable Event.";this._setBit(1,!value),this._parent&&this._parent.activeInHierarchy&&(value?this._processActive():this._processInActive())}}),__getset(0,__proto,"displayedInStage",function(){return this._getBit(16)?this._getBit(128):(this._setBitUp(16),this._getBit(128))}),__getset(0,__proto,"scene",function(){return this._scene}),__getset(0,__proto,"timer",function(){return this.scene?this.scene.timer:Laya.timer}),Node.ARRAY_EMPTY=[],Node}()),SoundChannel=function(_super){function SoundChannel(){this.url=null,this.loops=0,this.startTime=NaN,this.isStopped=!1,this.completeHandler=null,SoundChannel.__super.call(this)}__class(SoundChannel,"laya.media.SoundChannel",EventDispatcher);var __proto=SoundChannel.prototype;return __proto.play=function(){},__proto.stop=function(){this.completeHandler&&this.completeHandler.run()},__proto.pause=function(){},__proto.resume=function(){},__proto.__runComplete=function(handler){handler&&handler.run()},__getset(0,__proto,"volume",function(){return 1},function(v){}),__getset(0,__proto,"position",function(){return 0}),__getset(0,__proto,"duration",function(){return 0}),SoundChannel}(),Resource=function(_super){function Resource(){this._id=0,this._url=null,this._cpuMemory=0,this._gpuMemory=0,this._destroyed=!1,this._referenceCount=0,this.lock=!1,this.name=null,Resource.__super.call(this),this._id=++Resource._uniqueIDCounter,this._destroyed=!1,this._referenceCount=0,Resource._idResourcesMap[this.id]=this,this.lock=!1}__class(Resource,"laya.resource.Resource",EventDispatcher);var __proto=Resource.prototype;return Laya.imps(__proto,{"laya.resource.ICreateResource":!0,"laya.resource.IDestroy":!0}),__proto._setCPUMemory=function(value){var offsetValue=value-this._cpuMemory;this._cpuMemory=value,Resource._addCPUMemory(offsetValue)},__proto._setGPUMemory=function(value){var offsetValue=value-this._gpuMemory;this._gpuMemory=value,Resource._addGPUMemory(offsetValue)},__proto._setCreateURL=function(url){var resList;(url=URL.formatURL(url),this._url!==url)&&(this._url&&((resList=Resource._urlResourcesMap[this._url]).splice(resList.indexOf(this),1),0===resList.length&&delete Resource._urlResourcesMap[this._url]),url&&((resList=Resource._urlResourcesMap[url])||(Resource._urlResourcesMap[url]=resList=[]),resList.push(this)),this._url=url)},__proto._addReference=function(count){void 0===count&&(count=1),this._referenceCount+=count},__proto._removeReference=function(count){void 0===count&&(count=1),this._referenceCount-=count},__proto._clearReference=function(){this._referenceCount=0},__proto._recoverResource=function(){},__proto._disposeResource=function(){},__proto._activeResource=function(){},__proto.destroy=function(){var resList;this._destroyed||(this._destroyed=!0,this.lock=!1,this._disposeResource(),delete Resource._idResourcesMap[this.id],this._url&&((resList=Resource._urlResourcesMap[this._url])&&(resList.splice(resList.indexOf(this),1),0===resList.length&&delete Resource._urlResourcesMap[this._url]),Loader.getRes(this._url)==this&&delete Loader.loadedMap[this._url]))},__getset(0,__proto,"id",function(){return this._id}),__getset(0,__proto,"gpuMemory",function(){return this._gpuMemory}),__getset(0,__proto,"url",function(){return this._url}),__getset(0,__proto,"cpuMemory",function(){return this._cpuMemory}),__getset(0,__proto,"destroyed",function(){return this._destroyed}),__getset(0,__proto,"referenceCount",function(){return this._referenceCount}),__getset(1,Resource,"cpuMemory",function(){return this._cpuMemory},laya.events.EventDispatcher._$SET_cpuMemory),__getset(1,Resource,"gpuMemory",function(){return this._gpuMemory},laya.events.EventDispatcher._$SET_gpuMemory),Resource._addCPUMemory=function(size){this._cpuMemory+=size},Resource._addGPUMemory=function(size){this._gpuMemory+=size},Resource._addMemory=function(cpuSize,gpuSize){this._cpuMemory+=cpuSize,this._gpuMemory+=gpuSize},Resource.getResourceByID=function(id){return Resource._idResourcesMap[id]},Resource.getResourceByURL=function(url,index){return void 0===index&&(index=0),Resource._urlResourcesMap[url][index]},Resource.destroyUnusedResources=function(){for(var k in Resource._idResourcesMap){var res=Resource._idResourcesMap[k];res.lock||0!==res._referenceCount||res.destroy()}},Resource._uniqueIDCounter=0,Resource._idResourcesMap={},Resource._urlResourcesMap={},Resource._cpuMemory=0,Resource._gpuMemory=0,Resource}(),MeshVG=function(_super){function MeshVG(){MeshVG.__super.call(this,12,4,4),this.canReuse=!0,this.setAttributes(laya.webgl.utils.MeshVG._fixattriInfo)}__class(MeshVG,"laya.webgl.utils.MeshVG",Mesh2D);var __proto=MeshVG.prototype;return __proto.addVertAndIBToMesh=function(ctx,points,rgba,ib){for(var f32pos=this._vb.needSize(points.length/2*12)>>2,vbdata=this._vb._floatArray32||this._vb.getFloat32Array(),vbu32Arr=this._vb._uint32Array,ci=0,sz=points.length/2,i=0;i<sz;i++)vbdata[f32pos++]=points[ci],vbdata[f32pos++]=points[ci+1],ci+=2,vbu32Arr[f32pos++]=rgba;this._vb.setNeedUpload(),this._ib.append(new Uint16Array(ib)),this._ib.setNeedUpload(),this.vertNum+=sz,this.indexNum+=ib.length},__proto.releaseMesh=function(){this._vb.setByteLength(0),this._ib.setByteLength(0),this.vertNum=0,this.indexNum=0,laya.webgl.utils.MeshVG._POOL.push(this)},__proto.destroy=function(){this._ib.destroy(),this._vb.destroy(),this._ib.disposeResource(),this._vb.deleteBuffer()},MeshVG.getAMesh=function(mainctx){var ret;return ret=laya.webgl.utils.MeshVG._POOL.length?laya.webgl.utils.MeshVG._POOL.pop():new MeshVG,mainctx&&ret._vb._resizeBuffer(786432,!1),ret},MeshVG.const_stride=12,MeshVG._POOL=[],__static(MeshVG,["_fixattriInfo",function(){return this._fixattriInfo=[5126,2,0,5121,4,8]}]),MeshVG}(),TimeLine=function(_super){var tweenData;function TimeLine(){this._labelDic=null,this._tweenDic={},this._tweenDataList=[],this._endTweenDataList=null,this._currTime=0,this._lastTime=0,this._startTime=0,this._index=0,this._gidIndex=0,this._firstTweenDic={},this._startTimeSort=!1,this._endTimeSort=!1,this._loopKey=!1,this.scale=1,this._frameRate=60,this._frameIndex=0,this._total=0,TimeLine.__super.call(this)}__class(TimeLine,"laya.utils.TimeLine",EventDispatcher);var __proto=TimeLine.prototype;return __proto.to=function(target,props,duration,ease,offset){return void 0===offset&&(offset=0),this._create(target,props,duration,ease,offset,!0)},__proto.from=function(target,props,duration,ease,offset){return void 0===offset&&(offset=0),this._create(target,props,duration,ease,offset,!1)},__proto._create=function(target,props,duration,ease,offset,isTo){var tTweenData=Pool.getItemByClass("tweenData",tweenData);return tTweenData.isTo=isTo,tTweenData.type=0,tTweenData.target=target,tTweenData.duration=duration,tTweenData.data=props,tTweenData.startTime=this._startTime+offset,tTweenData.endTime=tTweenData.startTime+tTweenData.duration,tTweenData.ease=ease,this._startTime=Math.max(tTweenData.endTime,this._startTime),this._tweenDataList.push(tTweenData),this._startTimeSort=!0,this._endTimeSort=!0,this},__proto.addLabel=function(label,offset){var tTweenData=Pool.getItemByClass("tweenData",tweenData);return tTweenData.type=1,tTweenData.data=label,tTweenData.endTime=tTweenData.startTime=this._startTime+offset,this._labelDic||(this._labelDic={}),this._labelDic[label]=tTweenData,this._tweenDataList.push(tTweenData),this},__proto.removeLabel=function(label){if(this._labelDic&&this._labelDic[label]){var tTweenData=this._labelDic[label];if(tTweenData){var tIndex=this._tweenDataList.indexOf(tTweenData);tIndex>-1&&this._tweenDataList.splice(tIndex,1)}delete this._labelDic[label]}},__proto.gotoTime=function(time){if(null!=this._tweenDataList&&0!=this._tweenDataList.length){var tTween,tObject,tTweenDataCopyList,tTweenData;for(var p in this._firstTweenDic)if(tObject=this._firstTweenDic[p])for(var tDataP in tObject)tObject.diyTarget.hasOwnProperty(tDataP)&&(tObject.diyTarget[tDataP]=tObject[tDataP]);for(p in this._tweenDic)(tTween=this._tweenDic[p]).clear(),delete this._tweenDic[p];if(this._index=0,this._gidIndex=0,this._currTime=time,this._lastTime=Browser.now(),null==this._endTweenDataList||this._endTimeSort){this._endTimeSort=!1,this._endTweenDataList=tTweenDataCopyList=this._tweenDataList.concat(),tTweenDataCopyList.sort(function(paraA,paraB){return paraA.endTime>paraB.endTime?1:paraA.endTime<paraB.endTime?-1:0})}else tTweenDataCopyList=this._endTweenDataList;for(var i=0,n=tTweenDataCopyList.length;i<n;i++)if(0==(tTweenData=tTweenDataCopyList[i]).type){if(!(time>=tTweenData.endTime))break;this._index=Math.max(this._index,i+1);var props=tTweenData.data;if(tTweenData.isTo)for(var tP in props)tTweenData.target[tP]=props[tP]}for(i=0,n=this._tweenDataList.length;i<n;i++)0==(tTweenData=this._tweenDataList[i]).type&&time>=tTweenData.startTime&&time<tTweenData.endTime&&(this._index=Math.max(this._index,i+1),this._gidIndex++,(tTween=Pool.getItemByClass("tween",Tween))._create(tTweenData.target,tTweenData.data,tTweenData.duration,tTweenData.ease,Handler.create(this,this._animComplete,[this._gidIndex]),0,!1,tTweenData.isTo,!0,!1),tTween.setStartTime(this._currTime-(time-tTweenData.startTime)),tTween._updateEase(this._currTime),tTween.gid=this._gidIndex,this._tweenDic[this._gidIndex]=tTween)}},__proto.gotoLabel=function(Label){if(null!=this._labelDic){var tLabelData=this._labelDic[Label];tLabelData&&this.gotoTime(tLabelData.startTime)}},__proto.pause=function(){Laya.timer.clear(this,this._update)},__proto.resume=function(){this.play(this._currTime,this._loopKey)},__proto.play=function(timeOrLabel,loop){if(void 0===timeOrLabel&&(timeOrLabel=0),void 0===loop&&(loop=!1),this._tweenDataList){if(this._startTimeSort){this._startTimeSort=!1,this._tweenDataList.sort(function(paraA,paraB){return paraA.startTime>paraB.startTime?1:paraA.startTime<paraB.startTime?-1:0});for(var i=0,n=this._tweenDataList.length;i<n;i++){var tTweenData=this._tweenDataList[i];if(null!=tTweenData&&0==tTweenData.type){var tTarget=tTweenData.target,gid=tTarget.$_GID||(tTarget.$_GID=Utils.getGID()),tSrcData=null;for(var p in null==this._firstTweenDic[gid]?((tSrcData={}).diyTarget=tTarget,this._firstTweenDic[gid]=tSrcData):tSrcData=this._firstTweenDic[gid],tTweenData.data)null==tSrcData[p]&&(tSrcData[p]=tTarget[p])}}}"string"==typeof timeOrLabel?this.gotoLabel(timeOrLabel):this.gotoTime(timeOrLabel),this._loopKey=loop,this._lastTime=Browser.now(),Laya.timer.frameLoop(1,this,this._update)}},__proto._update=function(){if(this._currTime>=this._startTime){if(!this._loopKey){for(var p in this._tweenDic)(tTween=this._tweenDic[p]).complete();return this._complete(),void this.pause()}if(this._complete(),!this._tweenDataList)return;this.gotoTime(0)}var tTween,tNow=Browser.now(),tFrameTime=tNow-this._lastTime,tCurrTime=this._currTime+=tFrameTime*this.scale;for(p in this._lastTime=tNow,this._tweenDic)(tTween=this._tweenDic[p])._updateEase(tCurrTime);if(0!=this._tweenDataList.length&&this._index<this._tweenDataList.length){var tTweenData=this._tweenDataList[this._index];tCurrTime>=tTweenData.startTime&&(this._index++,0==tTweenData.type?(this._gidIndex++,(tTween=Pool.getItemByClass("tween",Tween))._create(tTweenData.target,tTweenData.data,tTweenData.duration,tTweenData.ease,Handler.create(this,this._animComplete,[this._gidIndex]),0,!1,tTweenData.isTo,!0,!1),tTween.setStartTime(tCurrTime),tTween.gid=this._gidIndex,this._tweenDic[this._gidIndex]=tTween,tTween._updateEase(tCurrTime)):this.event("label",tTweenData.data))}},__proto._animComplete=function(index){this._tweenDic[index]&&delete this._tweenDic[index]},__proto._complete=function(){this.event("complete")},__proto.reset=function(){var p;if(this._labelDic)for(p in this._labelDic)delete this._labelDic[p];for(p in this._tweenDic)this._tweenDic[p].clear(),delete this._tweenDic[p];for(p in this._firstTweenDic)delete this._firstTweenDic[p];if(this._endTweenDataList=null,this._tweenDataList&&this._tweenDataList.length){var len,i=0;for(len=this._tweenDataList.length,i=0;i<len;i++)this._tweenDataList[i]&&this._tweenDataList[i].destroy()}this._tweenDataList.length=0,this._currTime=0,this._lastTime=0,this._startTime=0,this._index=0,this._gidIndex=0,this.scale=1,Laya.timer.clear(this,this._update)},__proto.destroy=function(){this.reset(),this._labelDic=null,this._tweenDic=null,this._tweenDataList=null,this._firstTweenDic=null},__getset(0,__proto,"index",function(){return this._frameIndex},function(value){this._frameIndex=value,this.gotoTime(this._frameIndex/this._frameRate*1e3)}),__getset(0,__proto,"total",function(){return this._total=Math.floor(this._startTime/1e3*this._frameRate),this._total}),TimeLine.to=function(target,props,duration,ease,offset){return void 0===offset&&(offset=0),(new TimeLine).to(target,props,duration,ease,offset)},TimeLine.from=function(target,props,duration,ease,offset){return void 0===offset&&(offset=0),(new TimeLine).from(target,props,duration,ease,offset)},TimeLine.__init$=function(){tweenData=function(){function tweenData(){this.type=0,this.isTo=!0,this.startTime=NaN,this.endTime=NaN,this.target=null,this.duration=NaN,this.ease=null,this.data=null}return __class(tweenData,""),tweenData.prototype.destroy=function(){this.target=null,this.ease=null,this.data=null,this.isTo=!0,this.type=0,Pool.recover("tweenData",this)},tweenData}()},TimeLine}(),ShaderDefines2D=function(_super){function ShaderDefines2D(){ShaderDefines2D.__super.call(this,ShaderDefines2D.__name2int,ShaderDefines2D.__int2name,ShaderDefines2D.__int2nameMap)}return __class(ShaderDefines2D,"laya.webgl.shader.d2.ShaderDefines2D",ShaderDefinesBase),ShaderDefines2D.__init__=function(){ShaderDefines2D.reg("TEXTURE2D",1),ShaderDefines2D.reg("PRIMITIVE",4),ShaderDefines2D.reg("GLOW_FILTER",8),ShaderDefines2D.reg("BLUR_FILTER",16),ShaderDefines2D.reg("COLOR_FILTER",32),ShaderDefines2D.reg("COLOR_ADD",64),ShaderDefines2D.reg("WORLDMAT",128),ShaderDefines2D.reg("FILLTEXTURE",256),ShaderDefines2D.reg("FSHIGHPRECISION",1024),ShaderDefines2D.reg("MVP3D",2048)},ShaderDefines2D.reg=function(name,value){ShaderDefinesBase._reg(name,value,ShaderDefines2D.__name2int,ShaderDefines2D.__int2name)},ShaderDefines2D.toText=function(value,int2name,int2nameMap){return ShaderDefinesBase._toText(value,int2name,int2nameMap)},ShaderDefines2D.toInt=function(names){return ShaderDefinesBase._toInt(names,ShaderDefines2D.__name2int)},ShaderDefines2D.TEXTURE2D=1,ShaderDefines2D.PRIMITIVE=4,ShaderDefines2D.FILTERGLOW=8,ShaderDefines2D.FILTERBLUR=16,ShaderDefines2D.FILTERCOLOR=32,ShaderDefines2D.COLORADD=64,ShaderDefines2D.WORLDMAT=128,ShaderDefines2D.FILLTEXTURE=256,ShaderDefines2D.SKINMESH=512,ShaderDefines2D.SHADERDEFINE_FSHIGHPRECISION=1024,ShaderDefines2D.MVP3D=2048,ShaderDefines2D.NOOPTMASK=312,ShaderDefines2D.__name2int={},ShaderDefines2D.__int2name=[],ShaderDefines2D.__int2nameMap=[],ShaderDefines2D}(),Texture=function(_super){function Texture(bitmap,uv,sourceWidth,sourceHeight){this.uvrect=[0,0,1,1],this._destroyed=!1,this._referenceCount=0,this.$_GID=0,this.offsetX=0,this.offsetY=0,this._w=0,this._h=0,this.sourceWidth=0,this.sourceHeight=0,this.url=null,this.scaleRate=1,Texture.__super.call(this),void 0===sourceWidth&&(sourceWidth=0),void 0===sourceHeight&&(sourceHeight=0),this.setTo(bitmap,uv,sourceWidth,sourceHeight)}__class(Texture,"laya.resource.Texture",EventDispatcher);var __proto=Texture.prototype;return __proto._addReference=function(){this._bitmap&&this._bitmap._addReference(),this._referenceCount++},__proto._removeReference=function(){this._bitmap&&this._bitmap._removeReference(),this._referenceCount--},__proto._getSource=function(cb){return this._destroyed||!this._bitmap?null:(this.recoverBitmap(cb),this._bitmap.destroyed?null:this.bitmap._getSource())},__proto._onLoaded=function(complete,context){if(context)if(context==this);else if(context instanceof laya.resource.Texture){var tex=context;Texture._create(context,0,0,tex.width,tex.height,0,0,tex.sourceWidth,tex.sourceHeight,this)}else this.bitmap=context,this.sourceWidth=this._w=context.width,this.sourceHeight=this._h=context.height;else;complete&&complete.run(),this.event("ready",this)},__proto.getIsReady=function(){return!this._destroyed&&!!this._bitmap},__proto.setTo=function(bitmap,uv,sourceWidth,sourceHeight){void 0===sourceWidth&&(sourceWidth=0),void 0===sourceHeight&&(sourceHeight=0),this.bitmap=bitmap,this.sourceWidth=sourceWidth,this.sourceHeight=sourceHeight,bitmap&&(this._w=bitmap.width,this._h=bitmap.height,this.sourceWidth=this.sourceWidth||bitmap.width,this.sourceHeight=this.sourceHeight||bitmap.height),this.uv=uv||Texture.DEF_UV},__proto.load=function(url,complete){this._destroyed||Laya.loader.load(url,Handler.create(this,this._onLoaded,[complete]),null,"htmlimage",1,!1,null,!0)},__proto.getTexturePixels=function(x,y,width,height){var st=0,dst=0,i=0,tex2d=this.bitmap,texw=tex2d.width,texh=tex2d.height;if(x+width>texw&&(width-=x+width-texw),y+height>texh&&(height-=y+height-texh),width<=0||height<=0)return null;var wstride=4*width,pix=null;try{pix=tex2d.getPixels()}catch(e){}if(pix){if(0==x&&0==y&&width==texw&&height==texh)return pix;var ret=new Uint8Array(width*height*4);for(st=4*x,dst=(y+height-1)*(wstride=4*texw)+4*x,i=height-1;i>=0;i--)ret.set(dt.slice(dst,dst+4*width),st),st+=wstride,dst-=wstride;return ret}var ctx=new Context;ctx.size(width,height),ctx.asBitmap=!0;var uv=null;if(0!=x||0!=y||width!=texw||height!=texh){var stu=(uv=uv.concat())[0],stv=uv[1],uk=(uv[2]-stu)/texw,vk=(uv[7]-stv)/texh;uv=[stu+x*uk,stv+y*vk,stu+(x+width)*uk,stv+y*vk,stu+(x+width)*uk,stv+(y+height)*vk,stu+x*uk,stv+(y+height)*vk]}ctx._drawTextureM(this,0,0,width,height,null,1,uv),ctx._targets.start(),ctx.flush(),ctx._targets.end(),ctx._targets.restore();var dt=ctx._targets.getData(0,0,width,height);for(ctx.destroy(),ret=new Uint8Array(width*height*4),st=0,dst=(height-1)*wstride,i=height-1;i>=0;i--)ret.set(dt.slice(dst,dst+wstride),st),st+=wstride,dst-=wstride;return ret},__proto.getPixels=function(x,y,width,height){return Render.isConchApp?this._nativeObj.getImageData(x,y,width,height):this.getTexturePixels(x,y,width,height)},__proto.recoverBitmap=function(onok){var _$this=this,url=this._bitmap.url;this._destroyed||this._bitmap&&!this._bitmap.destroyed||!url||Laya.loader.load(url,Handler.create(this,function(bit){_$this.bitmap=bit,onok&&onok()}),null,"htmlimage",1,!1,null,!0)},__proto.disposeBitmap=function(){!this._destroyed&&this._bitmap&&this._bitmap.destroy()},__proto.destroy=function(force){if(void 0===force&&(force=!1),!this._destroyed){this._destroyed=!0;var bit=this._bitmap;bit&&(bit._removeReference(this._referenceCount),(0===bit.referenceCount||force)&&bit.destroy(),bit=null),this.url&&this===Laya.loader.getRes(this.url)&&Laya.loader.clearRes(this.url)}},__getset(0,__proto,"height",function(){return this._h?this._h:this.bitmap?this.uv&&this.uv!==Texture.DEF_UV?(this.uv[5]-this.uv[1])*this.bitmap.height:this.bitmap.height:0},function(value){this._h=value,this.sourceHeight||(this.sourceHeight=value)}),__getset(0,__proto,"uv",function(){return this._uv},function(value){this.uvrect[0]=Math.min(value[0],value[2],value[4],value[6]),this.uvrect[1]=Math.min(value[1],value[3],value[5],value[7]),this.uvrect[2]=Math.max(value[0],value[2],value[4],value[6])-this.uvrect[0],this.uvrect[3]=Math.max(value[1],value[3],value[5],value[7])-this.uvrect[1],this._uv=value}),__getset(0,__proto,"width",function(){return this._w?this._w:this.bitmap?this.uv&&this.uv!==Texture.DEF_UV?(this.uv[2]-this.uv[0])*this.bitmap.width:this.bitmap.width:0},function(value){this._w=value,this.sourceWidth||(this.sourceWidth=value)}),__getset(0,__proto,"bitmap",function(){return this._bitmap},function(value){this._bitmap&&this._bitmap._removeReference(this._referenceCount),this._bitmap=value,value&&value._addReference(this._referenceCount)}),__getset(0,__proto,"destroyed",function(){return this._destroyed}),Texture.moveUV=function(offsetX,offsetY,uv){for(var i=0;i<8;i+=2)uv[i]+=offsetX,uv[i+1]+=offsetY;return uv},Texture.create=function(source,x,y,width,height,offsetX,offsetY,sourceWidth,sourceHeight){return void 0===offsetX&&(offsetX=0),void 0===offsetY&&(offsetY=0),void 0===sourceWidth&&(sourceWidth=0),void 0===sourceHeight&&(sourceHeight=0),Texture._create(source,x,y,width,height,offsetX,offsetY,sourceWidth,sourceHeight)},Texture._create=function(source,x,y,width,height,offsetX,offsetY,sourceWidth,sourceHeight,outTexture){void 0===offsetX&&(offsetX=0),void 0===offsetY&&(offsetY=0),void 0===sourceWidth&&(sourceWidth=0),void 0===sourceHeight&&(sourceHeight=0);var tex,btex=source instanceof laya.resource.Texture,uv=btex?source.uv:Texture.DEF_UV,bitmap=btex?source.bitmap:source;bitmap.width&&x+width>bitmap.width&&(width=bitmap.width-x),bitmap.height&&y+height>bitmap.height&&(height=bitmap.height-y),outTexture?(tex=outTexture).setTo(bitmap,null,sourceWidth||width,sourceHeight||height):tex=new Texture(bitmap,null,sourceWidth||width,sourceHeight||height),tex.width=width,tex.height=height,tex.offsetX=offsetX,tex.offsetY=offsetY;var dwidth=1/bitmap.width,dheight=1/bitmap.height;x*=dwidth,y*=dheight,width*=dwidth,height*=dheight;var u1=tex.uv[0],v1=tex.uv[1],u2=tex.uv[4],v2=tex.uv[5],inAltasUVWidth=u2-u1,inAltasUVHeight=v2-v1,oriUV=Texture.moveUV(uv[0],uv[1],[x,y,x+width,y,x+width,y+height,x,y+height]);tex.uv=new Float32Array([u1+oriUV[0]*inAltasUVWidth,v1+oriUV[1]*inAltasUVHeight,u2-(1-oriUV[2])*inAltasUVWidth,v1+oriUV[3]*inAltasUVHeight,u2-(1-oriUV[4])*inAltasUVWidth,v2-(1-oriUV[5])*inAltasUVHeight,u1+oriUV[6]*inAltasUVWidth,v2-(1-oriUV[7])*inAltasUVHeight]);var bitmapScale=bitmap.scaleRate;return bitmapScale&&1!=bitmapScale?(tex.sourceWidth/=bitmapScale,tex.sourceHeight/=bitmapScale,tex.width/=bitmapScale,tex.height/=bitmapScale,tex.scaleRate=bitmapScale):tex.scaleRate=1,tex},Texture.createFromTexture=function(texture,x,y,width,height){var texScaleRate=texture.scaleRate;1!=texScaleRate&&(x*=texScaleRate,y*=texScaleRate,width*=texScaleRate,height*=texScaleRate);var rect=Rectangle.TEMP.setTo(x-texture.offsetX,y-texture.offsetY,width,height),result=rect.intersection(Texture._rect1.setTo(0,0,texture.width,texture.height),Texture._rect2);return result?Texture.create(texture,result.x,result.y,result.width,result.height,result.x-rect.x,result.y-rect.y,width,height):null},Texture.DEF_UV=new Float32Array([0,0,1,0,1,1,0,1]),Texture.NO_UV=new Float32Array([0,0,0,0,0,0,0,0]),Texture.INV_UV=new Float32Array([0,1,1,1,1,0,0,0]),Texture._rect1=new Rectangle,Texture._rect2=new Rectangle,Texture}(),HttpRequest=function(_super){function HttpRequest(){this._responseType=null,this._data=null,this._url=null,HttpRequest.__super.call(this),this._http=new Browser.window.XMLHttpRequest}__class(HttpRequest,"laya.net.HttpRequest",EventDispatcher);var __proto=HttpRequest.prototype;return __proto.send=function(url,data,method,responseType,headers){void 0===method&&(method="get"),void 0===responseType&&(responseType="text"),this._responseType=responseType,this._data=null,(Browser.onQGMiniGame||Browser.onVVMiniGame||Browser.onQQMiniGame)&&(url=encodeURI(url)),this._url=url;var _this=this,http=this._http;if(url=URL.getAdptedFilePath(url),http.open(method,url,!0),headers)for(var i=0;i<headers.length;i++)http.setRequestHeader(headers[i++],headers[i]);else Render.isConchApp||(data&&"string"!=typeof data?http.setRequestHeader("Content-Type","application/json"):http.setRequestHeader("Content-Type","application/x-www-form-urlencoded"));http.responseType="arraybuffer"!==responseType?"text":"arraybuffer",http.onerror=function(e){_this._onError(e)},http.onabort=function(e){_this._onAbort(e)},http.onprogress=function(e){_this._onProgress(e)},http.onload=function(e){_this._onLoad(e)},http.send(data)},__proto._onProgress=function(e){e&&e.lengthComputable&&this.event("progress",e.loaded/e.total)},__proto._onAbort=function(e){this.error("Request was aborted by user")},__proto._onError=function(e){this.error("Request failed Status:"+this._http.status+" text:"+this._http.statusText)},__proto._onLoad=function(e){var http=this._http,status=void 0!==http.status?http.status:200;200===status||204===status||0===status?this.complete():this.error("["+http.status+"]"+http.statusText+":"+http.responseURL)},__proto.error=function(message){this.clear(),console.warn(this.url,message),this.event("error",message)},__proto.complete=function(){this.clear();var flag=!0;try{"json"===this._responseType?this._data=JSON.parse(this._http.responseText):"xml"===this._responseType?this._data=Utils.parseXMLFromString(this._http.responseText):this._data=this._http.response||this._http.responseText}catch(e){flag=!1,this.error(e.message)}flag&&this.event("complete",this._data instanceof Array?[this._data]:this._data)},__proto.clear=function(){var http=this._http;http.onerror=http.onabort=http.onprogress=http.onload=null},__getset(0,__proto,"url",function(){return this._url}),__getset(0,__proto,"http",function(){return this._http}),__getset(0,__proto,"data",function(){return this._data}),HttpRequest}(),Loader=function(_super){function Loader(){this._data=null,this._url=null,this._type=null,this._cache=!1,this._http=null,this._useWorkerLoader=!1,this._customParse=!1,this._constructParams=null,this._propertyParams=null,this._createCache=!1,Loader.__super.call(this)}__class(Loader,"laya.net.Loader",EventDispatcher);var __proto=Loader.prototype;return __proto.load=function(url,type,cache,group,ignoreCache,useWorkerLoader){if(void 0===cache&&(cache=!0),void 0===ignoreCache&&(ignoreCache=!1),void 0===useWorkerLoader&&(useWorkerLoader=!1),url){if(Loader.setGroup(url,"666"),this._url=url,0===url.indexOf("data:image")?type="image":url=URL.formatURL(url),this._type=type||(type=Loader.getTypeFromUrl(this._url)),this._cache=cache,this._useWorkerLoader=useWorkerLoader,this._data=null,useWorkerLoader&&WorkerLoader.enableWorkerLoader(),!ignoreCache&&Loader.loadedMap[url])return this._data=Loader.loadedMap[url],this.event("progress",1),void this.event("complete",this._data);if(group&&Loader.setGroup(url,group),null!=Loader.parserMap[type])return this._customParse=!0,void(Loader.parserMap[type]instanceof laya.utils.Handler?Loader.parserMap[type].runWith(this):Loader.parserMap[type].call(null,this));if("image"===type||"htmlimage"===type||"nativeimage"===type)return this._loadImage(url);if("sound"===type)return this._loadSound(url);if("ttf"===type)return this._loadTTF(url);var contentType;switch(type){case"atlas":case"prefab":case"plf":contentType="json";break;case"font":contentType="xml";break;case"plfb":contentType="arraybuffer";break;default:contentType=type}Loader.preLoadedMap[url]?this.onLoaded(Loader.preLoadedMap[url]):(Browser.onVVMiniGame?(this._http=new HttpRequest,this._http.on("progress",this,this.onProgress),this._http.on("error",this,this.onError),this._http.on("complete",this,this.onLoaded)):this._http||(this._http=new HttpRequest,this._http.on("progress",this,this.onProgress),this._http.on("error",this,this.onError),this._http.on("complete",this,this.onLoaded)),this._http.send(url,null,"get",contentType))}else this.onLoaded(null)},__proto._loadTTF=function(url){url=URL.formatURL(url);var ttfLoader=new TTFLoader;ttfLoader.complete=Handler.create(this,this.onLoaded),ttfLoader.load(url)},__proto._loadImage=function(url){url=URL.formatURL(url);var image,_this=this;function clear(){var img=image;img&&(img.onload=null,img.onerror=null,delete Loader._imgCache[url])}var onerror=function(){clear(),_this.event("error","Load image failed")};if("nativeimage"===this._type){var onload=function(){clear(),_this.onLoaded(image)};(image=new Browser.window.Image).crossOrigin="",image.onload=onload,image.onerror=onerror,image.src=url,Loader._imgCache[url]=image}else{var ext=Utils.getFileExtension(url);if("ktx"===ext||"pvr"===ext){var tempHttp;onload=function(imageData){var format=0;switch(ext){case"ktx":format=5;break;case"pvr":format=12}(image=new Texture2D(0,0,format,!1,!1)).wrapModeU=1,image.wrapModeV=1,image.setCompressData(imageData),image._setCreateURL(url),clear(),_this.onLoaded(image)},(tempHttp=new HttpRequest).on("error",null,onerror),tempHttp.on("complete",null,onload),tempHttp.send(url,null,"get","arraybuffer")}else{var imageSource=new Browser.window.Image;onload=function(){var tex=new Texture2D(imageSource.width,imageSource.height,1,!1,!1);tex.wrapModeU=1,tex.wrapModeV=1,tex.loadImageSource(imageSource,!0),tex._setCreateURL(url),clear(),_this.onLoaded(tex)},imageSource.crossOrigin="",imageSource.onload=onload,imageSource.onerror=onerror,imageSource.src=url,Loader._imgCache[url]=imageSource}}},__proto._loadSound=function(url){var sound=new SoundManager._soundClass,_this=this;function clear(){sound.offAll()}sound.on("complete",this,function(){clear(),_this.onLoaded(sound)}),sound.on("error",this,function(){clear(),sound.dispose(),_this.event("error","Load sound failed")}),sound.load(url)},__proto.onProgress=function(value){"atlas"===this._type?this.event("progress",.3*value):this.event("progress",value)},__proto.onError=function(message){this.event("error",message)},__proto.onLoaded=function(data){var type=this._type;if("plfb"==type)this.parsePLFBData(data),this.complete(data);else if("plf"==type)this.parsePLFData(data),this.complete(data);else if("image"===type){var tex=new Texture(data);tex.url=this._url,this.complete(tex)}else if("sound"===type||"htmlimage"===type||"nativeimage"===type)this.complete(data);else if("atlas"===type){if(!data.url&&!data._setContext){if(!this._data){if(this._data=data,data.meta&&data.meta.image){var changeType,toloadPics=data.meta.image.split(","),split=this._url.indexOf("/")>=0?"/":"\\",idx=this._url.lastIndexOf(split),folderPath=idx>=0?this._url.substr(0,idx+1):"";Browser.onAndroid&&data.meta.compressTextureAndroid&&(changeType=".ktx"),Browser.onIOS&&data.meta.compressTextureIOS&&(changeType=".pvr");for(var i=0,len=toloadPics.length;i<len;i++)toloadPics[i]=changeType?folderPath+toloadPics[i].replace(".png",changeType):folderPath+toloadPics[i]}else toloadPics=[this._url.replace(".json",".png")];toloadPics.reverse(),data.toLoads=toloadPics,data.pics=[]}return this.event("progress",.3+1/toloadPics.length*.6),this._loadImage(toloadPics.pop())}if(this._data.pics.push(data),this._data.toLoads.length>0)return this.event("progress",.3+1/this._data.toLoads.length*.6),this._loadImage(this._data.toLoads.pop());var frames=this._data.frames,cleanUrl=this._url.split("?")[0],directory=this._data.meta&&this._data.meta.prefix?this._data.meta.prefix:cleanUrl.substring(0,cleanUrl.lastIndexOf("."))+"/",pics=this._data.pics,atlasURL=URL.formatURL(this._url),map=Loader.atlasMap[atlasURL]||(Loader.atlasMap[atlasURL]=[]);map.dir=directory;var scaleRate=1;if(this._data.meta&&this._data.meta.scale&&1!=this._data.meta.scale)for(var name in scaleRate=parseFloat(this._data.meta.scale),frames){var tTexture,obj=frames[name],tPic=pics[obj.frame.idx?obj.frame.idx:0],url=URL.formatURL(directory+name);tPic.scaleRate=scaleRate,tTexture=Texture._create(tPic,obj.frame.x,obj.frame.y,obj.frame.w,obj.frame.h,obj.spriteSourceSize.x,obj.spriteSourceSize.y,obj.sourceSize.w,obj.sourceSize.h,laya.net.Loader.getRes(url)),Loader.cacheRes(url,tTexture),tTexture.url=url,map.push(url)}else for(name in frames)tPic=pics[(obj=frames[name]).frame.idx?obj.frame.idx:0],url=URL.formatURL(directory+name),tTexture=Texture._create(tPic,obj.frame.x,obj.frame.y,obj.frame.w,obj.frame.h,obj.spriteSourceSize.x,obj.spriteSourceSize.y,obj.sourceSize.w,obj.sourceSize.h,laya.net.Loader.getRes(url)),Loader.cacheRes(url,tTexture),tTexture.url=url,map.push(url);delete this._data.pics,this.complete(this._data)}else if("font"===type){if(!data._source)return this._data=data,this.event("progress",.5),this._loadImage(this._url.replace(".fnt",".png"));var bFont=new BitmapFont;bFont.parseFont(this._data,new Texture(data));var tArr=this._url.split(".fnt")[0].split("/"),fontName=tArr[tArr.length-1];Text.registerBitmapFont(fontName,bFont),this._data=bFont,this.complete(this._data)}else if("prefab"===type){var prefab=new Prefab;prefab.json=data,this.complete(prefab)}else this.complete(data)},__proto.parsePLFData=function(plfData){var type,filePath,fileDic;for(type in plfData)switch(fileDic=plfData[type],type){case"json":case"text":for(filePath in fileDic)Loader.preLoadedMap[URL.formatURL(filePath)]=fileDic[filePath];break;default:for(filePath in fileDic)Loader.preLoadedMap[URL.formatURL(filePath)]=fileDic[filePath]}},__proto.parsePLFBData=function(plfData){var byte,len,i=0;for(len=(byte=new Byte(plfData)).getInt32(),i=0;i<len;i++)this.parseOnePLFBFile(byte)},__proto.parseOnePLFBFile=function(byte){var fileLen,fileName,fileData;fileName=byte.getUTFString(),fileLen=byte.getInt32(),fileData=byte.readArrayBuffer(fileLen),Loader.preLoadedMap[URL.formatURL(fileName)]=fileData},__proto.complete=function(data){this._data=data,this._customParse?this.event("loaded",data instanceof Array?[data]:data):(Loader._loaders.push(this),Loader._isWorking||Loader.checkNext())},__proto.endLoad=function(content){content&&(this._data=content),this._cache&&Loader.cacheRes(this._url,this._data),this.event("progress",1),this.event("complete",this.data instanceof Array?[this.data]:this.data)},__getset(0,__proto,"url",function(){return this._url}),__getset(0,__proto,"data",function(){return this._data}),__getset(0,__proto,"cache",function(){return this._cache}),__getset(0,__proto,"type",function(){return this._type}),Loader.getTypeFromUrl=function(url){var type=Utils.getFileExtension(url);return type?Loader.typeMap[type]:(console.warn("Not recognize the resources suffix",url),"text")},Loader.checkNext=function(){Loader._isWorking=!0;for(var startTimer=Browser.now();Loader._startIndex<Loader._loaders.length;)if(Browser.now(),Loader._loaders[Loader._startIndex].endLoad(),Loader._startIndex++,Browser.now()-startTimer>Loader.maxTimeOut)return console.warn("loader callback cost a long time:"+(Browser.now()-startTimer)+" url="+Loader._loaders[Loader._startIndex-1].url),void Laya.systemTimer.frameOnce(1,null,Loader.checkNext);Loader._loaders.length=0,Loader._startIndex=0,Loader._isWorking=!1},Loader.clearRes=function(url){url=URL.formatURL(url);var arr=Loader.getAtlas(url);if(arr){for(var i=0,n=arr.length;i<n;i++){var resUrl=arr[i],tex=Loader.getRes(resUrl);delete Loader.loadedMap[resUrl],tex&&tex.destroy()}arr.length=0,delete Loader.atlasMap[url],delete Loader.loadedMap[url]}else{var res=Loader.loadedMap[url];res&&(delete Loader.loadedMap[url],res instanceof laya.resource.Texture&&res.bitmap&&res.destroy())}},Loader.clearTextureRes=function(url){url=URL.formatURL(url);var arr=laya.net.Loader.getAtlas(url),res=arr&&arr.length>0?laya.net.Loader.getRes(arr[0]):laya.net.Loader.getRes(url);res instanceof laya.resource.Texture&&res.disposeBitmap()},Loader.getRes=function(url){return Loader.loadedMap[URL.formatURL(url)]},Loader.getAtlas=function(url){return Loader.atlasMap[URL.formatURL(url)]},Loader.cacheRes=function(url,data){url=URL.formatURL(url),null!=Loader.loadedMap[url]?console.warn("Resources already exist,is repeated loading:",url):Loader.loadedMap[url]=data},Loader.setGroup=function(url,group){Loader.groupMap[group]||(Loader.groupMap[group]=[]),Loader.groupMap[group].push(url)},Loader.clearResByGroup=function(group){if(Loader.groupMap[group]){var arr=Loader.groupMap[group],i=0,len=arr.length;for(i=0;i<len;i++)Loader.clearRes(arr[i]);arr.length=0}},Loader.TEXT="text",Loader.JSON="json",Loader.PREFAB="prefab",Loader.XML="xml",Loader.BUFFER="arraybuffer",Loader.IMAGE="image",Loader.SOUND="sound",Loader.ATLAS="atlas",Loader.FONT="font",Loader.TTF="ttf",Loader.PLF="plf",Loader.PLFB="plfb",Loader.HIERARCHY="HIERARCHY",Loader.MESH="MESH",Loader.MATERIAL="MATERIAL",Loader.TEXTURE2D="TEXTURE2D",Loader.TEXTURECUBE="TEXTURECUBE",Loader.ANIMATIONCLIP="ANIMATIONCLIP",Loader.AVATAR="AVATAR",Loader.TERRAINHEIGHTDATA="TERRAINHEIGHTDATA",Loader.TERRAINRES="TERRAIN",Loader.typeMap={ttf:"ttf",png:"image",jpg:"image",jpeg:"image",ktx:"image",pvr:"image",txt:"text",json:"json",prefab:"prefab",xml:"xml",als:"atlas",atlas:"atlas",mp3:"sound",ogg:"sound",wav:"sound",part:"json",fnt:"font",plf:"plf",plfb:"plfb",scene:"json",ani:"json",sk:"arraybuffer"},Loader.parserMap={},Loader.maxTimeOut=100,Loader.groupMap={},Loader.loadedMap={},Loader.atlasMap={},Loader.preLoadedMap={},Loader._imgCache={},Loader._loaders=[],Loader._isWorking=!1,Loader._startIndex=0,Loader}(),Buffer2D=(function(_super){function BlurFilter(strength){this.strength=NaN,this.strength_sig2_2sig2_gauss1=[],this.strength_sig2_native=null,this.renderFunc=null,BlurFilter.__super.call(this),void 0===strength&&(strength=4),this.strength=strength,this._glRender=new BlurFilterGLRender}__class(BlurFilter,"laya.filters.BlurFilter",Filter);var __proto=BlurFilter.prototype;__proto.getStrenth_sig2_2sig2_native=function(){this.strength_sig2_native||(this.strength_sig2_native=new Float32Array(4));var sigma=this.strength/3,sigma2=sigma*sigma;return this.strength_sig2_native[0]=this.strength,this.strength_sig2_native[1]=sigma2,this.strength_sig2_native[2]=2*sigma2,this.strength_sig2_native[3]=1/(2*Math.PI*sigma2),this.strength_sig2_native},__getset(0,__proto,"type",function(){return 16})}(),function(_super){function Buffer2D(){this._maxsize=0,this._upload=!0,this._uploadSize=0,this._bufferSize=0,this._u8Array=null,Buffer2D.__super.call(this)}__class(Buffer2D,"laya.webgl.utils.Buffer2D",Buffer);var __proto=Buffer2D.prototype;return __proto.setByteLength=function(value){this._byteLength!==value&&(value<=this._bufferSize||this._resizeBuffer(2*value+256,!0),this._byteLength=value)},__proto.needSize=function(sz){var old=this._byteLength;if(sz){var needsz=this._byteLength+sz;needsz<=this._bufferSize||this._resizeBuffer(needsz<<1,!0),this._byteLength=needsz}return old},__proto._bufferData=function(){this._maxsize=Math.max(this._maxsize,this._byteLength),Stat.loopCount%30==0&&(this._buffer.byteLength>this._maxsize+64&&(this._buffer=this._buffer.slice(0,this._maxsize+64),this._bufferSize=this._buffer.byteLength,this._checkArrayUse()),this._maxsize=this._byteLength),this._uploadSize<this._buffer.byteLength&&(this._uploadSize=this._buffer.byteLength,LayaGL.instance.bufferData(this._bufferType,this._uploadSize,this._bufferUsage)),LayaGL.instance.bufferSubData(this._bufferType,0,new Uint8Array(this._buffer,0,this._byteLength))},__proto._bufferSubData=function(offset,dataStart,dataLength){if(void 0===offset&&(offset=0),void 0===dataStart&&(dataStart=0),void 0===dataLength&&(dataLength=0),this._maxsize=Math.max(this._maxsize,this._byteLength),Stat.loopCount%30==0&&(this._buffer.byteLength>this._maxsize+64&&(this._buffer=this._buffer.slice(0,this._maxsize+64),this._bufferSize=this._buffer.byteLength,this._checkArrayUse()),this._maxsize=this._byteLength),this._uploadSize<this._buffer.byteLength&&(this._uploadSize=this._buffer.byteLength,LayaGL.instance.bufferData(this._bufferType,this._uploadSize,this._bufferUsage)),dataStart||dataLength){var subBuffer=this._buffer.slice(dataStart,dataLength);LayaGL.instance.bufferSubData(this._bufferType,offset,subBuffer)}else LayaGL.instance.bufferSubData(this._bufferType,offset,this._buffer)},__proto._checkArrayUse=function(){},__proto._bind_uploadForVAO=function(){return!!this._upload&&(this._upload=!1,this._bindForVAO(),this._bufferData(),!0)},__proto._bind_upload=function(){return!!this._upload&&(this._upload=!1,this.bind(),this._bufferData(),!0)},__proto._bind_subUpload=function(offset,dataStart,dataLength){return void 0===offset&&(offset=0),void 0===dataStart&&(dataStart=0),void 0===dataLength&&(dataLength=0),!!this._upload&&(this._upload=!1,this.bind(),this._bufferSubData(offset,dataStart,dataLength),!0)},__proto._resizeBuffer=function(nsz,copy){var buff=this._buffer;if(nsz<=buff.byteLength)return this;var u8buf=this._u8Array;if(copy&&buff&&buff.byteLength>0){var newbuffer=new ArrayBuffer(nsz),oldU8Arr=u8buf&&u8buf.buffer==buff?u8buf:new Uint8Array(buff);(u8buf=this._u8Array=new Uint8Array(newbuffer)).set(oldU8Arr,0),buff=this._buffer=newbuffer}else buff=this._buffer=new ArrayBuffer(nsz),this._u8Array=null;return this._checkArrayUse(),this._upload=!0,this._bufferSize=buff.byteLength,this},__proto.append=function(data){this._upload=!0;var byteLen,n;byteLen=data.byteLength,data instanceof Uint8Array?(this._resizeBuffer(this._byteLength+byteLen,!0),n=new Uint8Array(this._buffer,this._byteLength)):data instanceof Uint16Array?(this._resizeBuffer(this._byteLength+byteLen,!0),n=new Uint16Array(this._buffer,this._byteLength)):data instanceof Float32Array&&(this._resizeBuffer(this._byteLength+byteLen,!0),n=new Float32Array(this._buffer,this._byteLength)),n.set(data,0),this._byteLength+=byteLen,this._checkArrayUse()},__proto.appendU16Array=function(data,len){this._resizeBuffer(this._byteLength+2*len,!0);var u=new Uint16Array(this._buffer,this._byteLength,len);if(6==len)u[0]=data[0],u[1]=data[1],u[2]=data[2],u[3]=data[3],u[4]=data[4],u[5]=data[5];else if(len>=100)u.set(new Uint16Array(data.buffer,0,len));else for(var i=0;i<len;i++)u[i]=data[i];this._byteLength+=2*len,this._checkArrayUse()},__proto.appendEx=function(data,type){this._upload=!0;var byteLen;byteLen=data.byteLength,this._resizeBuffer(this._byteLength+byteLen,!0),new type(this._buffer,this._byteLength).set(data,0),this._byteLength+=byteLen,this._checkArrayUse()},__proto.appendEx2=function(data,type,dataLen,perDataLen){void 0===perDataLen&&(perDataLen=1),this._upload=!0;var byteLen,n;byteLen=dataLen*perDataLen,this._resizeBuffer(this._byteLength+byteLen,!0),n=new type(this._buffer,this._byteLength);var i=0;for(i=0;i<dataLen;i++)n[i]=data[i];this._byteLength+=byteLen,this._checkArrayUse()},__proto.getBuffer=function(){return this._buffer},__proto.setNeedUpload=function(){this._upload=!0},__proto.getNeedUpload=function(){return this._upload},__proto.upload=function(){var scuess=this._bind_upload();return LayaGL.instance.bindBuffer(this._bufferType,null),34962==this._bufferType&&(Buffer._bindedVertexBuffer=null),34963==this._bufferType&&(Buffer._bindedIndexBuffer=null),BaseShader.activeShader=null,scuess},__proto.subUpload=function(offset,dataStart,dataLength){void 0===offset&&(offset=0),void 0===dataStart&&(dataStart=0),void 0===dataLength&&(dataLength=0);var scuess=this._bind_subUpload();return LayaGL.instance.bindBuffer(this._bufferType,null),34962==this._bufferType&&(Buffer._bindedVertexBuffer=null),34963==this._bufferType&&(Buffer._bindedIndexBuffer=null),BaseShader.activeShader=null,scuess},__proto._disposeResource=function(){this._upload=!0,this._uploadSize=0},__proto.clear=function(){this._byteLength=0,this._upload=!0},__getset(0,__proto,"bufferLength",function(){return this._buffer.byteLength}),__getset(0,__proto,"byteLength",null,function(value){this.setByteLength(value)}),Buffer2D.__int__=function(gl){},Buffer2D.FLOAT32=4,Buffer2D.SHORT=2,Buffer2D}()),WebAudioSound=(function(_super){function GlowFilter(color,blur,offX,offY){this._sv_blurInfo2=[0,0,1,0],this._color=null,this._color_native=null,this._blurInof1_native=null,this._blurInof2_native=null,GlowFilter.__super.call(this),this._elements=new Float32Array(9),this._sv_blurInfo1=new Array(4),void 0===blur&&(blur=4),void 0===offX&&(offX=6),void 0===offY&&(offY=6),this._color=new ColorUtils(color),this.blur=Math.min(blur,20),this.offX=offX,this.offY=offY,this._sv_blurInfo1[0]=this._sv_blurInfo1[1]=this.blur,this._sv_blurInfo1[2]=offX,this._sv_blurInfo1[3]=-offY,this._glRender=new GlowFilterGLRender}__class(GlowFilter,"laya.filters.GlowFilter",Filter);var __proto=GlowFilter.prototype;__proto.getColor=function(){return this._color.arrColor},__proto.getColorNative=function(){this._color_native||(this._color_native=new Float32Array(4));var color=this.getColor();return this._color_native[0]=color[0],this._color_native[1]=color[1],this._color_native[2]=color[2],this._color_native[3]=color[3],this._color_native},__proto.getBlurInfo1Native=function(){return this._blurInof1_native||(this._blurInof1_native=new Float32Array(4)),this._blurInof1_native[0]=this._blurInof1_native[1]=this.blur,this._blurInof1_native[2]=this.offX,this._blurInof1_native[3]=this.offY,this._blurInof1_native},__proto.getBlurInfo2Native=function(){return this._blurInof2_native||(this._blurInof2_native=new Float32Array(4)),this._blurInof2_native[2]=1,this._blurInof2_native},__getset(0,__proto,"type",function(){return 8}),__getset(0,__proto,"offY",function(){return this._elements[6]},function(value){this._elements[6]=value,this._sv_blurInfo1[3]=-value}),__getset(0,__proto,"offX",function(){return this._elements[5]},function(value){this._elements[5]=value,this._sv_blurInfo1[2]=value}),__getset(0,__proto,"blur",function(){return this._elements[4]},function(value){this._elements[4]=value,this._sv_blurInfo1[0]=this._sv_blurInfo1[1]=value})}(),function(_super){function WebAudioSound(){this.url=null,this.loaded=!1,this.data=null,this.audioBuffer=null,this.__toPlays=null,this._disposed=!1,WebAudioSound.__super.call(this)}__class(WebAudioSound,"laya.media.webaudio.WebAudioSound",EventDispatcher);var __proto=WebAudioSound.prototype;return __proto.load=function(url){var me=this;if(url=URL.formatURL(url),this.url=url,this.audioBuffer=WebAudioSound._dataCache[url],this.audioBuffer)this._loaded(this.audioBuffer);else if(WebAudioSound.e.on("loaded:"+url,this,this._loaded),WebAudioSound.e.on("err:"+url,this,this._err),!WebAudioSound.__loadingSound[url]){WebAudioSound.__loadingSound[url]=!0;var request=new Browser.window.XMLHttpRequest;request.open("GET",url,!0),request.responseType="arraybuffer",request.onload=function(){me._disposed?me._removeLoadEvents():(me.data=request.response,WebAudioSound.buffs.push({buffer:me.data,url:me.url}),WebAudioSound.decode())},request.onerror=function(e){me._err()},request.send()}},__proto._err=function(){this._removeLoadEvents(),WebAudioSound.__loadingSound[this.url]=!1,this.event("error")},__proto._loaded=function(audioBuffer){this._removeLoadEvents(),this._disposed||(this.audioBuffer=audioBuffer,WebAudioSound._dataCache[this.url]=this.audioBuffer,this.loaded=!0,this.event("complete"))},__proto._removeLoadEvents=function(){WebAudioSound.e.off("loaded:"+this.url,this,this._loaded),WebAudioSound.e.off("err:"+this.url,this,this._err)},__proto.__playAfterLoaded=function(){if(this.__toPlays){var len,toPlays,tParams,i=0;for(len=(toPlays=this.__toPlays).length,i=0;i<len;i++)(tParams=toPlays[i])[2]&&!tParams[2].isStopped&&this.play(tParams[0],tParams[1],tParams[2]);this.__toPlays.length=0}},__proto.play=function(startTime,loops,channel){return void 0===startTime&&(startTime=0),void 0===loops&&(loops=0),channel=channel||new WebAudioSoundChannel,this.audioBuffer||this.url&&(this.__toPlays||(this.__toPlays=[]),this.__toPlays.push([startTime,loops,channel]),this.once("complete",this,this.__playAfterLoaded),this.load(this.url)),channel.url=this.url,channel.loops=loops,channel.audioBuffer=this.audioBuffer,channel.startTime=startTime,channel.play(),SoundManager.addChannel(channel),channel},__proto.dispose=function(){this._disposed=!0,delete WebAudioSound._dataCache[this.url],delete WebAudioSound.__loadingSound[this.url],this.audioBuffer=null,this.data=null,this.__toPlays=[]},__getset(0,__proto,"duration",function(){return this.audioBuffer?this.audioBuffer.duration:0}),WebAudioSound.decode=function(){WebAudioSound.buffs.length<=0||WebAudioSound.isDecoding||(WebAudioSound.isDecoding=!0,WebAudioSound.tInfo=WebAudioSound.buffs.shift(),WebAudioSound.ctx.decodeAudioData(WebAudioSound.tInfo.buffer,WebAudioSound._done,WebAudioSound._fail))},WebAudioSound._done=function(audioBuffer){WebAudioSound.e.event("loaded:"+WebAudioSound.tInfo.url,audioBuffer),WebAudioSound.isDecoding=!1,WebAudioSound.decode()},WebAudioSound._fail=function(){WebAudioSound.e.event("err:"+WebAudioSound.tInfo.url,null),WebAudioSound.isDecoding=!1,WebAudioSound.decode()},WebAudioSound._playEmptySound=function(){if(null!=WebAudioSound.ctx){var source=WebAudioSound.ctx.createBufferSource();source.buffer=WebAudioSound._miniBuffer,source.connect(WebAudioSound.ctx.destination),source.start(0,0,0)}},WebAudioSound._unlock=function(){WebAudioSound._unlocked||(WebAudioSound._playEmptySound(),"running"==WebAudioSound.ctx.state&&(Browser.document.removeEventListener("mousedown",WebAudioSound._unlock,!0),Browser.document.removeEventListener("touchend",WebAudioSound._unlock,!0),Browser.document.removeEventListener("touchstart",WebAudioSound._unlock,!0),WebAudioSound._unlocked=!0))},WebAudioSound.initWebAudio=function(){"running"!=WebAudioSound.ctx.state&&(WebAudioSound._unlock(),Browser.document.addEventListener("mousedown",WebAudioSound._unlock,!0),Browser.document.addEventListener("touchend",WebAudioSound._unlock,!0),Browser.document.addEventListener("touchstart",WebAudioSound._unlock,!0))},WebAudioSound._dataCache={},WebAudioSound.buffs=[],WebAudioSound.isDecoding=!1,WebAudioSound._unlocked=!1,WebAudioSound.tInfo=null,WebAudioSound.__loadingSound={},__static(WebAudioSound,["window",function(){return this.window=Browser.window},"webAudioEnabled",function(){return this.webAudioEnabled=WebAudioSound.window.AudioContext||WebAudioSound.window.webkitAudioContext||WebAudioSound.window.mozAudioContext},"ctx",function(){return this.ctx=WebAudioSound.webAudioEnabled?new(WebAudioSound.window.AudioContext||WebAudioSound.window.webkitAudioContext||WebAudioSound.window.mozAudioContext):void 0},"_miniBuffer",function(){return this._miniBuffer=WebAudioSound.ctx.createBuffer(1,1,22050)},"e",function(){return this.e=new EventDispatcher}]),WebAudioSound}()),MeshQuadTexture=function(_super){function MeshQuadTexture(){MeshQuadTexture.__super.call(this,24,4,4),this.canReuse=!0,this.setAttributes(laya.webgl.utils.MeshQuadTexture._fixattriInfo),laya.webgl.utils.MeshQuadTexture._fixib?(this._ib=laya.webgl.utils.MeshQuadTexture._fixib,this._quadNum=MeshQuadTexture._maxIB):(this.createQuadIB(MeshQuadTexture._maxIB),laya.webgl.utils.MeshQuadTexture._fixib=this._ib)}__class(MeshQuadTexture,"laya.webgl.utils.MeshQuadTexture",Mesh2D);var __proto=MeshQuadTexture.prototype;return __proto.releaseMesh=function(){this._vb.setByteLength(0),this.vertNum=0,this.indexNum=0,laya.webgl.utils.MeshQuadTexture._POOL.push(this)},__proto.destroy=function(){this._vb.destroy(),this._vb.deleteBuffer()},__proto.addQuad=function(pos,uv,color,useTex){var vb=this._vb,vpos=vb._byteLength>>2;vb.setByteLength(vpos+24<<2);var vbdata=vb._floatArray32||vb.getFloat32Array(),vbu32Arr=vb._uint32Array,cpos=vpos,useTexVal=useTex?255:0;vbdata[cpos++]=pos[0],vbdata[cpos++]=pos[1],vbdata[cpos++]=uv[0],vbdata[cpos++]=uv[1],vbu32Arr[cpos++]=color,vbu32Arr[cpos++]=useTexVal,vbdata[cpos++]=pos[2],vbdata[cpos++]=pos[3],vbdata[cpos++]=uv[2],vbdata[cpos++]=uv[3],vbu32Arr[cpos++]=color,vbu32Arr[cpos++]=useTexVal,vbdata[cpos++]=pos[4],vbdata[cpos++]=pos[5],vbdata[cpos++]=uv[4],vbdata[cpos++]=uv[5],vbu32Arr[cpos++]=color,vbu32Arr[cpos++]=useTexVal,vbdata[cpos++]=pos[6],vbdata[cpos++]=pos[7],vbdata[cpos++]=uv[6],vbdata[cpos++]=uv[7],vbu32Arr[cpos++]=color,vbu32Arr[cpos++]=useTexVal,vb._upload=!0},MeshQuadTexture.getAMesh=function(mainctx){var ret=null;return ret=laya.webgl.utils.MeshQuadTexture._POOL.length?laya.webgl.utils.MeshQuadTexture._POOL.pop():new MeshQuadTexture,mainctx&&ret._vb._resizeBuffer(1572864,!1),ret},MeshQuadTexture.const_stride=24,MeshQuadTexture._fixib=null,MeshQuadTexture._maxIB=16384,MeshQuadTexture._POOL=[],__static(MeshQuadTexture,["_fixattriInfo",function(){return this._fixattriInfo=[5126,4,0,5121,4,16,5121,4,20]}]),MeshQuadTexture}(),TextureSV=(function(_super){function Socket(host,port,byteClass,protocols){this._endian=null,this._socket=null,this._connected=!1,this._addInputPosition=0,this._input=null,this._output=null,this.disableInput=!1,this._byteClass=null,this.protocols=[],Socket.__super.call(this),void 0===port&&(port=0),this._byteClass=byteClass||Byte,this.protocols=protocols,this.endian="bigEndian",host&&port>0&&port<65535&&this.connect(host,port)}__class(Socket,"laya.net.Socket",EventDispatcher);var __proto=Socket.prototype;__proto.connect=function(host,port){var url="ws://"+host+":"+port;this.connectByUrl(url)},__proto.connectByUrl=function(url){var _$this=this;null!=this._socket&&this.close(),this._socket&&this.cleanSocket(),this.protocols&&0!=this.protocols.length?this._socket=new Browser.window.WebSocket(url,this.protocols):this._socket=new Browser.window.WebSocket(url),this._socket.binaryType="arraybuffer",this._output=new this._byteClass,this._output.endian=this.endian,this._input=new this._byteClass,this._input.endian=this.endian,this._addInputPosition=0,this._socket.onopen=function(e){_$this._onOpen(e)},this._socket.onmessage=function(msg){_$this._onMessage(msg)},this._socket.onclose=function(e){_$this._onClose(e)},this._socket.onerror=function(e){_$this._onError(e)}},__proto.cleanSocket=function(){this.close(),this._connected=!1,this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null,this._socket=null},__proto.close=function(){if(null!=this._socket)try{this._socket.close()}catch(e){}},__proto._onOpen=function(e){this._connected=!0,this.event("open",e)},__proto._onMessage=function(msg){if(msg&&msg.data){var data=msg.data;if(this.disableInput&&data)this.event("message",data);else{this._input.length>0&&this._input.bytesAvailable<1&&(this._input.clear(),this._addInputPosition=0);var pre=this._input.pos;!this._addInputPosition&&(this._addInputPosition=0),this._input.pos=this._addInputPosition,data&&("string"==typeof data?this._input.writeUTFBytes(data):this._input.writeArrayBuffer(data),this._addInputPosition=this._input.pos,this._input.pos=pre),this.event("message",data)}}},__proto._onClose=function(e){this._connected=!1,this.event("close",e)},__proto._onError=function(e){this.event("error",e)},__proto.send=function(data){this._socket.send(data)},__proto.flush=function(){if(this._output&&this._output.length>0){var evt;try{this._socket&&this._socket.send(this._output.__getBuffer().slice(0,this._output.length))}catch(e){evt=e}this._output.endian=this.endian,this._output.clear(),evt&&this.event("error",evt)}},__getset(0,__proto,"input",function(){return this._input}),__getset(0,__proto,"output",function(){return this._output}),__getset(0,__proto,"connected",function(){return this._connected}),__getset(0,__proto,"endian",function(){return this._endian},function(value){this._endian=value,null!=this._input&&(this._input.endian=value),null!=this._output&&(this._output.endian=value)}),Socket.LITTLE_ENDIAN="littleEndian",Socket.BIG_ENDIAN="bigEndian"}(),function(_super){function TextureSV(subID){this.u_colorMatrix=null,this.strength=0,this.blurInfo=null,this.colorMat=null,this.colorAlpha=null,void 0===subID&&(subID=0),TextureSV.__super.call(this,1,subID),this._attribLocation=["posuv",0,"attribColor",1,"attribFlags",2]}return __class(TextureSV,"laya.webgl.shader.d2.value.TextureSV",Value2D),TextureSV.prototype.clear=function(){this.texture=null,this.shader=null,this.defines._value=this.subID+(WebGL.shaderHighPrecision?1024:0)},TextureSV}()),LoaderManager=(function(_super){function CommonScript(){CommonScript.__super.call(this)}__class(CommonScript,"laya.components.CommonScript",Component);var __proto=CommonScript.prototype;__proto.onAwake=function(){},__proto.onEnable=function(){},__proto.onStart=function(){},__proto.onUpdate=function(){},__proto.onLateUpdate=function(){},__proto.onDisable=function(){},__proto.onDestroy=function(){},__getset(0,__proto,"isSingleton",function(){return!1})}(),function(_super){var ResInfo;function LoaderManager(){this.retryNum=1,this.retryDelay=0,this.maxLoader=5,this._loaders=[],this._loaderCount=0,this._resInfos=[],this._infoPool=[],this._maxPriority=5,this._failRes={},this._statInfo={count:1,loaded:1},LoaderManager.__super.call(this);for(var i=0;i<this._maxPriority;i++)this._resInfos[i]=[]}__class(LoaderManager,"laya.net.LoaderManager",EventDispatcher);var __proto=LoaderManager.prototype;return __proto.getProgress=function(){return this._statInfo.loaded/this._statInfo.count},__proto.resetProgress=function(){this._statInfo.count=this._statInfo.loaded=1},__proto.create=function(url,complete,progress,type,constructParams,propertyParams,priority,cache){void 0===priority&&(priority=1),void 0===cache&&(cache=!0),this._create(url,!0,complete,progress,type,constructParams,propertyParams,priority,cache)},__proto._create=function(url,mainResou,complete,progress,type,constructParams,propertyParams,priority,cache){if(void 0===priority&&(priority=1),void 0===cache&&(cache=!0),url instanceof Array){var allScuess=!0,items=url,itemCount=items.length,loadedCount=0;if(progress)var progress2=Handler.create(progress.caller,progress.method,progress.args,!1);for(var i=0;i<itemCount;i++){var item=items[i];"string"==typeof item&&(item=items[i]={url:item}),item.progress=0}for(i=0;i<itemCount;i++){item=items[i];var progressHandler=progress?Handler.create(null,onProgress,[item],!1):null,completeHandler=progress||complete?Handler.create(null,onComplete,[item]):null;this._createOne(item.url,mainResou,completeHandler,progressHandler,item.type||type,item.constructParams||constructParams,item.propertyParams||propertyParams,item.priority||priority,cache)}function onComplete(item,content){loadedCount++,item.progress=1,content||(allScuess=!1),loadedCount===itemCount&&complete&&complete.runWith(allScuess)}function onProgress(item,value){item.progress=value;for(var num=0,j=0;j<itemCount;j++){num+=items[j].progress}var v=num/itemCount;progress2.runWith(v)}}else this._createOne(url,mainResou,complete,progress,type,constructParams,propertyParams,priority,cache)},__proto._createOne=function(url,mainResou,complete,progress,type,constructParams,propertyParams,priority,cache){void 0===priority&&(priority=1),void 0===cache&&(cache=!0);var item=this.getRes(url);if(item)!mainResou&&item instanceof laya.resource.Resource&&item._addReference(),progress&&progress.runWith(1),complete&&complete.runWith(item);else{var extension=Utils.getFileExtension(url);if(type||(type=LoaderManager.createMap[extension]?LoaderManager.createMap[extension][0]:null),!type)return void this.load(url,complete,progress,type,priority,cache);if(!Loader.parserMap[type])return void this.load(url,complete,progress,type,priority,cache);this._createLoad(url,Handler.create(null,function(createRes){createRes&&(!mainResou&&createRes instanceof laya.resource.Resource&&createRes._addReference(),createRes._setCreateURL(url));complete&&complete.runWith(createRes),Laya.loader.event(url)}),progress,type,constructParams,propertyParams,priority,cache,!0)}},__proto.load=function(url,complete,progress,type,priority,cache,group,ignoreCache,useWorkerLoader){var _$this=this;if(void 0===priority&&(priority=1),void 0===cache&&(cache=!0),void 0===ignoreCache&&(ignoreCache=!1),void 0===useWorkerLoader&&(useWorkerLoader=!1),url instanceof Array)return this._loadAssets(url,complete,progress,type,priority,cache,group);var content=Loader.getRes(url);if(ignoreCache||null==content){var original;original=url,(url=AtlasInfoManager.getFileLoadPath(url))!=original&&"nativeimage"!==type?type="atlas":original=null;var info=LoaderManager._resMap[url];info?(complete&&(original?complete&&info._createListener("complete",this,this._resInfoLoaded,[original,complete],!1,!1):complete&&info._createListener("complete",complete.caller,complete.method,complete.args,!1,!1)),progress&&info._createListener("progress",progress.caller,progress.method,progress.args,!1,!1)):((info=this._infoPool.length?this._infoPool.pop():new ResInfo).url=url,info.type=type,info.cache=cache,info.group=group,info.ignoreCache=ignoreCache,info.useWorkerLoader=useWorkerLoader,info.originalUrl=original,complete&&info.on("complete",complete.caller,complete.method,complete.args),progress&&info.on("progress",progress.caller,progress.method,progress.args),LoaderManager._resMap[url]=info,priority=priority<this._maxPriority?priority:this._maxPriority-1,this._resInfos[priority].push(info),this._statInfo.count++,this.event("progress",this.getProgress()),this._next())}else Laya.systemTimer.frameOnce(1,null,function(){progress&&progress.runWith(1),complete&&complete.runWith(content instanceof Array?[content]:content),_$this._loaderCount||_$this.event("complete")});return this},__proto._resInfoLoaded=function(original,complete){complete.runWith(Loader.getRes(original))},__proto._createLoad=function(url,complete,progress,type,constructParams,propertyParams,priority,cache,ignoreCache){var _$this=this;if(void 0===priority&&(priority=1),void 0===cache&&(cache=!0),void 0===ignoreCache&&(ignoreCache=!1),url instanceof Array)return this._loadAssets(url,complete,progress,type,priority,cache);var content=Loader.getRes(url);if(null!=content)Laya.systemTimer.frameOnce(1,null,function(){progress&&progress.runWith(1),complete&&complete.runWith(content),_$this._loaderCount||_$this.event("complete")});else{var info=LoaderManager._resMap[url];info?(complete&&info._createListener("complete",complete.caller,complete.method,complete.args,!1,!1),progress&&info._createListener("progress",progress.caller,progress.method,progress.args,!1,!1)):((info=this._infoPool.length?this._infoPool.pop():new ResInfo).url=url,info.type=type,info.cache=!1,info.ignoreCache=ignoreCache,info.originalUrl=null,info.createCache=cache,info.createConstructParams=constructParams,info.createPropertyParams=propertyParams,complete&&info.on("complete",complete.caller,complete.method,complete.args),progress&&info.on("progress",progress.caller,progress.method,progress.args),LoaderManager._resMap[url]=info,priority=priority<this._maxPriority?priority:this._maxPriority-1,this._resInfos[priority].push(info),this._statInfo.count++,this.event("progress",this.getProgress()),this._next())}return this},__proto._next=function(){if(!(this._loaderCount>=this.maxLoader)){for(var i=0;i<this._maxPriority;i++)for(var infos=this._resInfos[i];infos.length>0;){var info=infos.shift();if(info)return this._doLoad(info)}this._loaderCount||this.event("complete")}},__proto._doLoad=function(resInfo){this._loaderCount++;var loader=this._loaders.length?this._loaders.pop():new Loader;loader.on("complete",null,onLoaded),loader.on("progress",null,function(num){resInfo.event("progress",num)}),loader.on("error",null,function(msg){onLoaded(null)});var _me=this;function onLoaded(data){loader.offAll(),loader._data=null,loader._customParse=!1,_me._loaders.push(loader),_me._endLoad(resInfo,data instanceof Array?[data]:data),_me._loaderCount--,_me._next()}loader._constructParams=resInfo.createConstructParams,loader._propertyParams=resInfo.createPropertyParams,loader._createCache=resInfo.createCache,loader.load(resInfo.url,resInfo.type,resInfo.cache,resInfo.group,resInfo.ignoreCache,resInfo.useWorkerLoader)},__proto._endLoad=function(resInfo,content){var url=resInfo.url;if(null==content){var errorCount=this._failRes[url]||0;if(errorCount<this.retryNum)return console.warn("[warn]Retry to load:",url),this._failRes[url]=errorCount+1,void Laya.systemTimer.once(this.retryDelay,this,this._addReTry,[resInfo],!1);Loader.clearRes(url),console.warn("[error]Failed to load:",url),this.event("error",url)}this._failRes[url]&&(this._failRes[url]=0),delete LoaderManager._resMap[url],resInfo.originalUrl&&(content=Loader.getRes(resInfo.originalUrl)),resInfo.event("complete",content),resInfo.offAll(),this._infoPool.push(resInfo),this._statInfo.loaded++,this.event("progress",this.getProgress())},__proto._addReTry=function(resInfo){this._resInfos[this._maxPriority-1].push(resInfo),this._next()},__proto.clearRes=function(url){Loader.clearRes(url)},__proto.clearTextureRes=function(url){Loader.clearTextureRes(url)},__proto.getRes=function(url){return Loader.getRes(url)},__proto.cacheRes=function(url,data){Loader.cacheRes(url,data)},__proto.setGroup=function(url,group){Loader.setGroup(url,group)},__proto.clearResByGroup=function(group){Loader.clearResByGroup(group)},__proto.clearUnLoaded=function(){for(var i=0;i<this._maxPriority;i++){for(var infos=this._resInfos[i],j=infos.length-1;j>-1;j--){var info=infos[j];info&&(info.offAll(),this._infoPool.push(info))}infos.length=0}this._loaderCount=0,LoaderManager._resMap={}},__proto.cancelLoadByUrls=function(urls){if(urls)for(var i=0,n=urls.length;i<n;i++)this.cancelLoadByUrl(urls[i])},__proto.cancelLoadByUrl=function(url){for(var i=0;i<this._maxPriority;i++)for(var infos=this._resInfos[i],j=infos.length-1;j>-1;j--){var info=infos[j];info&&info.url===url&&(infos[j]=null,info.offAll(),this._infoPool.push(info))}LoaderManager._resMap[url]&&delete LoaderManager._resMap[url]},__proto._loadAssets=function(arr,complete,progress,type,priority,cache,group){void 0===priority&&(priority=1),void 0===cache&&(cache=!0);for(var itemCount=arr.length,loadedCount=0,totalSize=0,items=[],success=!0,i=0;i<itemCount;i++){var item=arr[i];"string"==typeof item&&(item={url:item,type:type,size:1,priority:priority}),item.size||(item.size=1),item.progress=0,totalSize+=item.size,items.push(item);var progressHandler=progress?Handler.create(null,loadProgress,[item],!1):null,completeHandler=complete||progress?Handler.create(null,loadComplete,[item]):null;this.load(item.url,completeHandler,progressHandler,item.type,item.priority||1,cache,item.group||group,!1,item.useWorkerLoader)}function loadComplete(item,content){loadedCount++,item.progress=1,content||(success=!1),loadedCount===itemCount&&complete&&complete.runWith(success)}function loadProgress(item,value){if(null!=progress){item.progress=value;for(var num=0,j=0;j<items.length;j++){var item1=items[j];num+=item1.size*item1.progress}var v=num/totalSize;progress.runWith(v)}}return this},__proto.decodeBitmaps=function(urls){var ctx,i=0,len=urls.length;for(ctx=Render._context,i=0;i<len;i++){var atlas,tex;if(atlas=Loader.getAtlas(urls[i]))this._decodeTexture(atlas[0],ctx);else(tex=this.getRes(urls[i]))&&tex instanceof laya.resource.Texture&&this._decodeTexture(tex,ctx)}},__proto._decodeTexture=function(tex,ctx){var bitmap=tex.bitmap;if(tex&&bitmap){var tImg=bitmap.source||bitmap.image;if(tImg&&Laya.__typeof(tImg,Browser.window.HTMLImageElement)){ctx.drawImage(tImg,0,0,1,1);ctx.getImageData(0,0,1,1)}}},LoaderManager.cacheRes=function(url,data){Loader.cacheRes(url,data)},LoaderManager._resMap={},__static(LoaderManager,["createMap",function(){return this.createMap={atlas:[null,"atlas"]}}]),LoaderManager.__init$=function(){ResInfo=function(_super){function ResInfo(){this.url=null,this.type=null,this.cache=!1,this.group=null,this.ignoreCache=!1,this.useWorkerLoader=!1,this.originalUrl=null,this.createCache=!1,this.createConstructParams=null,this.createPropertyParams=null,ResInfo.__super.call(this)}return __class(ResInfo,"",EventDispatcher),ResInfo}()},LoaderManager}()),MeshTexture=function(_super){function MeshTexture(){MeshTexture.__super.call(this,24,4,4),this.canReuse=!0,this.setAttributes(laya.webgl.utils.MeshTexture._fixattriInfo)}__class(MeshTexture,"laya.webgl.utils.MeshTexture",Mesh2D);var __proto=MeshTexture.prototype;return __proto.addData=function(vertices,uvs,idx,matrix,rgba){var vb=this._vb,ib=this._ib,vertsz=vertices.length>>1,f32pos=vb.needSize(24*vertsz)>>2,vbdata=vb._floatArray32||vb.getFloat32Array(),vbu32Arr=vb._uint32Array,ci=0,m00=matrix.a,m01=matrix.b,m10=matrix.c,m11=matrix.d,tx=matrix.tx,ty=matrix.ty,i=0;for(i=0;i<vertsz;i++){var x=vertices[ci],y=vertices[ci+1];vbdata[f32pos]=x*m00+y*m10+tx,vbdata[f32pos+1]=x*m01+y*m11+ty,vbdata[f32pos+2]=uvs[ci],vbdata[f32pos+3]=uvs[ci+1],vbu32Arr[f32pos+4]=rgba,vbu32Arr[f32pos+5]=255,f32pos+=6,ci+=2}vb.setNeedUpload();var vertN=this.vertNum,sz=idx.length,stib=ib.needSize(idx.byteLength),cidx=ib.getUint16Array(),stibid=stib>>1;if(vertN>0){var end=stibid+sz,si=0;for(i=stibid;i<end;i++,si++)cidx[i]=idx[si]+vertN}else cidx.set(idx,stibid);ib.setNeedUpload(),this.vertNum+=vertsz,this.indexNum+=idx.length},__proto.releaseMesh=function(){this._vb.setByteLength(0),this._ib.setByteLength(0),this.vertNum=0,this.indexNum=0,laya.webgl.utils.MeshTexture._POOL.push(this)},__proto.destroy=function(){this._ib.destroy(),this._vb.destroy(),this._ib.disposeResource(),this._vb.deleteBuffer()},MeshTexture.getAMesh=function(mainctx){var ret;return ret=laya.webgl.utils.MeshTexture._POOL.length?laya.webgl.utils.MeshTexture._POOL.pop():new MeshTexture,mainctx&&ret._vb._resizeBuffer(1572864,!1),ret},MeshTexture.const_stride=24,MeshTexture._POOL=[],__static(MeshTexture,["_fixattriInfo",function(){return this._fixattriInfo=[5126,4,0,5121,4,16,5121,4,20]}]),MeshTexture}(),SceneLoader=function(_super){function SceneLoader(){this.totalCount=0,this._completeHandler=null,this._toLoadList=null,this._isLoading=!1,this._curUrl=null,SceneLoader.__super.call(this),this._completeHandler=new Handler(this,this.onOneLoadComplete),this.reset()}__class(SceneLoader,"laya.net.SceneLoader",EventDispatcher);var __proto=SceneLoader.prototype;return __proto.reset=function(){this._toLoadList=[],this._isLoading=!1,this.totalCount=0},__proto.load=function(url,is3D,ifCheck){if(void 0===is3D&&(is3D=!1),void 0===ifCheck&&(ifCheck=!0),url instanceof Array){var len,i=0;for(len=url.length,i=0;i<len;i++)this._addToLoadList(url[i],is3D)}else this._addToLoadList(url,is3D);ifCheck&&this._checkNext()},__proto._addToLoadList=function(url,is3D){void 0===is3D&&(is3D=!1),this._toLoadList.indexOf(url)>=0||Loader.getRes(url)||(is3D?this._toLoadList.push({url:url}):this._toLoadList.push(url),this.totalCount++)},__proto._checkNext=function(){if(!this._isLoading){if(0==this._toLoadList.length)return void this.event("complete");var tItem;"string"==typeof(tItem=this._toLoadList.pop())?this.loadOne(tItem):this.loadOne(tItem.url,!0)}},__proto.loadOne=function(url,is3D){void 0===is3D&&(is3D=!1),this._curUrl=url;var type=Utils.getFileExtension(this._curUrl);is3D?Laya.loader.create(url,this._completeHandler):SceneLoader.LoadableExtensions[type]?Laya.loader.load(url,this._completeHandler,null,SceneLoader.LoadableExtensions[type]):url!=AtlasInfoManager.getFileLoadPath(url)||SceneLoader.No3dLoadTypes[type]||!LoaderManager.createMap[type]?Laya.loader.load(url,this._completeHandler):Laya.loader.create(url,this._completeHandler)},__proto.onOneLoadComplete=function(){this._isLoading=!1,Loader.getRes(this._curUrl)||console.log("Fail to load:",this._curUrl);var dataO,type=Utils.getFileExtension(this._curUrl);SceneLoader.LoadableExtensions[type]&&((dataO=Loader.getRes(this._curUrl))&&dataO instanceof laya.components.Prefab&&(dataO=dataO.json),dataO&&(dataO.loadList&&this.load(dataO.loadList,!1,!1),dataO.loadList3D&&this.load(dataO.loadList3D,!0,!1)));"sk"==type&&this.load(this._curUrl.replace(".sk",".png"),!1,!1),this.event("progress",this.getProgress()),this._checkNext()},__proto.getProgress=function(){return this.loadedCount/this.totalCount},__getset(0,__proto,"loadedCount",function(){return this.totalCount-this.leftCount}),__getset(0,__proto,"leftCount",function(){return this._isLoading?this._toLoadList.length+1:this._toLoadList.length}),__static(SceneLoader,["LoadableExtensions",function(){return this.LoadableExtensions={scene:"json",scene3d:"json",ani:"json",ui:"json",prefab:"prefab"}},"No3dLoadTypes",function(){return this.No3dLoadTypes={png:!0,jpg:!0,txt:!0}}]),SceneLoader}(),TextStyle=function(_super){function TextStyle(){this.italic=!1,TextStyle.__super.call(this)}__class(TextStyle,"laya.display.css.TextStyle",_super);var __proto=TextStyle.prototype;return __proto.reset=function(){return _super.prototype.reset.call(this),this.italic=!1,this.align="left",this.wordWrap=!1,this.leading=0,this.padding=[0,0,0,0],this.bgColor=null,this.borderColor=null,this.asPassword=!1,this.stroke=0,this.strokeColor="#000000",this.bold=!1,this.underline=!1,this.underlineColor=null,this.currBitmapFont=null,this},__proto.recover=function(){this!==TextStyle.EMPTY&&Pool.recover("TextStyle",this.reset())},__proto.render=function(sprite,context,x,y){(this.bgColor||this.borderColor)&&context.drawRect(x,y,sprite.width,sprite.height,this.bgColor,this.borderColor,1)},TextStyle.create=function(){return Pool.getItemByClass("TextStyle",TextStyle)},TextStyle.EMPTY=new TextStyle,TextStyle}(SpriteStyle),WorkerLoader=function(_super){function WorkerLoader(){this.worker=null,this._useWorkerLoader=!1,WorkerLoader.__super.call(this);var _$this=this;this.worker=new Worker(WorkerLoader.workerPath),this.worker.onmessage=function(evt){_$this.workerMessage(evt.data)}}__class(WorkerLoader,"laya.net.WorkerLoader",EventDispatcher);var __proto=WorkerLoader.prototype;return __proto.workerMessage=function(data){if(data)switch(data.type){case"Image":this.imageLoaded(data);break;case"Disable":WorkerLoader.enable=!1}},__proto.imageLoaded=function(data){if(data.dataType&&"imageBitmap"==data.dataType){var canvas=new HTMLCanvas(!0),ctx=canvas.source.getContext("2d");switch(data.dataType){case"imageBitmap":var imageData=data.imageBitmap;canvas.size(imageData.width,imageData.height),ctx.drawImage(imageData,0,0)}console.log("load:",data.url),canvas._setGPUMemory(0);var tex=new Texture2D;tex.loadImageSource(canvas.source),this.event(data.url,tex)}else this.event(data.url,null)},__proto.loadImage=function(url){this.worker.postMessage(url)},__proto._loadImage=function(url){var _this=this;if(this._useWorkerLoader&&WorkerLoader._enable){url=URL.formatURL(url);var onload=function(image){laya.net.WorkerLoader.I.off(url,_this,onload),image?_this.onLoaded(image):WorkerLoader._preLoadFun.call(_this,url)};laya.net.WorkerLoader.I.on(url,_this,onload),laya.net.WorkerLoader.I.loadImage(url)}else WorkerLoader._preLoadFun.call(_this,url)},__getset(1,WorkerLoader,"enable",function(){return WorkerLoader._enable},function(value){WorkerLoader._enable!=value&&(WorkerLoader._enable=value,value&&null==WorkerLoader._preLoadFun&&(WorkerLoader._enable=WorkerLoader.__init__()))}),WorkerLoader.__init__=function(){return null==WorkerLoader._preLoadFun&&(!!Worker&&(WorkerLoader._preLoadFun=Loader.prototype._loadImage,Loader.prototype._loadImage=WorkerLoader.prototype._loadImage,WorkerLoader.I||(WorkerLoader.I=new WorkerLoader),!0))},WorkerLoader.workerSupported=function(){return!!Worker},WorkerLoader.enableWorkerLoader=function(){WorkerLoader._tryEnabled||(WorkerLoader.enable=!0,WorkerLoader._tryEnabled=!0)},WorkerLoader.I=null,WorkerLoader.workerPath="libs/workerloader.js",WorkerLoader._preLoadFun=null,WorkerLoader._enable=!1,WorkerLoader._tryEnabled=!1,WorkerLoader}(),BufferState2D=function(_super){function BufferState2D(){BufferState2D.__super.call(this)}return __class(BufferState2D,"laya.webgl.BufferState2D",BufferStateBase),BufferState2D}(),PrimitiveSV=function(_super){function PrimitiveSV(args){PrimitiveSV.__super.call(this,4,0),this._attribLocation=["position",0,"attribColor",1]}return __class(PrimitiveSV,"laya.webgl.shader.d2.value.PrimitiveSV",Value2D),PrimitiveSV}(),SkinSV=function(_super){function SkinSV(type){this.texcoord=null,this.position=null,this.offsetX=300,this.offsetY=0,SkinSV.__super.call(this,512,0);var _vlen=8*CONST3D2D.BYTES_PE;this.position=[2,5126,!1,_vlen,0],this.texcoord=[2,5126,!1,_vlen,2*CONST3D2D.BYTES_PE],this.color=[4,5126,!1,_vlen,4*CONST3D2D.BYTES_PE]}return __class(SkinSV,"laya.webgl.shader.d2.skinAnishader.SkinSV",Value2D),SkinSV}(),CharRender_Canvas=function(_super){function CharRender_Canvas(maxw,maxh,scalefont,useImageData,showdbg){this.ctx=null,this.lastScaleX=1,this.lastScaleY=1,this.needResetScale=!1,this.maxTexW=0,this.maxTexH=0,this.scaleFontSize=!0,this.showDbgInfo=!1,this.supportImageData=!0,this.settrans=null,CharRender_Canvas.__super.call(this),void 0===scalefont&&(scalefont=!0),void 0===useImageData&&(useImageData=!0),void 0===showdbg&&(showdbg=!1),this.maxTexW=maxw,this.maxTexH=maxh,this.scaleFontSize=scalefont,this.supportImageData=useImageData,this.showDbgInfo=showdbg,CharRender_Canvas.canvas||(CharRender_Canvas.canvas=window.document.createElement("canvas"),CharRender_Canvas.canvas.width=1024,CharRender_Canvas.canvas.height=512,CharRender_Canvas.canvas.style.left="-10000px",CharRender_Canvas.canvas.style.position="absolute",document.body.appendChild(CharRender_Canvas.canvas),this.ctx=CharRender_Canvas.canvas.getContext("2d"),this.settrans=this.ctx._setTransform||this.ctx.setTransform)}__class(CharRender_Canvas,"laya.webgl.text.CharRender_Canvas",ICharRender);var __proto=CharRender_Canvas.prototype;return __proto.getWidth=function(font,str){return this.ctx?(this.ctx._lastFont!=font&&(this.ctx.font=font,this.ctx._lastFont=font),this.ctx.measureText(str).width):0},__proto.scale=function(sx,sy){if(!this.supportImageData)return this.lastScaleX=sx,void(this.lastScaleY=sy);this.lastScaleX==sx&&this.lastScaleY==sy||(this.settrans.call(this.ctx,sx,0,0,sy,0,0),this.lastScaleX=sx,this.lastScaleY=sy)},__proto.getCharBmp=function(char,font,lineWidth,colStr,strokeColStr,cri,margin_left,margin_top,margin_right,margin_bottom,rect){if(!this.supportImageData)return this.getCharCanvas(char,font,lineWidth,colStr,strokeColStr,cri,margin_left,margin_top,margin_right,margin_bottom);var ctx=this.ctx;ctx.font!=font&&(ctx.font=font,ctx._lastFont=font),cri.width=ctx.measureText(char).width;var w=cri.width*this.lastScaleX,h=cri.height*this.lastScaleY;w+=(margin_left+margin_right)*this.lastScaleX,h+=(margin_top+margin_bottom)*this.lastScaleY,w=Math.ceil(w),h=Math.ceil(h);var clearW=(w=Math.min(w,laya.webgl.text.CharRender_Canvas.canvas.width))+2*lineWidth+1,clearH=(h=Math.min(h,laya.webgl.text.CharRender_Canvas.canvas.height))+2*lineWidth+1;rect&&(clearW=Math.max(clearW,rect[0]+rect[2]+1),clearH=Math.max(clearH,rect[1]+rect[3]+1)),ctx.clearRect(0,0,clearW,clearH),ctx.save(),ctx.textBaseline="top",lineWidth>0&&(ctx.strokeStyle=strokeColStr,ctx.lineWidth=lineWidth,ctx.strokeText(char,margin_left,margin_top)),ctx.fillStyle=colStr,ctx.fillText(char,margin_left,margin_top),this.showDbgInfo&&(ctx.strokeStyle="#ff0000",ctx.strokeRect(0,0,w,h),ctx.strokeStyle="#00ff00",ctx.strokeRect(margin_left,margin_top,cri.width,cri.height)),rect&&-1==rect[2]&&(rect[2]=Math.ceil((cri.width+2*lineWidth)*this.lastScaleX));var imgdt=rect?ctx.getImageData(rect[0],rect[1],rect[2],rect[3]):ctx.getImageData(0,0,w,h);return ctx.restore(),cri.bmpWidth=imgdt.width,cri.bmpHeight=imgdt.height,imgdt},__proto.getCharCanvas=function(char,font,lineWidth,colStr,strokeColStr,cri,margin_left,margin_top,margin_right,margin_bottom){var ctx=this.ctx;ctx.font!=font&&(ctx.font=font,ctx._lastFont=font),cri.width=ctx.measureText(char).width;var w=cri.width*this.lastScaleX,h=cri.height*this.lastScaleY;return w+=(margin_left+margin_right)*this.lastScaleX,h+=(margin_top+margin_bottom)*this.lastScaleY+1,w=Math.min(w,this.maxTexW),h=Math.min(h,this.maxTexH),CharRender_Canvas.canvas.width=Math.min(w+1,this.maxTexW),CharRender_Canvas.canvas.height=Math.min(h+1,this.maxTexH),ctx.font=font,ctx.clearRect(0,0,w+1+lineWidth,h+1+lineWidth),this.settrans.call(ctx,1,0,0,1,0,0),ctx.save(),this.scaleFontSize&&ctx.scale(this.lastScaleX,this.lastScaleY),ctx.translate(margin_left,margin_top),ctx.textAlign="left",ctx.textBaseline="top",lineWidth>0?(ctx.strokeStyle=strokeColStr,ctx.fillStyle=colStr,ctx.lineWidth=lineWidth,ctx.fillAndStrokeText?ctx.fillAndStrokeText(char,0,0):(ctx.strokeText(char,0,0),ctx.fillText(char,0,0))):(ctx.fillStyle=colStr,ctx.fillText(char,0,0)),this.showDbgInfo&&(ctx.strokeStyle="#ff0000",ctx.strokeRect(0,0,w,h),ctx.strokeStyle="#00ff00",ctx.strokeRect(0,0,cri.width,cri.height)),ctx.restore(),cri.bmpWidth=CharRender_Canvas.canvas.width,cri.bmpHeight=CharRender_Canvas.canvas.height,CharRender_Canvas.canvas},__getset(0,__proto,"canvasWidth",function(){return CharRender_Canvas.canvas.width},function(w){CharRender_Canvas.canvas.width!=w&&(CharRender_Canvas.canvas.width=w,w>2048&&console.warn("画文字设置的宽度太大,超过2048了"),this.settrans.call(this.ctx,1,0,0,1,0,0),this.ctx.scale(this.lastScaleX,this.lastScaleY))}),CharRender_Canvas.canvas=null,CharRender_Canvas}(),CharRender_Native=function(_super){function CharRender_Native(){this.lastFont="",CharRender_Native.__super.call(this)}__class(CharRender_Native,"laya.webgl.text.CharRender_Native",ICharRender);var __proto=CharRender_Native.prototype;return __proto.getWidth=function(font,str){return window.conchTextCanvas?(window.conchTextCanvas.font=font,this.lastFont=font,window.conchTextCanvas.measureText(str).width):0},__proto.scale=function(sx,sy){},__proto.getCharBmp=function(char,font,lineWidth,colStr,strokeColStr,size,margin_left,margin_top,margin_right,margin_bottom,rect){if(!window.conchTextCanvas)return null;window.conchTextCanvas.font=font,this.lastFont=font;size.width=window.conchTextCanvas.measureText(char).width,size.height;var nStrokeColor=ColorUtils.create(strokeColStr).numColor,nTextColor=ColorUtils.create(colStr).numColor,textInfo=window.conchTextCanvas.getTextBitmapData(char,nTextColor,lineWidth>2?2:lineWidth,nStrokeColor);return size.bmpWidth=textInfo.width,size.bmpHeight=textInfo.height,textInfo},CharRender_Native}(),Sprite=function(_super){function Sprite(){this._x=0,this._y=0,this._width=0,this._height=0,this._visible=!0,this._mouseState=0,this._zOrder=0,this._renderType=0,this._transform=null,this._tfChanged=!1,this._texture=null,this._boundStyle=null,this._graphics=null,this.mouseThrough=!1,this.autoSize=!1,this.hitTestPrior=!1,Sprite.__super.call(this),this._repaint=0,this._style=SpriteStyle.EMPTY,this._cacheStyle=CacheStyle.EMPTY}__class(Sprite,"laya.display.Sprite",_super);var __proto=Sprite.prototype;return __proto.destroy=function(destroyChild){void 0===destroyChild&&(destroyChild=!0),_super.prototype.destroy.call(this,destroyChild),this._style&&this._style.recover(),this._cacheStyle&&this._cacheStyle.recover(),this._boundStyle&&this._boundStyle.recover(),this._style=null,this._cacheStyle=null,this._boundStyle=null,this._transform=null,this._graphics&&this._graphics.autoDestroy&&this._graphics.destroy(),this._graphics=null,this.texture=null},__proto.updateZOrder=function(){Utils.updateOrder(this._children)&&this.repaint()},__proto._getBoundsStyle=function(){return this._boundStyle||(this._boundStyle=BoundsStyle.create()),this._boundStyle},__proto._setCustomRender=function(){},__proto._setCacheAs=function(value){},__proto._checkCanvasEnable=function(){var tEnable=this._cacheStyle.needEnableCanvasRender();this._getCacheStyle().enableCanvasRender=tEnable,tEnable?(this._cacheStyle.needBitmapCache()?this._cacheStyle.cacheAs="bitmap":this._cacheStyle.cacheAs=this._cacheStyle.userSetCache,this._cacheStyle.reCache=!0,this._renderType|=8):(this._cacheStyle.cacheAs="none",this._cacheStyle.releaseContext(),this._renderType&=-9),this._setCacheAs(this._cacheStyle.cacheAs),this._setRenderType(this._renderType)},__proto.reCache=function(){this._cacheStyle.reCache=!0,this._repaint|=2},__proto.getRepaint=function(){return this._repaint},__proto._setX=function(value){this._x=value},__proto._setY=function(value){this._y=value},__proto._setWidth=function(texture,value){},__proto._setHeight=function(texture,value){},__proto.setSelfBounds=function(bound){this._getBoundsStyle().userBounds=bound},__proto.getBounds=function(){return this._getBoundsStyle().bounds=Rectangle._getWrapRec(this._boundPointsToParent())},__proto.getSelfBounds=function(){return this._boundStyle&&this._boundStyle.userBounds?this._boundStyle.userBounds:this._graphics||0!==this._children.length||this._texture?this._getBoundsStyle().bounds=Rectangle._getWrapRec(this._getBoundPointsM(!1)):Rectangle.TEMP.setTo(0,0,0,0)},__proto._boundPointsToParent=function(ifRotate){void 0===ifRotate&&(ifRotate=!1);var pX=0,pY=0;this._style&&(pX=this.pivotX,pY=this.pivotY,ifRotate=ifRotate||0!==this._style.rotation,this._style.scrollRect&&(pX+=this._style.scrollRect.x,pY+=this._style.scrollRect.y));var pList=this._getBoundPointsM(ifRotate);if(!pList||pList.length<1)return pList;if(8!=pList.length&&(pList=ifRotate?GrahamScan.scanPList(pList):Rectangle._getWrapRec(pList,Rectangle.TEMP)._getBoundPoints()),!this.transform)return Utils.transPointList(pList,this._x-pX,this._y-pY),pList;var tPoint=Point.TEMP,i=0,len=pList.length;for(i=0;i<len;i+=2)tPoint.x=pList[i],tPoint.y=pList[i+1],this.toParentPoint(tPoint),pList[i]=tPoint.x,pList[i+1]=tPoint.y;return pList},__proto.getGraphicBounds=function(realSize){return void 0===realSize&&(realSize=!1),this._graphics?this._graphics.getBounds(realSize):Rectangle.TEMP.setTo(0,0,0,0)},__proto._getBoundPointsM=function(ifRotate){if(void 0===ifRotate&&(ifRotate=!1),this._boundStyle&&this._boundStyle.userBounds)return this._boundStyle.userBounds._getBoundPoints();if(this._boundStyle||this._getBoundsStyle(),this._boundStyle.temBM||(this._boundStyle.temBM=[]),this._style.scrollRect){var rst=Utils.clearArray(this._boundStyle.temBM),rec=Rectangle.TEMP;return rec.copyFrom(this._style.scrollRect),Utils.concatArray(rst,rec._getBoundPoints()),rst}var pList,child,cList,__childs;this._graphics?pList=this._graphics.getBoundPoints():(pList=Utils.clearArray(this._boundStyle.temBM),this._texture&&((rec=Rectangle.TEMP).setTo(0,0,this.width||this._texture.width,this.height||this._texture.height),Utils.concatArray(pList,rec._getBoundPoints())));for(var i=0,n=(__childs=this._children).length;i<n;i++)(child=__childs[i])instanceof laya.display.Sprite&&!0===child._visible&&(cList=child._boundPointsToParent(ifRotate))&&(pList=pList?Utils.concatArray(pList,cList):cList);return pList},__proto._getCacheStyle=function(){return this._cacheStyle===CacheStyle.EMPTY&&(this._cacheStyle=CacheStyle.create()),this._cacheStyle},__proto.getStyle=function(){return this._style===SpriteStyle.EMPTY&&(this._style=SpriteStyle.create()),this._style},__proto.setStyle=function(value){this._style=value},__proto._setScaleX=function(value){this._style.scaleX=value},__proto._setScaleY=function(value){this._style.scaleY=value},__proto._setRotation=function(value){this._style.rotation=value},__proto._setSkewX=function(value){this._style.skewX=value},__proto._setSkewY=function(value){this._style.skewY=value},__proto._createTransform=function(){return Matrix.create()},__proto._adjustTransform=function(){this._tfChanged=!1;var style=this._style,sx=style.scaleX,sy=style.scaleY,sskx=style.skewX,ssky=style.skewY,rot=style.rotation,m=this._transform||(this._transform=this._createTransform());if(rot||1!==sx||1!==sy||0!==sskx||0!==ssky){m._bTransform=!0;var skx=.0174532922222222*(rot-sskx),sky=.0174532922222222*(rot+ssky),cx=Math.cos(sky),ssx=Math.sin(sky),cy=Math.sin(skx),ssy=Math.cos(skx);m.a=sx*cx,m.b=sx*ssx,m.c=-sy*cy,m.d=sy*ssy,m.tx=m.ty=0}else m.identity(),this._renderType&=-3,this._setRenderType(this._renderType);return m},__proto._setTransform=function(value){},__proto._setPivotX=function(value){this.getStyle().pivotX=value},__proto._getPivotX=function(){return this._style.pivotX},__proto._setPivotY=function(value){this.getStyle().pivotY=value},__proto._getPivotY=function(){return this._style.pivotY},__proto._setAlpha=function(value){this._style.alpha!==value&&(this.getStyle().alpha=value,1!==value?this._renderType|=1:this._renderType&=-2,this._setRenderType(this._renderType),this.parentRepaint())},__proto._getAlpha=function(){return this._style.alpha},__proto._setBlendMode=function(value){},__proto._setGraphics=function(value){},__proto._setGraphicsCallBack=function(){},__proto._setScrollRect=function(value){},__proto.pos=function(x,y,speedMode){if(void 0===speedMode&&(speedMode=!1),this._x!==x||this._y!==y){if(this.destroyed)return this;if(speedMode){this._setX(x),this._setY(y),this.parentRepaint(2);var p=this._cacheStyle.maskParent;p&&p.repaint(2)}else this.x=x,this.y=y}return this},__proto.pivot=function(x,y){return this.pivotX=x,this.pivotY=y,this},__proto.size=function(width,height){return this.width=width,this.height=height,this},__proto.scale=function(scaleX,scaleY,speedMode){void 0===speedMode&&(speedMode=!1);var style=this.getStyle();if(style.scaleX!=scaleX||style.scaleY!=scaleY){if(this.destroyed)return this;speedMode?(this._setScaleX(scaleX),this._setScaleY(scaleY),this._setTranformChange()):(this.scaleX=scaleX,this.scaleY=scaleY)}return this},__proto.skew=function(skewX,skewY){return this.skewX=skewX,this.skewY=skewY,this},__proto.render=function(ctx,x,y){RenderSprite.renders[this._renderType]._fun(this,ctx,x+this._x,y+this._y),this._repaint=0},__proto.drawToCanvas=function(canvasWidth,canvasHeight,offsetX,offsetY){return RunDriver.drawToCanvas(this,this._renderType,canvasWidth,canvasHeight,offsetX,offsetY)},__proto.drawToTexture=function(canvasWidth,canvasHeight,offsetX,offsetY){return RunDriver.drawToTexture(this,this._renderType,canvasWidth,canvasHeight,offsetX,offsetY)},__proto.customRender=function(context,x,y){this._repaint=3},__proto._applyFilters=function(){},__proto._setColorFilter=function(value){},__proto._isHaveGlowFilter=function(){var len,i=0;if(this.filters)for(i=0;i<this.filters.length;i++)if(8==this.filters[i].type)return!0;for(i=0,len=this._children.length;i<len;i++)if(this._children[i]._isHaveGlowFilter())return!0;return!1},__proto.localToGlobal=function(point,createNewPoint,globalNode){void 0===createNewPoint&&(createNewPoint=!1),!0===createNewPoint&&(point=new Point(point.x,point.y));var ele=this;for(globalNode=globalNode||Laya.stage;ele&&!ele.destroyed&&ele!=globalNode;)point=ele.toParentPoint(point),ele=ele.parent;return point},__proto.globalToLocal=function(point,createNewPoint,globalNode){void 0===createNewPoint&&(createNewPoint=!1),createNewPoint&&(point=new Point(point.x,point.y));var ele=this,list=[];for(globalNode=globalNode||Laya.stage;ele&&!ele.destroyed&&ele!=globalNode;)list.push(ele),ele=ele.parent;for(var i=list.length-1;i>=0;)point=(ele=list[i]).fromParentPoint(point),i--;return point},__proto.toParentPoint=function(point){if(!point)return point;point.x-=this.pivotX,point.y-=this.pivotY,this.transform&&this._transform.transformPoint(point),point.x+=this._x,point.y+=this._y;var scroll=this._style.scrollRect;return scroll&&(point.x-=scroll.x,point.y-=scroll.y),point},__proto.fromParentPoint=function(point){if(!point)return point;point.x-=this._x,point.y-=this._y;var scroll=this._style.scrollRect;return scroll&&(point.x+=scroll.x,point.y+=scroll.y),this.transform&&this._transform.invertTransformPoint(point),point.x+=this.pivotX,point.y+=this.pivotY,point},__proto.fromStagePoint=function(point){return point},__proto.on=function(type,caller,listener,args){return 1!==this._mouseState&&this.isMouseEvent(type)?(this.mouseEnabled=!0,this._setBit(64,!0),this._parent&&this._$2__onDisplay(),this._createListener(type,caller,listener,args,!1)):_super.prototype.on.call(this,type,caller,listener,args)},__proto.once=function(type,caller,listener,args){return 1!==this._mouseState&&this.isMouseEvent(type)?(this.mouseEnabled=!0,this._setBit(64,!0),this._parent&&this._$2__onDisplay(),this._createListener(type,caller,listener,args,!0)):_super.prototype.once.call(this,type,caller,listener,args)},__proto._$2__onDisplay=function(){if(1!==this._mouseState){var ele=this;for(ele=ele.parent;ele&&1!==ele._mouseState&&!ele._getBit(64);)ele.mouseEnabled=!0,ele._setBit(64,!0),ele=ele.parent}},__proto._setParent=function(value){_super.prototype._setParent.call(this,value),value&&this._getBit(64)&&this._$2__onDisplay()},__proto.loadImage=function(url,complete){var _$this=this;if(null==url)this.texture=null,loaded();else{var tex=Loader.getRes(url);tex||((tex=new Texture).load(url),Loader.cacheRes(url,tex)),this.texture=tex,tex.getIsReady()?loaded():tex.once("ready",null,loaded)}function loaded(){_$this.repaint(3),complete&&complete.run()}return this},__proto.repaint=function(type){void 0===type&&(type=2),this._repaint&type||(this._repaint|=type,this.parentRepaint(type)),this._cacheStyle&&this._cacheStyle.maskParent&&this._cacheStyle.maskParent.repaint(type)},__proto._needRepaint=function(){return 2&this._repaint&&this._cacheStyle.enableCanvasRender&&this._cacheStyle.reCache},__proto._childChanged=function(child){this._children.length?this._renderType|=8192:this._renderType&=-8193,this._setRenderType(this._renderType),child&&this._getBit(32)&&Laya.systemTimer.callLater(this,this.updateZOrder),this.repaint(3)},__proto.parentRepaint=function(type){void 0===type&&(type=2);var p=this._parent;!p||p._repaint&type||(p._repaint|=type,p.parentRepaint(type))},__proto._setMask=function(value){},__proto.startDrag=function(area,hasInertia,elasticDistance,elasticBackTime,data,disableMouseEvent,ratio){void 0===hasInertia&&(hasInertia=!1),void 0===elasticDistance&&(elasticDistance=0),void 0===elasticBackTime&&(elasticBackTime=300),void 0===disableMouseEvent&&(disableMouseEvent=!1),void 0===ratio&&(ratio=.92),this._style.dragging||(this.getStyle().dragging=new Dragging),this._style.dragging.start(this,area,hasInertia,elasticDistance,elasticBackTime,data,disableMouseEvent,ratio)},__proto.stopDrag=function(){this._style.dragging&&this._style.dragging.stop()},__proto._setDisplay=function(value){value||this._cacheStyle&&(this._cacheStyle.releaseContext(),this._cacheStyle.releaseFilterCache(),this._cacheStyle.hasGlowFilter&&(this._cacheStyle.hasGlowFilter=!1)),_super.prototype._setDisplay.call(this,value)},__proto.hitTestPoint=function(x,y){var point=this.globalToLocal(Point.TEMP.setTo(x,y));return x=point.x,y=point.y,(this._style.hitArea?this._style.hitArea:this._width>0&&this._height>0?Rectangle.TEMP.setTo(0,0,this._width,this._height):this.getSelfBounds()).contains(x,y)},__proto.getMousePoint=function(){return this.globalToLocal(Point.TEMP.setTo(Laya.stage.mouseX,Laya.stage.mouseY))},__proto._setTexture=function(value){},__proto._setRenderType=function(type){},__proto._setTranformChange=function(){this._tfChanged=!0,this._renderType|=2,this.parentRepaint(2)},__proto._setBgStyleColor=function(x,y,width,height,fillColor){},__proto._setBorderStyleColor=function(x,y,width,height,fillColor,borderWidth){},__proto.captureMouseEvent=function(exclusive){MouseManager.instance.setCapture(this,exclusive)},__proto.releaseMouseEvent=function(){MouseManager.instance.releaseCapture()},__getset(0,__proto,"customRenderEnable",null,function(b){b&&(this._renderType|=2048,this._setRenderType(this._renderType),this._setCustomRender())}),__getset(0,__proto,"cacheAs",function(){return this._cacheStyle.cacheAs},function(value){value!==this._cacheStyle.userSetCache&&(this.mask&&"normal"===value||(this._setCacheAs(value),this._getCacheStyle().userSetCache=value,this._checkCanvasEnable(),this.repaint()))}),__getset(0,__proto,"globalScaleY",function(){for(var scale=1,ele=this;ele&&ele!==Laya.stage;)scale*=ele.scaleY,ele=ele.parent;return scale}),__getset(0,__proto,"hitArea",function(){return this._style.hitArea},function(value){this.getStyle().hitArea=value}),__getset(0,__proto,"staticCache",function(){return this._cacheStyle.staticCache},function(value){this._getCacheStyle().staticCache=value,value||this.reCache()}),__getset(0,__proto,"displayWidth",function(){return this.width*this.scaleX}),__getset(0,__proto,"zOrder",function(){return this._zOrder},function(value){this._zOrder!=value&&(this._zOrder=value,this._parent&&(value&&this._parent._setBit(32,!0),Laya.systemTimer.callLater(this._parent,this.updateZOrder)))}),__getset(0,__proto,"rotation",function(){return this._style.rotation},function(value){this.getStyle().rotation!==value&&(this._setRotation(value),this._setTranformChange())}),__getset(0,__proto,"width",function(){return this.autoSize?this.texture?this.texture.width:this._graphics||0!==this._children.length?this.getSelfBounds().width:0:this._width||(this.texture?this.texture.width:0)},function(value){this._width!==value&&(this._width=value,this._setWidth(this.texture,value),this._setTranformChange())}),__getset(0,__proto,"x",function(){return this._x},function(value){if(!this.destroyed&&this._x!==value){this._setX(value),this.parentRepaint(2);var p=this._cacheStyle.maskParent;p&&p.repaint(2)}}),__getset(0,__proto,"drawCallOptimize",function(){return this._getBit(256)},function(value){this._setBit(256,value)}),__getset(0,__proto,"texture",function(){return this._texture},function(value){"string"==typeof value?this.loadImage(value):this._texture!=value&&(this._texture&&this._texture._removeReference(),this._texture=value,value&&value._addReference(),this._setTexture(value),this._setWidth(this._texture,this.width),this._setHeight(this._texture,this.height),value?this._renderType|=256:this._renderType&=-257,this._setRenderType(this._renderType),this.repaint())}),__getset(0,__proto,"globalRotation",function(){for(var angle=0,ele=this;ele&&ele!==Laya.stage;)angle+=ele.rotation,ele=ele.parent;return angle}),__getset(0,__proto,"y",function(){return this._y},function(value){if(!this.destroyed&&this._y!==value){this._setY(value),this.parentRepaint(2);var p=this._cacheStyle.maskParent;p&&p.repaint(2)}}),__getset(0,__proto,"displayHeight",function(){return this.height*this.scaleY}),__getset(0,__proto,"height",function(){return this.autoSize?this.texture?this.texture.height:this._graphics||0!==this._children.length?this.getSelfBounds().height:0:this._height||(this.texture?this.texture.height:0)},function(value){this._height!==value&&(this._height=value,this._setHeight(this.texture,value),this._setTranformChange())}),__getset(0,__proto,"blendMode",function(){return this._style.blendMode},function(value){this._setBlendMode(value),this.getStyle().blendMode=value,value&&"source-over"!=value?this._renderType|=4:this._renderType&=-5,this._setRenderType(this._renderType),this.parentRepaint()}),__getset(0,__proto,"scaleX",function(){return this._style.scaleX},function(value){this.getStyle().scaleX!==value&&(this._setScaleX(value),this._setTranformChange())}),__getset(0,__proto,"scaleY",function(){return this._style.scaleY},function(value){this.getStyle().scaleY!==value&&(this._setScaleY(value),this._setTranformChange())}),__getset(0,__proto,"stage",function(){return Laya.stage}),__getset(0,__proto,"skewX",function(){return this._style.skewX},function(value){this.getStyle().skewX!==value&&(this._setSkewX(value),this._setTranformChange())}),__getset(0,__proto,"scrollRect",function(){return this._style.scrollRect},function(value){this.getStyle().scrollRect=value,this._setScrollRect(value),this.repaint(),value?this._renderType|=64:this._renderType&=-65,this._setRenderType(this._renderType)}),__getset(0,__proto,"skewY",function(){return this._style.skewY},function(value){this.getStyle().skewY!==value&&(this._setSkewY(value),this._setTranformChange())}),__getset(0,__proto,"transform",function(){return this._tfChanged?this._adjustTransform():this._transform},function(value){this._tfChanged=!1;var m=this._transform||(this._transform=this._createTransform());value.copyTo(m),this._setTransform(m),value&&(this._x=m.tx,this._y=m.ty,m.tx=m.ty=0),value?this._renderType|=2:this._renderType&=-3,this._setRenderType(this._renderType),this.parentRepaint()}),__getset(0,__proto,"pivotX",function(){return this._getPivotX()},function(value){this._setPivotX(value),this.repaint()}),__getset(0,__proto,"pivotY",function(){return this._getPivotY()},function(value){this._setPivotY(value),this.repaint()}),__getset(0,__proto,"alpha",function(){return this._getAlpha()},function(value){value=value<0?0:value>1?1:value,this._setAlpha(value)}),__getset(0,__proto,"visible",function(){return this._visible},function(value){this._visible!==value&&(this._visible=value,this.parentRepaint(3))}),__getset(0,__proto,"graphics",function(){return this._graphics||(this.graphics=new Graphics,this._graphics.autoDestroy=!0),this._graphics},function(value){this._graphics&&(this._graphics._sp=null),this._graphics=value,value?(this._setGraphics(value),this._renderType|=512,value._sp=this):this._renderType&=-513,this._setRenderType(this._renderType),this.repaint()}),__getset(0,__proto,"filters",function(){return this._cacheStyle.filters},function(value){value&&0===value.length&&(value=null),this._cacheStyle.filters!=value&&(this._getCacheStyle().filters=value?value.slice():null,value&&value.length?(this._setColorFilter(value[0]),this._renderType|=16):(this._setColorFilter(null),this._renderType&=-17),this._setRenderType(this._renderType),value&&value.length>0?(this._getBit(16)||this._setBitUp(16),1==value.length&&value[0]instanceof laya.filters.ColorFilter||(this._getCacheStyle().cacheForFilters=!0,this._checkCanvasEnable())):this._cacheStyle.cacheForFilters&&(this._cacheStyle.cacheForFilters=!1,this._checkCanvasEnable()),this._getCacheStyle().hasGlowFilter=this._isHaveGlowFilter(),this.repaint())}),__getset(0,__proto,"mask",function(){return this._cacheStyle.mask},function(value){value&&this.mask&&this.mask._cacheStyle.maskParent||(this._getCacheStyle().mask=value,this._setMask(value),this._checkCanvasEnable(),value?value._getCacheStyle().maskParent=this:this.mask&&(this.mask._getCacheStyle().maskParent=null),this._renderType|=32,this._setRenderType(this._renderType),this.parentRepaint(3))}),__getset(0,__proto,"mouseEnabled",function(){return this._mouseState>1},function(value){this._mouseState=value?2:1}),__getset(0,__proto,"globalScaleX",function(){for(var scale=1,ele=this;ele&&ele!==Laya.stage;)scale*=ele.scaleX,ele=ele.parent;return scale}),__getset(0,__proto,"mouseX",function(){return this.getMousePoint().x}),__getset(0,__proto,"mouseY",function(){return this.getMousePoint().y}),__getset(0,__proto,"viewport",function(){return this._style.viewport},function(value){var recArr;"string"==typeof value&&((recArr=value.split(",")).length>3&&(value=new Rectangle(parseFloat(recArr[0]),parseFloat(recArr[1]),parseFloat(recArr[2]),parseFloat(recArr[3]))));this.getStyle().viewport=value}),Sprite.fromImage=function(url){return(new Sprite).loadImage(url)},Sprite}(Node),BaseShader=function(_super){function BaseShader(){BaseShader.__super.call(this)}return __class(BaseShader,"laya.webgl.shader.BaseShader",Resource),BaseShader.activeShader=null,BaseShader.bindShader=null,BaseShader}(),Bitmap=function(_super){function Bitmap(){Bitmap.__super.call(this),this._width=-1,this._height=-1}__class(Bitmap,"laya.resource.Bitmap",Resource);var __proto=Bitmap.prototype;return __proto._getSource=function(){throw"Bitmap: must override it."},__getset(0,__proto,"width",function(){return this._width}),__getset(0,__proto,"height",function(){return this._height}),Bitmap}(),TextTexture=function(_super){function TextTexture(textureW,textureH){this._source=null,this._texW=0,this._texH=0,this.__destroyed=!1,this._discardTm=0,this.genID=0,this.bitmap={id:0,_glTexture:null},this.curUsedCovRate=0,this.curUsedCovRateAtlas=0,this.lastTouchTm=0,this.ri=null,TextTexture.__super.call(this),this._texW=textureW||TextRender.atlasWidth,this._texH=textureH||TextRender.atlasWidth,this.bitmap.id=this.id,this.lock=!0}__class(TextTexture,"laya.webgl.text.TextTexture",Resource);var __proto=TextTexture.prototype;return __proto.recreateResource=function(){if(!this._source){var gl=Render.isConchApp?LayaGL.instance.getDefaultCommandEncoder():WebGL.mainContext,glTex=this._source=gl.createTexture();this.bitmap._glTexture=glTex,WebGLContext.bindTexture(gl,3553,glTex),gl.texImage2D(3553,0,6408,this._texW,this._texH,0,6408,5121,null),gl.texParameteri(3553,10241,9729),gl.texParameteri(3553,10240,9729),gl.texParameteri(3553,10242,33071),gl.texParameteri(3553,10243,33071),TextRender.debugUV&&this.fillWhite()}},__proto.addChar=function(data,x,y,uv){if(TextRender.isWan1Wan)return this.addCharCanvas(data,x,y,uv);!this._source&&this.recreateResource();var gl=Render.isConchApp?LayaGL.instance.getDefaultCommandEncoder():WebGL.mainContext;WebGLContext.bindTexture(gl,3553,this._source),!Render.isConchApp&&gl.pixelStorei(37441,!0);var dt=data.data;data.data instanceof Uint8ClampedArray&&(dt=new Uint8Array(dt.buffer)),gl.texSubImage2D(3553,0,x,y,data.width,data.height,6408,5121,dt),!Render.isConchApp&&gl.pixelStorei(37441,!1);var u0=NaN,v0=NaN,u1=NaN,v1=NaN;return Render.isConchApp?(u0=x/this._texW,v0=y/this._texH,u1=(x+data.width)/this._texW,v1=(y+data.height)/this._texH):(u0=(x+1)/this._texW,v0=y/this._texH,u1=(x+data.width-1)/this._texW,v1=(y+data.height-1)/this._texH),(uv=uv||new Array(8))[0]=u0,uv[1]=v0,uv[2]=u1,uv[3]=v0,uv[4]=u1,uv[5]=v1,uv[6]=u0,uv[7]=v1,uv},__proto.addCharCanvas=function(canv,x,y,uv){!this._source&&this.recreateResource();var gl=Render.isConchApp?LayaGL.instance.getDefaultCommandEncoder():WebGL.mainContext;WebGLContext.bindTexture(gl,3553,this._source),!Render.isConchApp&&gl.pixelStorei(37441,!0),gl.texSubImage2D(3553,0,x,y,6408,5121,canv),!Render.isConchApp&&gl.pixelStorei(37441,!1);var u0=NaN,v0=NaN,u1=NaN,v1=NaN;return Render.isConchApp?(u0=x/this._texW,v0=y/this._texH,u1=(x+canv.width)/this._texW,v1=(y+canv.height)/this._texH):(u0=(x+1)/this._texW,v0=(y+1)/this._texH,u1=(x+canv.width-1)/this._texW,v1=(y+canv.height-1)/this._texH),(uv=uv||new Array(8))[0]=u0,uv[1]=v0,uv[2]=u1,uv[3]=v0,uv[4]=u1,uv[5]=v1,uv[6]=u0,uv[7]=v1,uv},__proto.fillWhite=function(){!this._source&&this.recreateResource();var gl=Render.isConchApp?LayaGL.instance.getDefaultCommandEncoder():WebGL.mainContext,dt=new Uint8Array(this._texW*this._texH*4);dt.fill(255),gl.texSubImage2D(3553,0,0,0,this._texW,this._texH,6408,5121,dt)},__proto.discard=function(){this._texW==TextRender.atlasWidth&&this._texH==TextRender.atlasWidth?(this.genID++,TextTexture.poolLen>=TextTexture.pool.length&&(TextTexture.pool=TextTexture.pool.concat(new Array(10))),this._discardTm=Laya.stage.getFrameTm(),TextTexture.pool[TextTexture.poolLen++]=this):this.destroy()},__proto.destroy=function(){this.__destroyed=!0;var gl=Render.isConchApp?LayaGL.instance.getDefaultCommandEncoder():WebGL.mainContext;this._source&&gl.deleteTexture(this._source),this._source=null},__proto.touchRect=function(ri,curloop){this.lastTouchTm!=curloop&&(this.curUsedCovRate=0,this.curUsedCovRateAtlas=0,this.lastTouchTm=curloop);var texw2=TextRender.atlasWidth*TextRender.atlasWidth,gridw2=TextAtlas.atlasGridW*TextAtlas.atlasGridW;this.curUsedCovRate+=ri.bmpWidth*ri.bmpHeight/texw2,this.curUsedCovRateAtlas+=Math.ceil(ri.bmpWidth/TextAtlas.atlasGridW)*Math.ceil(ri.bmpHeight/TextAtlas.atlasGridW)/(texw2/gridw2)},__proto._getSource=function(){return this._source},__proto.drawOnScreen=function(x,y){},__getset(0,__proto,"texture",function(){return this}),TextTexture.getTextTexture=function(w,h){if(w!=TextRender.atlasWidth||w!=TextRender.atlasWidth)return new TextTexture(w,h);if(TextTexture.poolLen>0){var ret=TextTexture.pool[--TextTexture.poolLen];return TextTexture.poolLen>0&&TextTexture.clean(),ret}return new TextTexture(w,h)},TextTexture.clean=function(){var curtm=Laya.stage.getFrameTm();if(0===TextTexture.cleanTm&&(TextTexture.cleanTm=curtm),curtm-TextTexture.cleanTm>=TextRender.checkCleanTextureDt){for(var i=0;i<TextTexture.poolLen;i++){var p=TextTexture.pool[i];curtm-p._discardTm>=TextRender.destroyUnusedTextureDt&&(p.destroy(),TextTexture.pool[i]=TextTexture.pool[TextTexture.poolLen-1],TextTexture.poolLen--,i--)}TextTexture.cleanTm=curtm}},TextTexture.poolLen=0,TextTexture.cleanTm=0,__static(TextTexture,["pool",function(){return this.pool=new Array(10)}]),TextTexture}(),IndexBuffer2D=function(_super){function IndexBuffer2D(bufferUsage){this._uint16Array=null,void 0===bufferUsage&&(bufferUsage=35044),IndexBuffer2D.__super.call(this),this._bufferUsage=bufferUsage,this._bufferType=34963,this._buffer=new ArrayBuffer(8)}__class(IndexBuffer2D,"laya.webgl.utils.IndexBuffer2D",Buffer2D);var __proto=IndexBuffer2D.prototype;return __proto._checkArrayUse=function(){this._uint16Array&&(this._uint16Array=new Uint16Array(this._buffer))},__proto.getUint16Array=function(){return this._uint16Array||(this._uint16Array=new Uint16Array(this._buffer))},__proto._bindForVAO=function(){LayaGL.instance.bindBuffer(34963,this._glBuffer)},__proto.bind=function(){return Buffer._bindedIndexBuffer!==this._glBuffer&&(LayaGL.instance.bindBuffer(34963,this._glBuffer),Buffer._bindedIndexBuffer=this._glBuffer,!0)},__proto.destory=function(){this._uint16Array=null,this._buffer=null},__proto.disposeResource=function(){this._disposeResource()},IndexBuffer2D.create=function(bufferUsage){return void 0===bufferUsage&&(bufferUsage=35044),new IndexBuffer2D(bufferUsage)},IndexBuffer2D}(),WebAudioSoundChannel=function(_super){function WebAudioSoundChannel(){this.audioBuffer=null,this.gain=null,this.bufferSource=null,this._currentTime=0,this._volume=1,this._startTime=0,this._pauseTime=0,this._onPlayEnd=null,this.context=WebAudioSound.ctx,WebAudioSoundChannel.__super.call(this),this._onPlayEnd=Utils.bind(this.__onPlayEnd,this),this.context.createGain?this.gain=this.context.createGain():this.gain=this.context.createGainNode()}__class(WebAudioSoundChannel,"laya.media.webaudio.WebAudioSoundChannel",_super);var __proto=WebAudioSoundChannel.prototype;return __proto.play=function(){if(SoundManager.addChannel(this),this.isStopped=!1,this._clearBufferSource(),this.audioBuffer){if(this.startTime>=this.duration)return this.stop();var context=this.context,gain=this.gain,bufferSource=context.createBufferSource();this.bufferSource=bufferSource,bufferSource.buffer=this.audioBuffer,bufferSource.connect(gain),gain&&gain.disconnect(),gain.connect(context.destination),bufferSource.onended=this._onPlayEnd,this._startTime=Browser.now(),this.gain.gain.setTargetAtTime?this.gain.gain.setTargetAtTime(this._volume,this.context.currentTime,.001):this.gain.gain.value=this._volume,0==this.loops&&(bufferSource.loop=!0),bufferSource.playbackRate.setTargetAtTime?bufferSource.playbackRate.setTargetAtTime(SoundManager.playbackRate,this.context.currentTime,.001):bufferSource.playbackRate.value=SoundManager.playbackRate,bufferSource.start(0,this.startTime),this._currentTime=0}},__proto.__onPlayEnd=function(){if(1==this.loops)return this.completeHandler&&(Laya.timer.once(10,this,this.__runComplete,[this.completeHandler],!1),this.completeHandler=null),this.stop(),void this.event("complete");this.loops>0&&this.loops--,this.startTime=0,this.play()},__proto._clearBufferSource=function(){if(this.bufferSource){var sourceNode=this.bufferSource;sourceNode.stop?sourceNode.stop(0):sourceNode.noteOff(0),sourceNode.disconnect(0),sourceNode.onended=null,WebAudioSoundChannel._tryCleanFailed||this._tryClearBuffer(sourceNode),this.bufferSource=null}},__proto._tryClearBuffer=function(sourceNode){if(Browser.onMac)try{sourceNode.buffer=WebAudioSound._miniBuffer}catch(e){WebAudioSoundChannel._tryCleanFailed=!0}else try{sourceNode.buffer=null}catch(e){WebAudioSoundChannel._tryCleanFailed=!0}},__proto.stop=function(){_super.prototype.stop.call(this),this._clearBufferSource(),this.audioBuffer=null,this.gain&&this.gain.disconnect(),this.isStopped=!0,SoundManager.removeChannel(this),this.completeHandler=null,SoundManager.autoReleaseSound&&SoundManager.disposeSoundLater(this.url)},__proto.pause=function(){this.isStopped||(this._pauseTime=this.position),this._clearBufferSource(),this.gain&&this.gain.disconnect(),this.isStopped=!0,SoundManager.removeChannel(this),SoundManager.autoReleaseSound&&SoundManager.disposeSoundLater(this.url)},__proto.resume=function(){this.startTime=this._pauseTime,this.play()},__getset(0,__proto,"position",function(){return this.bufferSource?(Browser.now()-this._startTime)/1e3+this.startTime:0}),__getset(0,__proto,"duration",function(){return this.audioBuffer?this.audioBuffer.duration:0}),__getset(0,__proto,"volume",function(){return this._volume},function(v){this._volume=v,this.isStopped||(this.gain.gain.setTargetAtTime?this.gain.gain.setTargetAtTime(v,this.context.currentTime,.001):this.gain.gain.value=v)}),WebAudioSoundChannel._tryCleanFailed=!1,WebAudioSoundChannel.SetTargetDelay=.001,WebAudioSoundChannel}(SoundChannel),AudioSoundChannel=function(_super){function AudioSoundChannel(audio){this._audio=null,this._onEnd=null,this._resumePlay=null,AudioSoundChannel.__super.call(this),this._onEnd=Utils.bind(this.__onEnd,this),this._resumePlay=Utils.bind(this.__resumePlay,this),audio.addEventListener("ended",this._onEnd),this._audio=audio}__class(AudioSoundChannel,"laya.media.h5audio.AudioSoundChannel",_super);var __proto=AudioSoundChannel.prototype;return __proto.__onEnd=function(){if(1==this.loops)return this.completeHandler&&(Laya.systemTimer.once(10,this,this.__runComplete,[this.completeHandler],!1),this.completeHandler=null),this.stop(),void this.event("complete");this.loops>0&&this.loops--,this.startTime=0,this.play()},__proto.__resumePlay=function(){if(this._audio&&this._audio.removeEventListener("canplay",this._resumePlay),!this.isStopped)try{this._audio.currentTime=this.startTime,Browser.container.appendChild(this._audio),this._audio.play()}catch(e){this.event("error")}},__proto.play=function(){this.isStopped=!1;try{this._audio.playbackRate=SoundManager.playbackRate,this._audio.currentTime=this.startTime}catch(e){return void this._audio.addEventListener("canplay",this._resumePlay)}SoundManager.addChannel(this),Browser.container.appendChild(this._audio),"play"in this._audio&&this._audio.play()},__proto.stop=function(){_super.prototype.stop.call(this),this.isStopped=!0,SoundManager.removeChannel(this),this.completeHandler=null,this._audio&&("pause"in this._audio&&Render.isConchApp&&this._audio.stop(),this._audio.pause(),this._audio.removeEventListener("ended",this._onEnd),this._audio.removeEventListener("canplay",this._resumePlay),Browser.onIE||this._audio!=AudioSound._musicAudio&&Pool.recover("audio:"+this.url,this._audio),Browser.removeElement(this._audio),this._audio=null)},__proto.pause=function(){this.isStopped=!0,SoundManager.removeChannel(this),"pause"in this._audio&&this._audio.pause()},__proto.resume=function(){this._audio&&(this.isStopped=!1,SoundManager.addChannel(this),"play"in this._audio&&this._audio.play())},__getset(0,__proto,"position",function(){return this._audio?this._audio.currentTime:0}),__getset(0,__proto,"duration",function(){return this._audio?this._audio.duration:0}),__getset(0,__proto,"volume",function(){return this._audio?this._audio.volume:1},function(v){this._audio&&(this._audio.volume=v)}),AudioSoundChannel}(SoundChannel),VertexBuffer2D=function(_super){function VertexBuffer2D(vertexStride,bufferUsage){this._floatArray32=null,this._uint32Array=null,this._vertexStride=0,VertexBuffer2D.__super.call(this),this._vertexStride=vertexStride,this._bufferUsage=bufferUsage,this._bufferType=34962,this._buffer=new ArrayBuffer(8),this._floatArray32=new Float32Array(this._buffer),this._uint32Array=new Uint32Array(this._buffer)}__class(VertexBuffer2D,"laya.webgl.utils.VertexBuffer2D",Buffer2D);var __proto=VertexBuffer2D.prototype;return __proto.getFloat32Array=function(){return this._floatArray32},__proto.appendArray=function(data){var oldoff=this._byteLength>>2;this.setByteLength(this._byteLength+4*data.length),this.getFloat32Array().set(data,oldoff),this._upload=!0},__proto._checkArrayUse=function(){this._floatArray32&&(this._floatArray32=new Float32Array(this._buffer)),this._uint32Array&&(this._uint32Array=new Uint32Array(this._buffer))},__proto.deleteBuffer=function(){this._disposeResource()},__proto._bindForVAO=function(){LayaGL.instance.bindBuffer(34962,this._glBuffer)},__proto.bind=function(){return Buffer._bindedVertexBuffer!==this._glBuffer&&(LayaGL.instance.bindBuffer(34962,this._glBuffer),Buffer._bindedVertexBuffer=this._glBuffer,!0)},__proto.destroy=function(){laya.webgl.utils.Buffer.prototype.destroy.call(this),this._byteLength=0,this._upload=!0,this._buffer=null,this._floatArray32=null},__getset(0,__proto,"vertexStride",function(){return this._vertexStride}),VertexBuffer2D.create=function(vertexStride,bufferUsage){return void 0===bufferUsage&&(bufferUsage=35048),new VertexBuffer2D(vertexStride,bufferUsage)},VertexBuffer2D}(),Text=function(_super){function Text(){this._clipPoint=null,this._text=null,this._isChanged=!1,this._textWidth=0,this._textHeight=0,this._lines=[],this._lineWidths=[],this._startX=0,this._startY=0,this._words=null,this._charSize={},this._valign="top",this._color="#000000",this._singleCharRender=!1,Text.__super.call(this),this._fontSize=Text.defaultFontSize,this._font=Text.defaultFont,this.overflow="visible",this._style=TextStyle.EMPTY}__class(Text,"laya.display.Text",_super);var __proto=Text.prototype;return __proto.getStyle=function(){return this._style===TextStyle.EMPTY&&(this._style=TextStyle.create()),this._style},__proto._getTextStyle=function(){return this._style===TextStyle.EMPTY&&(this._style=TextStyle.create()),this._style},__proto.destroy=function(destroyChild){void 0===destroyChild&&(destroyChild=!0),_super.prototype.destroy.call(this,destroyChild),this._clipPoint=null,this._lines=null,this._lineWidths=null,this._words&&this._words.forEach(function(w){w.cleanCache()}),this._words=null,this._charSize=null},__proto._getBoundPointsM=function(ifRotate){void 0===ifRotate&&(ifRotate=!1);var rec=Rectangle.TEMP;return rec.setTo(0,0,this.width,this.height),rec._getBoundPoints()},__proto.getGraphicBounds=function(realSize){void 0===realSize&&(realSize=!1);var rec=Rectangle.TEMP;return rec.setTo(0,0,this.width,this.height),rec},__proto._getCSSStyle=function(){return this._style},__proto.lang=function(text,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10){if(text=Text.langPacks&&Text.langPacks[text]?Text.langPacks[text]:text,arguments.length<2)this._text=text;else{for(var i=0,n=arguments.length;i<n;i++)text=text.replace("{"+i+"}",arguments[i+1]);this._text=text}},__proto._getContextFont=function(){return(this.italic?"italic ":"")+(this.bold?"bold ":"")+this.fontSize+"px "+(Browser.onIPhone&&laya.display.Text.fontFamilyMap[this.font]||this.font)},__proto._isPassWordMode=function(){var password=this._style.asPassword;return"prompt"in this&&this.prompt==this._text&&(password=!1),password},__proto._getPassWordTxt=function(txt){var word;word="";for(var j=txt.length;j>0;j--)word+="●";return word},__proto._renderText=function(){var padding=this.padding,visibleLineCount=this._lines.length;"visible"!=this.overflow&&(visibleLineCount=Math.min(visibleLineCount,Math.floor((this.height-padding[0]-padding[2])/(this.leading+this._charSize.height))+1));var beginLine=this.scrollY/(this._charSize.height+this.leading)|0,graphics=this.graphics;graphics.clear(!0);var ctxFont=this._getContextFont();Browser.context.font=ctxFont;var startX=padding[3],textAlgin="left",lines=this._lines,lineHeight=this.leading+this._charSize.height,tCurrBitmapFont=this._style.currBitmapFont;tCurrBitmapFont&&(lineHeight=this.leading+tCurrBitmapFont.getMaxHeight());var startY=padding[0];if(!tCurrBitmapFont&&this._width>0&&this._textWidth<=this._width&&("right"==this.align?(textAlgin="right",startX=this._width-padding[1]):"center"==this.align&&(textAlgin="center",startX=.5*this._width+padding[3]-padding[1])),this._height>0){var tempVAlign=this._textHeight>this._height?"top":this.valign;"middle"===tempVAlign?startY=.5*(this._height-visibleLineCount*lineHeight)+padding[0]-padding[2]:"bottom"===tempVAlign&&(startY=this._height-visibleLineCount*lineHeight-padding[2])}var style=this._style;if(tCurrBitmapFont&&tCurrBitmapFont.autoScaleSize)var bitmapScale=tCurrBitmapFont.fontSize/this.fontSize;if(this._clipPoint){if(graphics.save(),tCurrBitmapFont&&tCurrBitmapFont.autoScaleSize){var tClipWidth=0,tClipHeight=0;tClipWidth=this._width?this._width-padding[3]-padding[1]:this._textWidth,tClipHeight=this._height?this._height-padding[0]-padding[2]:this._textHeight,tClipWidth*=bitmapScale,tClipHeight*=bitmapScale,graphics.clipRect(padding[3],padding[0],tClipWidth,tClipHeight)}else graphics.clipRect(padding[3],padding[0],this._width?this._width-padding[3]-padding[1]:this._textWidth,this._height?this._height-padding[0]-padding[2]:this._textHeight);this.repaint()}var password=style.asPassword;"prompt"in this&&this.prompt==this._text&&(password=!1);for(var x=0,y=0,end=Math.min(this._lines.length,visibleLineCount+beginLine)||1,i=beginLine;i<end;i++){var _word,word=lines[i];if(password){var len=word.length;word="";for(var j=len;j>0;j--)word+="●"}if(null==word&&(word=""),x=startX-(this._clipPoint?this._clipPoint.x:0),y=startY+lineHeight*i-(this._clipPoint?this._clipPoint.y:0),this.underline&&this._drawUnderline(textAlgin,x,y,i),tCurrBitmapFont){var tWidth=this.width;tCurrBitmapFont.autoScaleSize&&(tWidth=this.width*bitmapScale),tCurrBitmapFont._drawText(word,this,x,y,this.align,tWidth)}else this._words||(this._words=[]),this._words.length>i-beginLine?_word=this._words[i-beginLine]:(_word=new WordText,this._words.push(_word)),_word.setText(word),_word.splitRender=this._singleCharRender,style.stroke?graphics.fillBorderText(_word,x,y,ctxFont,this.color,style.strokeColor,style.stroke,textAlgin):graphics.fillText(_word,x,y,ctxFont,this.color,textAlgin)}if(tCurrBitmapFont&&tCurrBitmapFont.autoScaleSize){var tScale=1/bitmapScale;this.scale(tScale,tScale)}this._clipPoint&&graphics.restore(),this._startX=startX,this._startY=startY},__proto._drawUnderline=function(align,x,y,lineIndex){var lineWidth=this._lineWidths[lineIndex];switch(align){case"center":x-=lineWidth/2;break;case"right":x-=lineWidth}y+=this._charSize.height,this._graphics.drawLine(x,y,x+lineWidth,y,this.underlineColor||this.color,1)},__proto.typeset=function(){if(this._isChanged=!1,!this._text)return this._clipPoint=null,this._textWidth=this._textHeight=0,void this.graphics.clear(!0);Render.isConchApp?window.conchTextCanvas.font=this._getContextFont():Browser.context.font=this._getContextFont(),this._lines.length=0,this._lineWidths.length=0,this._isPassWordMode()?this._parseLines(this._getPassWordTxt(this._text)):this._parseLines(this._text),this._evalTextSize(),this._checkEnabledViewportOrNot()?this._clipPoint||(this._clipPoint=new Point(0,0)):this._clipPoint=null,this._renderText()},__proto._evalTextSize=function(){var nw,nh=NaN;nw=Math.max.apply(this,this._lineWidths),nh=this._style.currBitmapFont?this._lines.length*(this._style.currBitmapFont.getMaxHeight()+this.leading)+this.padding[0]+this.padding[2]:this._lines.length*(this._charSize.height+this.leading)+this.padding[0]+this.padding[2],nw==this._textWidth&&nh==this._textHeight||(this._textWidth=nw,this._textHeight=nh)},__proto._checkEnabledViewportOrNot=function(){return"scroll"==this.overflow&&(this._width>0&&this._textWidth>this._width||this._height>0&&this._textHeight>this._height)},__proto.changeText=function(text){this._text!==text&&(this.lang(text+""),this._graphics&&this._graphics.replaceText(this._text)||this.typeset())},__proto._parseLines=function(text){var needWordWrapOrTruncate=this.wordWrap||"hidden"==this.overflow;if(needWordWrapOrTruncate)var wordWrapWidth=this._getWordWrapWidth();var bitmapFont=this._style.currBitmapFont;if(bitmapFont)this._charSize.width=bitmapFont.getMaxWidth(),this._charSize.height=bitmapFont.getMaxHeight();else{var measureResult=null;(measureResult=Render.isConchApp?window.conchTextCanvas.measureText(this._testWord):Browser.context.measureText(Text._testWord))||(measureResult={width:100}),this._charSize.width=measureResult.width,this._charSize.height=measureResult.height||this.fontSize}for(var lines=text.replace(/\r\n/g,"\n").split("\n"),i=0,n=lines.length;i<n;i++){var line=lines[i];needWordWrapOrTruncate?this._parseLine(line,wordWrapWidth):(this._lineWidths.push(this._getTextWidth(line)),this._lines.push(line))}},__proto._parseLine=function(line,wordWrapWidth){Browser.context;var execResult,lines=this._lines,maybeIndex=0,charsWidth=NaN,wordWidth=NaN,startIndex=0;if((charsWidth=this._getTextWidth(line))<=wordWrapWidth)return lines.push(line),void this._lineWidths.push(charsWidth);charsWidth=this._charSize.width,0==(maybeIndex=Math.floor(wordWrapWidth/charsWidth))&&(maybeIndex=1),wordWidth=charsWidth=this._getTextWidth(line.substring(0,maybeIndex));for(var j=maybeIndex,m=line.length;j<m;j++)if((wordWidth+=charsWidth=this._getTextWidth(line.charAt(j)))>wordWrapWidth)if(this.wordWrap){var newLine=line.substring(startIndex,j);if(newLine.charCodeAt(newLine.length-1)<255&&(execResult=/(?:\w|-)+$/.exec(newLine))&&(j=execResult.index+startIndex,0==execResult.index?j+=newLine.length:newLine=line.substring(startIndex,j)),lines.push(newLine),this._lineWidths.push(wordWidth-charsWidth),startIndex=j,!(j+maybeIndex<m)){lines.push(line.substring(startIndex,m)),this._lineWidths.push(this._getTextWidth(lines[lines.length-1])),startIndex=-1;break}j+=maybeIndex,wordWidth=charsWidth=this._getTextWidth(line.substring(startIndex,j)),j--}else if("hidden"==this.overflow)return lines.push(line.substring(0,j)),void this._lineWidths.push(this._getTextWidth(lines[lines.length-1]));this.wordWrap&&-1!=startIndex&&(lines.push(line.substring(startIndex,m)),this._lineWidths.push(this._getTextWidth(lines[lines.length-1])))},__proto._getTextWidth=function(text){var bitmapFont=this._style.currBitmapFont;return bitmapFont?bitmapFont.getTextWidth(text):Render.isConchApp?window.conchTextCanvas.measureText(text).width:Browser.context.measureText(text).width},__proto._getWordWrapWidth=function(){var p=this.padding,w=NaN,bitmapFont=this._style.currBitmapFont;return(w=bitmapFont&&bitmapFont.autoScaleSize?this._width*(bitmapFont.fontSize/this.fontSize):this._width)<=0&&(w=this.wordWrap?100:Browser.width),w<=0&&(w=100),w-p[3]-p[1]},__proto.getCharPoint=function(charIndex,out){this._isChanged&&Laya.systemTimer.runCallLater(this,this.typeset);for(var len=0,lines=this._lines,startIndex=0,i=0,n=lines.length;i<n;i++){if(charIndex<(len+=lines[i].length)){var line=i;break}startIndex=len}var ctxFont=(this.italic?"italic ":"")+(this.bold?"bold ":"")+this.fontSize+"px "+this.font;Browser.context.font=ctxFont;var width=this._getTextWidth(this._text.substring(startIndex,charIndex));return(out||new Point).setTo(this._startX+width-(this._clipPoint?this._clipPoint.x:0),this._startY+line*(this._charSize.height+this.leading)-(this._clipPoint?this._clipPoint.y:0))},__getset(0,__proto,"width",function(){return this._width?this._width:this.textWidth+this.padding[1]+this.padding[3]},function(value){value!=this._width&&(Laya.superSet(Sprite,this,"width",value),this.isChanged=!0,this.borderColor&&this._setBorderStyleColor(0,0,this.width,this.height,this.borderColor,1))}),__getset(0,__proto,"textWidth",function(){return this._isChanged&&Laya.systemTimer.runCallLater(this,this.typeset),this._textWidth}),__getset(0,__proto,"height",function(){return this._height?this._height:this.textHeight},function(value){value!=this._height&&(Laya.superSet(Sprite,this,"height",value),this.isChanged=!0,this.borderColor&&this._setBorderStyleColor(0,0,this.width,this.height,this.borderColor,1))}),__getset(0,__proto,"textHeight",function(){return this._isChanged&&Laya.systemTimer.runCallLater(this,this.typeset),this._textHeight}),__getset(0,__proto,"padding",function(){return this._style.padding},function(value){if("string"==typeof value){var arr,len,i=0;for(len=(arr=value.split(",")).length;arr.length<4;)arr.push(0);for(i=0;i<len;i++)arr[i]=parseFloat(arr[i])||0;value=arr}this._getTextStyle().padding=value,this.isChanged=!0}),__getset(0,__proto,"bold",function(){return this._style.bold},function(value){this._getTextStyle().bold=value,this.isChanged=!0}),__getset(0,__proto,"text",function(){return this._text||""},function(value){this._text!==value&&(this.lang(value+""),this.isChanged=!0,this.event("change"),this.borderColor&&this._setBorderStyleColor(0,0,this.width,this.height,this.borderColor,1))}),__getset(0,__proto,"color",function(){return this._color},function(value){this._color!=value&&(this._color=value,!this._isChanged&&this._graphics?this._graphics.replaceTextColor(this.color):this.isChanged=!0)}),__getset(0,__proto,"font",function(){return this._font},function(value){this._style.currBitmapFont&&(this._getTextStyle().currBitmapFont=null,this.scale(1,1)),Text._bitmapFonts&&Text._bitmapFonts[value]&&(this._getTextStyle().currBitmapFont=Text._bitmapFonts[value]),this._font=value,this.isChanged=!0}),__getset(0,__proto,"fontSize",function(){return this._fontSize},function(value){this._fontSize!=value&&(this._fontSize=value,this.isChanged=!0)}),__getset(0,__proto,"italic",function(){return this._style.italic},function(value){this._getTextStyle().italic=value,this.isChanged=!0}),__getset(0,__proto,"align",function(){return this._style.align},function(value){this._getTextStyle().align=value,this.isChanged=!0}),__getset(0,__proto,"valign",function(){return this._valign},function(value){this._valign=value,this.isChanged=!0}),__getset(0,__proto,"wordWrap",function(){return this._style.wordWrap},function(value){this._getTextStyle().wordWrap=value,this.isChanged=!0}),__getset(0,__proto,"singleCharRender",function(){return this._singleCharRender},function(value){this._singleCharRender=value}),__getset(0,__proto,"leading",function(){return this._style.leading},function(value){this._getTextStyle().leading=value,this.isChanged=!0}),__getset(0,__proto,"bgColor",function(){return this._style.bgColor},function(value){this._getTextStyle().bgColor=value,this._renderType|=128,this._setBgStyleColor(0,0,this.width,this.height,value),this._setRenderType(this._renderType),this.isChanged=!0}),__getset(0,__proto,"borderColor",function(){return this._style.borderColor},function(value){this._getTextStyle().borderColor=value,this._renderType|=128,this._setBorderStyleColor(0,0,this.width,this.height,value,1),this._setRenderType(this._renderType),this.isChanged=!0}),__getset(0,__proto,"stroke",function(){return this._style.stroke},function(value){this._getTextStyle().stroke=value,this.isChanged=!0}),__getset(0,__proto,"strokeColor",function(){return this._style.strokeColor},function(value){this._getTextStyle().strokeColor=value,this.isChanged=!0}),__getset(0,__proto,"isChanged",null,function(value){this._isChanged!==value&&(this._isChanged=value,value&&Laya.systemTimer.callLater(this,this.typeset))}),__getset(0,__proto,"scrollX",function(){return this._clipPoint?this._clipPoint.x:0},function(value){if(!("scroll"!=this.overflow||this.textWidth<this._width)&&this._clipPoint){value=value<this.padding[3]?this.padding[3]:value;var maxScrollX=this._textWidth-this._width;value=value>maxScrollX?maxScrollX:value,this._clipPoint.x=value,this._renderText()}}),__getset(0,__proto,"scrollY",function(){return this._clipPoint?this._clipPoint.y:0},function(value){if(!("scroll"!=this.overflow||this.textHeight<this._height)&&this._clipPoint){value=value<this.padding[0]?this.padding[0]:value;var maxScrollY=this._textHeight-this._height;value=value>maxScrollY?maxScrollY:value,this._clipPoint.y=value,this._renderText()}}),__getset(0,__proto,"maxScrollX",function(){return this.textWidth<this._width?0:this._textWidth-this._width}),__getset(0,__proto,"maxScrollY",function(){return this.textHeight<this._height?0:this._textHeight-this._height}),__getset(0,__proto,"lines",function(){return this._isChanged&&this.typeset(),this._lines}),__getset(0,__proto,"underlineColor",function(){return this._style.underlineColor},function(value){this._getTextStyle().underlineColor=value,this._isChanged||this._renderText()}),__getset(0,__proto,"underline",function(){return this._style.underline},function(value){this._getTextStyle().underline=value}),Text.defaultFontStr=function(){return Text.defaultFontSize+"px "+Text.defaultFont},Text.registerBitmapFont=function(name,bitmapFont){Text._bitmapFonts||(Text._bitmapFonts={}),Text._bitmapFonts[name]=bitmapFont},Text.unregisterBitmapFont=function(name,destroy){if(void 0===destroy&&(destroy=!0),Text._bitmapFonts&&Text._bitmapFonts[name]){var tBitmapFont=Text._bitmapFonts[name];destroy&&tBitmapFont.destroy(),delete Text._bitmapFonts[name]}},Text.VISIBLE="visible",Text.SCROLL="scroll",Text.HIDDEN="hidden",Text.defaultFontSize=12,Text.defaultFont="Arial",Text.langPacks=null,Text.isComplexText=!1,Text._testWord="游",Text._bitmapFonts=null,Text.CharacterCache=!0,Text.RightToLeft=!1,__static(Text,["fontFamilyMap",function(){return this.fontFamilyMap={"报隶":"报隶-简","黑体":"黑体-简","楷体":"楷体-简","兰亭黑":"兰亭黑-简","隶变":"隶变-简","凌慧体":"凌慧体-简","翩翩体":"翩翩体-简","苹方":"苹方-简","手札体":"手札体-简","宋体":"宋体-简","娃娃体":"娃娃体-简","魏碑":"魏碑-简","行楷":"行楷-简","雅痞":"雅痞-简","圆体":"圆体-简"}}]),Text}(Sprite),AnimationBase=function(_super){function AnimationBase(){this.loop=!1,this.wrapMode=0,this._index=0,this._count=0,this._isPlaying=!1,this._labels=null,this._isReverse=!1,this._frameRateChanged=!1,this._actionName=null,this._controlNode=null,AnimationBase.__super.call(this),this._interval=Config.animationInterval,this._setBitUp(16)}__class(AnimationBase,"laya.display.AnimationBase",_super);var __proto=AnimationBase.prototype;return __proto.play=function(start,loop,name){void 0===start&&(start=0),void 0===loop&&(loop=!0),void 0===name&&(name=""),this._isPlaying=!0,this._actionName=name,this.index="string"==typeof start?this._getFrameByLabel(start):start,this.loop=loop,this._isReverse=1===this.wrapMode,0==this.index&&this._isReverse&&(this.index=this.count-1),this.interval>0&&this.timerLoop(this.interval,this,this._frameLoop,null,!0,!0)},__proto._getFrameByLabel=function(label){for(var i=0;i<this._count;i++){var item=this._labels[i];if(item&&item.indexOf(label)>-1)return i}return 0},__proto._frameLoop=function(){if(this._isReverse){if(this._index--,this._index<0){if(!this.loop)return this._index=0,this.stop(),void this.event("complete");2==this.wrapMode?(this._index=this._count>0?1:0,this._isReverse=!1):this._index=this._count-1,this.event("complete")}}else if(this._index++,this._index>=this._count){if(!this.loop)return this._index--,this.stop(),void this.event("complete");2==this.wrapMode?(this._index=this._count-2>=0?this._count-2:0,this._isReverse=!0):this._index=0,this.event("complete")}this.index=this._index},__proto._setControlNode=function(node){this._controlNode&&(this._controlNode.off("display",this,this._resumePlay),this._controlNode.off("undisplay",this,this._resumePlay)),this._controlNode=node,node&&node!=this&&(node.on("display",this,this._resumePlay),node.on("undisplay",this,this._resumePlay))},__proto._setDisplay=function(value){_super.prototype._setDisplay.call(this,value),this._resumePlay()},__proto._resumePlay=function(){this._isPlaying&&(this._controlNode.displayedInStage?this.play(this._index,this.loop,this._actionName):this.clearTimer(this,this._frameLoop))},__proto.stop=function(){this._isPlaying=!1,this.clearTimer(this,this._frameLoop)},__proto.addLabel=function(label,index){this._labels||(this._labels={}),this._labels[index]||(this._labels[index]=[]),this._labels[index].push(label)},__proto.removeLabel=function(label){if(label){if(this._labels)for(var name in this._labels)this._removeLabelFromList(this._labels[name],label)}else this._labels=null},__proto._removeLabelFromList=function(list,label){if(list)for(var i=list.length-1;i>=0;i--)list[i]==label&&list.splice(i,1)},__proto.gotoAndStop=function(position){this.index="string"==typeof position?this._getFrameByLabel(position):position,this.stop()},__proto._displayToIndex=function(value){},__proto.clear=function(){return this.stop(),this._labels=null,this},__getset(0,__proto,"interval",function(){return this._interval},function(value){this._interval!=value&&(this._frameRateChanged=!0,this._interval=value,this._isPlaying&&value>0&&this.timerLoop(value,this,this._frameLoop,null,!0,!0))}),__getset(0,__proto,"isPlaying",function(){return this._isPlaying}),__getset(0,__proto,"index",function(){return this._index},function(value){if(this._index=value,this._displayToIndex(value),this._labels&&this._labels[value])for(var tArr=this._labels[value],i=0,len=tArr.length;i<len;i++)this.event("label",tArr[i])}),__getset(0,__proto,"count",function(){return this._count}),AnimationBase.WRAP_POSITIVE=0,AnimationBase.WRAP_REVERSE=1,AnimationBase.WRAP_PINGPONG=2,AnimationBase}(Sprite),Shader=function(_super){function Shader(vs,ps,saveName,nameMap,bindAttrib){if(this._attribInfo=null,this.customCompile=!1,this._curActTexIndex=0,this.tag={},this._program=null,this._params=null,this._paramsMap={},Shader.__super.call(this),!vs||!ps)throw"Shader Error";this._attribInfo=bindAttrib,this._id=++Shader._count,this._vs=vs,this._ps=ps,this._nameMap=nameMap||{},null!=saveName&&(Shader.sharders[saveName]=this),this.recreateResource(),this.lock=!0}__class(Shader,"laya.webgl.shader.Shader",BaseShader);var __proto=Shader.prototype;return __proto.recreateResource=function(){this._compile(),this._setGPUMemory(0)},__proto._disposeResource=function(){WebGL.mainContext.deleteShader(this._vshader),WebGL.mainContext.deleteShader(this._pshader),WebGL.mainContext.deleteProgram(this._program),this._vshader=this._pshader=this._program=null,this._params=null,this._paramsMap={},this._setGPUMemory(0),this._curActTexIndex=0},__proto._compile=function(){if(this._vs&&this._ps&&!this._params){var result;this._reCompile=!0,this._params=[],this.customCompile&&(result=ShaderCompile.preGetParams(this._vs,this._ps));var gl=WebGL.mainContext;this._program=gl.createProgram(),this._vshader=Shader._createShader(gl,this._vs,35633),this._pshader=Shader._createShader(gl,this._ps,35632),gl.attachShader(this._program,this._vshader),gl.attachShader(this._program,this._pshader);var one,n,i=0,attribDescNum=this._attribInfo?this._attribInfo.length:0;for(i=0;i<attribDescNum;i+=2)gl.bindAttribLocation(this._program,this._attribInfo[i+1],this._attribInfo[i]);if(gl.linkProgram(this._program),!this.customCompile&&!gl.getProgramParameter(this._program,35714))throw gl.getProgramInfoLog(this._program);var nUniformNum=this.customCompile?result.uniforms.length:gl.getProgramParameter(this._program,35718);for(i=0;i<nUniformNum;i++){var uniform=this.customCompile?result.uniforms[i]:gl.getActiveUniform(this._program,i);(one={vartype:"uniform",glfun:null,ivartype:1,location:gl.getUniformLocation(this._program,uniform.name),name:uniform.name,type:uniform.type,isArray:!1,isSame:!1,preValue:null,indexOfParams:0}).name.indexOf("[0]")>0&&(one.name=one.name.substr(0,one.name.length-3),one.isArray=!0,one.location=gl.getUniformLocation(this._program,one.name)),this._params.push(one)}for(i=0,n=this._params.length;i<n;i++)switch((one=this._params[i]).indexOfParams=i,one.index=1,one.value=[one.location,null],one.codename=one.name,one.name=this._nameMap[one.codename]?this._nameMap[one.codename]:one.codename,this._paramsMap[one.name]=one,one._this=this,one.uploadedValue=[],one.type){case 5124:one.fun=one.isArray?this._uniform1iv:this._uniform1i;break;case 5126:one.fun=one.isArray?this._uniform1fv:this._uniform1f;break;case 35664:one.fun=one.isArray?this._uniform_vec2v:this._uniform_vec2;break;case 35665:one.fun=one.isArray?this._uniform_vec3v:this._uniform_vec3;break;case 35666:one.fun=one.isArray?this._uniform_vec4v:this._uniform_vec4;break;case 35678:one.fun=this._uniform_sampler2D;break;case 35680:one.fun=this._uniform_samplerCube;break;case 35676:one.glfun=gl.uniformMatrix4fv,one.fun=this._uniformMatrix4fv;break;case 35670:one.fun=this._uniform1i;break;case 35674:case 35675:default:throw new Error("compile shader err!")}}},__proto.getUniform=function(name){return this._paramsMap[name]},__proto._uniform1f=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value?(WebGL.mainContext.uniform1f(one.location,uploadedValue[0]=value),1):0},__proto._uniform1fv=function(one,value){if(value.length<4){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]||uploadedValue[2]!==value[2]||uploadedValue[3]!==value[3]?(WebGL.mainContext.uniform1fv(one.location,value),uploadedValue[0]=value[0],uploadedValue[1]=value[1],uploadedValue[2]=value[2],uploadedValue[3]=value[3],1):0}return WebGL.mainContext.uniform1fv(one.location,value),1},__proto._uniform_vec2=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]?(WebGL.mainContext.uniform2f(one.location,uploadedValue[0]=value[0],uploadedValue[1]=value[1]),1):0},__proto._uniform_vec2v=function(one,value){if(value.length<2){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]||uploadedValue[2]!==value[2]||uploadedValue[3]!==value[3]?(WebGL.mainContext.uniform2fv(one.location,value),uploadedValue[0]=value[0],uploadedValue[1]=value[1],uploadedValue[2]=value[2],uploadedValue[3]=value[3],1):0}return WebGL.mainContext.uniform2fv(one.location,value),1},__proto._uniform_vec3=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]||uploadedValue[2]!==value[2]?(WebGL.mainContext.uniform3f(one.location,uploadedValue[0]=value[0],uploadedValue[1]=value[1],uploadedValue[2]=value[2]),1):0},__proto._uniform_vec3v=function(one,value){return WebGL.mainContext.uniform3fv(one.location,value),1},__proto._uniform_vec4=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]||uploadedValue[2]!==value[2]||uploadedValue[3]!==value[3]?(WebGL.mainContext.uniform4f(one.location,uploadedValue[0]=value[0],uploadedValue[1]=value[1],uploadedValue[2]=value[2],uploadedValue[3]=value[3]),1):0},__proto._uniform_vec4v=function(one,value){return WebGL.mainContext.uniform4fv(one.location,value),1},__proto._uniformMatrix2fv=function(one,value){return WebGL.mainContext.uniformMatrix2fv(one.location,!1,value),1},__proto._uniformMatrix3fv=function(one,value){return WebGL.mainContext.uniformMatrix3fv(one.location,!1,value),1},__proto._uniformMatrix4fv=function(one,value){return WebGL.mainContext.uniformMatrix4fv(one.location,!1,value),1},__proto._uniform1i=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value?(WebGL.mainContext.uniform1i(one.location,uploadedValue[0]=value),1):0},__proto._uniform1iv=function(one,value){return WebGL.mainContext.uniform1iv(one.location,value),1},__proto._uniform_ivec2=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]?(WebGL.mainContext.uniform2i(one.location,uploadedValue[0]=value[0],uploadedValue[1]=value[1]),1):0},__proto._uniform_ivec2v=function(one,value){return WebGL.mainContext.uniform2iv(one.location,value),1},__proto._uniform_vec3i=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]||uploadedValue[2]!==value[2]?(WebGL.mainContext.uniform3i(one.location,uploadedValue[0]=value[0],uploadedValue[1]=value[1],uploadedValue[2]=value[2]),1):0},__proto._uniform_vec3vi=function(one,value){return WebGL.mainContext.uniform3iv(one.location,value),1},__proto._uniform_vec4i=function(one,value){var uploadedValue=one.uploadedValue;return uploadedValue[0]!==value[0]||uploadedValue[1]!==value[1]||uploadedValue[2]!==value[2]||uploadedValue[3]!==value[3]?(WebGL.mainContext.uniform4i(one.location,uploadedValue[0]=value[0],uploadedValue[1]=value[1],uploadedValue[2]=value[2],uploadedValue[3]=value[3]),1):0},__proto._uniform_vec4vi=function(one,value){return WebGL.mainContext.uniform4iv(one.location,value),1},__proto._uniform_sampler2D=function(one,value){var gl=WebGL.mainContext,uploadedValue=one.uploadedValue;return null==uploadedValue[0]?(uploadedValue[0]=this._curActTexIndex,gl.uniform1i(one.location,this._curActTexIndex),WebGLContext.activeTexture(gl,33984+this._curActTexIndex),WebGLContext.bindTexture(gl,3553,value),this._curActTexIndex++,1):(WebGLContext.activeTexture(gl,33984+uploadedValue[0]),WebGLContext.bindTexture(gl,3553,value),0)},__proto._uniform_samplerCube=function(one,value){var gl=WebGL.mainContext,uploadedValue=one.uploadedValue;return null==uploadedValue[0]?(uploadedValue[0]=this._curActTexIndex,gl.uniform1i(one.location,this._curActTexIndex),WebGLContext.activeTexture(gl,33984+this._curActTexIndex),WebGLContext.bindTexture(gl,34067,value),this._curActTexIndex++,1):(WebGLContext.activeTexture(gl,33984+uploadedValue[0]),WebGLContext.bindTexture(gl,34067,value),0)},__proto._noSetValue=function(one){console.log("no....:"+one.name)},__proto.uploadOne=function(name,value){WebGLContext.useProgram(WebGL.mainContext,this._program);var one=this._paramsMap[name];one.fun.call(this,one,value)},__proto.uploadTexture2D=function(value){var CTX=WebGLContext;CTX._activeTextures[0]!==value&&(CTX.bindTexture(WebGL.mainContext,CTX.TEXTURE_2D,value),CTX._activeTextures[0]=value)},__proto.upload=function(shaderValue,params){BaseShader.activeShader=BaseShader.bindShader=this;var gl=WebGL.mainContext;WebGLContext.useProgram(gl,this._program),this._reCompile?(params=this._params,this._reCompile=!1):params=params||this._params;for(var one,value,n=params.length,shaderCall=0,i=0;i<n;i++)null!==(value=shaderValue[(one=params[i]).name])&&(shaderCall+=one.fun.call(this,one,value));Stat.shaderCall+=shaderCall},__proto.uploadArray=function(shaderValue,length,_bufferUsage){BaseShader.activeShader=this,BaseShader.bindShader=this,WebGLContext.useProgram(WebGL.mainContext,this._program);this._params;for(var value,one,shaderCall=0,i=length-2;i>=0;i-=2)(one=this._paramsMap[shaderValue[i]])&&null!=(value=shaderValue[i+1])&&(_bufferUsage&&_bufferUsage[one.name]&&_bufferUsage[one.name].bind(),shaderCall+=one.fun.call(this,one,value));Stat.shaderCall+=shaderCall},__proto.getParams=function(){return this._params},__proto.setAttributesLocation=function(attribDesc){this._attribInfo=attribDesc},Shader.getShader=function(name){return Shader.sharders[name]},Shader.create=function(vs,ps,saveName,nameMap,bindAttrib){return new Shader(vs,ps,saveName,nameMap,bindAttrib)},Shader.withCompile=function(nameID,define,shaderName,createShader){if(shaderName&&Shader.sharders[shaderName])return Shader.sharders[shaderName];var pre=Shader._preCompileShader[2e-4*nameID];if(!pre)throw new Error("withCompile shader err!"+nameID);return pre.createShader(define,shaderName,createShader,null)},Shader.withCompile2D=function(nameID,mainID,define,shaderName,createShader,bindAttrib){if(shaderName&&Shader.sharders[shaderName])return Shader.sharders[shaderName];var pre=Shader._preCompileShader[2e-4*nameID+mainID];if(!pre)throw new Error("withCompile shader err!"+nameID+" "+mainID);return pre.createShader(define,shaderName,createShader,bindAttrib)},Shader.addInclude=function(fileName,txt){ShaderCompile.addInclude(fileName,txt)},Shader.preCompile=function(nameID,vs,ps,nameMap){var id=2e-4*nameID;Shader._preCompileShader[id]=new ShaderCompile(vs,ps,nameMap)},Shader.preCompile2D=function(nameID,mainID,vs,ps,nameMap){var id=2e-4*nameID+mainID;Shader._preCompileShader[id]=new ShaderCompile(vs,ps,nameMap)},Shader._createShader=function(gl,str,type){var shader=gl.createShader(type);return gl.shaderSource(shader,str),gl.compileShader(shader),gl.getShaderParameter(shader,35713)?shader:(console.log(gl.getShaderInfoLog(shader)),null)},Shader._count=0,Shader._preCompileShader={},Shader.SHADERNAME2ID=2e-4,Shader.sharders=new Array(32),__static(Shader,["nameKey",function(){return this.nameKey=new StringKey}]),Shader}(),BaseTexture=(function(_super){function SoundNode(){this.url=null,this._channel=null,this._tar=null,this._playEvents=null,this._stopEvents=null,SoundNode.__super.call(this),this.visible=!1,this.on("added",this,this._onParentChange),this.on("removed",this,this._onParentChange)}__class(SoundNode,"laya.media.SoundNode",Sprite);var __proto=SoundNode.prototype;__proto._onParentChange=function(){this.target=this.parent},__proto.play=function(loops,complete){void 0===loops&&(loops=1),isNaN(loops)&&(loops=1),this.url&&(this.stop(),this._channel=SoundManager.playSound(this.url,loops,complete))},__proto.stop=function(){this._channel&&!this._channel.isStopped&&this._channel.stop(),this._channel=null},__proto._setPlayAction=function(tar,event,action,add){void 0===add&&(add=!0),this[action]&&tar&&(add?tar.on(event,this,this[action]):tar.off(event,this,this[action]))},__proto._setPlayActions=function(tar,events,action,add){if(void 0===add&&(add=!0),tar&&events){var len,eventArr=events.split(","),i=0;for(len=eventArr.length,i=0;i<len;i++)this._setPlayAction(tar,eventArr[i],action,add)}},__getset(0,__proto,"playEvent",null,function(events){this._playEvents=events,events&&this._tar&&this._setPlayActions(this._tar,events,"play")}),__getset(0,__proto,"target",null,function(tar){this._tar&&(this._setPlayActions(this._tar,this._playEvents,"play",!1),this._setPlayActions(this._tar,this._stopEvents,"stop",!1)),this._tar=tar,this._tar&&(this._setPlayActions(this._tar,this._playEvents,"play",!0),this._setPlayActions(this._tar,this._stopEvents,"stop",!0))}),__getset(0,__proto,"stopEvent",null,function(events){this._stopEvents=events,events&&this._tar&&this._setPlayActions(this._tar,events,"stop")})}(),function(_super){function BaseTexture(format,mipMap){BaseTexture.__super.call(this),this._wrapModeU=0,this._wrapModeV=0,this._filterMode=1,this._readyed=!1,this._width=-1,this._height=-1,this._format=format,this._mipmap=mipMap,this._anisoLevel=1,this._glTexture=LayaGL.instance.createTexture()}__class(BaseTexture,"laya.resource.BaseTexture",Bitmap);var __proto=BaseTexture.prototype;return __proto._isPot=function(size){return 0==(size&size-1)},__proto._getGLFormat=function(){var glFormat=0;switch(this._format){case 0:glFormat=6407;break;case 1:glFormat=6408;break;case 2:glFormat=6406;break;case 3:if(!WebGLContext._compressedTextureS3tc)throw"BaseTexture: not support DXT1 format.";glFormat=WebGLContext._compressedTextureS3tc.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case 4:if(!WebGLContext._compressedTextureS3tc)throw"BaseTexture: not support DXT5 format.";glFormat=WebGLContext._compressedTextureS3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;case 5:if(!WebGLContext._compressedTextureEtc1)throw"BaseTexture: not support ETC1RGB format.";glFormat=WebGLContext._compressedTextureEtc1.COMPRESSED_RGB_ETC1_WEBGL;break;case 9:if(!WebGLContext._compressedTexturePvrtc)throw"BaseTexture: not support PVRTCRGB_2BPPV format.";glFormat=WebGLContext._compressedTexturePvrtc.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;break;case 10:if(!WebGLContext._compressedTexturePvrtc)throw"BaseTexture: not support PVRTCRGBA_2BPPV format.";glFormat=WebGLContext._compressedTexturePvrtc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;break;case 11:if(!WebGLContext._compressedTexturePvrtc)throw"BaseTexture: not support PVRTCRGB_4BPPV format.";glFormat=WebGLContext._compressedTexturePvrtc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;break;case 12:if(!WebGLContext._compressedTexturePvrtc)throw"BaseTexture: not support PVRTCRGBA_4BPPV format.";glFormat=WebGLContext._compressedTexturePvrtc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;break;default:throw"BaseTexture: unknown texture format."}return glFormat},__proto._setFilterMode=function(value){var gl=LayaGL.instance;switch(WebGLContext.bindTexture(gl,this._glTextureType,this._glTexture),value){case 0:this._mipmap?gl.texParameteri(this._glTextureType,10241,9984):gl.texParameteri(this._glTextureType,10241,9728),gl.texParameteri(this._glTextureType,10240,9728);break;case 1:this._mipmap?gl.texParameteri(this._glTextureType,10241,9985):gl.texParameteri(this._glTextureType,10241,9729),gl.texParameteri(this._glTextureType,10240,9729);break;case 2:this._mipmap?gl.texParameteri(this._glTextureType,10241,9987):gl.texParameteri(this._glTextureType,10241,9729),gl.texParameteri(this._glTextureType,10240,9729);break;default:throw new Error("BaseTexture:unknown filterMode value.")}},__proto._setWarpMode=function(orientation,mode){var gl=LayaGL.instance;if(WebGLContext.bindTexture(gl,this._glTextureType,this._glTexture),this._isPot(this._width)&&this._isPot(this._height))switch(mode){case 0:gl.texParameteri(this._glTextureType,orientation,10497);break;case 1:gl.texParameteri(this._glTextureType,orientation,33071)}else gl.texParameteri(this._glTextureType,orientation,33071)},__proto._setAnisotropy=function(value){var anisotropic=WebGLContext._extTextureFilterAnisotropic;if(anisotropic&&!Browser.onLimixiu){value=Math.max(value,1);var gl=LayaGL.instance;WebGLContext.bindTexture(gl,this._glTextureType,this._glTexture),value=Math.min(gl.getParameter(anisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT),value),gl.texParameterf(this._glTextureType,anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,value)}},__proto._disposeResource=function(){this._glTexture&&(LayaGL.instance.deleteTexture(this._glTexture),this._glTexture=null,this._setGPUMemory(0))},__proto._getSource=function(){return this._readyed?this._glTexture:null},__proto.generateMipmap=function(){this._isPot(this.width)&&this._isPot(this.height)&&LayaGL.instance.generateMipmap(this._glTextureType)},__getset(0,__proto,"wrapModeU",function(){return this._wrapModeU},function(value){this._wrapModeU!==value&&(this._wrapModeU=value,-1!==this._width&&this._setWarpMode(10242,value))}),__getset(0,__proto,"mipmap",function(){return this._mipmap}),__getset(0,__proto,"format",function(){return this._format}),__getset(0,__proto,"wrapModeV",function(){return this._wrapModeV},function(value){this._wrapModeV!==value&&(this._wrapModeV=value,-1!==this._height&&this._setWarpMode(10243,value))}),__getset(0,__proto,"defaulteTexture",function(){throw"BaseTexture:must override it."}),__getset(0,__proto,"filterMode",function(){return this._filterMode},function(value){value!==this._filterMode&&(this._filterMode=value,-1!==this._width&&-1!==this._height&&this._setFilterMode(value))}),__getset(0,__proto,"anisoLevel",function(){return this._anisoLevel},function(value){value!==this._anisoLevel&&(this._anisoLevel=Math.max(1,Math.min(16,value)),-1!==this._width&&-1!==this._height&&this._setAnisotropy(value))}),BaseTexture.WARPMODE_REPEAT=0,BaseTexture.WARPMODE_CLAMP=1,BaseTexture.FILTERMODE_POINT=0,BaseTexture.FILTERMODE_BILINEAR=1,BaseTexture.FILTERMODE_TRILINEAR=2,BaseTexture.FORMAT_R8G8B8=0,BaseTexture.FORMAT_R8G8B8A8=1,BaseTexture.FORMAT_ALPHA8=2,BaseTexture.FORMAT_DXT1=3,BaseTexture.FORMAT_DXT5=4,BaseTexture.FORMAT_ETC1RGB=5,BaseTexture.FORMAT_PVRTCRGB_2BPPV=9,BaseTexture.FORMAT_PVRTCRGBA_2BPPV=10,BaseTexture.FORMAT_PVRTCRGB_4BPPV=11,BaseTexture.FORMAT_PVRTCRGBA_4BPPV=12,BaseTexture.FORMAT_DEPTH_16=0,BaseTexture.FORMAT_STENCIL_8=1,BaseTexture.FORMAT_DEPTHSTENCIL_16_8=2,BaseTexture.FORMAT_DEPTHSTENCIL_NONE=3,BaseTexture}()),HTMLCanvas=function(_super){function HTMLCanvas(createCanvas){HTMLCanvas.__super.call(this),void 0===createCanvas&&(createCanvas=!1),this._source=createCanvas?Browser.createElement("canvas"):this,this.lock=!0}__class(HTMLCanvas,"laya.resource.HTMLCanvas",Bitmap);var __proto=HTMLCanvas.prototype;return __proto._getSource=function(){return this._source},__proto.clear=function(){this._ctx&&this._ctx.clear&&this._ctx.clear(),this._texture&&(this._texture.destroy(),this._texture=null)},__proto.destroy=function(){laya.resource.Resource.prototype.destroy.call(this),this._setCPUMemory(0),this._ctx&&this._ctx.destroy(),this._ctx=null},__proto.release=function(){},__proto._setContext=function(context){this._ctx=context},__proto.getContext=function(contextID,other){return this.context},__proto.getMemSize=function(){return 0},__proto.size=function(w,h){(this._width!=w||this._height!=h||this._source&&(this._source.width!=w||this._source.height!=h))&&(this._width=w,this._height=h,this._setCPUMemory(w*h*4),this._ctx&&this._ctx.size&&this._ctx.size(w,h),this._source&&(this._source.height=h,this._source.width=w),this._texture&&(this._texture.destroy(),this._texture=null))},__proto.getTexture=function(){if(!this._texture){var bitmap=new Texture2D;bitmap.loadImageSource(this.source),this._texture=new Texture(bitmap)}return this._texture},__proto.toBase64=function(type,encoderOptions){if(this._source){if(Render.isConchApp){if(2==conchConfig.threadMode)throw"native 2 thread mode use toBase64Async";var width=this._ctx._targets.sourceWidth,height=this._ctx._targets.sourceHeight,data=this._ctx._targets.getData(0,0,width,height);return conchToBase64FlipY?conchToBase64FlipY(type,encoderOptions,data.buffer,width,height):conchToBase64(type,encoderOptions,data.buffer,width,height)}return this._source.toDataURL(type,encoderOptions)}return null},__proto.toBase64Async=function(type,encoderOptions,callBack){var width=this._ctx._targets.sourceWidth,height=this._ctx._targets.sourceHeight;this._ctx._targets.getDataAsync(0,0,width,height,function(data){var base64=conchToBase64FlipY?conchToBase64FlipY(type,encoderOptions,data.buffer,width,height):conchToBase64(type,encoderOptions,data.buffer,width,height);callBack(base64)})},__getset(0,__proto,"source",function(){return this._source}),__getset(0,__proto,"context",function(){return this._ctx?this._ctx:(this._source==this?this._ctx=new Context:this._ctx=this._source.getContext(Render.isConchApp?"layagl":"2d"),this._ctx._canvas=this,this._ctx)}),HTMLCanvas}(),Stage=(function(_super){function HTMLImage(){HTMLImage.__super.call(this)}__class(HTMLImage,"laya.resource.HTMLImage",Bitmap),HTMLImage.create=function(width,height,format){var tex=new Texture2D(width,height,format,!1,!1);return tex.wrapModeU=1,tex.wrapModeV=1,tex}}(),function(_super){function Stage(){this.focus=null,this._frameRate="fast",this.designWidth=0,this.designHeight=0,this.canvasRotation=!1,this.canvasDegree=0,this.renderingEnabled=!0,this.screenAdaptationEnabled=!0,this._screenMode="none",this._scaleMode="noscale",this._alignV="top",this._alignH="left",this._bgColor="black",this._mouseMoveTime=0,this._renderCount=0,this._safariOffsetY=0,this._frameStartTime=0,this._isFocused=!1,this._isVisibility=!1,this._wgColor=[0,0,0,1],this._scene3Ds=[],this._globalRepaintSet=!1,this._globalRepaintGet=!1,this._curUIBase=null,this.useRetinalCanvas=!1,Stage.__super.call(this),this.offset=new Point,this._canvasTransform=new Matrix,this._previousOrientation=Browser.window.orientation,this._3dUI=[];var _$this=this;this.transform=this._createTransform(),this.mouseEnabled=!0,this.hitTestPrior=!0,this.autoSize=!1,this._setBit(128,!0),this._setBit(2,!0),this._isFocused=!0,this._isVisibility=!0,this.useRetinalCanvas=Config.useRetinalCanvas;var window=Browser.window,_me=this;window.addEventListener("focus",function(){_$this._isFocused=!0,_me.event("focus"),_me.event("focuschange")}),window.addEventListener("blur",function(){_$this._isFocused=!1,_me.event("blur"),_me.event("focuschange"),_me._isInputting()&&(Input.inputElement.target.focus=!1)});var state="visibilityState",visibilityChange="visibilitychange",document=window.document;void 0!==document.hidden?(visibilityChange="visibilitychange",state="visibilityState"):void 0!==document.mozHidden?(visibilityChange="mozvisibilitychange",state="mozVisibilityState"):void 0!==document.msHidden?(visibilityChange="msvisibilitychange",state="msVisibilityState"):void 0!==document.webkitHidden&&(visibilityChange="webkitvisibilitychange",state="webkitVisibilityState"),window.document.addEventListener(visibilityChange,function(){"hidden"==Browser.document[state]?(_$this._isVisibility=!1,_me._isInputting()&&(Input.inputElement.target.focus=!1)):_$this._isVisibility=!0;_$this.renderingEnabled=_$this._isVisibility,_me.event("visibilitychange")}),window.addEventListener("resize",function(){var orientation=Browser.window.orientation;null!=orientation&&orientation!=_$this._previousOrientation&&_me._isInputting()&&(Input.inputElement.target.focus=!1),_$this._previousOrientation=orientation,_me._isInputting()||(Browser.onSafari&&(_me._safariOffsetY=(Browser.window.__innerHeight||Browser.document.body.clientHeight||Browser.document.documentElement.clientHeight)-Browser.window.innerHeight),_me._resetCanvas())}),window.addEventListener("orientationchange",function(e){_me._resetCanvas()}),this.on("mousemove",this,this._onmouseMove),Browser.onMobile&&this.on("mousedown",this,this._onmouseMove)}__class(Stage,"laya.display.Stage",_super);var __proto=Stage.prototype;return __proto._isInputting=function(){return Browser.onMobile&&Input.isInputting},__proto._changeCanvasSize=function(){this.setScreenSize(Browser.clientWidth*Browser.pixelRatio,Browser.clientHeight*Browser.pixelRatio)},__proto._resetCanvas=function(){this.screenAdaptationEnabled&&this._changeCanvasSize()},__proto.setScreenSize=function(screenWidth,screenHeight){var rotation=!1;if("none"!==this._screenMode&&(rotation=(screenWidth/screenHeight<1?"vertical":"horizontal")!==this._screenMode)){var temp=screenHeight;screenHeight=screenWidth,screenWidth=temp}this.canvasRotation=rotation;var canvas=Render._mainCanvas,canvasStyle=canvas.source.style,mat=this._canvasTransform.identity(),scaleMode=this._scaleMode,scaleX=screenWidth/this.designWidth,scaleY=screenHeight/this.designHeight,canvasWidth=this.useRetinalCanvas?screenWidth:this.designWidth,canvasHeight=this.useRetinalCanvas?screenHeight:this.designHeight,realWidth=screenWidth,realHeight=screenHeight,pixelRatio=Browser.pixelRatio;switch(this._width=this.designWidth,this._height=this.designHeight,scaleMode){case"noscale":scaleX=scaleY=1,realWidth=this.designWidth,realHeight=this.designHeight;break;case"showall":scaleX=scaleY=Math.min(scaleX,scaleY),canvasWidth=realWidth=Math.round(this.designWidth*scaleX),canvasHeight=realHeight=Math.round(this.designHeight*scaleY);break;case"noborder":scaleX=scaleY=Math.max(scaleX,scaleY),realWidth=Math.round(this.designWidth*scaleX),realHeight=Math.round(this.designHeight*scaleY);break;case"full":scaleX=scaleY=1,this._width=canvasWidth=screenWidth,this._height=canvasHeight=screenHeight;break;case"fixedwidth":scaleY=scaleX,this._height=canvasHeight=Math.round(screenHeight/scaleX);break;case"fixedheight":scaleX=scaleY,this._width=canvasWidth=Math.round(screenWidth/scaleY);break;case"fixedauto":screenWidth/screenHeight<this.designWidth/this.designHeight?(scaleY=scaleX,this._height=canvasHeight=Math.round(screenHeight/scaleX)):(scaleX=scaleY,this._width=canvasWidth=Math.round(screenWidth/scaleY))}this.useRetinalCanvas&&(canvasWidth=screenWidth,canvasHeight=screenHeight),scaleX*=this.scaleX,scaleY*=this.scaleY,1===scaleX&&1===scaleY?this.transform.identity():(this.transform.a=this._formatData(scaleX/(realWidth/canvasWidth)),this.transform.d=this._formatData(scaleY/(realHeight/canvasHeight))),canvas.size(canvasWidth,canvasHeight),RunDriver.changeWebGLSize(canvasWidth,canvasHeight),mat.scale(realWidth/canvasWidth/pixelRatio,realHeight/canvasHeight/pixelRatio),"left"===this._alignH?this.offset.x=0:"right"===this._alignH?this.offset.x=screenWidth-realWidth:this.offset.x=.5*(screenWidth-realWidth)/pixelRatio,"top"===this._alignV?this.offset.y=0:"bottom"===this._alignV?this.offset.y=screenHeight-realHeight:this.offset.y=.5*(screenHeight-realHeight)/pixelRatio,this.offset.x=Math.round(this.offset.x),this.offset.y=Math.round(this.offset.y),mat.translate(this.offset.x,this.offset.y),this._safariOffsetY&&mat.translate(0,this._safariOffsetY),this.canvasDegree=0,rotation&&("horizontal"===this._screenMode?(mat.rotate(Math.PI/2),mat.translate(screenHeight/pixelRatio,0),this.canvasDegree=90):(mat.rotate(-Math.PI/2),mat.translate(0,screenWidth/pixelRatio),this.canvasDegree=-90)),mat.a=this._formatData(mat.a),mat.d=this._formatData(mat.d),mat.tx=this._formatData(mat.tx),mat.ty=this._formatData(mat.ty),this.transform=this.transform,canvasStyle.transformOrigin=canvasStyle.webkitTransformOrigin=canvasStyle.msTransformOrigin=canvasStyle.mozTransformOrigin=canvasStyle.oTransformOrigin="0px 0px 0px",canvasStyle.transform=canvasStyle.webkitTransform=canvasStyle.msTransform=canvasStyle.mozTransform=canvasStyle.oTransform="matrix("+mat.toString()+")",this._safariOffsetY&&mat.translate(0,-this._safariOffsetY),mat.translate(parseInt(canvasStyle.left)||0,parseInt(canvasStyle.top)||0),this.visible=!0,this._repaint|=2,this.event("resize")},__proto._formatData=function(value){return Math.abs(value)<1e-6?0:Math.abs(1-value)<.001?value>0?1:-1:value},__proto.getMousePoint=function(){return Point.TEMP.setTo(this.mouseX,this.mouseY)},__proto.repaint=function(type){void 0===type&&(type=2),this._repaint|=type},__proto.parentRepaint=function(type){void 0===type&&(type=2)},__proto._loop=function(){return this._globalRepaintGet=this._globalRepaintSet,this._globalRepaintSet=!1,this.render(Render._context,0,0),!0},__proto.getFrameTm=function(){return this._frameStartTime},__proto._onmouseMove=function(e){this._mouseMoveTime=Browser.now()},__proto.getTimeFromFrameStart=function(){return Browser.now()-this._frameStartTime},__proto.render=function(context,x,y){if(Stage._dbgSprite.graphics.clear(),"sleep"===this._frameRate){var now=Browser.now();if(!(now-this._frameStartTime>=1e3))return;this._frameStartTime=now}else{if(!this._visible)return this._renderCount++,void(this._renderCount%5==0&&(CallLater.I._update(),Stat.loopCount++,this._updateTimers()));this._frameStartTime=Browser.now()}this._renderCount++;var isFastMode="slow"!==("mouse"===this._frameRate?this._frameStartTime-this._mouseMoveTime<2e3?"fast":"slow":this._frameRate),isDoubleLoop=this._renderCount%2==0;if(Stat.renderSlow=!isFastMode,(isFastMode||isDoubleLoop)&&(CallLater.I._update(),Stat.loopCount++,this.renderingEnabled)){for(var i=0,n=this._scene3Ds.length;i<n;i++)this._scene3Ds[i]._update();context.clear(),_super.prototype.render.call(this,context,x,y),Stat._show&&Stat._sp&&Stat._sp.render(context,x,y)}Stage._dbgSprite.render(context,0,0),!isFastMode&&isDoubleLoop||(this.renderingEnabled&&(RunDriver.clear(this._bgColor),context.flush(),VectorGraphManager.instance&&VectorGraphManager.getInstance().endDispose()),this._updateTimers())},__proto.renderToNative=function(context,x,y){if(this._renderCount++,this._visible){if(CallLater.I._update(),Stat.loopCount++,this.renderingEnabled){for(var i=0,n=this._scene3Ds.length;i<n;i++)this._scene3Ds[i]._update();context.clear(),_super.prototype.render.call(this,context,x,y),Stat._show&&Stat._sp&&Stat._sp.render(context,x,y)}this.renderingEnabled&&(RunDriver.clear(this._bgColor),context.flush(),VectorGraphManager.instance&&VectorGraphManager.getInstance().endDispose()),this._updateTimers()}else this._renderCount%5==0&&(CallLater.I._update(),Stat.loopCount++,this._updateTimers())},__proto._updateTimers=function(){Laya.systemTimer._update(),Laya.startTimer._update(),Laya.physicsTimer._update(),Laya.updateTimer._update(),Laya.lateTimer._update(),Laya.timer._update()},__proto._requestFullscreen=function(){var element=Browser.document.documentElement;element.requestFullscreen?element.requestFullscreen():element.mozRequestFullScreen?element.mozRequestFullScreen():element.webkitRequestFullscreen?element.webkitRequestFullscreen():element.msRequestFullscreen&&element.msRequestFullscreen()},__proto._fullScreenChanged=function(){Laya.stage.event("fullscreenchange")},__proto.exitFullscreen=function(){var document=Browser.document;document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},__proto.isGlobalRepaint=function(){return this._globalRepaintGet},__proto.setGlobalRepaint=function(){this._globalRepaintSet=!0},__proto.add3DUI=function(uibase){var uiroot=uibase.rootView;this._3dUI.indexOf(uiroot)>=0||this._3dUI.push(uiroot)},__proto.remove3DUI=function(uibase){var uiroot=uibase.rootView,p=this._3dUI.indexOf(uiroot);return p>=0&&(this._3dUI.splice(p,1),!0)},__getset(0,__proto,"clientScaleY",function(){return this._transform?this._transform.getScaleY():1}),__getset(0,__proto,"width",_super.prototype._$get_width,function(value){this.designWidth=value,Laya.superSet(Sprite,this,"width",value),Laya.systemTimer.callLater(this,this._changeCanvasSize)}),__getset(0,__proto,"isFocused",function(){return this._isFocused}),__getset(0,__proto,"alignH",function(){return this._alignH},function(value){this._alignH=value,Laya.systemTimer.callLater(this,this._changeCanvasSize)}),__getset(0,__proto,"height",_super.prototype._$get_height,function(value){this.designHeight=value,Laya.superSet(Sprite,this,"height",value),Laya.systemTimer.callLater(this,this._changeCanvasSize)}),__getset(0,__proto,"transform",function(){return this._tfChanged&&this._adjustTransform(),this._transform=this._transform||this._createTransform()},_super.prototype._$set_transform),__getset(0,__proto,"isVisibility",function(){return this._isVisibility}),__getset(0,__proto,"scaleMode",function(){return this._scaleMode},function(value){this._scaleMode=value,Laya.systemTimer.callLater(this,this._changeCanvasSize)}),__getset(0,__proto,"alignV",function(){return this._alignV},function(value){this._alignV=value,Laya.systemTimer.callLater(this,this._changeCanvasSize)}),__getset(0,__proto,"bgColor",function(){return this._bgColor},function(value){this._bgColor=value,this._wgColor=value?ColorUtils.create(value).arrColor:null,Browser.onLimixiu?this._wgColor=ColorUtils.create(value).arrColor:Render.canvas.style.background=value||"none"}),__getset(0,__proto,"mouseX",function(){return Math.round(MouseManager.instance.mouseX/this.clientScaleX)}),__getset(0,__proto,"mouseY",function(){return Math.round(MouseManager.instance.mouseY/this.clientScaleY)}),__getset(0,__proto,"clientScaleX",function(){return this._transform?this._transform.getScaleX():1}),__getset(0,__proto,"screenMode",function(){return this._screenMode},function(value){this._screenMode=value}),__getset(0,__proto,"visible",_super.prototype._$get_visible,function(value){this.visible!==value&&(Laya.superSet(Sprite,this,"visible",value),Render._mainCanvas.source.style.visibility=value?"visible":"hidden")}),__getset(0,__proto,"fullScreenEnabled",null,function(value){var document=Browser.document,canvas=Render.canvas;value?(canvas.addEventListener("mousedown",this._requestFullscreen),canvas.addEventListener("touchstart",this._requestFullscreen),document.addEventListener("fullscreenchange",this._fullScreenChanged),document.addEventListener("mozfullscreenchange",this._fullScreenChanged),document.addEventListener("webkitfullscreenchange",this._fullScreenChanged),document.addEventListener("msfullscreenchange",this._fullScreenChanged)):(canvas.removeEventListener("mousedown",this._requestFullscreen),canvas.removeEventListener("touchstart",this._requestFullscreen),document.removeEventListener("fullscreenchange",this._fullScreenChanged),document.removeEventListener("mozfullscreenchange",this._fullScreenChanged),document.removeEventListener("webkitfullscreenchange",this._fullScreenChanged),document.removeEventListener("msfullscreenchange",this._fullScreenChanged))}),__getset(0,__proto,"frameRate",function(){return Render.isConchApp?this._frameRateNative:this._frameRate},function(value){if(Render.isConchApp){switch(value){case"fast":window.conch.config.setLimitFPS(60);break;case"mouse":window.conch.config.setMouseFrame(2e3);break;case"slow":window.conch.config.setSlowFrame(!0);break;case"sleep":window.conch.config.setLimitFPS(1)}this._frameRateNative=value}else this._frameRate=value}),Stage.SCALE_NOSCALE="noscale",Stage.SCALE_EXACTFIT="exactfit",Stage.SCALE_SHOWALL="showall",Stage.SCALE_NOBORDER="noborder",Stage.SCALE_FULL="full",Stage.SCALE_FIXED_WIDTH="fixedwidth",Stage.SCALE_FIXED_HEIGHT="fixedheight",Stage.SCALE_FIXED_AUTO="fixedauto",Stage.ALIGN_LEFT="left",Stage.ALIGN_RIGHT="right",Stage.ALIGN_CENTER="center",Stage.ALIGN_TOP="top",Stage.ALIGN_MIDDLE="middle",Stage.ALIGN_BOTTOM="bottom",Stage.SCREEN_NONE="none",Stage.SCREEN_HORIZONTAL="horizontal",Stage.SCREEN_VERTICAL="vertical",Stage.FRAME_FAST="fast",Stage.FRAME_SLOW="slow",Stage.FRAME_MOUSE="mouse",Stage.FRAME_SLEEP="sleep",__static(Stage,["_dbgSprite",function(){return this._dbgSprite=new Sprite}]),Stage}(Sprite)),PerfHUD=function(_super){function PerfHUD(){this.datas=[],this.hud_width=800,this.hud_height=200,this.gMinV=0,this.gMaxV=100,this.textSpace=40,this._now=null,this.sttm=0,PerfHUD.__super.call(this),this.xdata=new Array(PerfHUD.DATANUM),this.ydata=new Array(PerfHUD.DATANUM),PerfHUD.inst=this,this._renderType|=2048,this._setRenderType(this._renderType),this._setCustomRender(),this.addDataDef(0,16777215,"frame",1),this.addDataDef(1,65280,"update",1),this.addDataDef(2,16711680,"flush",1),this._now=performance?performance.now.bind(performance):Date.now}__class(PerfHUD,"laya.utils.PerfHUD",Sprite);var __proto=PerfHUD.prototype;return __proto.now=function(){return this._now()},__proto.start=function(){this.sttm=this._now()},__proto.end=function(i){var dt=this._now()-this.sttm;this.updateValue(i,dt)},__proto.config=function(w,h){this.hud_width=w,this.hud_height=h},__proto.addDataDef=function(id,color,name,scale){this.datas[id]=new PerfData(id,color,name,scale)},__proto.updateValue=function(id,v){this.datas[id].addData(v)},__proto.v2y=function(v){this._y,this.hud_height,this.gMinV,this.gMaxV;return this._y+this.hud_height*(1-(v-this.gMinV)/this.gMaxV)},__proto.drawHLine=function(ctx,v,color,text){var sx=this._x,sy=(this._x,this.hud_width,this.v2y(v));ctx.fillText(text,sx,sy-6,null,"green",null),sx+=this.textSpace,ctx.fillStyle=color,ctx.fillRect(sx,sy,this._x+this.hud_width,1,null)},__proto.customRender=function(ctx,x,y){var now=performance.now();PerfHUD._lastTm<=0&&(PerfHUD._lastTm=now),this.updateValue(0,now-PerfHUD._lastTm),PerfHUD._lastTm=now,ctx.save(),ctx.fillRect(this._x,this._y,this.hud_width,this.hud_height+4,"#000000cc"),ctx.globalAlpha=.9,this.drawHLine(ctx,0,"green"," 0"),this.drawHLine(ctx,10,"green"," 10"),this.drawHLine(ctx,16.667,"red"," "),this.drawHLine(ctx,20,"green","50|20"),this.drawHLine(ctx,33.334,"yellow",""),this.drawHLine(ctx,16.667*3,"yellow",""),this.drawHLine(ctx,66.668,"yellow",""),this.drawHLine(ctx,50,"green","20|50"),this.drawHLine(ctx,100,"green","10|100");for(var di=0,sz=this.datas.length;di<sz;di++){var cd=this.datas[di];if(cd){var dtlen=cd.datas.length,dx=(this.hud_width-this.textSpace)/dtlen,cx=cd.datapos,_cx=this._x+this.textSpace;ctx.fillStyle=cd.color;for(var dtsz=dtlen;cx<dtsz;cx++){var sty=this.v2y(cd.datas[cx]*cd.scale);ctx.fillRect(_cx,sty,dx,this.hud_height+this._y-sty,null),_cx+=dx}for(cx=0;cx<cd.datapos;cx++)sty=this.v2y(cd.datas[cx]*cd.scale),ctx.fillRect(_cx,sty,dx,this.hud_height+this._y-sty,null),_cx+=dx}}ctx.restore()},PerfHUD._lastTm=0,PerfHUD._now=0,PerfHUD.DATANUM=300,PerfHUD.inst=null,PerfHUD.drawTexTm=0,PerfHUD}(),Scene=function(_super){function Scene(){this.autoDestroyAtClosed=!1,this.url=null,this._timer=null,this._viewCreated=!1,this._idMap=null,this._$componentType="Scene",Scene.__super.call(this),this._setBit(8,!0),Scene.unDestroyedScenes.push(this),this._scene=this,this.createChildren()}__class(Scene,"laya.display.Scene",_super);var __proto=Scene.prototype;return __proto.createChildren=function(){},__proto.loadScene=function(path){var url=path.indexOf(".")>-1?path:path+".scene",view=Laya.loader.getRes(url);if(view)this.createView(view);else{Laya.loader.resetProgress();var loader=new SceneLoader;loader.on("complete",this,this._onSceneLoaded,[url]),loader.load(url)}},__proto._onSceneLoaded=function(url){this.createView(Loader.getRes(url))},__proto.createView=function(view){view&&!this._viewCreated&&(this._viewCreated=!0,SceneUtils.createByData(this,view))},__proto.getNodeByID=function(id){return this._idMap?this._idMap[id]:null},__proto.open=function(closeOther,param){void 0===closeOther&&(closeOther=!0),closeOther&&Scene.closeAll(),Scene.root.addChild(this),this.onOpened(param)},__proto.onOpened=function(param){},__proto.close=function(type){this.onClosed(type),this.autoDestroyAtClosed?this.destroy():this.removeSelf()},__proto.onClosed=function(type){},__proto.destroy=function(destroyChild){void 0===destroyChild&&(destroyChild=!0),this._idMap=null,_super.prototype.destroy.call(this,destroyChild);for(var list=laya.display.Scene.unDestroyedScenes,i=list.length-1;i>-1;i--)if(list[i]===this)return void list.splice(i,1)},__proto._sizeChanged=function(){this.event("resize")},__getset(0,__proto,"scaleX",_super.prototype._$get_scaleX,function(value){Laya.superGet(Sprite,this,"scaleX")!=value&&(Laya.superSet(Sprite,this,"scaleX",value),this.event("resize"))}),__getset(0,__proto,"scaleY",_super.prototype._$get_scaleY,function(value){Laya.superGet(Sprite,this,"scaleY")!=value&&(Laya.superSet(Sprite,this,"scaleY",value),this.event("resize"))}),__getset(0,__proto,"width",function(){if(this._width)return this._width;for(var max=0,i=this.numChildren-1;i>-1;i--){var comp=this.getChildAt(i);comp._visible&&(max=Math.max(comp._x+comp.width*comp.scaleX,max))}return max},function(value){Laya.superGet(Sprite,this,"width")!=value&&(Laya.superSet(Sprite,this,"width",value),this.callLater(this._sizeChanged))}),__getset(0,__proto,"timer",function(){return this._timer||Laya.timer},function(value){this._timer=value}),__getset(0,__proto,"height",function(){if(this._height)return this._height;for(var max=0,i=this.numChildren-1;i>-1;i--){var comp=this.getChildAt(i);comp._visible&&(max=Math.max(comp._y+comp.height*comp.scaleY,max))}return max},function(value){Laya.superGet(Sprite,this,"height")!=value&&(Laya.superSet(Sprite,this,"height",value),this.callLater(this._sizeChanged))}),__getset(1,Scene,"root",function(){if(!Scene._root){function resize(){Scene._root.size(Laya.stage.width,Laya.stage.height),Scene._root.event("resize")}Scene._root=Laya.stage.addChild(new Sprite),Scene._root.name="root",Laya.stage.on("resize",null,resize),resize()}return Scene._root},laya.display.Sprite._$SET_root),Scene.load=function(url,complete,progress){Laya.loader.resetProgress();var loader=new SceneLoader;function onProgress(value){Scene._loadPage&&Scene._loadPage.event("progress",value),progress&&progress.runWith(value)}loader.on("progress",null,onProgress),loader.once("complete",null,function(){loader.off("progress",null,onProgress);var obj=Loader.getRes(url);if(!obj)throw"Can not find scene:"+url;if(!obj.props)throw"Scene data is error:"+url;var runtime=obj.props.runtime?obj.props.runtime:obj.type,clas=ClassUtils.getClass(runtime);if("instance"==obj.props.renderType)var scene=clas.instance||(clas.instance=new clas);else scene=new clas;if(!(scene&&scene instanceof laya.display.Node))throw"Can not find scene:"+runtime;scene.url=url,scene._getBit(8)?(scene.on("onViewCreated",null,function(){complete&&complete.runWith(scene)}),scene.createView(obj)):complete&&complete.runWith(scene),Scene.hideLoadingPage()}),loader.load(url)},Scene.open=function(url,closeOther,param,complete,progress){if(void 0===closeOther&&(closeOther=!0),param instanceof laya.utils.Handler){var temp=complete;complete=param,param=temp}Scene.showLoadingPage(),Scene.load(url,Handler.create(null,this._onSceneLoaded,[closeOther,complete,param]),progress)},Scene._onSceneLoaded=function(closeOther,complete,param,scene){scene.open(closeOther,param),complete&&complete.runWith(scene)},Scene.close=function(url,name){void 0===name&&(name="");for(var flag=!1,list=laya.display.Scene.unDestroyedScenes,i=0,n=list.length;i<n;i++){var scene=list[i];scene&&scene.parent&&scene.url===url&&scene.name==name&&(scene.close(),flag=!0)}return flag},Scene.closeAll=function(){for(var root=laya.display.Scene.root,i=0,n=root.numChildren;i<n;i++){var scene=root.getChildAt(0);scene instanceof laya.display.Scene?scene.close():scene.removeSelf()}},Scene.destroy=function(url,name){void 0===name&&(name="");for(var flag=!1,list=laya.display.Scene.unDestroyedScenes,i=0,n=list.length;i<n;i++){var scene=list[i];scene.url===url&&scene.name==name&&(scene.destroy(),flag=!0)}return flag},Scene.gc=function(){Resource.destroyUnusedResources()},Scene.setLoadingPage=function(loadPage){Scene._loadPage!=loadPage&&(Scene._loadPage=loadPage)},Scene.showLoadingPage=function(param,delay){void 0===delay&&(delay=500),Scene._loadPage&&(Laya.systemTimer.clear(null,Scene._showLoading),Laya.systemTimer.clear(null,Scene._hideLoading),Laya.systemTimer.once(delay,null,Scene._showLoading,[param],!1))},Scene._showLoading=function(param){Laya.stage.addChild(Scene._loadPage),Scene._loadPage.onOpened(param)},Scene._hideLoading=function(){Scene._loadPage.close()},Scene.hideLoadingPage=function(delay){void 0===delay&&(delay=500),Scene._loadPage&&(Laya.systemTimer.clear(null,Scene._showLoading),Laya.systemTimer.clear(null,Scene._hideLoading),Laya.systemTimer.once(delay,null,Scene._hideLoading))},Scene.unDestroyedScenes=[],Scene._root=null,Scene._loadPage=null,Scene}(Sprite),Input=function(_super){function Input(){this._focus=!1,this._multiline=!1,this._editable=!0,this._restrictPattern=null,this._type="text",this._prompt="",this._promptColor="#A9A9A9",this._originColor="#000000",this._content="",Input.__super.call(this),this._maxChars=1e5,this._width=100,this._height=20,this.multiline=!1,this.overflow="scroll",this.on("mousedown",this,this._onMouseDown),this.on("undisplay",this,this._onUnDisplay)}__class(Input,"laya.display.Input",_super);var __proto=Input.prototype;return __proto.setSelection=function(startIndex,endIndex){this.focus=!0,laya.display.Input.inputElement.selectionStart=startIndex,laya.display.Input.inputElement.selectionEnd=endIndex},__proto._onUnDisplay=function(e){this.focus=!1},__proto._onMouseDown=function(e){this.focus=!0},__proto._syncInputTransform=function(){var inputElement=this.nativeInput,transform=Utils.getTransformRelativeToWindow(this,this.padding[3],this.padding[0]),inputWid=this._width-this.padding[1]-this.padding[3],inputHei=this._height-this.padding[0]-this.padding[2];Render.isConchApp?(inputElement.setScale(transform.scaleX,transform.scaleY),inputElement.setSize(inputWid,inputHei),inputElement.setPos(transform.x,transform.y)):(Input.inputContainer.style.transform=Input.inputContainer.style.webkitTransform="scale("+transform.scaleX+","+transform.scaleY+") rotate("+Laya.stage.canvasDegree+"deg)",inputElement.style.width=inputWid+"px",inputElement.style.height=inputHei+"px",Input.inputContainer.style.left=transform.x+"px",Input.inputContainer.style.top=transform.y+"px")},__proto.select=function(){this.nativeInput.select()},__proto._setInputMethod=function(){Input.input.parentElement&&Input.inputContainer.removeChild(Input.input),Input.area.parentElement&&Input.inputContainer.removeChild(Input.area),Input.inputElement=this._multiline?Input.area:Input.input,Input.inputContainer.appendChild(Input.inputElement),Text.RightToLeft&&(Input.inputElement.style.direction="rtl")},__proto._focusIn=function(){laya.display.Input.isInputting=!0;var input=this.nativeInput;this._focus=!0;var cssStyle=input.style;cssStyle.whiteSpace=this.wordWrap?"pre-wrap":"nowrap",this._setPromptColor(),input.readOnly=!this._editable,Render.isConchApp&&(input.setType(this._type),input.setForbidEdit(!this._editable)),input.maxLength=this._maxChars;this.padding;if(input.type=this._type,input.value=this._content,input.placeholder=this._prompt,Laya.stage.off("keydown",this,this._onKeyDown),Laya.stage.on("keydown",this,this._onKeyDown),Laya.stage.focus=this,this.event("focus"),Browser.onPC&&input.focus(),!(Browser.onMiniGame||Browser.onBDMiniGame||Browser.onQGMiniGame||Browser.onKGMiniGame||Browser.onVVMiniGame||Browser.onAlipayMiniGame||Browser.onBLMiniGame||Browser.onQQMiniGame)){this._text;this._text=null}this.typeset(),input.setColor(this._originColor),input.setFontSize(this.fontSize),input.setFontFace(Browser.onIPhone&&Text.fontFamilyMap[this.font]||this.font),Render.isConchApp&&input.setMultiAble&&input.setMultiAble(this._multiline),cssStyle.lineHeight=this.leading+this.fontSize+"px",cssStyle.fontStyle=this.italic?"italic":"normal",cssStyle.fontWeight=this.bold?"bold":"normal",cssStyle.textAlign=this.align,cssStyle.padding="0 0",this._syncInputTransform(),!Render.isConchApp&&Browser.onPC&&Laya.systemTimer.frameLoop(1,this,this._syncInputTransform)},__proto._setPromptColor=function(){Input.promptStyleDOM=Browser.getElementById("promptStyle"),Input.promptStyleDOM||(Input.promptStyleDOM=Browser.createElement("style"),Input.promptStyleDOM.setAttribute("id","promptStyle"),Browser.document.head.appendChild(Input.promptStyleDOM)),Input.promptStyleDOM.innerText="input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {color:"+this._promptColor+"}input:-moz-placeholder, textarea:-moz-placeholder {color:"+this._promptColor+"}input::-moz-placeholder, textarea::-moz-placeholder {color:"+this._promptColor+"}input:-ms-input-placeholder, textarea:-ms-input-placeholder {color:"+this._promptColor+"}"},__proto._focusOut=function(){laya.display.Input.isInputting=!1,this._focus=!1,this._text=null,this._content=this.nativeInput.value,this._content?(Laya.superSet(Text,this,"text",this._content),Laya.superSet(Text,this,"color",this._originColor)):(Laya.superSet(Text,this,"text",this._prompt),Laya.superSet(Text,this,"color",this._promptColor)),Laya.stage.off("keydown",this,this._onKeyDown),Laya.stage.focus=null,this.event("blur"),this.event("change"),Render.isConchApp&&this.nativeInput.blur(),Browser.onPC&&Laya.systemTimer.clear(this,this._syncInputTransform)},__proto._onKeyDown=function(e){13===e.keyCode&&(Browser.onMobile&&!this._multiline&&(this.focus=!1),this.event("enter"))},__proto.changeText=function(text){this._content=text,this._focus?(this.nativeInput.value=text||"",this.event("change")):_super.prototype.changeText.call(this,text)},__getset(0,__proto,"color",_super.prototype._$get_color,function(value){this._focus&&this.nativeInput.setColor(value),Laya.superSet(Text,this,"color",this._content?value:this._promptColor),this._originColor=value}),__getset(0,__proto,"multiline",function(){return this._multiline},function(value){this._multiline=value,this.valign=value?"top":"middle"}),__getset(0,__proto,"maxChars",function(){return this._maxChars},function(value){value<=0&&(value=1e5),this._maxChars=value}),__getset(0,__proto,"text",function(){return this._focus?this.nativeInput.value:this._content||""},function(value){Laya.superSet(Text,this,"color",this._originColor),value+="",this._focus?(this.nativeInput.value=value||"",this.event("change")):(this._multiline||(value=value.replace(/\r?\n/g,"")),this._content=value,value?Laya.superSet(Text,this,"text",value):(Laya.superSet(Text,this,"text",this._prompt),Laya.superSet(Text,this,"color",this.promptColor)))}),__getset(0,__proto,"nativeInput",function(){return this._multiline?Input.area:Input.input}),__getset(0,__proto,"focus",function(){return this._focus},function(value){var input=this.nativeInput;this._focus!==value&&(value?(input.target?input.target._focusOut():this._setInputMethod(),input.target=this,this._focusIn()):(input.target=null,this._focusOut(),Browser.document.body.scrollTop=0,input.blur(),Render.isConchApp?input.setPos(-1e4,-1e4):Input.inputContainer.contains(input)&&Input.inputContainer.removeChild(input)))}),__getset(0,__proto,"editable",function(){return this._editable},function(value){this._editable=value,Render.isConchApp&&Input.input.setForbidEdit(!value)}),__getset(0,__proto,"bgColor",_super.prototype._$get_bgColor,function(value){Laya.superSet(Text,this,"bgColor",value),Render.isConchApp&&this.nativeInput.setBgColor(value)}),__getset(0,__proto,"restrict",function(){return this._restrictPattern?this._restrictPattern.source:""},function(pattern){pattern?((pattern="[^"+pattern+"]").indexOf("^^")>-1&&(pattern=pattern.replace("^^","")),this._restrictPattern=new RegExp(pattern,"g")):this._restrictPattern=null}),__getset(0,__proto,"prompt",function(){return this._prompt},function(value){!this._text&&value&&Laya.superSet(Text,this,"color",this._promptColor),this.promptColor=this._promptColor,this._text?Laya.superSet(Text,this,"text",this._text==this._prompt?value:this._text):Laya.superSet(Text,this,"text",value),this._prompt=Text.langPacks&&Text.langPacks[value]?Text.langPacks[value]:value}),__getset(0,__proto,"promptColor",function(){return this._promptColor},function(value){this._promptColor=value,this._content||Laya.superSet(Text,this,"color",value)}),__getset(0,__proto,"type",function(){return this._type},function(value){this._getTextStyle().asPassword="password"===value,this._type=value}),Input.__init__=function(){if(Input._createInputElement(),Browser.onMobile){var isTrue=!1;(Browser.onMiniGame||Browser.onBDMiniGame||Browser.onQGMiniGame||Browser.onKGMiniGame||Browser.onVVMiniGame||Browser.onAlipayMiniGame||Browser.onBLMiniGame||Browser.onQQMiniGame)&&(isTrue=!0),Render.canvas.addEventListener(Input.IOS_IFRAME?isTrue?"touchend":"click":"touchend",Input._popupInputMethod)}},Input._popupInputMethod=function(e){laya.display.Input.isInputting&&laya.display.Input.inputElement.focus()},Input._createInputElement=function(){Input._initInput(Input.area=Browser.createElement("textarea")),Input._initInput(Input.input=Browser.createElement("input")),Input.inputContainer=Browser.createElement("div"),Input.inputContainer.style.position="absolute",Input.inputContainer.style.zIndex=1e5,Browser.container.appendChild(Input.inputContainer),Input.inputContainer.setPos=function(x,y){Input.inputContainer.style.left=x+"px",Input.inputContainer.style.top=y+"px"}},Input._initInput=function(input){var style=input.style;style.cssText="position:absolute;overflow:hidden;resize:none;transform-origin:0 0;-webkit-transform-origin:0 0;-moz-transform-origin:0 0;-o-transform-origin:0 0;",style.resize="none",style.backgroundColor="transparent",style.border="none",style.outline="none",style.zIndex=1,input.addEventListener("input",Input._processInputting),input.addEventListener("mousemove",Input._stopEvent),input.addEventListener("mousedown",Input._stopEvent),input.addEventListener("touchmove",Input._stopEvent),input.setFontFace=function(fontFace){input.style.fontFamily=fontFace},Render.isConchApp||(input.setColor=function(color){input.style.color=color},input.setFontSize=function(fontSize){input.style.fontSize=fontSize+"px"})},Input._processInputting=function(e){var input=laya.display.Input.inputElement.target;if(input){var value=laya.display.Input.inputElement.value;input._restrictPattern&&(value=value.replace(/\u2006|\x27/g,""),input._restrictPattern.test(value)&&(value=value.replace(input._restrictPattern,""),laya.display.Input.inputElement.value=value)),input._text=value,input.event("input")}},Input._stopEvent=function(e){"touchmove"==e.type&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},Input.TYPE_TEXT="text",Input.TYPE_PASSWORD="password",Input.TYPE_EMAIL="email",Input.TYPE_URL="url",Input.TYPE_NUMBER="number",Input.TYPE_RANGE="range",Input.TYPE_DATE="date",Input.TYPE_MONTH="month",Input.TYPE_WEEK="week",Input.TYPE_TIME="time",Input.TYPE_DATE_TIME="datetime",Input.TYPE_DATE_TIME_LOCAL="datetime-local",Input.TYPE_SEARCH="search",Input.input=null,Input.area=null,Input.inputElement=null,Input.inputContainer=null,Input.confirmButton=null,Input.promptStyleDOM=null,Input.inputHeight=45,Input.isInputting=!1,Input.stageMatrix=null,__static(Input,["IOS_IFRAME",function(){return this.IOS_IFRAME=Browser.onIOS&&Browser.window.top!=Browser.window.self}]),Input}(Text),Shader2X=(function(_super){function Animation(){this._frames=null,this._url=null,Animation.__super.call(this),this._setControlNode(this)}__class(Animation,"laya.display.Animation",_super);var __proto=Animation.prototype;__proto.destroy=function(destroyChild){void 0===destroyChild&&(destroyChild=!0),this.stop(),laya.display.Sprite.prototype.destroy.call(this,destroyChild),this._frames=null,this._labels=null},__proto.play=function(start,loop,name){void 0===start&&(start=0),void 0===loop&&(loop=!0),void 0===name&&(name=""),name&&this._setFramesFromCache(name,!0),_super.prototype.play.call(this,start,loop,name)},__proto._setFramesFromCache=function(name,showWarn){if(void 0===showWarn&&(showWarn=!1),this._url&&(name=this._url+"#"+name),name&&Animation.framesMap[name]){var tAniO=Animation.framesMap[name];return tAniO instanceof Array?(this._frames=Animation.framesMap[name],this._count=this._frames.length):(tAniO.nodeRoot&&(Animation.framesMap[name]=GraphicAnimation.parseAnimationByData(tAniO),tAniO=Animation.framesMap[name]),this._frames=tAniO.frames,this._count=this._frames.length,this._frameRateChanged||(this._interval=tAniO.interval),this._labels=this._copyLabels(tAniO.labels)),!0}return showWarn&&console.log("ani not found:",name),!1},__proto._copyLabels=function(labels){if(!labels)return null;var rst,key;for(key in rst={},labels)rst[key]=Utils.copyArray([],labels[key]);return rst},__proto._frameLoop=function(){this._visible&&this._style.alpha>.01&&this._frames&&_super.prototype._frameLoop.call(this)},__proto._displayToIndex=function(value){this._frames&&(this.graphics=this._frames[value])},__proto.clear=function(){return _super.prototype.clear.call(this),this.stop(),this.graphics=null,this._frames=null,this._labels=null,this},__proto.loadImages=function(urls,cacheName){return void 0===cacheName&&(cacheName=""),this._url="",this._setFramesFromCache(cacheName)||(this.frames=Animation.framesMap[cacheName]?Animation.framesMap[cacheName]:Animation.createFrames(urls,cacheName)),this},__proto.loadAtlas=function(url,loaded,cacheName){void 0===cacheName&&(cacheName=""),this._url="";var _this=this;if(!_this._setFramesFromCache(cacheName)){function onLoaded(loadUrl){url===loadUrl&&(_this.frames=Animation.framesMap[cacheName]?Animation.framesMap[cacheName]:Animation.createFrames(url,cacheName),loaded&&loaded.run())}Loader.getAtlas(url)?onLoaded(url):Laya.loader.load(url,Handler.create(null,onLoaded,[url]),null,"atlas")}return this},__proto.loadAnimation=function(url,loaded,atlas){this._url=url;return this._actionName||(this._actionName=""),this._setFramesFromCache(this._actionName)?(this._setFramesFromCache(this._actionName,!0),this.index=0,loaded&&loaded.run()):!atlas||Loader.getAtlas(atlas)?this._loadAnimationData(url,loaded,atlas):Laya.loader.load(atlas,Handler.create(this,this._loadAnimationData,[url,loaded,atlas]),null,"atlas"),this},__proto._loadAnimationData=function(url,loaded,atlas){var _$this=this;if(!atlas||Loader.getAtlas(atlas)){var _this=this;Loader.getRes(url)?onLoaded(url):Laya.loader.load(url,Handler.create(null,onLoaded,[url]),null,"json")}else console.warn("atlas load fail:"+atlas);function onLoaded(loadUrl){if(Loader.getRes(loadUrl)){if(url===loadUrl){var tAniO;if(Animation.framesMap[url+"#"])_this._setFramesFromCache(_$this._actionName,!0),_$this.index=0,_$this._resumePlay();else{var aniData=GraphicAnimation.parseAnimationData(Loader.getRes(url));if(!aniData)return;var defaultO,aniList=aniData.animationList,i=0,len=aniList.length;for(i=0;i<len;i++)tAniO=aniList[i],Animation.framesMap[url+"#"+tAniO.name]=tAniO,defaultO||(defaultO=tAniO);defaultO&&(Animation.framesMap[url+"#"]=defaultO,_this._setFramesFromCache(_$this._actionName,!0),_$this.index=0),_$this._resumePlay()}loaded&&loaded.run()}Loader.clearRes(url)}else Animation.framesMap[url+"#"]&&(_this._setFramesFromCache(_$this._actionName,!0),_$this.index=0,_$this._resumePlay(),loaded&&loaded.run())}},__getset(0,__proto,"frames",function(){return this._frames},function(value){this._frames=value,value&&(this._count=value.length,this._actionName&&this._setFramesFromCache(this._actionName,!0),this.index=this._index)}),__getset(0,__proto,"autoPlay",null,function(value){value?this.play():this.stop()}),__getset(0,__proto,"source",null,function(value){value.indexOf(".ani")>-1?this.loadAnimation(value):value.indexOf(".json")>-1||value.indexOf("als")>-1||value.indexOf("atlas")>-1?this.loadAtlas(value):this.loadImages(value.split(","))}),__getset(0,__proto,"autoAnimation",null,function(value){this.play(0,!0,value)}),Animation.createFrames=function(url,name){var arr;if("string"==typeof url){var atlas=Loader.getAtlas(url);if(atlas&&atlas.length){arr=[];for(var i=0,n=atlas.length;i<n;i++){var g=new Graphics;g.drawImage(Loader.getRes(atlas[i]),0,0),arr.push(g)}}}else if(url instanceof Array)for(arr=[],i=0,n=url.length;i<n;i++)(g=new Graphics).loadImage(url[i],0,0),arr.push(g);return name&&(Animation.framesMap[name]=arr),arr},Animation.clearCache=function(key){var val,cache=Animation.framesMap,key2=key+"#";for(val in cache)val!==key&&0!==val.indexOf(key2)||delete Animation.framesMap[val]},Animation.framesMap={}}(AnimationBase),function(_super){function Shader2X(vs,ps,saveName,nameMap,bindAttrib){this._params2dQuick2=null,this._shaderValueWidth=0,this._shaderValueHeight=0,Shader2X.__super.call(this,vs,ps,saveName,nameMap,bindAttrib)}__class(Shader2X,"laya.webgl.shader.d2.Shader2X",_super);var __proto=Shader2X.prototype;return __proto._disposeResource=function(){_super.prototype._disposeResource.call(this),this._params2dQuick2=null},__proto.upload2dQuick2=function(shaderValue){this.upload(shaderValue,this._params2dQuick2||this._make2dQuick2())},__proto._make2dQuick2=function(){if(!this._params2dQuick2){this._params2dQuick2=[];for(var one,params=this._params,i=0,n=params.length;i<n;i++)"size"!==(one=params[i]).name&&this._params2dQuick2.push(one)}return this._params2dQuick2},Shader2X.create=function(vs,ps,saveName,nameMap,bindAttrib){return new Shader2X(vs,ps,saveName,nameMap,bindAttrib)},Shader2X}(Shader)),FrameAnimation=function(_super){function FrameAnimation(){this._targetDic=null,this._animationData=null,this._usedFrames=null,FrameAnimation.__super.call(this),null===FrameAnimation._sortIndexFun&&(FrameAnimation._sortIndexFun=MathUtil.sortByKey("index",!1,!0))}__class(FrameAnimation,"laya.display.FrameAnimation",_super);var __proto=FrameAnimation.prototype;return __proto._setUp=function(targetDic,animationData){this._targetDic=targetDic,this._animationData=animationData,this.interval=1e3/animationData.frameRate,animationData.parsed?(this._count=animationData.count,this._labels=animationData.labels,this._usedFrames=animationData.animationNewFrames):(this._usedFrames=[],this._calculateDatas(),animationData.parsed=!0,animationData.labels=this._labels,animationData.count=this._count,animationData.animationNewFrames=this._usedFrames)},__proto.clear=function(){return _super.prototype.clear.call(this),this._targetDic=null,this._animationData=null,this},__proto._displayToIndex=function(value){if(this._animationData){value<0&&(value=0),value>this._count&&(value=this._count);var nodes=this._animationData.nodes,i=0,len=nodes.length;for(i=0;i<len;i++)this._displayNodeToFrame(nodes[i],value)}},__proto._displayNodeToFrame=function(node,frame,targetDic){targetDic||(targetDic=this._targetDic);var target=targetDic[node.target];if(target){var key,propFrames,value,frames=node.frames,keys=node.keys,i=0,len=keys.length;for(i=0;i<len;i++)value=(propFrames=frames[key=keys[i]]).length>frame?propFrames[frame]:propFrames[propFrames.length-1],target[key]=value;var funFrames,funkeys=node.funkeys;if(0!=(len=funkeys.length))for(i=0;i<len;i++)void 0!==(funFrames=frames[key=funkeys[i]])[frame]&&target[key]&&target[key].apply(target,funFrames[frame])}},__proto._calculateDatas=function(){if(this._animationData){var tNode,nodes=this._animationData.nodes,i=0,len=nodes.length;for(this._count=0,i=0;i<len;i++)tNode=nodes[i],this._calculateKeyFrames(tNode);this._count+=1}},__proto._calculateKeyFrames=function(node){var key,tKeyFrames,keyFrames=node.keyframes,target=node.target;for(key in node.frames||(node.frames={}),node.keys?node.keys.length=0:node.keys=[],node.funkeys?node.funkeys.length=0:node.funkeys=[],node.initValues||(node.initValues={}),keyFrames){var isFun=-1!=key.indexOf("()");if(tKeyFrames=keyFrames[key],isFun&&(key=key.substr(0,key.length-2)),node.frames[key]||(node.frames[key]=[]),isFun){node.funkeys.push(key);for(var map=node.frames[key],i=0;i<tKeyFrames.length;i++){var temp=tKeyFrames[i];map[temp.index]=temp.value,temp.index>this._count&&(this._count=temp.index)}}else this._targetDic&&this._targetDic[target]&&(node.initValues[key]=this._targetDic[target][key]),tKeyFrames.sort(FrameAnimation._sortIndexFun),node.keys.push(key),this._calculateNodePropFrames(tKeyFrames,node.frames[key],key,target)}},__proto.resetNodes=function(){if(this._targetDic&&this._animationData){var tNode,initValues,nodes=this._animationData.nodes,i=0,len=nodes.length;for(i=0;i<len;i++)if(initValues=(tNode=nodes[i]).initValues){var key,target=this._targetDic[tNode.target];if(target)for(key in initValues)target[key]=initValues[key]}}},__proto._calculateNodePropFrames=function(keyframes,frames,key,target){var i=0,len=keyframes.length-1;for(frames.length=keyframes[len].index+1,i=0;i<len;i++)this._dealKeyFrame(keyframes[i]),this._calculateFrameValues(keyframes[i],keyframes[i+1],frames);0==len&&(frames[0]=keyframes[0].value,this._usedFrames&&(this._usedFrames[keyframes[0].index]=!0)),this._dealKeyFrame(keyframes[i])},__proto._dealKeyFrame=function(keyFrame){keyFrame.label&&""!=keyFrame.label&&this.addLabel(keyFrame.label,keyFrame.index)},__proto._calculateFrameValues=function(startFrame,endFrame,result){var easeFun,i=0,start=startFrame.index,end=endFrame.index,startValue=startFrame.value,dValue=endFrame.value-startFrame.value,dLen=end-start,frames=this._usedFrames;if(end>this._count&&(this._count=end),startFrame.tween)for(null==(easeFun=Ease[startFrame.tweenMethod])&&(easeFun=Ease.linearNone),i=start;i<end;i++)result[i]=easeFun(i-start,startValue,dValue,dLen),frames&&(frames[i]=!0);else for(i=start;i<end;i++)result[i]=startValue;frames&&(frames[startFrame.index]=!0,frames[endFrame.index]=!0),result[endFrame.index]=endFrame.value},FrameAnimation._sortIndexFun=null,FrameAnimation}(AnimationBase),Texture2D=function(_super){function Texture2D(width,height,format,mipmap,canRead){if(void 0===width&&(width=0),void 0===height&&(height=0),void 0===format&&(format=1),void 0===mipmap&&(mipmap=!0),void 0===canRead&&(canRead=!1),Texture2D.__super.call(this,format,mipmap),this._glTextureType=3553,this._width=width,this._height=height,this._canRead=canRead,this._setWarpMode(10242,this._wrapModeU),this._setWarpMode(10243,this._wrapModeV),this._setFilterMode(this._filterMode),this._setAnisotropy(this._anisoLevel),this._mipmap){this._mipmapCount=Math.max(Math.ceil(Math.log2(width))+1,Math.ceil(Math.log2(2))+1);for(var i=0;i<this._mipmapCount;i++)this._setPixels(null,i,Math.max(width>>i,1),Math.max(height>>i,1));this._setGPUMemory(width*height*4*(1+1/3))}else this._mipmapCount=1,this._setGPUMemory(width*height*4)}__class(Texture2D,"laya.resource.Texture2D",BaseTexture);var __proto=Texture2D.prototype;return __proto._getFormatByteCount=function(){switch(this._format){case 0:return 3;case 1:return 4;case 2:return 1;default:throw"Texture2D: unknown format."}},__proto._setPixels=function(pixels,miplevel,width,height){var gl=LayaGL.instance,textureType=this._glTextureType,glFormat=this._getGLFormat();WebGLContext.bindTexture(gl,textureType,this._glTexture),0===this.format?(gl.pixelStorei(3317,1),gl.texImage2D(textureType,miplevel,glFormat,width,height,0,glFormat,5121,pixels),gl.pixelStorei(3317,4)):gl.texImage2D(textureType,miplevel,glFormat,width,height,0,glFormat,5121,pixels)},__proto._calcualatesCompressedDataSize=function(format,width,height){switch(format){case 3:case 5:return(width+3>>2)*(height+3>>2)*8;case 4:return(width+3>>2)*(height+3>>2)*16;case 11:case 12:return Math.floor((Math.max(width,8)*Math.max(height,8)*4+7)/8);case 9:case 10:return Math.floor((Math.max(width,16)*Math.max(height,8)*2+7)/8);default:return 0}},__proto._pharseDDS=function(arrayBuffer){var header=new Int32Array(arrayBuffer,0,31);if(542327876!=header[0])throw"Invalid magic number in DDS header";if(!(4&header[20]))throw"Unsupported format, must contain a FourCC code";var compressedFormat=header[21];switch(this._format){case 3:if(827611204!==compressedFormat)throw"the FourCC code is not same with texture format.";break;case 4:if(894720068!==compressedFormat)throw"the FourCC code is not same with texture format.";break;default:throw"unknown texture format."}var mipLevels=1;if(131072&header[2]){if(mipLevels=Math.max(1,header[7]),!this._mipmap)throw"the mipmap is not same with Texture2D."}else if(this._mipmap)throw"the mipmap is not same with Texture2D.";var width=header[4],height=header[3];this._width=width,this._height=height;var dataOffset=header[1]+4;this._upLoadCompressedTexImage2D(arrayBuffer,width,height,mipLevels,dataOffset,0)},__proto._pharseKTX=function(arrayBuffer){var id=new Uint8Array(arrayBuffer,0,12);if(171!=id[0]||75!=id[1]||84!=id[2]||88!=id[3]||32!=id[4]||49!=id[5]||49!=id[6]||187!=id[7]||13!=id[8]||10!=id[9]||26!=id[10]||10!=id[11])throw"Invalid fileIdentifier in KTX header";var header=new Int32Array(id.buffer,id.length,13);switch(header[4]){case WebGLContext._compressedTextureEtc1.COMPRESSED_RGB_ETC1_WEBGL:this._format=5;break;default:throw"unknown texture format."}var mipLevels=header[11],width=header[6],height=header[7];this._width=width,this._height=height;var dataOffset=64+header[12];this._upLoadCompressedTexImage2D(arrayBuffer,width,height,mipLevels,dataOffset,4)},__proto._pharsePVR=function(arrayBuffer){var header=new Int32Array(arrayBuffer,0,13);if(55727696!=header[0])throw"Invalid magic number in PVR header";switch(header[2]){case 0:this._format=9;break;case 2:this._format=11;break;case 1:this._format=10;break;case 3:this._format=12;break;default:throw"Texture2D:unknown PVR format."}var mipLevels=header[11],width=header[7],height=header[6];this._width=width,this._height=height;var dataOffset=header[12]+52;this._upLoadCompressedTexImage2D(arrayBuffer,width,height,mipLevels,dataOffset,0)},__proto._upLoadCompressedTexImage2D=function(data,width,height,miplevelCount,dataOffset,imageSizeOffset){var gl=LayaGL.instance,textureType=this._glTextureType;WebGLContext.bindTexture(gl,textureType,this._glTexture);for(var glFormat=this._getGLFormat(),offset=dataOffset,i=0;i<miplevelCount;i++){offset+=imageSizeOffset;var mipDataSize=this._calcualatesCompressedDataSize(this._format,width,height),mipData=new Uint8Array(data,offset,mipDataSize);gl.compressedTexImage2D(textureType,i,glFormat,width,height,0,mipData),width=Math.max(width>>1,1),height=Math.max(height>>1,1),offset+=mipDataSize}var memory=offset;this._setGPUMemory(memory),this._readyed=!0,this._activeResource()},__proto.loadImageSource=function(source,premultiplyAlpha){void 0===premultiplyAlpha&&(premultiplyAlpha=!1);var width=source.width,height=source.height;this._width=width,this._height=height,this._isPot(width)&&this._isPot(height)||(this._mipmap=!1),this._setWarpMode(10242,this._wrapModeU),this._setWarpMode(10243,this._wrapModeV),this._setFilterMode(this._filterMode);var gl=LayaGL.instance;WebGLContext.bindTexture(gl,this._glTextureType,this._glTexture);var glFormat=this._getGLFormat();Render.isConchApp?source instanceof laya.resource.HTMLCanvas?gl.texImage2D(this._glTextureType,0,6408,6408,5121,source):(source.setPremultiplyAlpha(premultiplyAlpha),gl.texImage2D(this._glTextureType,0,6408,6408,5121,source)):(premultiplyAlpha&&gl.pixelStorei(37441,!0),gl.texImage2D(this._glTextureType,0,glFormat,glFormat,5121,source),premultiplyAlpha&&gl.pixelStorei(37441,!1)),this._mipmap?(gl.generateMipmap(this._glTextureType),this._setGPUMemory(width*height*4*(1+1/3))):this._setGPUMemory(width*height*4),this._canRead&&(Render.isConchApp?this._pixels=new Uint8Array(source._nativeObj.getImageData(0,0,width,height)):(Browser.canvas.size(width,height),Browser.canvas.clear(),Browser.context.drawImage(source,0,0,width,height),this._pixels=new Uint8Array(Browser.context.getImageData(0,0,width,height).data.buffer))),this._readyed=!0,this._activeResource()},__proto.setPixels=function(pixels,miplevel){if(void 0===miplevel&&(miplevel=0),!pixels)throw"Texture2D:pixels can't be null.";var width=Math.max(this._width>>miplevel,1),height=Math.max(this._height>>miplevel,1),pixelsCount=width*height*this._getFormatByteCount();if(pixels.length<pixelsCount)throw"Texture2D:pixels length should at least "+pixelsCount+".";this._setPixels(pixels,miplevel,width,height),this._canRead&&(this._pixels=pixels),this._readyed=!0,this._activeResource()},__proto.setSubPixels=function(x,y,width,height,pixels,miplevel){if(void 0===miplevel&&(miplevel=0),!pixels)throw"Texture2D:pixels can't be null.";var gl=LayaGL.instance,textureType=this._glTextureType;WebGLContext.bindTexture(gl,textureType,this._glTexture);var glFormat=this._getGLFormat();0===this._format?(gl.pixelStorei(3317,1),gl.texSubImage2D(textureType,miplevel,x,y,width,height,glFormat,5121,pixels),gl.pixelStorei(3317,4)):gl.texSubImage2D(textureType,miplevel,x,y,width,height,glFormat,5121,pixels),this._readyed=!0,this._activeResource()},__proto.setCompressData=function(data){switch(this._format){case 3:case 4:this._pharseDDS(data);break;case 5:this._pharseKTX(data);break;case 9:case 10:case 11:case 12:this._pharsePVR(data);break;default:throw"Texture2D:unkonwn format."}},__proto._recoverResource=function(){},__proto.getPixels=function(){if(this._canRead)return this._pixels;throw new Error("Texture2D: must set texture canRead is true.")},__getset(0,__proto,"mipmapCount",function(){return this._mipmapCount}),__getset(0,__proto,"defaulteTexture",function(){return laya.resource.Texture2D.grayTexture}),Texture2D.__init__=function(){var pixels=new Uint8Array(3);pixels[0]=128,pixels[1]=128,pixels[2]=128,Texture2D.grayTexture=new Texture2D(1,1,0,!1,!1),Texture2D.grayTexture.setPixels(pixels),Texture2D.grayTexture.lock=!0,pixels[0]=255,pixels[1]=255,pixels[2]=255,Texture2D.whiteTexture=new Texture2D(1,1,0,!1,!1),Texture2D.whiteTexture.setPixels(pixels),Texture2D.whiteTexture.lock=!0,pixels[0]=0,pixels[1]=0,pixels[2]=0,Texture2D.blackTexture=new Texture2D(1,1,0,!1,!1),Texture2D.blackTexture.setPixels(pixels),Texture2D.blackTexture.lock=!0},Texture2D._parse=function(data,propertyParams,constructParams){var texture=constructParams?new Texture2D(constructParams[0],constructParams[1],constructParams[2],constructParams[3],constructParams[4]):new Texture2D(0,0);switch(propertyParams&&(texture.wrapModeU=propertyParams.wrapModeU,texture.wrapModeV=propertyParams.wrapModeV,texture.filterMode=propertyParams.filterMode,texture.anisoLevel=propertyParams.anisoLevel),texture._format){case 0:case 1:texture.loadImageSource(data);break;case 3:case 4:case 5:case 9:case 10:case 11:case 12:texture.setCompressData(data);break;default:throw"Texture2D:unkonwn format."}return texture},Texture2D.load=function(url,complete){Laya.loader.create(url,complete,null,"TEXTURE2D")},Texture2D.grayTexture=null,Texture2D.whiteTexture=null,Texture2D.blackTexture=null,Texture2D}(),RenderTexture2D=function(_super){function RenderTexture2D(width,height,format,depthStencilFormat){this._mgrKey=0,void 0===format&&(format=0),void 0===depthStencilFormat&&(depthStencilFormat=0),RenderTexture2D.__super.call(this,format,!1),this._glTextureType=3553,this._width=width,this._height=height,this._depthStencilFormat=depthStencilFormat,this._create(width,height),this.lock=!0}__class(RenderTexture2D,"laya.resource.RenderTexture2D",BaseTexture);var __proto=RenderTexture2D.prototype;return __proto.getIsReady=function(){return!0},__proto._create=function(width,height){var gl=LayaGL.instance;this._frameBuffer=gl.createFramebuffer(),WebGLContext.bindTexture(gl,this._glTextureType,this._glTexture);var glFormat=this._getGLFormat();if(gl.texImage2D(this._glTextureType,0,glFormat,width,height,0,glFormat,5121,null),this._setGPUMemory(width*height*4),gl.bindFramebuffer(36160,this._frameBuffer),gl.framebufferTexture2D(36160,36064,3553,this._glTexture,0),3!==this._depthStencilFormat)switch(this._depthStencilBuffer=gl.createRenderbuffer(),gl.bindRenderbuffer(36161,this._depthStencilBuffer),this._depthStencilFormat){case 0:gl.renderbufferStorage(36161,33189,width,height),gl.framebufferRenderbuffer(36160,36096,36161,this._depthStencilBuffer);break;case 1:gl.renderbufferStorage(36161,36168,width,height),gl.framebufferRenderbuffer(36160,36128,36161,this._depthStencilBuffer);break;case 2:gl.renderbufferStorage(36161,34041,width,height),gl.framebufferRenderbuffer(36160,33306,36161,this._depthStencilBuffer)}gl.bindFramebuffer(36160,null),gl.bindRenderbuffer(36161,null),this._setWarpMode(10242,this._wrapModeU),this._setWarpMode(10243,this._wrapModeV),this._setFilterMode(this._filterMode),this._setAnisotropy(this._anisoLevel),this._readyed=!0,this._activeResource()},__proto.generateMipmap=function(){this._isPot(this.width)&&this._isPot(this.height)?(this._mipmap=!0,LayaGL.instance.generateMipmap(this._glTextureType),this._setFilterMode(this._filterMode),this._setGPUMemory(this.width*this.height*4*(1+1/3))):(this._mipmap=!1,this._setGPUMemory(this.width*this.height*4))},__proto.start=function(){var gl=LayaGL.instance;LayaGL.instance.bindFramebuffer(36160,this._frameBuffer),this._lastRT=RenderTexture2D._currentActive,RenderTexture2D._currentActive=this,this._readyed=!0,gl.viewport(0,0,this._width,this._height),this._lastWidth=RenderState2D.width,this._lastHeight=RenderState2D.height,RenderState2D.width=this._width,RenderState2D.height=this._height,BaseShader.activeShader=null},__proto.end=function(){LayaGL.instance.bindFramebuffer(36160,null),RenderTexture2D._currentActive=null,this._readyed=!0},__proto.restore=function(){var gl=LayaGL.instance;this._lastRT!=RenderTexture2D._currentActive&&(LayaGL.instance.bindFramebuffer(36160,this._lastRT?this._lastRT._frameBuffer:null),RenderTexture2D._currentActive=this._lastRT),this._readyed=!0,gl.viewport(0,0,this._lastWidth,this._lastHeight),RenderState2D.width=this._lastWidth,RenderState2D.height=this._lastHeight,BaseShader.activeShader=null},__proto.clear=function(r,g,b,a){void 0===r&&(r=0),void 0===g&&(g=0),void 0===b&&(b=0),void 0===a&&(a=1);var gl=LayaGL.instance;gl.clearColor(r,g,b,a);var clearFlag=16384;switch(this._depthStencilFormat){case 33189:clearFlag|=256;break;case 36168:clearFlag|=1024;break;case 34041:clearFlag|=256,clearFlag|=1024}gl.clear(clearFlag)},__proto.getData=function(x,y,width,height){if(Render.isConchApp&&2==conchConfig.threadMode)throw"native 2 thread mode use getDataAsync";var gl=LayaGL.instance;if(gl.bindFramebuffer(36160,this._frameBuffer),!(36053===gl.checkFramebufferStatus(36160)))return gl.bindFramebuffer(36160,null),null;var pixels=new Uint8Array(this._width*this._height*4),glFormat=this._getGLFormat();return gl.readPixels(x,y,width,height,glFormat,5121,pixels),gl.bindFramebuffer(36160,null),pixels},__proto.getDataAsync=function(x,y,width,height,callBack){var gl=LayaGL.instance;gl.bindFramebuffer(36160,this._frameBuffer),gl.readPixelsAsync(x,y,width,height,6408,5121,function(data){callBack(new Uint8Array(data))}),gl.bindFramebuffer(36160,null)},__proto.recycle=function(){},__proto._disposeResource=function(){if(this._frameBuffer){var gl=LayaGL.instance;gl.deleteTexture(this._glTexture),gl.deleteFramebuffer(this._frameBuffer),gl.deleteRenderbuffer(this._depthStencilBuffer),this._glTexture=null,this._frameBuffer=null,this._depthStencilBuffer=null,this._setGPUMemory(0)}},__getset(0,__proto,"depthStencilFormat",function(){return this._depthStencilFormat}),__getset(0,__proto,"defaulteTexture",function(){return Texture2D.grayTexture}),__getset(0,__proto,"sourceWidth",function(){return this._width}),__getset(0,__proto,"sourceHeight",function(){return this._height}),__getset(0,__proto,"offsetX",function(){return 0}),__getset(0,__proto,"offsetY",function(){return 0}),__getset(1,RenderTexture2D,"currentActive",function(){return RenderTexture2D._currentActive},laya.resource.BaseTexture._$SET_currentActive),RenderTexture2D.pushRT=function(){RenderTexture2D.rtStack.push({rt:RenderTexture2D._currentActive,w:RenderState2D.width,h:RenderState2D.height})},RenderTexture2D.popRT=function(){var gl=LayaGL.instance,top=RenderTexture2D.rtStack.pop();top&&(RenderTexture2D._currentActive!=top.rt&&(LayaGL.instance.bindFramebuffer(36160,top.rt?top.rt._frameBuffer:null),RenderTexture2D._currentActive=top.rt),gl.viewport(0,0,top.w,top.h),RenderState2D.width=top.w,RenderState2D.height=top.h)},RenderTexture2D._currentActive=null,RenderTexture2D.rtStack=[],__static(RenderTexture2D,["defuv",function(){return this.defuv=[0,0,1,0,1,1,0,1]},"flipyuv",function(){return this.flipyuv=[0,1,1,1,1,0,0,0]}]),RenderTexture2D}(),GraphicAnimation=function(_super){var GraphicNode;function GraphicAnimation(){this.animationList=null,this.animationDic=null,this._nodeList=null,this._nodeDefaultProps=null,this._gList=null,this._nodeIDAniDic={},this._rootNode=null,this._nodeGDic=null,GraphicAnimation.__super.call(this)}__class(GraphicAnimation,"laya.utils.GraphicAnimation",_super);var __proto=GraphicAnimation.prototype;return __proto._parseNodeList=function(uiView){this._nodeList||(this._nodeList=[]),this._nodeDefaultProps[uiView.compId]=uiView.props,uiView.compId&&this._nodeList.push(uiView.compId);var childs=uiView.child;if(childs){var i=0,len=childs.length;for(i=0;i<len;i++)this._parseNodeList(childs[i])}},__proto._calGraphicData=function(aniData){var key;if(this._setUp(null,aniData),this._createGraphicData(),this._nodeIDAniDic)for(key in this._nodeIDAniDic)this._nodeIDAniDic[key]=null},__proto._createGraphicData=function(){var preGraphic,gList=[],i=0,len=this.count,animationDataNew=this._usedFrames;for(animationDataNew||(animationDataNew=[]),i=0;i<len;i++)!animationDataNew[i]&&preGraphic||(preGraphic=this._createFrameGraphic(i)),gList.push(preGraphic);this._gList=gList},__proto._createFrameGraphic=function(frame){var g=new Graphics;return GraphicAnimation._rootMatrix||(GraphicAnimation._rootMatrix=new Matrix),this._updateNodeGraphic(this._rootNode,frame,GraphicAnimation._rootMatrix,g),g},__proto._updateNodeGraphic=function(node,frame,parentTransfrom,g,alpha){var tNodeG,tResultTransform,tTex;void 0===alpha&&(alpha=1),(tNodeG=this._nodeGDic[node.compId]=this._getNodeGraphicData(node.compId,frame,this._nodeGDic[node.compId])).resultTransform||(tNodeG.resultTransform=new Matrix),tResultTransform=tNodeG.resultTransform,Matrix.mul(tNodeG.transform,parentTransfrom,tResultTransform);var tGraphicAlpha=tNodeG.alpha*alpha;if(!(tGraphicAlpha<.01)){tNodeG.skin&&(tTex=this._getTextureByUrl(tNodeG.skin))&&(tResultTransform._checkTransform()?(g.drawTexture(tTex,0,0,tNodeG.width,tNodeG.height,tResultTransform,tGraphicAlpha),tNodeG.resultTransform=null):g.drawTexture(tTex,tResultTransform.tx,tResultTransform.ty,tNodeG.width,tNodeG.height,null,tGraphicAlpha));var childs=node.child;if(childs){var len,i=0;for(len=childs.length,i=0;i<len;i++)this._updateNodeGraphic(childs[i],frame,tResultTransform,g,tGraphicAlpha)}}},__proto._updateNoChilds=function(tNodeG,g){if(tNodeG.skin){var tTex=this._getTextureByUrl(tNodeG.skin);if(tTex){var tTransform=tNodeG.transform;tTransform._checkTransform();!tTransform._bTransform?g.drawTexture(tTex,tTransform.tx,tTransform.ty,tNodeG.width,tNodeG.height,null,tNodeG.alpha):g.drawTexture(tTex,0,0,tNodeG.width,tNodeG.height,tTransform.clone(),tNodeG.alpha)}}},__proto._updateNodeGraphic2=function(node,frame,g){var tNodeG;if(tNodeG=this._nodeGDic[node.compId]=this._getNodeGraphicData(node.compId,frame,this._nodeGDic[node.compId]),node.child){var tTransform=tNodeG.transform;tTransform._checkTransform();var onlyTranslate,hasTrans;hasTrans=(onlyTranslate=!tTransform._bTransform)&&(0!=tTransform.tx||0!=tTransform.ty);var ifSave;(ifSave=tTransform._bTransform||1!=tNodeG.alpha)&&g.save(),1!=tNodeG.alpha&&g.alpha(tNodeG.alpha),onlyTranslate?hasTrans&&g.translate(tTransform.tx,tTransform.ty):g.transform(tTransform.clone());var tTex,childs=node.child;if(tNodeG.skin&&(tTex=this._getTextureByUrl(tNodeG.skin))&&g.drawImage(tTex,0,0,tNodeG.width,tNodeG.height),childs){var len,i=0;for(len=childs.length,i=0;i<len;i++)this._updateNodeGraphic2(childs[i],frame,g)}ifSave?g.restore():onlyTranslate?hasTrans&&g.translate(-tTransform.tx,-tTransform.ty):g.transform(tTransform.clone().invert())}else this._updateNoChilds(tNodeG,g)},__proto._calculateKeyFrames=function(node){_super.prototype._calculateKeyFrames.call(this,node),this._nodeIDAniDic[node.target]=node},__proto.getNodeDataByID=function(nodeID){return this._nodeIDAniDic[nodeID]},__proto._getParams=function(obj,params,frame,obj2){var rst=GraphicAnimation._temParam;rst.length=params.length;var i=0,len=params.length;for(i=0;i<len;i++)rst[i]=this._getObjVar(obj,params[i][0],frame,params[i][1],obj2);return rst},__proto._getObjVar=function(obj,key,frame,noValue,obj2){if(obj.hasOwnProperty(key)){var vArr=obj[key];return frame>=vArr.length&&(frame=vArr.length-1),obj[key][frame]}return obj2.hasOwnProperty(key)?obj2[key]:noValue},__proto._getNodeGraphicData=function(nodeID,frame,rst){rst||(rst=new GraphicNode),rst.transform?rst.transform.identity():rst.transform=new Matrix;var node=this.getNodeDataByID(nodeID);if(!node)return rst;var tex,frameData=node.frames,params=this._getParams(frameData,GraphicAnimation._drawTextureCmd,frame,this._nodeDefaultProps[nodeID]),url=params[0],width=NaN,height=NaN,px=params[5],py=params[6],aX=params[13],aY=params[14],sx=params[7],sy=params[8],rotate=params[9],skewX=params[11],skewY=params[12];width=params[3],height=params[4],0!=width&&0!=height||(url=null),-1==width&&(width=0),-1==height&&(height=0),rst.skin=url,rst.width=width,rst.height=height,url&&((tex=this._getTextureByUrl(url))?(width||(width=tex.sourceWidth),height||(height=tex.sourceHeight)):console.warn("lost skin:",url,",you may load pics first")),rst.alpha=params[10];var m=rst.transform;0!=aX&&(px=aX*width),0!=aY&&(py=aY*height),0==px&&0==py||m.translate(-px,-py);var tm=null;if(rotate||1!==sx||1!==sy||skewX||skewY){(tm=GraphicAnimation._tempMt).identity(),tm._bTransform=!0;var skx=.0174532922222222*(rotate-skewX),sky=.0174532922222222*(rotate+skewY),cx=Math.cos(sky),ssx=Math.sin(sky),cy=Math.sin(skx),ssy=Math.cos(skx);tm.a=sx*cx,tm.b=sx*ssx,tm.c=-sy*cy,tm.d=sy*ssy,tm.tx=tm.ty=0}return tm&&(m=Matrix.mul(m,tm,m)),m.translate(params[1],params[2]),rst},__proto._getTextureByUrl=function(url){return Loader.getRes(url)},__proto.setAniData=function(uiView,aniName){if(uiView.animations){this._nodeDefaultProps={},this._nodeGDic={},this._nodeList&&(this._nodeList.length=0),this._rootNode=uiView,this._parseNodeList(uiView);var tAniO,aniDic={},anilist=[],animations=uiView.animations,i=0,len=animations.length;for(i=0;i<len;i++)if(tAniO=animations[i],this._labels=null,(!aniName||aniName==tAniO.name)&&tAniO){try{this._calGraphicData(tAniO)}catch(e){console.warn("parse animation fail:"+tAniO.name+",empty animation created"),this._gList=[]}var frameO={};frameO.interval=1e3/tAniO.frameRate,frameO.frames=this._gList,frameO.labels=this._labels,frameO.name=tAniO.name,anilist.push(frameO),aniDic[tAniO.name]=frameO}this.animationList=anilist,this.animationDic=aniDic}GraphicAnimation._temParam.length=0},__proto.parseByData=function(aniData){var rootNode,aniO;rootNode=aniData.nodeRoot,aniO=aniData.aniO,delete aniData.nodeRoot,delete aniData.aniO,this._nodeDefaultProps={},this._nodeGDic={},this._nodeList&&(this._nodeList.length=0),this._rootNode=rootNode,this._parseNodeList(rootNode),this._labels=null;try{this._calGraphicData(aniO)}catch(e){console.warn("parse animation fail:"+aniO.name+",empty animation created"),this._gList=[]}var frameO=aniData;return frameO.interval=1e3/aniO.frameRate,frameO.frames=this._gList,frameO.labels=this._labels,frameO.name=aniO.name,frameO},__proto.setUpAniData=function(uiView){if(uiView.animations){var tAniO,aniDic={},anilist=[],animations=uiView.animations,i=0,len=animations.length;for(i=0;i<len;i++)if(tAniO=animations[i]){var frameO={};frameO.name=tAniO.name,frameO.aniO=tAniO,frameO.nodeRoot=uiView,anilist.push(frameO),aniDic[tAniO.name]=frameO}this.animationList=anilist,this.animationDic=aniDic}},__proto._clear=function(){this.animationList=null,this.animationDic=null,this._gList=null,this._nodeGDic=null},GraphicAnimation.parseAnimationByData=function(animationObject){var rst;return GraphicAnimation._I||(GraphicAnimation._I=new GraphicAnimation),rst=GraphicAnimation._I.parseByData(animationObject),GraphicAnimation._I._clear(),rst},GraphicAnimation.parseAnimationData=function(aniData){var rst;return GraphicAnimation._I||(GraphicAnimation._I=new GraphicAnimation),GraphicAnimation._I.setUpAniData(aniData),(rst={}).animationList=GraphicAnimation._I.animationList,rst.animationDic=GraphicAnimation._I.animationDic,GraphicAnimation._I._clear(),rst},GraphicAnimation._temParam=[],GraphicAnimation._I=null,GraphicAnimation._rootMatrix=null,__static(GraphicAnimation,["_drawTextureCmd",function(){return this._drawTextureCmd=[["skin",null],["x",0],["y",0],["width",-1],["height",-1],["pivotX",0],["pivotY",0],["scaleX",1],["scaleY",1],["rotation",0],["alpha",1],["skewX",0],["skewY",0],["anchorX",0],["anchorY",0]]},"_tempMt",function(){return this._tempMt=new Matrix}]),GraphicAnimation.__init$=function(){GraphicNode=function(){function GraphicNode(){this.skin=null,this.transform=null,this.resultTransform=null,this.width=NaN,this.height=NaN,this.alpha=1}return __class(GraphicNode,""),GraphicNode}()},GraphicAnimation}(FrameAnimation);!function(_super){function EffectAnimation(){this._target=null,this._playEvent=null,this._initData={},this._aniKeys=null,this._effectClass=null,EffectAnimation.__super.call(this)}__class(EffectAnimation,"laya.display.EffectAnimation",_super);var __proto=EffectAnimation.prototype;__proto._onOtherBegin=function(effect){effect!==this&&this.stop()},__proto._addEvent=function(){this._target&&this._playEvent&&(this._setControlNode(this._target),this._target.on(this._playEvent,this,this._onPlayAction))},__proto._onPlayAction=function(){this.play(0,!1)},__proto.play=function(start,loop,name){void 0===start&&(start=0),void 0===loop&&(loop=!0),void 0===name&&(name=""),this._target&&(this._target.event("effectbegin",[this]),this._recordInitData(),laya.display.AnimationBase.prototype.play.call(this,start,loop,name))},__proto._recordInitData=function(){if(this._aniKeys){var len,key,i=0;for(len=this._aniKeys.length,i=0;i<len;i++)key=this._aniKeys[i],this._initData[key]=this._target[key]}},__proto._displayToIndex=function(value){if(this._animationData){value<0&&(value=0),value>this._count&&(value=this._count);var nodes=this._animationData.nodes,i=0,len=nodes.length;for(len=len>1?1:len,i=0;i<len;i++)this._displayNodeToFrame(nodes[i],value)}},__proto._displayNodeToFrame=function(node,frame,targetDic){if(this._target){var key,propFrames,value,easeFun,tKeyFrames,startFrame,endFrame,target=this._target,frames=node.frames,keys=node.keys,i=0,len=keys.length,secondFrames=node.secondFrames,tSecondFrame=0;for(i=0;i<len;i++)propFrames=frames[key=keys[i]],-1==(tSecondFrame=secondFrames[key])?value=this._initData[key]:frame<tSecondFrame?(startFrame=(tKeyFrames=node.keyframes[key])[0]).tween?(null==(easeFun=Ease[startFrame.tweenMethod])&&(easeFun=Ease.linearNone),endFrame=tKeyFrames[1],value=easeFun(frame,this._initData[key],endFrame.value-this._initData[key],endFrame.index)):value=this._initData[key]:value=propFrames.length>frame?propFrames[frame]:propFrames[propFrames.length-1],target[key]=value}},__proto._calculateKeyFrames=function(node){_super.prototype._calculateKeyFrames.call(this,node);var key,tKeyFrames,keyFrames=node.keyframes,secondFrames=(node.target,{});for(key in node.secondFrames=secondFrames,keyFrames)(tKeyFrames=keyFrames[key]).length<=1?secondFrames[key]=-1:secondFrames[key]=tKeyFrames[1].index},__getset(0,__proto,"target",function(){return this._target},function(v){this._target&&this._target.off("effectbegin",this,this._onOtherBegin),this._target=v,this._target&&this._target.on("effectbegin",this,this._onOtherBegin),this._addEvent()}),__getset(0,__proto,"playEvent",null,function(event){this._playEvent=event,event&&this._addEvent()}),__getset(0,__proto,"effectData",null,function(uiData){if(uiData){var aniData=uiData.animations;if(aniData&&aniData[0]){var data=aniData[0];this._setUp({},data),data.nodes&&data.nodes[0]&&(this._aniKeys=data.nodes[0].keys)}}}),__getset(0,__proto,"effectClass",null,function(classStr){if(this._effectClass=ClassUtils.getClass(classStr),this._effectClass){var uiData=this._effectClass.uiView;if(uiData){var aniData=uiData.animations;if(aniData&&aniData[0]){var data=aniData[0];this._setUp({},data),data.nodes&&data.nodes[0]&&(this._aniKeys=data.nodes[0].keys)}}}}),EffectAnimation.EFFECT_BEGIN="effectbegin"}(FrameAnimation);Laya.__init([LoaderManager,EventDispatcher,Context,Path,GraphicAnimation,SceneUtils,Render,SubmitCMD,Timer,CallLater,LocalStorage,SubmitCanvas,SubmitTarget,TimeLine])}(window,document,Laya),function(window,document,Laya){Laya.un,Laya.uns,Laya.static;var __class=Laya.class;Laya.getset,Laya.__newvec;new(function(){function LayaMain(){}return __class(LayaMain,"LayaMain"),LayaMain}())}(window,document,Laya);
|