mirror of
https://github.com/Cola-Echo/memory-manager-concurrent.git
synced 2026-06-06 19:25:52 +00:00
13 lines
382 KiB
JavaScript
13 lines
382 KiB
JavaScript
var window=window||global,document=document||(window.document={}),Laya=window.Laya=function(t,e){var i={__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(t,e){return 1==arguments.length?i.__presubstr.call(this,t):i.__presubstr.call(this,t,e>0?e:this.length+e)},__init:function(t){t.forEach(function(t){t.__init$&&t.__init$()})},__isClass:function(t){return t&&(t.__isclass||t==Object||t==String||t==Array)},__newvec:function(t,e){var i=[];i.length=t;for(var n=0;t>n;n++)i[n]=e;return i},__extend:function(t,e){function n(){i.un(this,"constructor",t)}for(var s in e)if(e.hasOwnProperty(s)){var r=Object.getOwnPropertyDescriptor(e,s),a=r.get,o=r.set;a||o?a&&o?Object.defineProperty(t,s,r):(a&&Object.defineProperty(t,s,a),o&&Object.defineProperty(t,s,o)):t[s]=e[s]}n.prototype=e.prototype,t.prototype=new n,i.un(t.prototype,"__imps",i.__copy({},e.prototype.__imps))},__copy:function(t,e){if(!e)return null;t=t||{};for(var i in e)t[i]=e[i];return t},__package:function(e,n){if(!i.__packages[e]){i.__packages[e]=!0;var s=t,r=e.split(".");if(r.length>1)for(var a=0,o=r.length-1;o>a;a++){var h=s[r[a]];s=h?h:s[r[a]]={}}s[r[r.length-1]]||(s[r[r.length-1]]=n||{})}},__hasOwnProperty:function(t,e){function i(t,e){if(Object.hasOwnProperty.call(e.prototype,t))return!0;var n=e.prototype.__super;return null==n?null:i(t,n)}return e=e||this,Object.hasOwnProperty.call(e,t)||i(t,e.__class)},__typeof:function(t,e){if(!t||!e)return!1;if(e===String)return"string"==typeof t;if(e===Number)return"number"==typeof t;if(e.__interface__)e=e.__interface__;else if("string"!=typeof e)return t instanceof e;return t.__imps&&t.__imps[e]||t.__class==e},__as:function(t,e){return this.__typeof(t,e)?t:null},"interface":function(e,n){i.__package(e,{});var s=i.__internals,r=s[e]=s[e]||{self:e};if(n){var a=n.split(",");r.extend=[];for(var o=0;o<a.length;o++){var e=a[o];s[e]=s[e]||{self:e},r.extend.push(s[e])}}for(var h=t,l=e.split("."),o=0;o<l.length-1;o++)h=h[l[o]];h[l[l.length-1]]={__interface__:e}},"class":function(e,n,s,r){if(s&&i.__extend(e,s),n)if(i.__package(n,e),i.__classmap[n]=e,n.indexOf(".")>0){if(0==n.indexOf("laya.")){var a=n.split(".");r=r||a[a.length-1],i[r]&&console.log("Warning!,this class["+r+"] already exist:",i[r]),i[r]=e}}else"Main"==n?t.Main=e:(i[n]&&console.log("Error!,this class["+n+"] already exist:",i[n]),i[n]=e);var o=i.un,h=e.prototype;o(h,"hasOwnProperty",i.__hasOwnProperty),o(h,"__class",e),o(h,"__super",s),o(h,"__className",n),o(e,"__super",s),o(e,"__className",n),o(e,"__isclass",!0),o(e,"super",function(t){this.__super.call(t)})},imps:function(t,e){function n(t){var e,r;if((e=i.__internals[t])&&(s[t]=!0,r=e.extend))for(var a=0;a<r.length;a++)n(r[a].self)}if(!e)return null;var s=t.__imps||i.un(t,"__imps",{});for(var r in e)n(r)},getset:function(t,e,n,s,r){t?(s&&(e["_$GET_"+n]=s),r&&(e["_$SET_"+n]=r)):(s&&i.un(e,"_$get_"+n,s),r&&i.un(e,"_$set_"+n,r)),s&&r?Object.defineProperty(e,n,{get:s,set:r,enumerable:!1}):(s&&Object.defineProperty(e,n,{get:s,enumerable:!1}),r&&Object.defineProperty(e,n,{set:r,enumerable:!1}))},"static":function(t,e){function i(){var i=e[n],s=e[n+1];Object.defineProperty(t,i,{get:function(){return delete this[i],this[i]=s.call(this)},set:function(t){delete this[i],this[i]=t},enumerable:!0,configurable:!0})}for(var n=0,s=e.length;s>n;n+=2)"length"==e[n]?t.length=e[n+1].call(t):i()},un:function(t,e,n){return n||(n=t[e]),i.__propun.value=n,Object.defineProperty(t,e,i.__propun),n},uns:function(t,e){e.forEach(function(e){i.un(t,e)})}};return t.console=t.console||{log:function(){}},t.trace=t.console.log,Error.prototype.throwError=function(){throw arguments},String.prototype.substr=i.__substr,Object.defineProperty(Array.prototype,"fixed",{enumerable:!1}),i}(window,document);!function(t,e,i){i.un,i.uns,i["static"],i["class"],i.getset,i.__newvec}(window,document,Laya),function(window,document,Laya){var __un=Laya.un,__uns=Laya.uns,__static=Laya["static"],__class=Laya["class"],__getset=Laya.getset,__newvec=Laya.__newvec;Laya["interface"]("laya.runtime.IMarket"),Laya["interface"]("laya.filters.IFilter"),Laya["interface"]("laya.display.ILayout"),Laya["interface"]("laya.resource.IDispose"),Laya["interface"]("laya.runtime.IPlatform"),Laya["interface"]("laya.resource.IDestroy"),Laya["interface"]("laya.runtime.IConchNode"),Laya["interface"]("laya.filters.IFilterAction"),Laya["interface"]("laya.runtime.ICPlatformClass"),Laya["interface"]("laya.resource.ICreateResource"),Laya["interface"]("laya.runtime.IPlatformClass","laya.runtime.IPlatform");var RunDriver=function(){function t(){}return __class(t,"laya.utils.RunDriver"),t.FILTER_ACTIONS=[],t.pixelRatio=-1,t._charSizeTestDiv=null,t.now=function(){return Date.now()},t.getWindow=function(){return window},t.newWebGLContext=function(t,e){return t.getContext(e,{stencil:!0,alpha:Config.isAlpha,antialias:Config.isAntialias,premultipliedAlpha:Config.premultipliedAlpha})},t.getPixelRatio=function(){if(t.pixelRatio<0){var e=Browser.context,i=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;t.pixelRatio=(Browser.window.devicePixelRatio||1)/i}return t.pixelRatio},t.getIncludeStr=function(t){return null},t.createShaderCondition=function(t){var e="(function() {return "+t+";})";return Browser.window.eval(e)},t.measureText=function(e,i){if(Render.isConchApp){var n=ConchTextCanvas;return n.font=i,n.measureText(e)}return null==t._charSizeTestDiv&&(t._charSizeTestDiv=Browser.createElement("div"),t._charSizeTestDiv.style.cssText="z-index:10000000;padding:0px;position: absolute;left:0px;visibility:hidden;top:0px;background:white",Browser.container.appendChild(t._charSizeTestDiv)),t._charSizeTestDiv.style.font=i,t._charSizeTestDiv.innerText=" "==e?"i":e,{width:t._charSizeTestDiv.offsetWidth,height:t._charSizeTestDiv.offsetHeight}},t.beginFlush=function(){},t.endFinish=function(){},t.addToAtlas=null,t.flashFlushImage=function(t){},t.drawToCanvas=function(t,e,i,n,s,r){var a=HTMLCanvas.create("2D"),o=new RenderContext(i,n,a);return RenderSprite.renders[e]._fun(t,o,s,r),a},t.createParticleTemplate2D=null,t.createGLTextur=null,t.createWebGLContext2D=null,t.changeWebGLSize=function(t,e){},t.createRenderSprite=function(t,e){return new RenderSprite(t,e)},t.createFilterAction=function(t){return new ColorFilterAction},t.createGraphics=function(){return new Graphics},t.clear=function(t){Render._context.ctx.clear()},t.clearAtlas=function(t){},t.addTextureToAtlas=function(t){},t.getTexturePixels=function(t,e,i,n,s){return null},t.skinAniSprite=function(){return null},t}(),___Laya=function(){return __getset(1,Laya,"alertGlobalError",null,function(t){var e=0;t?Browser.window.onerror=function(t,i,n,s,r){e++<5&&r&&alert("出错啦,请把此信息截图给研发商\n"+t+"\n"+r.stack)}:Browser.window.onerror=null}),Laya.init=function(t,e,i){for(var n=[],s=2,r=arguments.length;r>s;s++)n.push(arguments[s]);if(!Laya._isinit){Laya._isinit=!0,Browser.__init__(),Context.__init__(),Graphics.__init__(),Laya.timer=new Timer,Laya.loader=new LoaderManager;for(var s=0,a=n.length;a>s;s++)n[s].enable&&n[s].enable();Font.__init__(),Style.__init__(),ResourceManager.__init__(),CacheManger.beginCheck(),Laya.stageBox=Laya.stage=new Stage,Laya.stage.model&&Laya.stage.model.setRootNode();var o=Browser.window.location,h=o.pathname;return h=":"==h.charAt(2)?h.substring(1):h,URL.rootPath=URL.basePath=URL.getPath("file:"==o.protocol?h:o.protocol+"//"+o.host+o.pathname),Laya.render=new Render(0,0),Laya.stage.size(t,e),RenderSprite.__init__(),KeyBoardManager.__init__(),MouseManager.instance.__init__(Laya.stage,Render.canvas),Input.__init__(),SoundManager.autoStopMusic=!0,LocalStorage.__init__(),Render.canvas}},Laya.stage=null,Laya.timer=null,Laya.loader=null,Laya.render=null,Laya.version="1.5.5",Laya.stageBox=null,Laya._isinit=!1,__static(Laya,["conchMarket",function(){return this.conchMarket=window.conch?conchMarket:null},"PlatformClass",function(){return this.PlatformClass=window.PlatformClass}]),Laya}(),Config=function(){function t(){}return __class(t,"Config"),t.WebGLTextCacheCount=500,t.atlasEnable=!1,t.showCanvasMark=!1,t.CPUMemoryLimit=125829120,t.GPUMemoryLimit=167772160,t.animationInterval=50,t.isAntialias=!1,t.isAlpha=!1,t.premultipliedAlpha=!1,t}(),EventDispatcher=function(){function t(){this._events=null}var e;__class(t,"laya.events.EventDispatcher");var i=t.prototype;return i.hasListener=function(t){var e=this._events&&this._events[t];return!!e},i.event=function(t,e){if(!this._events||!this._events[t])return!1;var i=this._events[t];if(i.run)i.once&&delete this._events[t],null!=e?i.runWith(e):i.run();else{for(var n=0,s=i.length;s>n;n++){var r=i[n];r&&(null!=e?r.runWith(e):r.run()),r&&!r.once||(i.splice(n,1),n--,s--)}0===i.length&&delete this._events[t]}return!0},i.on=function(t,e,i,n){return this._createListener(t,e,i,n,!1)},i.once=function(t,e,i,n){return this._createListener(t,e,i,n,!0)},i._createListener=function(t,i,n,s,r,a){void 0===a&&(a=!0),a&&this.off(t,i,n,r);var o=e.create(i||this,n,s,r);this._events||(this._events={});var h=this._events;return h[t]?h[t].run?h[t]=[h[t],o]:h[t].push(o):h[t]=o,this},i.off=function(t,e,i,n){if(void 0===n&&(n=!1),!this._events||!this._events[t])return this;var s=this._events[t];if(null!=i)if(s.run)e&&s.caller!==e||s.method!==i||n&&!s.once||(delete this._events[t],s.recover());else{for(var r=0,a=0,o=s.length;o>a;a++){var h=s[a];!h||e&&h.caller!==e||h.method!==i||n&&!h.once||(r++,s[a]=null,h.recover())}r===o&&delete this._events[t]}return this},i.offAll=function(t){var e=this._events;if(!e)return this;if(t)this._recoverHandlers(e[t]),delete e[t];else{for(var i in e)this._recoverHandlers(e[i]);this._events=null}return this},i._recoverHandlers=function(t){if(t)if(t.run)t.recover();else for(var e=t.length-1;e>-1;e--)t[e]&&(t[e].recover(),t[e]=null)},i.isMouseEvent=function(e){return t.MOUSE_EVENTS[e]},t.MOUSE_EVENTS={rightmousedown:!0,rightmouseup:!0,rightclick:!0,mousedown:!0,mouseup:!0,mousemove:!0,mouseover:!0,mouseout:!0,click:!0,doubleclick:!0},t.__init$=function(){e=function(t){function e(t,i,n,s){e.__super.call(this,t,i,n,s)}__class(e,"",t);var i=e.prototype;return i.recover=function(){this._id>0&&(this._id=0,e._pool.push(this.clear()))},e.create=function(t,i,n,s){return void 0===s&&(s=!0),e._pool.length?e._pool.pop().setTo(t,i,n,s):new e(t,i,n,s)},e._pool=[],e}(Handler)},t}(),Handler=function(){function t(t,e,i,n){this.once=!1,this._id=0,void 0===n&&(n=!1),this.setTo(t,e,i,n)}__class(t,"laya.utils.Handler");var e=t.prototype;return e.setTo=function(e,i,n,s){return this._id=t._gid++,this.caller=e,this.method=i,this.args=n,this.once=s,this},e.run=function(){if(null==this.method)return null;var t=this._id,e=this.method.apply(this.caller,this.args);return this._id===t&&this.once&&this.recover(),e},e.runWith=function(t){if(null==this.method)return null;var e=this._id;if(null==t)var i=this.method.apply(this.caller,this.args);else i=this.args||t.unshift?this.args?this.method.apply(this.caller,this.args.concat(t)):this.method.apply(this.caller,t):this.method.call(this.caller,t);return this._id===e&&this.once&&this.recover(),i},e.clear=function(){return this.caller=null,this.method=null,this.args=null,this},e.recover=function(){this._id>0&&(this._id=0,t._pool.push(this.clear()))},t.create=function(e,i,n,s){return void 0===s&&(s=!0),t._pool.length?t._pool.pop().setTo(e,i,n,s):new t(e,i,n,s)},t._pool=[],t._gid=1,t}(),BitmapFont=function(){function t(){this.fontSize=12,this.autoScaleSize=!1,this._texture=null,this._fontCharDic={},this._complete=null,this._path=null,this._maxHeight=0,this._maxWidth=0,this._spaceWidth=10,this._leftPadding=0,this._rightPadding=0,this._letterSpacing=0}__class(t,"laya.display.BitmapFont");var e=t.prototype;return e.loadFont=function(t,e){this._path=t,this._complete=e,Laya.loader.load([{url:this._path,type:"xml"},{url:this._path.replace(".fnt",".png"),type:"image"}],Handler.create(this,this.onLoaded))},e.onLoaded=function(){this.parseFont(Loader.getRes(this._path),Loader.getRes(this._path.replace(".fnt",".png"))),this._complete&&this._complete.run()},e.parseFont=function(t,e){if(null!=t&&null!=e){this._texture=e;var i=1,n=t.getElementsByTagName("info");this.fontSize=parseInt(n[0].attributes.size.nodeValue);var s=n[0].attributes.padding.nodeValue,r=s.split(","),a=parseInt(r[0]),o=parseInt(r[2]);this._leftPadding=parseInt(r[3]),this._rightPadding=parseInt(r[1]);var h=t.getElementsByTagName("char"),l=0;for(l=0;l<h.length;l++){var u=h[l].attributes,c=parseInt(u.id.nodeValue),_=parseInt(u.xoffset.nodeValue)/i,d=parseInt(u.yoffset.nodeValue)/i,f=(parseInt(u.xadvance.nodeValue)/i,new Rectangle);f.x=parseInt(u.x.nodeValue),f.y=parseInt(u.y.nodeValue),f.width=parseInt(u.width.nodeValue),f.height=parseInt(u.height.nodeValue);var p=Texture.create(e,f.x,f.y,f.width,f.height,_,d);this._maxHeight=Math.max(this._maxHeight,a+o+p.height),this._maxWidth=Math.max(this._maxWidth,p.width),this._fontCharDic[c]=p}this.getCharTexture(" ")&&this.setSpaceWidth(this.getCharWidth(" "))}},e.getCharTexture=function(t){return this._fontCharDic[t.charCodeAt(0)]},e.destroy=function(){var t=null;for(var e in this._fontCharDic)t=this._fontCharDic[e],t&&t.destroy(),delete this._fontCharDic[e];this._texture.destroy()},e.setSpaceWidth=function(t){this._spaceWidth=t},e.getCharWidth=function(t){if(" "==t)return this._spaceWidth+this._letterSpacing;var e=this.getCharTexture(t);return e?e.width+2*e.offsetX+this._letterSpacing:0},e.getTextWidth=function(t){for(var e=0,i=0,n=t.length;n>i;i++)e+=this.getCharWidth(t.charAt(i));return e},e.getMaxWidth=function(){return this._maxWidth+this._letterSpacing},e.getMaxHeight=function(){return this._maxHeight},e.drawText=function(t,e,i,n,s,r){for(var a,o=0,h=0,l=t.length;l>h;h++)o+=this.getCharWidth(t.charAt(h));var u=this._leftPadding;"center"===s&&(u=(r-o)/2),"right"===s&&(u=r-o-this._rightPadding);var c=0;for(h=0,l=t.length;l>h;h++)a=this.getCharTexture(t.charAt(h)),a&&e.graphics.drawTexture(a,i+c+u,n,a.width,a.height),c+=this.getCharWidth(t.charAt(h))},__getset(0,e,"letterSpacing",function(){return this._letterSpacing},function(t){this._letterSpacing=t}),t}(),Style=function(){function t(){this.alpha=1,this.visible=!0,this.scrollRect=null,this.blendMode=null,this._type=0,this._tf=t._TF_EMPTY}__class(t,"laya.display.css.Style");var e=t.prototype;return e.getTransform=function(){return this._tf},e.setTransform=function(e){this._tf="none"!==e&&e?e:t._TF_EMPTY},e.setTranslateX=function(e){this._tf===t._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.translateX=e},e.setTranslateY=function(e){this._tf===t._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.translateY=e},e.setScaleX=function(e){this._tf===t._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.scaleX=e},e.setScaleY=function(e){this._tf===t._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.scaleY=e},e.setRotate=function(e){this._tf===t._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.rotate=e},e.setSkewX=function(e){this._tf===t._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.skewX=e},e.setSkewY=function(e){this._tf===t._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.skewY=e},e.destroy=function(){this.scrollRect=null},e.render=function(t,e,i,n){},e.getCSSStyle=function(){return CSSStyle.EMPTY},e._enableLayout=function(){return!1},__getset(0,e,"scaleX",function(){return this._tf.scaleX},function(t){this.setScaleX(t)}),__getset(0,e,"transform",function(){return this.getTransform()},function(t){this.setTransform(t)}),__getset(0,e,"translateX",function(){return this._tf.translateX},function(t){this.setTranslateX(t)}),__getset(0,e,"translateY",function(){return this._tf.translateY},function(t){this.setTranslateY(t)}),__getset(0,e,"scaleY",function(){return this._tf.scaleY},function(t){this.setScaleY(t)}),__getset(0,e,"block",function(){return 0!=(1&this._type)}),__getset(0,e,"skewY",function(){return this._tf.skewY},function(t){this.setSkewY(t)}),__getset(0,e,"rotate",function(){return this._tf.rotate},function(t){this.setRotate(t)}),__getset(0,e,"skewX",function(){return this._tf.skewX},function(t){this.setSkewX(t)}),__getset(0,e,"paddingLeft",function(){return 0}),__getset(0,e,"paddingTop",function(){return 0}),__getset(0,e,"absolute",function(){return!0}),t.__init__=function(){t._TF_EMPTY=new TransformInfo,t.EMPTY=new t},t.EMPTY=null,t._TF_EMPTY=null,t}(),Font=function(){function t(e){this._type=0,this._weight=0,this._decoration=null,this._text=null,this.indent=0,this._color=Color.create(t.defaultColor),this.family=t.defaultFamily,this.stroke=t._STROKE,this.size=t.defaultSize,e&&e!==t.EMPTY&&e.copyTo(this)}__class(t,"laya.display.css.Font");var e=t.prototype;return e.set=function(t){this._text=null;for(var e=t.split(" "),i=0,n=e.length;n>i;i++){var s=e[i];switch(s){case"italic":this.italic=!0;continue;case"bold":this.bold=!0;continue}s.indexOf("px")>0&&(this.size=parseInt(s),this.family=e[i+1],i++)}},e.toString=function(){return this._text="",this.italic&&(this._text+="italic "),this.bold&&(this._text+="bold "),this._text+=this.size+"px "+this.family},e.copyTo=function(e){e._type=this._type,e._text=this._text,e._weight=this._weight,e._color=this._color,e.family=this.family,e.stroke=this.stroke!=t._STROKE?this.stroke.slice():t._STROKE,e.indent=this.indent,e.size=this.size},__getset(0,e,"password",function(){return 0!==(1024&this._type)},function(t){t?this._type|=1024:this._type&=-1025}),__getset(0,e,"color",function(){return this._color.strColor},function(t){this._color=Color.create(t)}),__getset(0,e,"italic",function(){return 0!==(512&this._type)},function(t){t?this._type|=512:this._type&=-513}),__getset(0,e,"bold",function(){return 0!==(2048&this._type)},function(t){t?this._type|=2048:this._type&=-2049}),__getset(0,e,"weight",function(){return""+this._weight},function(t){var e=0;switch(t){case"normal":break;case"bold":this.bold=!0,e=700;break;case"bolder":e=800;break;case"lighter":e=100;break;default:e=parseInt(t)}this._weight=e,this._text=null}),__getset(0,e,"decoration",function(){return this._decoration?this._decoration.value:"none"},function(t){var e=t.split(" ");switch(this._decoration||(this._decoration={}),e[0]){case"_":this._decoration.type="underline";break;case"-":this._decoration.type="line-through";break;case"overline":this._decoration.type="overline";break;default:this._decoration.type=e[0]}e[1]&&(this._decoration.color=Color.create(e)),this._decoration.value=t}),t.__init__=function(){t.EMPTY=new t(null)},t.EMPTY=null,t.defaultColor="#000000",t.defaultSize=12,t.defaultFamily="Arial",t.defaultFont="12px Arial",t._STROKE=[0,"#000000"],t._ITALIC=512,t._PASSWORD=1024,t._BOLD=2048,t}(),TransformInfo=function(){function t(){this.translateX=0,this.translateY=0,this.scaleX=1,this.scaleY=1,this.rotate=0,this.skewX=0,this.skewY=0}return __class(t,"laya.display.css.TransformInfo"),t}(),Graphics=function(){function t(){this._one=null,this._cmds=null,this._render=this._renderEmpty,this._render=this._renderEmpty,Render.isConchNode&&(this._nativeObj=new _conchGraphics,this.id=this._nativeObj.conchID)}__class(t,"laya.display.Graphics");var e=t.prototype;return e.destroy=function(){this.clear(),this._temp=null,this._bounds=null,this._rstBoundPoints=null,this._sp&&(this._sp._renderType=0),this._sp=null},e.clear=function(){if(this._one=null,this._render=this._renderEmpty,this._cmds=null,this._temp&&(this._temp.length=0),this._sp&&(this._sp._renderType&=-2),this._sp&&(this._sp._renderType&=-257),this._repaint(),this._vectorgraphArray){for(var t=0,e=this._vectorgraphArray.length;e>t;t++)VectorGraphManager.getInstance().deleteShape(this._vectorgraphArray[t]);this._vectorgraphArray.length=0}},e._repaint=function(){this._temp&&(this._temp.length=0),this._sp&&this._sp.repaint()},e._isOnlyOne=function(){return!this._cmds||0===this._cmds.length},e.getBounds=function(){return(!this._bounds||!this._temp||this._temp.length<1)&&(this._bounds=Rectangle._getWrapRec(this.getBoundPoints(),this._bounds)),this._bounds},e.getBoundPoints=function(){return(!this._temp||this._temp.length<1)&&(this._temp=this._getCmdPoints()),this._rstBoundPoints=Utils.copyArray(this._rstBoundPoints,this._temp)},e._addCmd=function(t){this._cmds=this._cmds||[],t.callee=t.shift(),this._cmds.push(t)},e._getCmdPoints=function(){var e,i=Render._context,n=this._cmds;if(e=this._temp||(this._temp=[]),e.length=0,n||null==this._one||(t._tempCmds.length=0,t._tempCmds.push(this._one),n=t._tempCmds),!n)return e;var s;s=t._tempMatrixArrays,s.length=0;var r=t._initMatrix;r.identity();for(var a,o=t._tempMatrix,h=0,l=n.length;l>h;h++)switch(a=n[h],a.callee){case i.save:case 7:s.push(r),r=r.clone();break;case i.restore:case 8:r=s.pop();break;case i._scale:case 5:o.identity(),o.translate(-a[2],-a[3]),o.scale(a[0],a[1]),o.translate(a[2],a[3]),this._switchMatrix(r,o);break;case i._rotate:case 3:o.identity(),o.translate(-a[1],-a[2]),o.rotate(a[0]),o.translate(a[1],a[2]),this._switchMatrix(r,o);break;case i._translate:case 6:o.identity(),o.translate(a[0],a[1]),this._switchMatrix(r,o);break;case i._transform:case 4:o.identity(),o.translate(-a[1],-a[2]),o.concat(a[0]),o.translate(a[1],a[2]),this._switchMatrix(r,o);break;case 16:case 24:t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0],a[1],a[2],a[3]),r);break;case 17:r.copyTo(o),o.concat(a[4]),t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0],a[1],a[2],a[3]),o);break;case i._drawTexture:case i._fillTexture:if(a[3]&&a[4])t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],a[3],a[4]),r);else{var u=a[0];t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],u.width,u.height),r)}break;case i._drawTextureWithTransform:var c;a[5]?(r.copyTo(o),o.concat(a[5]),c=o):c=r,a[3]&&a[4]?t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],a[3],a[4]),c):(u=a[0],t._addPointArrToRst(e,Rectangle._getBoundPointS(a[1],a[2],u.width,u.height),c));break;case i._drawRect:case 13:t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0],a[1],a[2],a[3]),r);break;case i._drawCircle:case i._fillCircle:case 14:t._addPointArrToRst(e,Rectangle._getBoundPointS(a[0]-a[2],a[1]-a[2],a[2]+a[2],a[2]+a[2]),r);break;case i._drawLine:case 20:t._tempPoints.length=0;var _=NaN;_=.5*a[5],a[0]==a[2]?t._tempPoints.push(a[0]+_,a[1],a[2]+_,a[3],a[0]-_,a[1],a[2]-_,a[3]):a[1]==a[3]?t._tempPoints.push(a[0],a[1]+_,a[2],a[3]+_,a[0],a[1]-_,a[2],a[3]-_):t._tempPoints.push(a[0],a[1],a[2],a[3]),t._addPointArrToRst(e,t._tempPoints,r);break;case i._drawCurves:case 22:t._addPointArrToRst(e,Bezier.I.getBezierPoints(a[2]),r,a[0],a[1]);break;case i._drawPoly:case i._drawLines:case 18:t._addPointArrToRst(e,a[2],r,a[0],a[1]);break;case i._drawPath:case 19:t._addPointArrToRst(e,this._getPathPoints(a[2]),r,a[0],a[1]);break;case i._drawPie:case 15:t._addPointArrToRst(e,this._getPiePoints(a[0],a[1],a[2],a[3],a[4]),r)}return e.length>200?e=Utils.copyArray(e,Rectangle._getWrapRec(e)._getBoundPoints()):e.length>8&&(e=GrahamScan.scanPList(e)),e},e._switchMatrix=function(t,e){e.concat(t),e.copyTo(t)},e.drawTexture=function(t,e,i,n,s,r,a){if(void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=1),t&&(n||(n=t.sourceWidth),s||(s=t.sourceHeight),n=n-t.sourceWidth+t.width,s=s-t.sourceHeight+t.height,!t.loaded||!(0>=n||0>=s))){e+=t.offsetX,i+=t.offsetY,this._sp&&(this._sp._renderType|=256);var o=[t,e,i,n,s,r,a];o.callee=r||1!=a?Render._context._drawTextureWithTransform:Render._context._drawTexture,null!=this._one||r||1!=a?this._saveToCmd(o.callee,o):(this._one=o,this._render=this._renderOneImg),t.loaded||t.once("loaded",this,this._textureLoaded,[t,o]),this._repaint()}},e.cleanByTexture=function(t,e,i,n,s){return void 0===n&&(n=0),void 0===s&&(s=0),t?void(this._one&&this._render===this._renderOneImg?(n||(n=t.sourceWidth),s||(s=t.sourceHeight),n=n-t.sourceWidth+t.width,s=s-t.sourceHeight+t.height,e+=t.offsetX,i+=t.offsetY,this._one[0]=t,this._one[1]=e,this._one[2]=i,this._one[3]=n,this._one[4]=s):(this.clear(),t&&this.drawTexture(t,e,i,n,s))):this.clear()},e.drawTextures=function(t,e){t&&this._saveToCmd(Render._context._drawTextures,[t,e])},e.fillTexture=function(t,e,i,n,s,r,a){if(void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r="repeat"),t){var o=[t,e,i,n,s,r,a||Point.EMPTY,{}];t.loaded||t.once("loaded",this,this._textureLoaded,[t,o]),this._saveToCmd(Render._context._fillTexture,o)}},e._textureLoaded=function(t,e){e[3]=e[3]||t.width,e[4]=e[4]||t.height,this._repaint()},e._saveToCmd=function(t,e){return this._sp&&(this._sp._renderType|=256),null==this._one?(this._one=e,this._render=this._renderOne):(this._sp&&(this._sp._renderType&=-2),this._render=this._renderAll,0===(this._cmds||(this._cmds=[])).length&&this._cmds.push(this._one),this._cmds.push(e)),e.callee=t,this._temp&&(this._temp.length=0),this._repaint(),e},e.clipRect=function(t,e,i,n){this._saveToCmd(Render._context._clipRect,[t,e,i,n])},e.fillText=function(t,e,i,n,s,r){this._saveToCmd(Render._context._fillText,[t,e,i,n||Font.defaultFont,s,r])},e.fillBorderText=function(t,e,i,n,s,r,a,o){this._saveToCmd(Render._context._fillBorderText,[t,e,i,n||Font.defaultFont,s,r,a,o])},e.strokeText=function(t,e,i,n,s,r,a){this._saveToCmd(Render._context._strokeText,[t,e,i,n||Font.defaultFont,s,r,a])},e.alpha=function(t){this._saveToCmd(Render._context._alpha,[t])},e.transform=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this._saveToCmd(Render._context._transform,[t,e,i])},e.rotate=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this._saveToCmd(Render._context._rotate,[t,e,i])},e.scale=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this._saveToCmd(Render._context._scale,[t,e,i,n])},e.translate=function(t,e){this._saveToCmd(Render._context._translate,[t,e])},e.save=function(){this._saveToCmd(Render._context._save,[])},e.restore=function(){this._saveToCmd(Render._context._restore,[])},e.replaceText=function(t){this._repaint();var e=this._cmds;if(e){for(var i=e.length-1;i>-1;i--)if(this._isTextCmd(e[i].callee))return e[i][0].toUpperCase?e[i][0]=t:e[i][0].setText(t),!0}else if(this._one&&this._isTextCmd(this._one.callee))return this._one[0].toUpperCase?this._one[0]=t:this._one[0].setText(t),!0;return!1},e._isTextCmd=function(t){return t===Render._context._fillText||t===Render._context._fillBorderText||t===Render._context._strokeText},e.replaceTextColor=function(t){this._repaint();var e=this._cmds;if(e)for(var i=e.length-1;i>-1;i--)this._isTextCmd(e[i].callee)&&(e[i][4]=t,e[i][0].toUpperCase||(e[i][0].changed=!0));else this._one&&this._isTextCmd(this._one.callee)&&(this._one[4]=t,this._one[0].toUpperCase||(this._one[0].changed=!0))},e.loadImage=function(t,e,i,n,s,r){function a(t){t&&(o.drawTexture(t,e,i,n,s),null!=r&&r.call(o._sp,t))}var o=this;void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0);var h=Loader.getRes(t);h?a(h):Laya.loader.load(t,Handler.create(null,a),null,"image")},e._renderEmpty=function(t,e,i,n){},e._renderAll=function(t,e,i,n){for(var s,r=this._cmds,a=0,o=r.length;o>a;a++)(s=r[a]).callee.call(e,i,n,s)},e._renderOne=function(t,e,i,n){this._one.callee.call(e,i,n,this._one)},e._renderOneImg=function(t,e,i,n){this._one.callee.call(e,i,n,this._one),2305!==t._renderType&&(t._renderType|=1)},e.drawLine=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=0;Render.isWebGL&&(a=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(a));var o=[t+.5,e+.5,i+.5,n+.5,s,r,a];this._saveToCmd(Render._context._drawLine,o)},e.drawLines=function(t,e,i,n,s){void 0===s&&(s=1);var r=0;Render.isWebGL&&(r=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(r));var a=[t+.5,e+.5,i,n,s,r];this._saveToCmd(Render._context._drawLines,a)},e.drawCurves=function(t,e,i,n,s){void 0===s&&(s=1);var r=[t+.5,e+.5,i,n,s];this._saveToCmd(Render._context._drawCurves,r)},e.drawRect=function(t,e,i,n,s,r,a){void 0===a&&(a=1);var o=r?.5:0,h=[t+o,e+o,i,n,s,r,a];this._saveToCmd(Render._context._drawRect,h)},e.drawCircle=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=s?.5:0,o=0;Render.isWebGL&&(o=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(o));var h=[t+a,e+a,i,n,s,r,o];this._saveToCmd(Render._context._drawCircle,h)},e.drawPie=function(t,e,i,n,s,r,a,o){void 0===o&&(o=1);var h=a?.5:0,l=0;Render.isWebGL&&(l=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(l));var u=[t+h,e+h,i,n,s,r,a,o,l];u[3]=Utils.toRadian(n),u[4]=Utils.toRadian(s),this._saveToCmd(Render._context._drawPie,u)},e._getPiePoints=function(e,i,n,s,r){var a=t._tempPoints;t._tempPoints.length=0,a.push(e,i);var o=Math.PI/10,h=NaN;for(h=s;r>h;h+=o)a.push(e+n*Math.cos(h),i+n*Math.sin(h));return r!=h&&a.push(e+n*Math.cos(r),i+n*Math.sin(r)),a},e.drawPoly=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=s?.5:0,o=0;if(Render.isWebGL){o=VectorGraphManager.getInstance().getId(),null==this._vectorgraphArray&&(this._vectorgraphArray=[]),this._vectorgraphArray.push(o);var h=!1;h=!(i.length>6)}var l=[t+a,e+a,i,n,s,r,o,h];this._saveToCmd(Render._context._drawPoly,l)},e._getPathPoints=function(e){var i=0,n=0,s=t._tempPoints;s.length=0,n=e.length;var r;for(i=0;n>i;i++)r=e[i],r.length>1&&(s.push(r[1],r[2]),r.length>3&&s.push(r[3],r[4]));return s},e.drawPath=function(t,e,i,n,s){var r=[t+.5,e+.5,i,n,s];this._saveToCmd(Render._context._drawPath,r)},__getset(0,e,"cmds",function(){return this._cmds},function(t){this._sp&&(this._sp._renderType|=256),this._cmds=t,this._render=this._renderAll,this._repaint()}),t.__init__=function(){if(Render.isConchNode){for(var t=laya.display.Graphics.prototype,e=ConchGraphics.prototype,i=["clear","destroy","alpha","rotate","transform","scale","translate","save","restore","clipRect","blendMode","fillText","fillBorderText","_fands","drawRect","drawCircle","drawPie","drawPoly","drawPath","drawImageM","drawLine","drawLines","_drawPs","drawCurves","replaceText","replaceTextColor","_fillImage","fillTexture","setSkinMesh","drawParticle","drawImageS"],n=0,s=i.length;s>=n;n++){var r=i[n];t[r]=e[r]}t._saveToCmd=null,e.drawImageS&&(t.drawTextures=function(t,e){if(t&&t.loaded&&t.bitmap&&t.source){var i=t.uv,n=t.bitmap.width,s=t.bitmap.height;this.drawImageS(t.bitmap.source,i[0]*n,i[1]*s,(i[2]-i[0])*n,(i[5]-i[3])*s,t.offsetX,t.offsetY,t.width,t.height,e)}}),t.drawTexture=function(t,e,i,n,s,r){if(void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),t&&t.loaded&&t.bitmap&&t.source&&(n||(n=t.sourceWidth),s||(s=t.sourceHeight),n=n-t.sourceWidth+t.width,s=s-t.sourceHeight+t.height,!(0>=n||0>=s))){e+=t.offsetX,i+=t.offsetY;var a=t.uv,o=t.bitmap.width,h=t.bitmap.height;this.drawImageM(t.bitmap.source,a[0]*o,a[1]*h,(a[2]-a[0])*o,(a[5]-a[3])*h,e,i,n,s,r)}},t.fillTexture=function(t,e,i,n,s,r,a){if(void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r="repeat"),t&&t.loaded){var o,h=Render._context.ctx,l=t.bitmap.width,u=t.bitmap.height,c=t.uv;o=t.uv!=Texture.DEF_UV?h.createPattern(t.bitmap.source,r,c[0]*l,c[1]*u,(c[2]-c[0])*l,(c[5]-c[3])*u):h.createPattern(t.bitmap.source,r);var _=0,d=0;a&&(e+=a.x%t.width,i+=a.y%t.height,_-=a.x%t.width,d-=a.y%t.height),this._fillImage(o,e,i,_,d,n,s)}}}},t._addPointArrToRst=function(e,i,n,s,r){void 0===s&&(s=0),void 0===r&&(r=0);var a=0,o=0;for(o=i.length,a=0;o>a;a+=2)t._addPointToRst(e,i[a]+s,i[a+1]+r,n)},t._addPointToRst=function(t,e,i,n){var s=Point.TEMP;s.setTo(e?e:0,i?i:0),n.transformPoint(s),t.push(s.x,s.y)},t._tempPoints=[],t._tempMatrixArrays=[],t._tempCmds=[],__static(t,["_tempMatrix",function(){return this._tempMatrix=new Matrix},"_initMatrix",function(){return this._initMatrix=new Matrix}]),t}(),Event=function(){function t(){}__class(t,"laya.events.Event");var e=t.prototype;return e.setTo=function(t,e,i){
|
||
return this.type=t,this.currentTarget=e,this.target=i,this},e.stopPropagation=function(){this._stoped=!0},__getset(0,e,"stageY",function(){return Laya.stage.mouseY}),__getset(0,e,"charCode",function(){return this.nativeEvent.charCode}),__getset(0,e,"touches",function(){var t=this.nativeEvent.touches;if(t)for(var e=Laya.stage,i=0,n=t.length;n>i;i++){var s=t[i],r=Point.TEMP;r.setTo(s.clientX,s.clientY),e._canvasTransform.invertTransformPoint(r),e.transform.invertTransformPoint(r),s.stageX=r.x,s.stageY=r.y}return t}),__getset(0,e,"keyLocation",function(){return this.nativeEvent.keyLocation}),__getset(0,e,"ctrlKey",function(){return this.nativeEvent.ctrlKey}),__getset(0,e,"altKey",function(){return this.nativeEvent.altKey}),__getset(0,e,"shiftKey",function(){return this.nativeEvent.shiftKey}),__getset(0,e,"stageX",function(){return Laya.stage.mouseX}),t.EMPTY=new t,t.MOUSE_DOWN="mousedown",t.MOUSE_UP="mouseup",t.CLICK="click",t.RIGHT_MOUSE_DOWN="rightmousedown",t.RIGHT_MOUSE_UP="rightmouseup",t.RIGHT_CLICK="rightclick",t.MOUSE_MOVE="mousemove",t.MOUSE_OVER="mouseover",t.MOUSE_OUT="mouseout",t.MOUSE_WHEEL="mousewheel",t.ROLL_OVER="mouseover",t.ROLL_OUT="mouseout",t.DOUBLE_CLICK="doubleclick",t.CHANGE="change",t.CHANGED="changed",t.RESIZE="resize",t.ADDED="added",t.REMOVED="removed",t.DISPLAY="display",t.UNDISPLAY="undisplay",t.ERROR="error",t.COMPLETE="complete",t.LOADED="loaded",t.PROGRESS="progress",t.INPUT="input",t.RENDER="render",t.OPEN="open",t.MESSAGE="message",t.CLOSE="close",t.KEY_DOWN="keydown",t.KEY_PRESS="keypress",t.KEY_UP="keyup",t.FRAME="enterframe",t.DRAG_START="dragstart",t.DRAG_MOVE="dragmove",t.DRAG_END="dragend",t.ENTER="enter",t.SELECT="select",t.BLUR="blur",t.FOCUS="focus",t.PLAYED="played",t.PAUSED="paused",t.STOPPED="stopped",t.START="start",t.END="end",t.ENABLED_CHANGED="enabledchanged",t.COMPONENT_ADDED="componentadded",t.COMPONENT_REMOVED="componentremoved",t.ACTIVE_CHANGED="activechanged",t.LAYER_CHANGED="layerchanged",t.HIERARCHY_LOADED="hierarchyloaded",t.RECOVERING="recovering",t.RECOVERED="recovered",t.RELEASED="released",t.LINK="link",t.LABEL="label",t.FULL_SCREEN_CHANGE="fullscreenchange",t.DEVICE_LOST="devicelost",t.MESH_CHANGED="meshchanged",t.MATERIAL_CHANGED="materialchanged",t.RENDERQUEUE_CHANGED="renderqueuechanged",t.WORLDMATRIX_NEEDCHANGE="worldmatrixneedchanged",t.ANIMATION_CHANGED="animationchanged",t}(),Keyboard=function(){function t(){}return __class(t,"laya.events.Keyboard"),t.NUMBER_0=48,t.NUMBER_1=49,t.NUMBER_2=50,t.NUMBER_3=51,t.NUMBER_4=52,t.NUMBER_5=53,t.NUMBER_6=54,t.NUMBER_7=55,t.NUMBER_8=56,t.NUMBER_9=57,t.A=65,t.B=66,t.C=67,t.D=68,t.E=69,t.F=70,t.G=71,t.H=72,t.I=73,t.J=74,t.K=75,t.L=76,t.M=77,t.N=78,t.O=79,t.P=80,t.Q=81,t.R=82,t.S=83,t.T=84,t.U=85,t.V=86,t.W=87,t.X=88,t.Y=89,t.Z=90,t.F1=112,t.F2=113,t.F3=114,t.F4=115,t.F5=116,t.F6=117,t.F7=118,t.F8=119,t.F9=120,t.F10=121,t.F11=122,t.F12=123,t.F13=124,t.F14=125,t.F15=126,t.NUMPAD=21,t.NUMPAD_0=96,t.NUMPAD_1=97,t.NUMPAD_2=98,t.NUMPAD_3=99,t.NUMPAD_4=100,t.NUMPAD_5=101,t.NUMPAD_6=102,t.NUMPAD_7=103,t.NUMPAD_8=104,t.NUMPAD_9=105,t.NUMPAD_ADD=107,t.NUMPAD_DECIMAL=110,t.NUMPAD_DIVIDE=111,t.NUMPAD_ENTER=108,t.NUMPAD_MULTIPLY=106,t.NUMPAD_SUBTRACT=109,t.SEMICOLON=186,t.EQUAL=187,t.COMMA=188,t.MINUS=189,t.PERIOD=190,t.SLASH=191,t.BACKQUOTE=192,t.LEFTBRACKET=219,t.BACKSLASH=220,t.RIGHTBRACKET=221,t.QUOTE=222,t.ALTERNATE=18,t.BACKSPACE=8,t.CAPS_LOCK=20,t.COMMAND=15,t.CONTROL=17,t.DELETE=46,t.ENTER=13,t.ESCAPE=27,t.PAGE_UP=33,t.PAGE_DOWN=34,t.END=35,t.HOME=36,t.LEFT=37,t.UP=38,t.RIGHT=39,t.DOWN=40,t.SHIFT=16,t.SPACE=32,t.TAB=9,t.INSERT=45,t}(),KeyBoardManager=function(){function t(){}return __class(t,"laya.events.KeyBoardManager"),t.__init__=function(){t._addEvent("keydown"),t._addEvent("keypress"),t._addEvent("keyup")},t._addEvent=function(t){Browser.document.addEventListener(t,function(e){laya.events.KeyBoardManager._dispatch(e,t)},!0)},t._dispatch=function(e,i){if(t.enabled){t._event._stoped=!1,t._event.nativeEvent=e,t._event.keyCode=e.keyCode||e.which||e.charCode,"keydown"===i?t._pressKeys[t._event.keyCode]=!0:"keyup"===i&&(t._pressKeys[t._event.keyCode]=null);for(var n=Laya.stage.focus&&null!=Laya.stage.focus.event?Laya.stage.focus:Laya.stage,s=n;s;)s.event(i,t._event.setTo(i,s,n)),s=s.parent}},t.hasKeyDown=function(e){return t._pressKeys[e]},t._pressKeys={},t.enabled=!0,__static(t,["_event",function(){return this._event=new Event}]),t}(),KeyLocation=function(){function t(){}return __class(t,"laya.events.KeyLocation"),t.STANDARD=0,t.LEFT=1,t.RIGHT=2,t.NUM_PAD=3,t}(),MouseManager=function(){function t(){this.mouseX=0,this.mouseY=0,this.disableMouseEvent=!1,this.mouseDownTime=0,this.mouseMoveAccuracy=2,this._stage=null,this._target=null,this._lastOvers=[],this._currOvers=[],this._lastClickTimer=0,this._lastMoveTimer=0,this._isDoubleClick=!1,this._isLeftMouse=!1,this._eventList=[],this._touchIDs={},this._id=1,this._event=new Event,this._matrix=new Matrix,this._point=new Point,this._rect=new Rectangle,this._prePoint=new Point}__class(t,"laya.events.MouseManager");var e=t.prototype;return e.__init__=function(e,i){var n=this;this._stage=e;var s=this,r=this._eventList;i.oncontextmenu=function(e){return t.enabled?!1:void 0},i.addEventListener("mousedown",function(e){t.enabled&&(e.preventDefault(),r.push(e),s.mouseDownTime=Browser.now())}),i.addEventListener("mouseup",function(e){t.enabled&&(e.preventDefault(),r.push(e),s.mouseDownTime=-Browser.now())},!0),i.addEventListener("mousemove",function(e){if(t.enabled){e.preventDefault();var i=Browser.now();if(i-s._lastMoveTimer<10)return;s._lastMoveTimer=i,r.push(e)}},!0),i.addEventListener("mouseout",function(e){t.enabled&&r.push(e)}),i.addEventListener("mouseover",function(e){t.enabled&&r.push(e)}),i.addEventListener("touchstart",function(e){t.enabled&&(r.push(e),n.runEvent(),Input.isInputting||e.preventDefault(),s.mouseDownTime=Browser.now())}),i.addEventListener("touchend",function(e){t.enabled&&(Input.isInputting||e.preventDefault(),r.push(e),s.mouseDownTime=-Browser.now())},!0),i.addEventListener("touchmove",function(e){t.enabled&&(e.preventDefault(),r.push(e))},!0),i.addEventListener("mousewheel",function(e){t.enabled&&r.push(e)}),i.addEventListener("DOMMouseScroll",function(e){t.enabled&&r.push(e)})},e.initEvent=function(t,e){var i=this;i._event._stoped=!1,i._event.nativeEvent=e||t,i._target=null,this._point.setTo(t.clientX,t.clientY),this._stage._canvasTransform.invertTransformPoint(this._point),i.mouseX=this._point.x,i.mouseY=this._point.y,i._event.touchId=t.identifier||0},e.checkMouseWheel=function(t){this._event.delta=t.wheelDelta?.025*t.wheelDelta:-t.detail;for(var e=0,i=this._lastOvers.length;i>e;e++){var n=this._lastOvers[e];n.event("mousewheel",this._event.setTo("mousewheel",n,this._target))}this._stage.event("mousewheel",this._event.setTo("mousewheel",this._stage,this._target))},e.checkMouseOut=function(){if(!this.disableMouseEvent){for(var t=0,e=this._lastOvers.length;e>t;t++){var i=this._lastOvers[t];!i.destroyed&&this._currOvers.indexOf(i)<0&&(i._set$P("$_MOUSEOVER",!1),i.event("mouseout",this._event.setTo("mouseout",i,this._target)))}var n=this._lastOvers;this._lastOvers=this._currOvers,this._currOvers=n,this._currOvers.length=0}},e.onMouseMove=function(t){this.sendMouseMove(t),this._event._stoped=!1,this.sendMouseOver(this._target)},e.sendMouseMove=function(t){t.event("mousemove",this._event.setTo("mousemove",t,this._target)),!this._event._stoped&&t.parent&&this.sendMouseMove(t.parent)},e.sendMouseOver=function(t){(t.parent||t===this._stage)&&(t._get$P("$_MOUSEOVER")||(t._set$P("$_MOUSEOVER",!0),t.event("mouseover",this._event.setTo("mouseover",t,this._target))),this._currOvers.push(t)),!this._event._stoped&&t.parent&&this.sendMouseOver(t.parent)},e.onMouseDown=function(t){Input.isInputting&&Laya.stage.focus&&Laya.stage.focus.focus&&!Laya.stage.focus.contains(this._target)&&(Laya.stage.focus.focus=!1),this._onMouseDown(t)},e._onMouseDown=function(t){this._isLeftMouse?(t._set$P("$_MOUSEDOWN",this._touchIDs[this._event.touchId]),t.event("mousedown",this._event.setTo("mousedown",t,this._target))):(t._set$P("$_RIGHTMOUSEDOWN",this._touchIDs[this._event.touchId]),t.event("rightmousedown",this._event.setTo("rightmousedown",t,this._target))),!this._event._stoped&&t.parent&&this.onMouseDown(t.parent)},e.onMouseUp=function(t){var e=this._isLeftMouse?"mouseup":"rightmouseup";this.sendMouseUp(t,e),this._event._stoped=!1,this.sendClick(this._target,e)},e.sendMouseUp=function(t,e){t.event(e,this._event.setTo(e,t,this._target)),!this._event._stoped&&t.parent&&this.sendMouseUp(t.parent,e)},e.sendClick=function(t,e){t.destroyed||("mouseup"===e&&t._get$P("$_MOUSEDOWN")===this._touchIDs[this._event.touchId]?(t._set$P("$_MOUSEDOWN",-1),t.event("click",this._event.setTo("click",t,this._target)),this._isDoubleClick&&t.event("doubleclick",this._event.setTo("doubleclick",t,this._target))):"rightmouseup"===e&&t._get$P("$_RIGHTMOUSEDOWN")===this._touchIDs[this._event.touchId]&&(t._set$P("$_RIGHTMOUSEDOWN",-1),t.event("rightclick",this._event.setTo("rightclick",t,this._target))),!this._event._stoped&&t.parent&&this.sendClick(t.parent,e))},e.check=function(t,e,i,n){var s=t.transform||this._matrix,r=t.pivotX,a=t.pivotY;if(0===r&&0===a)s.setTranslate(t.x,t.y);else if(s===this._matrix)s.setTranslate(t.x-r,t.y-a);else{var o=s.cos,h=s.sin;s.setTranslate(t.x-(r*o-a*h)*t.scaleX,t.y-(r*h+a*o)*t.scaleY)}s.invertTransformPoint(this._point.setTo(e,i)),s.setTranslate(0,0),e=this._point.x,i=this._point.y;var l=t.scrollRect;if(l){this._rect.setTo(0,0,l.width,l.height);var u=this._rect.contains(e,i);if(!u)return!1}if(!this.disableMouseEvent){var c=!1;if(t.hitTestPrior&&!t.mouseThrough&&!this.hitTest(t,e,i))return!1;for(var _=t._childs.length-1;_>-1;_--){var d=t._childs[_];if(!d.destroyed&&d.mouseEnabled&&d.visible&&(c=this.check(d,e+(l?l.x:0),i+(l?l.y:0),n)))return!0}}return u=this.hitTest(t,e,i),u?(this._target=t,n.call(this,t)):n===this.onMouseUp&&t===this._stage&&(this._target=this._stage,n.call(this,this._target)),u},e.hitTest=function(t,e,i){var n=!1;if(t.hitArea instanceof laya.utils.HitArea)return t.hitArea.isHit(e,i);if(t.width>0&&t.height>0||t.mouseThrough||t.hitArea){var s=this._rect;t.mouseThrough?n=t.getGraphicBounds().contains(e,i):(t.hitArea?s=t.hitArea:s.setTo(0,0,t.width,t.height),n=s.contains(e,i))}return n},e.runEvent=function(){var e=this._eventList.length;if(e){for(var i=this,n=0;e>n;){var s=this._eventList[n];switch("mousemove"!==s.type&&(this._prePoint.x=this._prePoint.y=-1e6),s.type){case"mousedown":this._touchIDs[0]=this._id++,t._isTouchRespond?t._isTouchRespond=!1:(i._isLeftMouse=0===s.button,i.initEvent(s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseDown));break;case"mouseup":i._isLeftMouse=0===s.button;var r=Browser.now();i._isDoubleClick=r-i._lastClickTimer<300,i._lastClickTimer=r,i.initEvent(s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseUp);break;case"mousemove":Math.abs(this._prePoint.x-s.clientX)+Math.abs(this._prePoint.y-s.clientY)>=this.mouseMoveAccuracy&&(this._prePoint.x=s.clientX,this._prePoint.y=s.clientY,i.initEvent(s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseMove),i.checkMouseOut());break;case"touchstart":t._isTouchRespond=!0,i._isLeftMouse=!0;for(var a=s.changedTouches,o=0,h=a.length;h>o;o++){var l=a[o];this._id%200===0&&(this._touchIDs={}),this._touchIDs[l.identifier]=this._id++,i.initEvent(l,s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseDown)}break;case"touchend":t._isTouchRespond=!0,i._isLeftMouse=!0,r=Browser.now(),i._isDoubleClick=r-i._lastClickTimer<300,i._lastClickTimer=r;var u=s.changedTouches;for(o=0,h=u.length;h>o;o++)i.initEvent(u[o],s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseUp);break;case"touchmove":var c=s.changedTouches;for(o=0,h=c.length;h>o;o++)i.initEvent(c[o],s),i.check(i._stage,i.mouseX,i.mouseY,i.onMouseMove);i.checkMouseOut();break;case"wheel":case"mousewheel":case"DOMMouseScroll":i.checkMouseWheel(s);break;case"mouseout":i._stage.event("mouseout",i._event.setTo("mouseout",i._stage,i._stage));break;case"mouseover":i._stage.event("mouseover",i._event.setTo("mouseover",i._stage,i._stage))}n++}this._eventList.length=0}},t.enabled=!0,t._isTouchRespond=!1,__static(t,["instance",function(){return this.instance=new t}]),t}(),Filter=function(){function t(){this._action=null}__class(t,"laya.filters.Filter");var e=t.prototype;return Laya.imps(e,{"laya.filters.IFilter":!0}),e.callNative=function(t){},__getset(0,e,"type",function(){return-1}),__getset(0,e,"action",function(){return this._action}),t.BLUR=16,t.COLOR=32,t.GLOW=8,t._filterStart=null,t._filterEnd=null,t._EndTarget=null,t._recycleScope=null,t._filter=null,t._useSrc=null,t._endSrc=null,t._useOut=null,t._endOut=null,t}(),ColorFilterAction=function(){function t(){this.data=null}__class(t,"laya.filters.ColorFilterAction");var e=t.prototype;return Laya.imps(e,{"laya.filters.IFilterAction":!0}),e.apply=function(t){var e=t.ctx.ctx,i=t.ctx.ctx.canvas;if(0==i.width||0==i.height)return i;for(var n,s=e.getImageData(0,0,i.width,i.height),r=s.data,a=0,o=r.length;o>a;a+=4)n=this.getColor(r[a],r[a+1],r[a+2],r[a+3]),0!=r[a+3]&&(r[a]=n[0],r[a+1]=n[1],r[a+2]=n[2],r[a+3]=n[3]);return e.putImageData(s,0,0),t},e.getColor=function(t,e,i,n){var s=[];if(this.data._mat&&this.data._alpha){var r=this.data._mat,a=this.data._alpha;s[0]=r[0]*t+r[1]*e+r[2]*i+r[3]*n+a[0],s[1]=r[4]*t+r[5]*e+r[6]*i+r[7]*n+a[1],s[2]=r[8]*t+r[9]*e+r[10]*i+r[11]*n+a[2],s[3]=r[12]*t+r[13]*e+r[14]*i+r[15]*n+a[3]}return s},t}(),Arith=function(){function t(){}return __class(t,"laya.maths.Arith"),t.formatR=function(t){return t>Math.PI&&(t-=2*Math.PI),t<-Math.PI&&(t+=2*Math.PI),t},t.isPOT=function(t,e){return t>0&&0===(t&t-1)&&e>0&&0===(e&e-1)},t.setMatToArray=function(t,e){t.a,t.b,t.c,t.d,t.tx+20,t.ty+20,1,e[0]=t.a,e[1]=t.b,e[4]=t.c,e[5]=t.d,e[12]=t.tx,e[13]=t.ty},t}(),Bezier=function(){function t(){this._controlPoints=[new Point,new Point,new Point],this._calFun=this.getPoint2}__class(t,"laya.maths.Bezier");var e=t.prototype;return e._switchPoint=function(t,e){var i=this._controlPoints.shift();i.setTo(t,e),this._controlPoints.push(i)},e.getPoint2=function(t,e){var i=this._controlPoints[0],n=this._controlPoints[1],s=this._controlPoints[2],r=Math.pow(1-t,2)*i.x+2*t*(1-t)*n.x+Math.pow(t,2)*s.x,a=Math.pow(1-t,2)*i.y+2*t*(1-t)*n.y+Math.pow(t,2)*s.y;e.push(r,a)},e.getPoint3=function(t,e){var i=this._controlPoints[0],n=this._controlPoints[1],s=this._controlPoints[2],r=this._controlPoints[3],a=Math.pow(1-t,3)*i.x+3*n.x*t*(1-t)*(1-t)+3*s.x*t*t*(1-t)+r.x*Math.pow(t,3),o=Math.pow(1-t,3)*i.y+3*n.y*t*(1-t)*(1-t)+3*s.y*t*t*(1-t)+r.y*Math.pow(t,3);e.push(a,o)},e.insertPoints=function(t,e){var i=NaN;t=t>0?t:5;var n=NaN;for(n=1/t,i=0;1>=i;i+=n)this._calFun(i,e)},e.getBezierPoints=function(t,e,i){void 0===e&&(e=5),void 0===i&&(i=2);var n=0,s=0;if(s=t.length,2*(i+1)>s)return[];var r;switch(r=[],i){case 2:this._calFun=this.getPoint2;break;case 3:this._calFun=this.getPoint3;break;default:return[]}for(;this._controlPoints.length<=i;)this._controlPoints.push(new Point);for(n=0;2*i>n;n+=2)this._switchPoint(t[n],t[n+1]);for(n=2*i;s>n;n+=2)this._switchPoint(t[n],t[n+1]),n/2%i==0&&this.insertPoints(e,r);return r},__static(t,["I",function(){return this.I=new t}]),t}(),GrahamScan=function(){function t(){}return __class(t,"laya.maths.GrahamScan"),t.multiply=function(t,e,i){return(t.x-i.x)*(e.y-i.y)-(e.x-i.x)*(t.y-i.y)},t.dis=function(t,e){return(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)},t._getPoints=function(e,i,n){for(void 0===i&&(i=!1),t._mPointList||(t._mPointList=[]);t._mPointList.length<e;)t._mPointList.push(new Point);return n||(n=[]),n.length=0,i?t.getFrom(n,t._mPointList,e):t.getFromR(n,t._mPointList,e),n},t.getFrom=function(t,e,i){var n=0;for(n=0;i>n;n++)t.push(e[n]);return t},t.getFromR=function(t,e,i){var n=0;for(n=0;i>n;n++)t.push(e.pop());return t},t.pListToPointList=function(e,i){void 0===i&&(i=!1);var n=0,s=e.length/2,r=t._getPoints(s,i,t._tempPointList);for(n=0;s>n;n++)r[n].setTo(e[n+n],e[n+n+1]);return r},t.pointListToPlist=function(e){var i,n=0,s=e.length,r=t._temPList;for(r.length=0,n=0;s>n;n++)i=e[n],r.push(i.x,i.y);return r},t.scanPList=function(e){return Utils.copyArray(e,t.pointListToPlist(t.scan(t.pListToPointList(e,!0))))},t.scan=function(e){var i,n,s,r=0,a=0,o=0,h=e.length,l={};for(n=t._temArr,n.length=0,h=e.length,r=h-1;r>=0;r--)i=e[r],s=i.x+"_"+i.y,l.hasOwnProperty(s)||(l[s]=!0,n.push(i));for(h=n.length,Utils.copyArray(e,n),r=1;h>r;r++)(e[r].y<e[o].y||e[r].y==e[o].y&&e[r].x<e[o].x)&&(o=r);for(i=e[0],e[0]=e[o],e[o]=i,r=1;h-1>r;r++){for(o=r,a=r+1;h>a;a++)(t.multiply(e[a],e[o],e[0])>0||0==t.multiply(e[a],e[o],e[0])&&t.dis(e[0],e[a])<t.dis(e[0],e[o]))&&(o=a);i=e[r],e[r]=e[o],e[o]=i}if(n=t._temArr,n.length=0,e.length<3)return Utils.copyArray(n,e);for(n.push(e[0],e[1],e[2]),r=3;h>r;r++){for(;n.length>=2&&t.multiply(e[r],n[n.length-1],n[n.length-2])>=0;)n.pop();e[r]&&n.push(e[r])}return n},t._mPointList=null,t._tempPointList=[],t._temPList=[],t._temArr=[],t}(),MathUtil=function(){function t(){}return __class(t,"laya.maths.MathUtil"),t.subtractVector3=function(t,e,i){i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[2]},t.lerp=function(t,e,i){return t*(1-i)+e*i},t.scaleVector3=function(t,e,i){i[0]=t[0]*e,i[1]=t[1]*e,i[2]=t[2]*e},t.lerpVector3=function(t,e,i,n){var s=t[0],r=t[1],a=t[2];n[0]=s+i*(e[0]-s),n[1]=r+i*(e[1]-r),n[2]=a+i*(e[2]-a)},t.lerpVector4=function(t,e,i,n){var s=t[0],r=t[1],a=t[2],o=t[3];n[0]=s+i*(e[0]-s),n[1]=r+i*(e[1]-r),n[2]=a+i*(e[2]-a),n[3]=o+i*(e[3]-o)},t.slerpQuaternionArray=function(t,e,i,n,s,r,a){var o,h,l,u,c,_=t[e+0],d=t[e+1],f=t[e+2],p=t[e+3],g=i[n+0],m=i[n+1],v=i[n+2],y=i[n+3];return h=_*g+d*m+f*v+p*y,0>h&&(h=-h,g=-g,m=-m,v=-v,y=-y),1-h>1e-6?(o=Math.acos(h),l=Math.sin(o),u=Math.sin((1-s)*o)/l,c=Math.sin(s*o)/l):(u=1-s,c=s),r[a+0]=u*_+c*g,r[a+1]=u*d+c*m,r[a+2]=u*f+c*v,r[a+3]=u*p+c*y,r},t.getRotation=function(t,e,i,n){return Math.atan2(n-e,i-t)/Math.PI*180},t.sortBigFirst=function(t,e){return t==e?0:e>t?1:-1},t.sortSmallFirst=function(t,e){return t==e?0:e>t?-1:1},t.sortNumBigFirst=function(t,e){return parseFloat(e)-parseFloat(t)},t.sortNumSmallFirst=function(t,e){return parseFloat(t)-parseFloat(e)},t.sortByKey=function(e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!0);var s;return s=i?n?t.sortNumBigFirst:t.sortBigFirst:n?t.sortNumSmallFirst:t.sortSmallFirst,function(t,i){return s(t[e],i[e])}},t}(),Matrix=function(){function t(t,e,i,n,s,r){this.cos=1,this.sin=0,this.inPool=!1,this.bTransform=!1,void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=r,this._checkTransform()}__class(t,"laya.maths.Matrix");var e=t.prototype;return e.identity=function(){return this.a=this.d=1,this.b=this.tx=this.ty=this.c=0,this.bTransform=!1,this},e._checkTransform=function(){return this.bTransform=1!==this.a||0!==this.b||0!==this.c||1!==this.d},e.setTranslate=function(t,e){return this.tx=t,this.ty=e,this},e.translate=function(t,e){return this.tx+=t,this.ty+=e,this},e.scale=function(t,e){this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this.bTransform=!0},e.rotate=function(t){var e=this.cos=Math.cos(t),i=this.sin=Math.sin(t),n=this.a,s=this.c,r=this.tx;this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=r*e-this.ty*i,this.ty=r*i+this.ty*e,this.bTransform=!0},e.skew=function(t,e){var i=Math.tan(t),n=Math.tan(e),s=this.a,r=this.b;return this.a+=n*this.c,this.b+=n*this.d,this.c+=i*s,this.d+=i*r,this},e.invertTransformPoint=function(t){var e=this.a,i=this.b,n=this.c,s=this.d,r=this.tx,a=e*s-i*n,o=s/a,h=-i/a,l=-n/a,u=e/a,c=(n*this.ty-s*r)/a,_=-(e*this.ty-i*r)/a;return t.setTo(o*t.x+l*t.y+c,h*t.x+u*t.y+_)},e.transformPoint=function(t){return t.setTo(this.a*t.x+this.c*t.y+this.tx,this.b*t.x+this.d*t.y+this.ty)},e.transformPointArray=function(t,e){for(var i=t.length,n=0;i>n;n+=2){var s=t[n],r=t[n+1];e[n]=this.a*s+this.c*r+this.tx,e[n+1]=this.b*s+this.d*r+this.ty}return e},e.transformPointArrayScale=function(t,e){for(var i=t.length,n=0;i>n;n+=2){var s=t[n],r=t[n+1];e[n]=this.a*s+this.c*r,e[n+1]=this.b*s+this.d*r}return e},e.getScaleX=function(){return 0===this.b?this.a:Math.sqrt(this.a*this.a+this.b*this.b)},e.getScaleY=function(){return 0===this.c?this.d:Math.sqrt(this.c*this.c+this.d*this.d)},e.invert=function(){var t=this.a,e=this.b,i=this.c,n=this.d,s=this.tx,r=t*n-e*i;return this.a=n/r,this.b=-e/r,this.c=-i/r,this.d=t/r,this.tx=(i*this.ty-n*s)/r,this.ty=-(t*this.ty-e*s)/r,this},e.setTo=function(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=r,this},e.concat=function(t){var e=this.a,i=this.c,n=this.tx;return this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d,this.tx=n*t.a+this.ty*t.c+t.tx,this.ty=n*t.b+this.ty*t.d+t.ty,this},e.scaleEx=function(t,e){var i=this.a,n=this.b,s=this.c,r=this.d;0!==n||0!==s?(this.a=t*i,this.b=t*n,this.c=e*s,this.d=e*r):(this.a=t*i,this.b=0*r,this.c=0*i,this.d=e*r),this.bTransform=!0},e.rotateEx=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.a,s=this.b,r=this.c,a=this.d;0!==s||0!==r?(this.a=e*n+i*r,this.b=e*s+i*a,this.c=-i*n+e*r,this.d=-i*s+e*a):(this.a=e*n,this.b=i*a,this.c=-i*n,this.d=e*a),this.bTransform=!0},e.clone=function(){var e=t._cache,i=e._length?e[--e._length]:new t;return i.a=this.a,i.b=this.b,i.c=this.c,i.d=this.d,i.tx=this.tx,i.ty=this.ty,i.bTransform=this.bTransform,i},e.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t.bTransform=this.bTransform,t},e.toString=function(){return this.a+","+this.b+","+this.c+","+this.d+","+this.tx+","+this.ty},e.destroy=function(){if(!this.inPool){var e=t._cache;this.inPool=!0,e._length||(e._length=0),e[e._length++]=this,this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this.bTransform=!1}},t.mul=function(t,e,i){var n=t.a,s=t.b,r=t.c,a=t.d,o=t.tx,h=t.ty,l=e.a,u=e.b,c=e.c,_=e.d,d=e.tx,f=e.ty;return 0!==u||0!==c?(i.a=n*l+s*c,i.b=n*u+s*_,i.c=r*l+a*c,i.d=r*u+a*_,i.tx=l*o+c*h+d,i.ty=u*o+_*h+f):(i.a=n*l,i.b=s*_,i.c=r*l,i.d=a*_,i.tx=l*o+d,i.ty=_*h+f),i},t.mulPre=function(t,e,i,n,s,r,a,o){var h=t.a,l=t.b,u=t.c,c=t.d,_=t.tx,d=t.ty;return 0!==i||0!==n?(o.a=h*e+l*n,o.b=h*i+l*s,o.c=u*e+c*n,o.d=u*i+c*s,o.tx=e*_+n*d+r,o.ty=i*_+s*d+a):(o.a=h*e,o.b=l*s,o.c=u*e,o.d=c*s,o.tx=e*_+r,o.ty=s*d+a),o},t.mulPos=function(t,e,i,n,s,r,a,o){var h=t.a,l=t.b,u=t.c,c=t.d,_=t.tx,d=t.ty;return 0!==l||0!==u?(o.a=e*h+i*u,o.b=e*l+i*c,o.c=n*h+s*u,o.d=n*l+s*c,o.tx=h*r+u*a+_,o.ty=l*r+c*a+d):(o.a=e*h,o.b=i*c,o.c=n*h,o.d=s*c,o.tx=h*r+_,o.ty=c*a+d),o},t.preMul=function(t,e,i){var n=t.a,s=t.b,r=t.c,a=t.d,o=e.a,h=e.b,l=e.c,u=e.d,c=e.tx,_=e.ty;return i.a=o*n,i.b=i.c=0,i.d=u*a,i.tx=c*n+t.tx,i.ty=_*a+t.ty,0===h&&0===l&&0===s&&0===r||(i.a+=h*r,i.d+=l*s,i.b+=o*s+h*a,i.c+=l*n+u*r,i.tx+=_*r,i.ty+=c*s),i},t.preMulXY=function(t,e,i,n){var s=t.a,r=t.b,a=t.c,o=t.d;return n.a=s,n.b=r,n.c=a,n.d=o,n.tx=e*s+t.tx+i*a,n.ty=i*o+t.ty+e*r,n},t.create=function(){var e=t._cache,i=e._length?e[--e._length]:new t;return i.inPool=!1,i},t.EMPTY=new t,t.TEMP=new t,t._cache=[],t}(),Point=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}__class(t,"laya.maths.Point");var e=t.prototype;return e.setTo=function(t,e){return this.x=t,this.y=e,this},e.distance=function(t,e){return Math.sqrt((this.x-t)*(this.x-t)+(this.y-e)*(this.y-e))},e.toString=function(){return this.x+","+this.y},e.normalize=function(){var t=Math.sqrt(this.x*this.x+this.y*this.y);if(t>0){var e=1/t;this.x*=e,this.y*=e}},t.TEMP=new t,t.EMPTY=new t,t}(),Rectangle=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n}__class(t,"laya.maths.Rectangle");var e=t.prototype;return e.setTo=function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},e.contains=function(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.right&&e>=this.y&&e<this.bottom},e.intersects=function(t){return!(t.x>this.x+this.width||t.x+t.width<this.x||t.y>this.y+this.height||t.y+t.height<this.y)},e.intersection=function(e,i){return this.intersects(e)?(i||(i=new t),i.x=Math.max(this.x,e.x),i.y=Math.max(this.y,e.y),i.width=Math.min(this.right,e.right)-i.x,i.height=Math.min(this.bottom,e.bottom)-i.y,i):null},e.union=function(e,i){return i||(i=new t),this.clone(i),e.width<=0||e.height<=0?i:(i.addPoint(e.x,e.y),i.addPoint(e.right,e.bottom),this)},e.clone=function(e){return e||(e=new t),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},e.toString=function(){return this.x+","+this.y+","+this.width+","+this.height},e.equals=function(t){return!(!t||t.x!==this.x||t.y!==this.y||t.width!==this.width||t.height!==this.height)},e.addPoint=function(t,e){return this.x>t&&(this.width+=this.x-t,this.x=t),this.y>e&&(this.height+=this.y-e,this.y=e),this.width<t-this.x&&(this.width=t-this.x),this.height<e-this.y&&(this.height=e-this.y),this},e._getBoundPoints=function(){var e=t._temB;return e.length=0,0==this.width||0==this.height?e:(e.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),e)},e.isEmpty=function(){return this.width<=0||this.height<=0},__getset(0,e,"right",function(){return this.x+this.width}),__getset(0,e,"bottom",function(){return this.y+this.height}),t._getBoundPointS=function(e,i,n,s){var r=t._temA;return r.length=0,0==n||0==s?r:(r.push(e,i,e+n,i,e,i+s,e+n,i+s),r)},t._getWrapRec=function(e,i){if(!e||e.length<1)return i?i.setTo(0,0,0,0):t.TEMP.setTo(0,0,0,0);i=i?i:new t;var n,s,r,a,o,h=e.length,l=Point.TEMP;for(s=a=99999,r=o=-s,n=0;h>n;n+=2)l.x=e[n],l.y=e[n+1],s=s<l.x?s:l.x,a=a<l.y?a:l.y,r=r>l.x?r:l.x,o=o>l.y?o:l.y;return i.setTo(s,a,r-s,o-a)},t.EMPTY=new t,t.TEMP=new t,t._temB=[],t._temA=[],t}(),SoundManager=function(){function t(){}return __class(t,"laya.media.SoundManager"),__getset(1,t,"autoStopMusic",function(){return t._autoStopMusic},function(e){Laya.stage.off("blur",null,t._stageOnBlur),Laya.stage.off("focus",null,t._stageOnFocus),t._autoStopMusic=e,e&&(Laya.stage.on("blur",null,t._stageOnBlur),Laya.stage.on("focus",null,t._stageOnFocus))}),__getset(1,t,"muted",function(){return t._muted},function(e){e&&t.stopAll(),t._muted=e}),__getset(1,t,"musicMuted",function(){return t._musicMuted},function(e){e?(t._tMusic&&t.stopSound(t._tMusic),t._musicMuted=e):(t._musicMuted=e,t._tMusic&&t.playMusic(t._tMusic))}),__getset(1,t,"soundMuted",function(){return t._soundMuted},function(e){t._soundMuted=e}),t.addChannel=function(e){t._channels.indexOf(e)>=0||t._channels.push(e)},t.removeChannel=function(e){var i=0;for(i=t._channels.length-1;i>=0;i--)t._channels[i]==e&&t._channels.splice(i,1)},t._stageOnBlur=function(){t._musicChannel&&(t._musicChannel.isStopped||(t._blurPaused=!0,t._musicLoops=t._musicChannel.loops,t._musicCompleteHandler=t._musicChannel.completeHandler,t._musicPosition=t._musicChannel.position,t._musicChannel.stop(),Laya.stage.once("mousedown",null,t._stageOnFocus)))},t._stageOnFocus=function(){Laya.stage.off("mousedown",null,t._stageOnFocus),t._blurPaused&&(t.playMusic(t._tMusic,t._musicLoops,t._musicCompleteHandler,t._musicPosition),t._blurPaused=!1)},t.playSound=function(e,i,n,s,r){if(void 0===i&&(i=1),void 0===r&&(r=0),t._muted)return null;if(e==t._tMusic){if(t._musicMuted)return null}else if(t._soundMuted)return null;var a=Laya.loader.getRes(e);s||(s=t._soundClass),a||(a=new s,a.load(e),Loader.cacheRes(e,a));var o;return o=a.play(r,i),o.url=e,o.volume=e==t._tMusic?t.musicVolume:t.soundVolume,o.completeHandler=n,o},t.destroySound=function(t){var e=Laya.loader.getRes(t);e&&(Loader.clearRes(t),e.dispose())},t.playMusic=function(e,i,n,s){return void 0===i&&(i=0),void 0===s&&(s=0),t._tMusic=e,t._musicChannel&&t._musicChannel.stop(),t._musicChannel=t.playSound(e,i,n,null,s)},t.stopSound=function(e){var i,n=0;for(n=t._channels.length-1;n>=0;n--)i=t._channels[n],i.url==e&&i.stop()},t.stopAll=function(){var e,i=0;for(i=t._channels.length-1;i>=0;i--)e=t._channels[i],e.stop()},t.stopMusic=function(){t._musicChannel&&t._musicChannel.stop()},t.setSoundVolume=function(e,i){i?t._setVolume(i,e):t.soundVolume=e},t.setMusicVolume=function(e){t.musicVolume=e,t._setVolume(t._tMusic,e)},t._setVolume=function(e,i){var n,s=0;for(s=t._channels.length-1;s>=0;s--)n=t._channels[s],n.url==e&&(n.volume=i)},t.musicVolume=1,t.soundVolume=1,t._muted=!1,t._soundMuted=!1,t._musicMuted=!1,t._tMusic=null,t._musicChannel=null,t._channels=[],t._autoStopMusic=!1,t._blurPaused=!1,t._musicLoops=0,t._musicPosition=0,t._musicCompleteHandler=null,t._soundClass=null,t}(),LocalStorage=function(){function t(){}var e;return __class(t,"laya.net.LocalStorage"),t.__init__=function(){t._baseClass||(t._baseClass=e,e.init()),t.items=t._baseClass.items,t.support=t._baseClass.support},t.setItem=function(e,i){t._baseClass.setItem(e,i)},t.getItem=function(e){return t._baseClass.getItem(e)},t.setJSON=function(e,i){t._baseClass.setJSON(e,i)},t.getJSON=function(e){return t._baseClass.getJSON(e)},t.removeItem=function(e){t._baseClass.removeItem(e)},t.clear=function(){t._baseClass.clear()},t._baseClass=null,t.items=null,t.support=!1,t.__init$=function(){e=function(){function t(){}return __class(t,""),t.init=function(){try{t.items=window.localStorage,t.setItem("laya","1"),t.removeItem("laya"),t.support=!0}catch(e){}t.support||console.log("LocalStorage is not supprot or browser is private mode.")},t.setItem=function(e,i){try{t.support&&t.items.setItem(e,i)}catch(n){console.log("set localStorage failed",n)}},t.getItem=function(e){return t.support?t.items.getItem(e):null},t.setJSON=function(e,i){try{t.support&&t.items.setItem(e,JSON.stringify(i))}catch(n){console.log("set localStorage failed",n)}},t.getJSON=function(e){return JSON.parse(t.support?t.items.getItem(e):null)},t.removeItem=function(e){t.support&&t.items.removeItem(e)},t.clear=function(){t.support&&t.items.clear()},t.items=null,t.support=!0,t}()},t}(),URL=function(){function t(e){this._url=null,this._path=null,this._url=t.formatURL(e),this._path=t.getPath(e)}__class(t,"laya.net.URL");var e=t.prototype;return __getset(0,e,"path",function(){return this._path}),__getset(0,e,"url",function(){return this._url}),t.formatURL=function(e,i){if(null!=t.customFormat&&(e=t.customFormat(e,i)),!e)return"null path";if(0===e.indexOf("data:image"))return e;if(0==Render.isConchApp&&t.version[e]&&(e+="?v="+t.version[e]),"~"==e.charAt(0))return t.rootPath+e.substring(1);if(t.isAbsolute(e))return e;var n=(i||t.basePath)+e;return t.formatRelativePath(n)},t.formatRelativePath=function(t){if(t.indexOf("../")>-1){for(var e=t.split("/"),i=0,n=e.length;n>i;i++)".."==e[i]&&(e.splice(i-1,2),i-=2);return e.join("/")}return t},t.isAbsolute=function(t){return t.indexOf(":")>0||"/"==t.charAt(0)},t.getPath=function(t){var e=t.lastIndexOf("/");return e>0?t.substr(0,e+1):""},t.getFileName=function(t){var e=t.lastIndexOf("/");return e>0?t.substr(e+1):t},t.version={},t.basePath="",t.rootPath="",t.customFormat=null,t}(),Render=function(){function t(e,i){function n(){Laya.stage._loop(),Browser.window.requestAnimationFrame(n)}this._timeId=0;var s=t._mainCanvas.source.style;s.position="absolute",s.top=s.left="0px",s.background="#000000",t._mainCanvas.source.id=t._mainCanvas.source.id||"layaCanvas";var r=laya.renders.Render.isWebGL;r&&t.WebGL.init(t._mainCanvas,e,i),(t._mainCanvas.source.nodeName||laya.renders.Render.isConchApp)&&Browser.container.appendChild(t._mainCanvas.source),t._context=new RenderContext(e,i,r?null:t._mainCanvas),t._context.ctx.setIsMainContext(),Browser.window.requestAnimationFrame(n),Laya.stage.on("blur",this,this._onBlur),Laya.stage.on("focus",this,this._onFocus)}__class(t,"laya.renders.Render");var e=t.prototype;return e._onFocus=function(){Browser.window.clearInterval(this._timeId)},e._onBlur=function(){this._timeId=Browser.window.setInterval(this._enterFrame,1e3)},e._enterFrame=function(t){Laya.stage._loop()},__getset(1,t,"isConchApp",function(){
|
||
return 4==(4&window.ConchRenderType)}),__getset(1,t,"context",function(){return t._context}),__getset(1,t,"isConchNode",function(){return 5==(5&window.ConchRenderType)},function(t){t?window.ConchRenderType|=1:window.ConchRenderType&=-2}),__getset(1,t,"isConchWebGL",function(){return 6==window.ConchRenderType},function(e){e?(t.isConchNode=!1,window.ConchRenderType|=2):window.ConchRenderType&=-3}),__getset(1,t,"canvas",function(){return t._mainCanvas.source}),t._context=null,t._mainCanvas=null,t.WebGL=null,t.NODE=1,t.WEBGL=2,t.CONCH=4,t.isWebGL=!1,t.is3DMode=!1,t.optimizeTextureMemory=function(t,e){return!0},t.__init$=function(){window.ConchRenderType=window.ConchRenderType||1,window.ConchRenderType|=window.conch?4:0},t}(),RenderContext=function(){function t(e,i,n){this.x=0,this.y=0,this._drawTexture=function(t,e,i){i[0].loaded&&this.ctx.drawTexture(i[0],i[1],i[2],i[3],i[4],t,e)},this._fillTexture=function(t,e,i){i[0].loaded&&this.ctx.fillTexture(i[0],i[1]+t,i[2]+e,i[3],i[4],i[5],i[6],i[7])},this._drawTextureWithTransform=function(t,e,i){i[0].loaded&&this.ctx.drawTextureWithTransform(i[0],i[1],i[2],i[3],i[4],i[5],t,e,i[6])},this._fillQuadrangle=function(t,e,i){this.ctx.fillQuadrangle(i[0],i[1],i[2],i[3],i[4])},this._drawRect=function(t,e,i){var n=this.ctx;null!=i[4]&&(n.fillStyle=i[4],n.fillRect(t+i[0],e+i[1],i[2],i[3],null)),null!=i[5]&&(n.strokeStyle=i[5],n.lineWidth=i[6],n.strokeRect(t+i[0],e+i[1],i[2],i[3],i[6]))},this._drawPie=function(t,e,i){var n=this.ctx;Render.isWebGL&&n.setPathId(i[8]),n.beginPath(),Render.isWebGL?(n.movePath(i[0]+t,i[1]+e),n.moveTo(0,0)):n.moveTo(t+i[0],e+i[1]),n.arc(t+i[0],e+i[1],i[2],i[3],i[4]),n.closePath(),this._fillAndStroke(i[5],i[6],i[7],!0)},this._clipRect=function(t,e,i){this.ctx.clipRect(t+i[0],e+i[1],i[2],i[3])},this._fillRect=function(t,e,i){this.ctx.fillRect(t+i[0],e+i[1],i[2],i[3],i[4])},this._drawCircle=function(e,i,n){var s=this.ctx;Render.isWebGL&&s.setPathId(n[6]),Stat.drawCall++,s.beginPath(),Render.isWebGL&&s.movePath(n[0]+e,n[1]+i),s.arc(n[0]+e,n[1]+i,n[2],0,t.PI2),s.closePath(),this._fillAndStroke(n[3],n[4],n[5],!0)},this._fillCircle=function(e,i,n){Stat.drawCall++;var s=this.ctx;s.beginPath(),s.fillStyle=n[3],s.arc(n[0]+e,n[1]+i,n[2],0,t.PI2),s.fill()},this._setShader=function(t,e,i){this.ctx.setShader(i[0])},this._drawLine=function(t,e,i){var n=this.ctx;Render.isWebGL&&n.setPathId(i[6]),n.beginPath(),n.strokeStyle=i[4],n.lineWidth=i[5],Render.isWebGL?(n.movePath(t,e),n.moveTo(i[0],i[1]),n.lineTo(i[2],i[3])):(n.moveTo(t+i[0],e+i[1]),n.lineTo(t+i[2],e+i[3])),n.stroke()},this._drawLines=function(t,e,i){var n=this.ctx;Render.isWebGL&&n.setPathId(i[5]),n.beginPath(),t+=i[0],e+=i[1],Render.isWebGL&&n.movePath(t,e),n.strokeStyle=i[3],n.lineWidth=i[4];var s=i[2],r=2,a=s.length;if(Render.isWebGL)for(n.moveTo(s[0],s[1]);a>r;)n.lineTo(s[r++],s[r++]);else for(n.moveTo(t+s[0],e+s[1]);a>r;)n.lineTo(t+s[r++],e+s[r++]);n.stroke()},this._drawLinesWebGL=function(t,e,i){this.ctx.drawLines(t+this.x+i[0],e+this.y+i[1],i[2],i[3],i[4])},this._drawCurves=function(t,e,i){var n=this.ctx;Render.isWebGL&&n.setPathId(-1),n.beginPath(),n.strokeStyle=i[3],n.lineWidth=i[4];var s=i[2];t+=i[0],e+=i[1],n.moveTo(t+s[0],e+s[1]);for(var r=2,a=s.length;a>r;)n.quadraticCurveTo(t+s[r++],e+s[r++],t+s[r++],e+s[r++]);n.stroke()},this._draw=function(t,e,i){i[0].call(null,this,t,e)},this._transformByMatrix=function(t,e,i){this.ctx.transformByMatrix(i[0])},this._setTransform=function(t,e,i){this.ctx.setTransform(i[0],i[1],i[2],i[3],i[4],i[5])},this._setTransformByMatrix=function(t,e,i){this.ctx.setTransformByMatrix(i[0])},this._save=function(t,e,i){this.ctx.save()},this._restore=function(t,e,i){this.ctx.restore()},this._translate=function(t,e,i){this.ctx.translate(i[0],i[1])},this._transform=function(t,e,i){this.ctx.translate(i[1]+t,i[2]+e);var n=i[0];this.ctx.transform(n.a,n.b,n.c,n.d,n.tx,n.ty),this.ctx.translate(-t-i[1],-e-i[2])},this._rotate=function(t,e,i){this.ctx.translate(i[1]+t,i[2]+e),this.ctx.rotate(i[0]),this.ctx.translate(-t-i[1],-e-i[2])},this._scale=function(t,e,i){this.ctx.translate(i[2]+t,i[3]+e),this.ctx.scale(i[0],i[1]),this.ctx.translate(-t-i[2],-e-i[3])},this._alpha=function(t,e,i){this.ctx.globalAlpha*=i[0]},this._setAlpha=function(t,e,i){this.ctx.globalAlpha=i[0]},this._fillText=function(t,e,i){this.ctx.fillText(i[0],i[1]+t,i[2]+e,i[3],i[4],i[5])},this._strokeText=function(t,e,i){this.ctx.strokeText(i[0],i[1]+t,i[2]+e,i[3],i[4],i[5],i[6])},this._fillBorderText=function(t,e,i){this.ctx.fillBorderText(i[0],i[1]+t,i[2]+e,i[3],i[4],i[5],i[6],i[7])},this._blendMode=function(t,e,i){this.ctx.globalCompositeOperation=i[0]},this._beginClip=function(t,e,i){this.ctx.beginClip&&this.ctx.beginClip(t+i[0],e+i[1],i[2],i[3])},this._setIBVB=function(t,e,i){this.ctx.setIBVB(i[0]+t,i[1]+e,i[2],i[3],i[4],i[5],i[6],i[7])},this._fillTrangles=function(t,e,i){this.ctx.fillTrangles(i[0],i[1]+t,i[2]+e,i[3],i[4])},this._drawPath=function(t,e,i){var n=this.ctx;Render.isWebGL&&n.setPathId(-1),n.beginPath(),t+=i[0],e+=i[1];for(var s=i[2],r=0,a=s.length;a>r;r++){var o=s[r];switch(o[0]){case"moveTo":n.moveTo(t+o[1],e+o[2]);break;case"lineTo":n.lineTo(t+o[1],e+o[2]);break;case"arcTo":n.arcTo(t+o[1],e+o[2],t+o[3],e+o[4],o[5]);break;case"closePath":n.closePath()}}var h=i[3];null!=h&&(n.fillStyle=h.fillStyle,n.fill());var l=i[4];null!=l&&(n.strokeStyle=l.strokeStyle,n.lineWidth=l.lineWidth||1,n.lineJoin=l.lineJoin,n.lineCap=l.lineCap,n.miterLimit=l.miterLimit,n.stroke())},this.drawPoly=function(t,e,i){this.ctx.drawPoly(t+this.x+i[0],e+this.y+i[1],i[2],i[3],i[4],i[5],i[6])},this._drawPoly=function(t,e,i){var n=this.ctx,s=i[2],r=2,a=s.length;if(Render.isWebGL)for(n.setPathId(i[6]),n.beginPath(),t+=i[0],e+=i[1],n.movePath(t,e),n.moveTo(s[0],s[1]);a>r;)n.lineTo(s[r++],s[r++]);else for(n.beginPath(),t+=i[0],e+=i[1],n.moveTo(t+s[0],e+s[1]);a>r;)n.lineTo(t+s[r++],e+s[r++]);n.closePath(),this._fillAndStroke(i[3],i[4],i[5],i[7])},this._drawSkin=function(t,e,i){var n=i[0];if(n){var s=this.ctx;n.render(s,t,e)}},this._drawParticle=function(t,e,i){this.ctx.drawParticle(t+this.x,e+this.y,i[0])},n?this.ctx=n.getContext("2d"):(n=HTMLCanvas.create("3D"),this.ctx=RunDriver.createWebGLContext2D(n),n._setContext(this.ctx)),n.size(e,i),this.canvas=n}__class(t,"laya.renders.RenderContext");var e=t.prototype;return e.destroy=function(){this.canvas&&(this.canvas.destroy(),this.canvas=null),this.ctx&&(this.ctx.destroy(),this.ctx=null)},e.drawTexture=function(t,e,i,n,s){t.loaded&&this.ctx.drawTexture(t,e,i,n,s,this.x,this.y)},e._drawTextures=function(t,e,i){i[0].loaded&&this.ctx.drawTextures(i[0],i[1],t+this.x,e+this.y)},e.drawTextureWithTransform=function(t,e,i,n,s,r,a){t.loaded&&this.ctx.drawTextureWithTransform(t,e,i,n,s,r,this.x,this.y,a)},e.fillQuadrangle=function(t,e,i,n,s){this.ctx.fillQuadrangle(t,e,i,n,s)},e.drawCanvas=function(t,e,i,n,s){this.ctx.drawCanvas(t,e+this.x,i+this.y,n,s)},e.drawRect=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=this.ctx;a.strokeStyle=s,a.lineWidth=r,a.strokeRect(t+this.x,e+this.y,i,n,r)},e._fillAndStroke=function(t,e,i,n){void 0===n&&(n=!1);var s=this.ctx;null!=t&&(s.fillStyle=t,Render.isWebGL?s.fill(n):s.fill()),null!=e&&i>0&&(s.strokeStyle=e,s.lineWidth=i,s.stroke())},e.clipRect=function(t,e,i,n){this.ctx.clipRect(t+this.x,e+this.y,i,n)},e.fillRect=function(t,e,i,n,s){this.ctx.fillRect(t+this.x,e+this.y,i,n,s)},e.drawCircle=function(e,i,n,s,r){void 0===r&&(r=1),Stat.drawCall++;var a=this.ctx;a.beginPath(),a.strokeStyle=s,a.lineWidth=r,a.arc(e+this.x,i+this.y,n,0,t.PI2),a.stroke()},e.fillCircle=function(e,i,n,s){Stat.drawCall++;var r=this.ctx;r.beginPath(),r.fillStyle=s,r.arc(e+this.x,i+this.y,n,0,t.PI2),r.fill()},e.setShader=function(t){this.ctx.setShader(t)},e.drawLine=function(t,e,i,n,s,r){void 0===r&&(r=1);var a=this.ctx;a.beginPath(),a.strokeStyle=s,a.lineWidth=r,a.moveTo(this.x+t,this.y+e),a.lineTo(this.x+i,this.y+n),a.stroke()},e.clear=function(){this.ctx.clear()},e.transformByMatrix=function(t){this.ctx.transformByMatrix(t)},e.setTransform=function(t,e,i,n,s,r){this.ctx.setTransform(t,e,i,n,s,r)},e.setTransformByMatrix=function(t){this.ctx.setTransformByMatrix(t)},e.save=function(){this.ctx.save()},e.restore=function(){this.ctx.restore()},e.translate=function(t,e){this.ctx.translate(t,e)},e.transform=function(t,e,i,n,s,r){this.ctx.transform(t,e,i,n,s,r)},e.rotate=function(t){this.ctx.rotate(t)},e.scale=function(t,e){this.ctx.scale(t,e)},e.alpha=function(t){this.ctx.globalAlpha*=t},e.setAlpha=function(t){this.ctx.globalAlpha=t},e.fillWords=function(t,e,i,n,s){this.ctx.fillWords(t,e,i,n,s)},e.fillText=function(t,e,i,n,s,r){this.ctx.fillText(t,e+this.x,i+this.y,n,s,r)},e.strokeText=function(t,e,i,n,s,r,a){this.ctx.strokeText(t,e+this.x,i+this.y,n,s,r,a)},e.blendMode=function(t){this.ctx.globalCompositeOperation=t},e.flush=function(){this.ctx.flush&&this.ctx.flush()},e.addRenderObject=function(t){this.ctx.addRenderObject(t)},e.beginClip=function(t,e,i,n){this.ctx.beginClip&&this.ctx.beginClip(t,e,i,n)},e.endClip=function(){this.ctx.endClip&&this.ctx.endClip()},e.fillTrangles=function(t,e,i){this.ctx.fillTrangles(i[0],i[1],i[2],i[3],i.length>4?i[4]:null)},t.PI2=2*Math.PI,t}(),RenderSprite=function(){function t(e,i){switch(this._next=i||t.NORENDER,e){case 0:return void(this._fun=this._no);case 1:return void(this._fun=this._image);case 2:return void(this._fun=this._alpha);case 4:return void(this._fun=this._transform);case 32:return void(this._fun=this._blend);case 8:return void(this._fun=this._canvas);case 64:return void(this._fun=this._clip);case 128:return void(this._fun=this._style);case 256:return void(this._fun=this._graphics);case 2048:return void(this._fun=this._childs);case 512:return void(this._fun=this._custom);case 257:return void(this._fun=this._image2);case 261:return void(this._fun=this._image2);case 16:return void(this._fun=Filter._filter);case 69905:return void(this._fun=t._initRenderFun)}this.onCreate(e)}__class(t,"laya.renders.RenderSprite");var e=t.prototype;return e.onCreate=function(t){},e._style=function(t,e,i,n){t._style.render(t,e,i,n);var s=this._next;s._fun.call(s,t,e,i,n)},e._no=function(t,e,i,n){},e._custom=function(t,e,i,n){t.customRender(e,i,n);var s=t._style._tf;this._next._fun.call(this._next,t,e,i-s.translateX,n-s.translateY)},e._clip=function(e,i,n,s){var r=this._next;if(r!=t.NORENDER){var a=e._style.scrollRect;i.ctx.save(),i.ctx.clipRect(n,s,a.width,a.height),r._fun.call(r,e,i,n-a.x,s-a.y),i.ctx.restore()}},e._blend=function(t,e,i,n){var s=t._style;s.blendMode&&(e.ctx.globalCompositeOperation=s.blendMode);var r=this._next;r._fun.call(r,t,e,i,n);var a=t.mask;a&&(e.ctx.globalCompositeOperation="destination-in",(a.numChildren>0||!a.graphics._isOnlyOne())&&(a.cacheAsBitmap=!0),a.render(e,i,n)),e.ctx.globalCompositeOperation="source-over"},e._graphics=function(t,e,i,n){var s=t._style._tf;t._graphics&&t._graphics._render(t,e,i-s.translateX,n-s.translateY);var r=this._next;r._fun.call(r,t,e,i,n)},e._image=function(t,e,i,n){var s=t._style;e.ctx.drawTexture2(i,n,s._tf.translateX,s._tf.translateY,t.transform,s.alpha,s.blendMode,t._graphics._one)},e._image2=function(t,e,i,n){var s=t._style._tf;e.ctx.drawTexture2(i,n,s.translateX,s.translateY,t.transform,1,null,t._graphics._one)},e._alpha=function(t,e,i,n){var s,r=t._style;if((s=r.alpha)>.01){var a=e.ctx.globalAlpha;e.ctx.globalAlpha*=s;var o=this._next;o._fun.call(o,t,e,i,n),e.ctx.globalAlpha=a}},e._transform=function(e,i,n,s){var r=e.transform,a=this._next;r&&a!=t.NORENDER?(i.save(),i.transform(r.a,r.b,r.c,r.d,r.tx+n,r.ty+s),a._fun.call(a,e,i,0,0),i.restore()):a._fun.call(a,e,i,n,s)},e._childs=function(t,e,i,n){var s=t._style;if(i+=-s._tf.translateX+s.paddingLeft,n+=-s._tf.translateY+s.paddingTop,s._calculation){var r=t._getWords();r&&e.fillWords(r,i,n,s.font,s.color)}var a,o=t._childs,h=o.length;if(t.viewport&&t.optimizeScrollRect){var l=t.viewport,u=l.x,c=l.y,_=l.right,d=l.bottom,f=NaN,p=NaN;for(g=0;h>g;++g)(a=o[g]).visible&&(f=a._x)<_&&f+a.width>u&&(p=a._y)<d&&p+a.height>c&&a.render(e,i,n)}else for(var g=0;h>g;++g)(a=o[g])._style.visible&&a.render(e,i,n)},e._canvas=function(t,e,i,n){var s=t._$P.cacheCanvas,r=this._next;if(!s)return void r._fun.call(r,t,u,i,n);var a,o,h,l,u=s.ctx,c=t._needRepaint()||!u;if("bitmap"===s.type?Stat.canvasBitmap++:Stat.canvasNormal++,c){s._cacheRec||(s._cacheRec=new Rectangle);var _,d;l=t.getSelfBounds(),l.x-=t.pivotX,l.y-=t.pivotY,l.x-=10,l.y-=10,l.width+=20,l.height+=20,l.x=Math.floor(l.x+i)-i,l.y=Math.floor(l.y+n)-n,l.width=Math.floor(l.width),l.height=Math.floor(l.height),s._cacheRec.copyFrom(l),l=s._cacheRec;var f=Render.isWebGL?1:Browser.pixelRatio*Laya.stage.clientScaleX,p=Render.isWebGL?1:Browser.pixelRatio*Laya.stage.clientScaleY;if(!Render.isWebGL){var g,m=1,v=1;for(g=t;g&&g!=Laya.stage;)m*=g.scaleX,v*=g.scaleY,g=g.parent;Render.isWebGL?(1>m&&(f*=m),1>v&&(p*=v)):(m>1&&(f*=m),v>1&&(p*=v))}if(_=l.width*f,d=l.height*p,o=l.x,h=l.y,Render.isWebGL&&"bitmap"===s.type&&(_>2048||d>2048))return console.log("cache bitmap size larger than 2048,cache ignored"),s.ctx&&(Pool.recover("RenderContext",s.ctx),s.ctx=null),void r._fun.call(r,t,e,i,n);u||(u=s.ctx=Pool.getItem("RenderContext")||new RenderContext(_,d,HTMLCanvas.create("AUTO")),u.ctx.sprite=t),a=u.canvas,"bitmap"===s.type&&(a.context.asBitmap=!0),a.clear(),(a.width!=_||a.height!=d)&&a.size(_,d);var y;if(1!=f||1!=p){var x=u.ctx;x.save(),x.scale(f,p),!Render.isConchWebGL&&Render.isConchApp&&(y=t._$P.cf,y&&x.setFilterMatrix&&x.setFilterMatrix(y._mat,y._alpha)),r._fun.call(r,t,u,-o,-h),x.restore(),Render.isConchApp&&!Render.isConchWebGL||t._applyFilters()}else x=u.ctx,!Render.isConchWebGL&&Render.isConchApp&&(y=t._$P.cf,y&&x.setFilterMatrix&&x.setFilterMatrix(y._mat,y._alpha)),r._fun.call(r,t,u,-o,-h),Render.isConchApp&&!Render.isConchWebGL||t._applyFilters();t._$P.staticCache&&(s.reCache=!1),Stat.canvasReCache++}else l=s._cacheRec,o=l.x,h=l.y,a=u.canvas;e.drawCanvas(a,i+o,n+h,l.width,l.height)},t.__init__=function(){function e(e,i){for(var n=0,s=0;s<e.length;s++)n|=e[s],t.renders[n]=i}var i,n=0,s=0;for(i=RunDriver.createRenderSprite(69905,null),s=t.renders.length=4096,n=0;s>n;n++)t.renders[n]=i;t.renders[0]=RunDriver.createRenderSprite(0,null),e([1,256,4,2],new t(1,null)),t.renders[257]=RunDriver.createRenderSprite(257,null),t.renders[261]=new t(261,null)},t._initRenderFun=function(e,i,n,s){var r=e._renderType,a=t.renders[r]=t._getTypeRender(r);a._fun(e,i,n,s)},t._getTypeRender=function(t){for(var e=null,i=2048;i>1;)i&t&&(e=RunDriver.createRenderSprite(i,e)),i>>=1;return e},t.IMAGE=1,t.ALPHA=2,t.TRANSFORM=4,t.CANVAS=8,t.FILTERS=16,t.BLEND=32,t.CLIP=64,t.STYLE=128,t.GRAPHICS=256,t.CUSTOM=512,t.CHILDS=2048,t.INIT=69905,t.renders=[],t.NORENDER=new t(0,null),t}(),Context=function(){function t(){this._repaint=!1}__class(t,"laya.resource.Context");var e=t.prototype;return e.setIsMainContext=function(){},e.drawTextures=function(t,e,i,n){Stat.drawCall+=e.length/2;for(var s=t.bitmap.width,r=t.bitmap.height,a=0,o=e.length;o>a;a+=2)this.drawTexture(t,e[a],e[a+1],s,r,i,n)},e.drawCanvas=function(t,e,i,n,s){Stat.drawCall++,this.drawImage(t.source,e,i,n,s)},e.fillRect=function(t,e,i,n,s){Stat.drawCall++,s&&(this.fillStyle=s),this.__fillRect(t,e,i,n)},e.fillText=function(t,e,i,n,s,r){Stat.drawCall++,arguments.length>3&&null!=n&&(this.font=n,this.fillStyle=s,this.textAlign=r,this.textBaseline="top"),this.__fillText(t,e,i)},e.fillBorderText=function(t,e,i,n,s,r,a,o){Stat.drawCall++,this.font=n,this.fillStyle=s,this.textBaseline="top",this.strokeStyle=r,this.lineWidth=a,this.textAlign=o,this.__strokeText(t,e,i),this.__fillText(t,e,i)},e.strokeText=function(t,e,i,n,s,r,a){Stat.drawCall++,arguments.length>3&&null!=n&&(this.font=n,this.strokeStyle=s,this.lineWidth=r,this.textAlign=a,this.textBaseline="top"),this.__strokeText(t,e,i)},e.transformByMatrix=function(t){this.transform(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.setTransformByMatrix=function(t){this.setTransform(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.clipRect=function(t,e,i,n){Stat.drawCall++,this.beginPath(),this.rect(t,e,i,n),this.clip()},e.drawTexture=function(t,e,i,n,s,r,a){Stat.drawCall++;var o=t.uv,h=t.bitmap.width,l=t.bitmap.height;this.drawImage(t.source,o[0]*h,o[1]*l,(o[2]-o[0])*h,(o[5]-o[3])*l,e+r,i+a,n,s)},e.drawTextureWithTransform=function(t,e,i,n,s,r,a,o,h){Stat.drawCall++;var l=t.uv,u=t.bitmap.width,c=t.bitmap.height;this.save(),1!=h&&(this.globalAlpha*=h),r?(this.transform(r.a,r.b,r.c,r.d,r.tx+a,r.ty+o),this.drawImage(t.source,l[0]*u,l[1]*c,(l[2]-l[0])*u,(l[5]-l[3])*c,e,i,n,s)):this.drawImage(t.source,l[0]*u,l[1]*c,(l[2]-l[0])*u,(l[5]-l[3])*c,e+a,i+o,n,s),this.restore()},e.drawTexture2=function(t,e,i,n,s,r,a,o){"use strict";var h=o[0];if(h.loaded&&h.bitmap&&h.source){Stat.drawCall++;var l=1!==r;if(l){var u=this.globalAlpha;this.globalAlpha*=r}var c=h.uv,_=h.bitmap.width,d=h.bitmap.height;s?(this.save(),this.transform(s.a,s.b,s.c,s.d,s.tx+t,s.ty+e),this.drawImage(h.source,c[0]*_,c[1]*d,(c[2]-c[0])*_,(c[5]-c[3])*d,o[1]-i,o[2]-n,o[3],o[4]),this.restore()):this.drawImage(h.source,c[0]*_,c[1]*d,(c[2]-c[0])*_,(c[5]-c[3])*d,o[1]-i+t,o[2]-n+e,o[3],o[4]),l&&(this.globalAlpha=u)}},e.fillTexture=function(t,e,i,n,s,r,a,o){if(!o.pat){if(t.uv!=Texture.DEF_UV){var h=new HTMLCanvas("2D");h.getContext("2d"),h.size(t.width,t.height),h.context.drawTexture(t,0,0,t.width,t.height,0,0),t=new Texture(h)}o.pat=this.createPattern(t.bitmap.source,r)}var l=e,u=i,c=0,_=0;a&&(l+=a.x%t.width,u+=a.y%t.height,c-=a.x%t.width,_-=a.y%t.height),this.translate(l,u),this.fillRect(c,_,n,s,o.pat),this.translate(-l,-u)},e.flush=function(){return 0},e.fillWords=function(t,e,i,n,s){n&&(this.font=n),s&&(this.fillStyle=s);this.textBaseline="top",this.textAlign="left";for(var r=0,a=t.length;a>r;r++){var o=t[r];this.__fillText(o["char"],o.x+e,o.y+i)}},e.destroy=function(){this.canvas.width=this.canvas.height=0},e.clear=function(){this.clearRect(0,0,this._canvas.width,this._canvas.height),this._repaint=!1},t.__init__=function(t){var e=laya.resource.Context.prototype;t=t||CanvasRenderingContext2D.prototype,t.__fillText=t.fillText,t.__fillRect=t.fillRect,t.__strokeText=t.strokeText;var i=["drawTextures","fillWords","setIsMainContext","fillRect","strokeText","fillTexture","fillText","transformByMatrix","setTransformByMatrix","clipRect","drawTexture","drawTexture2","drawTextureWithTransform","flush","clear","destroy","drawCanvas","fillBorderText"];i.forEach(function(i){t[i]=e[i]||t[i]})},t._default=new t,t}(),ResourceManager=function(){function t(){this._id=0,this._name=null,this._resources=null,this._memorySize=0,this._garbageCollectionRate=NaN,this._isOverflow=!1,this.autoRelease=!1,this.autoReleaseMaxSize=0,this._id=++t._uniqueIDCounter,this._name="Content Manager",t._isResourceManagersSorted=!1,this._memorySize=0,this._isOverflow=!1,this.autoRelease=!1,this.autoReleaseMaxSize=536870912,this._garbageCollectionRate=.2,t._resourceManagers.push(this),this._resources=[]}__class(t,"laya.resource.ResourceManager");var e=t.prototype;return Laya.imps(e,{"laya.resource.IDispose":!0}),e.getResourceByIndex=function(t){return this._resources[t]},e.getResourcesLength=function(){return this._resources.length},e.addResource=function(t){t.resourceManager&&t.resourceManager.removeResource(t);var e=this._resources.indexOf(t);return-1===e?(t._resourceManager=this,this._resources.push(t),this.addSize(t.memorySize),!0):!1},e.removeResource=function(t){var e=this._resources.indexOf(t);return-1!==e?(this._resources.splice(e,1),t._resourceManager=null,this._memorySize-=t.memorySize,!0):!1},e.unload=function(){for(var t=this._resources.slice(0,this._resources.length),e=0;e<t.length;e++){var i=t[e];i.dispose()}t.length=0},e.setUniqueName=function(e){for(var i=!0,n=0;n<t._resourceManagers.length;n++)if(t._resourceManagers[n]._name===e&&t._resourceManagers[n]!==this)return void(i=!1);i?this.name!=e&&(this.name=e,t._isResourceManagersSorted=!1):this.setUniqueName(e.concat("-copy"))},e.dispose=function(){if(this===t._systemResourceManager)throw new Error("systemResourceManager不能被释放!");t._resourceManagers.splice(t._resourceManagers.indexOf(this),1),t._isResourceManagersSorted=!1;for(var e=this._resources.slice(0,this._resources.length),i=0;i<e.length;i++){var n=e[i];n.resourceManager.removeResource(n),n.dispose()}e.length=0},e.addSize=function(t){t&&(this.autoRelease&&t>0&&this._memorySize+t>this.autoReleaseMaxSize&&this.garbageCollection((1-this._garbageCollectionRate)*this.autoReleaseMaxSize),this._memorySize+=t)},e.garbageCollection=function(t){var e=this._resources;e=e.slice(),e.sort(function(t,e){if(!t||!e)throw new Error("a或b不能为空!");return t.released&&e.released?0:t.released?1:e.released?-1:t.lastUseFrameCount-e.lastUseFrameCount});for(var i=Stat.loopCount,n=0,s=e.length;s>n;n++){var r=e[n];if(!(i-r.lastUseFrameCount>1))return void(this._memorySize>=t&&(this._isOverflow=!0));if(r.releaseResource(),this._memorySize<t)return void(this._isOverflow=!1)}},__getset(0,e,"id",function(){return this._id}),__getset(0,e,"name",function(){return this._name},function(e){!e&&""===e||this._name===e||(this._name=e,t._isResourceManagersSorted=!1)}),__getset(0,e,"memorySize",function(){return this._memorySize}),__getset(1,t,"systemResourceManager",function(){return null===t._systemResourceManager&&(t._systemResourceManager=new t,t._systemResourceManager._name="System Resource Manager"),t._systemResourceManager}),__getset(1,t,"sortedResourceManagersByName",function(){return t._isResourceManagersSorted||(t._isResourceManagersSorted=!0,t._resourceManagers.sort(t.compareResourceManagersByName)),t._resourceManagers}),t.__init__=function(){t.currentResourceManager=t.systemResourceManager},t.getLoadedResourceManagerByIndex=function(e){return t._resourceManagers[e]},t.getLoadedResourceManagersCount=function(){return t._resourceManagers.length},t.recreateContentManagers=function(e){void 0===e&&(e=!1);for(var i=t.currentResourceManager,n=0;n<t._resourceManagers.length;n++){t.currentResourceManager=t._resourceManagers[n];for(var s=0;s<t.currentResourceManager._resources.length;s++)t.currentResourceManager._resources[s].releaseResource(e),t.currentResourceManager._resources[s].activeResource(e)}t.currentResourceManager=i},t.releaseContentManagers=function(e){void 0===e&&(e=!1);for(var i=t.currentResourceManager,n=0;n<t._resourceManagers.length;n++){t.currentResourceManager=t._resourceManagers[n];for(var s=0;s<t.currentResourceManager._resources.length;s++){var r=t.currentResourceManager._resources[s];!r.released&&r.releaseResource(e)}}t.currentResourceManager=i},t.compareResourceManagersByName=function(t,e){if(t==e)return 0;var i=t._name,n=e._name;if(null==i)return null==n?0:-1;if(null==n)return 1;var s=i.localeCompare(n);return 0!=s?s:(e.setUniqueName(n),n=e._name,i.localeCompare(n))},t._uniqueIDCounter=0,t._systemResourceManager=null,t._isResourceManagersSorted=!1,t._resourceManagers=[],t.currentResourceManager=null,t}(),WXCanvas=function(){function t(t){this._ctx=null,this._id=null,this.style={},this._id=t}__class(t,"laya.resource.WXCanvas");var e=t.prototype;return e.getContext=function(){var t=laya.resource.WXCanvas.wx,e=t.createContext();return e.id=this._id,e.fillRect=function(t,e,i,n){this.rect(t,e,i,n),this.fill()},e.strokeRect=function(t,e,i,n){this.rect(t,e,i,n),this.stroke()},e.___drawImage=e.drawImage,e.drawImage=function(){var t=arguments[0].tempFilePath;if(null!=t)switch(arguments.length){case 3:return void this.___drawImage(t,arguments[1],arguments[2],arguments[0].width,arguments[0].height);case 5:return void this.___drawImage(t,arguments[1],arguments[2],arguments[3],arguments[4]);case 9:return void this.___drawImage(t,arguments[5],arguments[6],arguments[7],arguments[8])}},Object.defineProperty(e,"strokeStyle",{set:function(t){this.setStrokeStyle(t)},enumerable:!1}),Object.defineProperty(e,"fillStyle",{set:function(t){this.setFillStyle(t)},enumerable:!1}),Object.defineProperty(e,"fontSize",{set:function(t){this.setFontSize(t)},enumerable:!1}),Object.defineProperty(e,"lineWidth",{set:function(t){this.setLineWidth(t)},enumerable:!1}),Context.__init__(e),e.flush=function(){t.drawCanvas({canvasId:this.id,actions:this.getActions()})},e},e.oncontextmenu=function(t){},e.addEventListener=function(){},__getset(0,e,"id",function(){return this._id},function(t){this._id=t}),t.wx=null,t}(),System=function(){function System(){}return __class(System,"laya.system.System"),System.changeDefinition=function(name,classObj){Laya[name]=classObj;var str=name+"=classObj";eval(str)},System.__init__=function(){Render.isConchApp&&(conch.disableConchResManager(),conch.disableConchAutoRestoreLostedDevice())},System}(),Browser=function(){function t(){}return __class(t,"laya.utils.Browser"),__getset(1,t,"pixelRatio",function(){return t.__init__(),RunDriver.getPixelRatio()}),__getset(1,t,"height",function(){return t.__init__(),(Laya.stage&&Laya.stage.canvasRotation?t.clientWidth:t.clientHeight)*t.pixelRatio}),__getset(1,t,"clientWidth",function(){return t.__init__(),t.window.innerWidth||t.document.body.clientWidth}),__getset(1,t,"window",function(){return t.__init__(),t._window}),__getset(1,t,"clientHeight",function(){return t.__init__(),t.window.innerHeight||t.document.body.clientHeight||t.document.documentElement.clientHeight}),__getset(1,t,"width",function(){return t.__init__(),(Laya.stage&&Laya.stage.canvasRotation?t.clientHeight:t.clientWidth)*t.pixelRatio}),__getset(1,t,"container",function(){return t.__init__(),t._container||(t._container=t.createElement("div"),t._container.id="layaContainer",t.document.body.appendChild(t._container)),t._container},function(e){t._container=e}),__getset(1,t,"document",function(){return t.__init__(),t._document}),t.__init__=function(){if(!t._window){t._window=RunDriver.getWindow(),t._document=t.window.document,t._window.addEventListener("message",function(t){laya.utils.Browser._onMessage(t)},!1),t.document.__createElement=t.document.createElement,window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}();var e=window.document.body.style;e.margin=0,e.overflow="hidden";for(var i=window.document.getElementsByTagName("meta"),n=0,s=!1,r="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no";n<i.length;){var a=i[n];if("viewport"==a.name){a.content=r,s=!0;break}n++}s||(a=document.createElement("meta"),a.name="viewport",a.content=r,document.getElementsByTagName("head")[0].appendChild(a)),t.userAgent=t.window.navigator.userAgent,t.u=t.userAgent,t.onIOS=!!t.u.match(/\(i[^;]+;(U;)? CPU.+Mac OS X/),t.onMobile=t.u.indexOf("Mobile")>-1,t.onIPhone=t.u.indexOf("iPhone")>-1,t.onIPad=t.u.indexOf("iPad")>-1,t.onAndriod=t.u.indexOf("Android")>-1||t.u.indexOf("Adr")>-1,t.onWP=t.u.indexOf("Windows Phone")>-1,t.onQQBrowser=t.u.indexOf("QQBrowser")>-1,t.onMQQBrowser=t.u.indexOf("MQQBrowser")>-1,t.onWeiXin=t.u.indexOf("MicroMessenger")>-1,t.onPC=!t.onMobile,t.onSafari=!!t.u.match(/Version\/\d+\.\d\x20Mobile\/\S+\x20Safari/),t.httpProtocol="http:"==t.window.location.protocol,t.webAudioEnabled=!!(t.window.AudioContext||t.window.webkitAudioContext||t.window.mozAudioContext),t.soundType=t.webAudioEnabled?"WEBAUDIOSOUND":"AUDIOSOUND",Sound=t.webAudioEnabled?WebAudioSound:AudioSound,t.webAudioEnabled&&WebAudioSound.initWebAudio(),t.enableTouch="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,window.focus(),SoundManager._soundClass=Sound;var o=null;if(t.window.MainCanvasID){var h=wx;if(h&&!h.createContext&&(h=null),null!=(WXCanvas.wx=h)){o=new WXCanvas(t.window.MainCanvasID);var l=Context.prototype;l.flush=null,t.window.Image=function(){this.setSrc=function(t){this.__src=t;this.success()},this.success=function(t){this.width=200,this.height=200,this.tempFilePath=t?t.tempFilePath:this.__src,this.onload&&this.onload()},this.getSrc=function(){return this.__src},Object.defineProperty(this,"src",{get:this.getSrc,set:this.setSrc,enumerable:!1})}}else o=t.document.getElementById(t.window.MainCanvasID)}Render._mainCanvas=Render._mainCanvas||HTMLCanvas.create("2D",o),t.canvas||(t.canvas=HTMLCanvas.create("2D"),t.context=t.canvas.getContext("2d"))}},t._onMessage=function(e){if(e.data&&"size"==e.data.name){if(t.window.innerWidth=e.data.width,t.window.innerHeight=e.data.height,t.window.__innerHeight=e.data.clientHeight,!t.document.createEvent)return void console.log("no document.createEvent");var i=t.document.createEvent("HTMLEvents");return i.initEvent("resize",!1,!1),void t.window.dispatchEvent(i)}},t.createElement=function(e){return t.__init__(),t.document.__createElement(e)},t.getElementById=function(e){return t.__init__(),t.document.getElementById(e)},t.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},t.now=function(){return RunDriver.now()},t._window=null,t._document=null,t._container=null,t.userAgent=null,t.u=null,t.onIOS=!1,t.onMobile=!1,t.onIPhone=!1,t.onIPad=!1,t.onAndriod=!1,t.onWP=!1,t.onQQBrowser=!1,t.onMQQBrowser=!1,t.onSafari=!1,t.onWeiXin=!1,t.onPC=!1,t.httpProtocol=!1,t.webAudioEnabled=!1,t.soundType=null,t.enableTouch=!1,t.canvas=null,t.context=null,t.__init$=function(){},t}(),Byte=function(){function t(t){this._xd_=!0,this._allocated_=8,this._pos_=0,this._length=0,t?(this._u8d_=new Uint8Array(t),this._d_=new DataView(this._u8d_.buffer),this._length=this._d_.byteLength):this.___resizeBuffer(this._allocated_)}__class(t,"laya.utils.Byte");var e=t.prototype;return e.___resizeBuffer=function(t){try{var e=new Uint8Array(t);null!=this._u8d_&&(this._u8d_.length<=t?e.set(this._u8d_):e.set(this._u8d_.subarray(0,t))),this._u8d_=e,this._d_=new DataView(e.buffer)}catch(i){throw"___resizeBuffer err:"+t}},e.getString=function(){return this.rUTF(this.getUint16())},e.getFloat32Array=function(t,e){var i=new Float32Array(this._d_.buffer.slice(t,t+e));return this._pos_+=e,i},e.getUint8Array=function(t,e){var i=new Uint8Array(this._d_.buffer.slice(t,t+e));return this._pos_+=e,i},e.getInt16Array=function(t,e){var i=new Int16Array(this._d_.buffer.slice(t,t+e));return this._pos_+=e,i},e.getFloat32=function(){var t=this._d_.getFloat32(this._pos_,this._xd_);return this._pos_+=4,t},e.getFloat64=function(){var t=this._d_.getFloat64(this._pos_,this._xd_);return this._pos_+=8,t},e.writeFloat32=function(t){this.ensureWrite(this._pos_+4),this._d_.setFloat32(this._pos_,t,this._xd_),this._pos_+=4},e.writeFloat64=function(t){this.ensureWrite(this._pos_+8),this._d_.setFloat64(this._pos_,t,this._xd_),this._pos_+=8},e.getInt32=function(){var t=this._d_.getInt32(this._pos_,this._xd_);return this._pos_+=4,t},e.getUint32=function(){var t=this._d_.getUint32(this._pos_,this._xd_);return this._pos_+=4,t},e.writeInt32=function(t){this.ensureWrite(this._pos_+4),this._d_.setInt32(this._pos_,t,this._xd_),this._pos_+=4},e.writeUint32=function(t){this.ensureWrite(this._pos_+4),this._d_.setUint32(this._pos_,t,this._xd_),this._pos_+=4},e.getInt16=function(){var t=this._d_.getInt16(this._pos_,this._xd_);return this._pos_+=2,t},e.getUint16=function(){var t=this._d_.getUint16(this._pos_,this._xd_);return this._pos_+=2,t},e.writeUint16=function(t){this.ensureWrite(this._pos_+2),this._d_.setUint16(this._pos_,t,this._xd_),this._pos_+=2},e.writeInt16=function(t){this.ensureWrite(this._pos_+2),this._d_.setInt16(this._pos_,t,this._xd_),this._pos_+=2},e.getUint8=function(){return this._d_.getUint8(this._pos_++)},e.writeUint8=function(t){this.ensureWrite(this._pos_+1),this._d_.setUint8(this._pos_,t,this._xd_),this._pos_++},e._getUInt8=function(t){return this._d_.getUint8(t)},e._getUint16=function(t){return this._d_.getUint16(t,this._xd_)},e._getMatrix=function(){var t=new Matrix(this.getFloat32(),this.getFloat32(),this.getFloat32(),this.getFloat32(),this.getFloat32(),this.getFloat32());return t},e.rUTF=function(t){for(var e="",i=this._pos_+t,n=0,s=0,r=0,a=String.fromCharCode,o=this._u8d_,h=0;this._pos_<i;)n=o[this._pos_++],128>n?0!=n&&(e+=a(n)):224>n?e+=a((63&n)<<6|127&o[this._pos_++]):240>n?(s=o[this._pos_++],
|
||
e+=a((31&n)<<12|(127&s)<<6|127&o[this._pos_++])):(s=o[this._pos_++],r=o[this._pos_++],e+=a((15&n)<<18|(127&s)<<12|r<<6&127|127&o[this._pos_++])),h++;return e},e.getCustomString=function(t){for(var e="",i=0,n=0,s=0,r=String.fromCharCode,a=this._u8d_;t>0;)if(n=a[this._pos_],128>n)e+=r(n),this._pos_++,t--;else for(i=n-128,this._pos_++,t-=i;i>0;)n=a[this._pos_++],s=a[this._pos_++],e+=r(s<<8|n),i--;return e},e.clear=function(){this._pos_=0,this.length=0},e.__getBuffer=function(){return this._d_.buffer},e.writeUTFBytes=function(t){t+="";for(var e=0,i=t.length;i>e;e++){var n=t.charCodeAt(e);127>=n?this.writeByte(n):2047>=n?(this.writeByte(192|n>>6),this.writeByte(128|63&n)):65535>=n?(this.writeByte(224|n>>12),this.writeByte(128|n>>6&63),this.writeByte(128|63&n)):(this.writeByte(240|n>>18),this.writeByte(128|n>>12&63),this.writeByte(128|n>>6&63),this.writeByte(128|63&n))}},e.writeUTFString=function(t){var e=0;e=this.pos,this.writeUint16(1),this.writeUTFBytes(t);var i=0;i=this.pos-e-2,this._d_.setUint16(e,i,this._xd_)},e.readUTFString=function(){var t=0;t=this.pos;var e=0;return e=this.getUint16(),this.readUTFBytes(e)},e.getUTFString=function(){return this.readUTFString()},e.readUTFBytes=function(t){return void 0===t&&(t=-1),0==t?"":(t=t>0?t:this.bytesAvailable,this.rUTF(t))},e.getUTFBytes=function(t){return void 0===t&&(t=-1),this.readUTFBytes(t)},e.writeByte=function(t){this.ensureWrite(this._pos_+1),this._d_.setInt8(this._pos_,t),this._pos_+=1},e.readByte=function(){return this._d_.getInt8(this._pos_++)},e.getByte=function(){return this.readByte()},e.ensureWrite=function(t){this._length<t&&(this._length=t),this._allocated_<t&&(this.length=t)},e.writeArrayBuffer=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),0>e||0>i)throw"writeArrayBuffer error - Out of bounds";0==i&&(i=t.byteLength-e),this.ensureWrite(this._pos_+i);var n=new Uint8Array(t);this._u8d_.set(n.subarray(e,e+i),this._pos_),this._pos_+=i},__getset(0,e,"buffer",function(){var t=this._d_.buffer;return t.byteLength==this.length?t:t.slice(0,this.length)}),__getset(0,e,"endian",function(){return this._xd_?"littleEndian":"bigEndian"},function(t){this._xd_="littleEndian"==t}),__getset(0,e,"length",function(){return this._length},function(t){this._allocated_<t?this.___resizeBuffer(this._allocated_=Math.floor(Math.max(t,2*this._allocated_))):this._allocated_>t&&this.___resizeBuffer(this._allocated_=t),this._length=t}),__getset(0,e,"pos",function(){return this._pos_},function(t){this._pos_=t,this._d_.byteOffset=t}),__getset(0,e,"bytesAvailable",function(){return this.length-this._pos_}),t.getSystemEndian=function(){if(!t._sysEndian){var e=new ArrayBuffer(2);new DataView(e).setInt16(0,256,!0),t._sysEndian=256===new Int16Array(e)[0]?"littleEndian":"bigEndian"}return t._sysEndian},t.BIG_ENDIAN="bigEndian",t.LITTLE_ENDIAN="littleEndian",t._sysEndian=null,t}(),CacheManger=function(){function t(){}return __class(t,"laya.utils.CacheManger"),t.regCacheByFunction=function(e,i){t.unRegCacheByFunction(e,i);var n;n={tryDispose:e,getCacheList:i},t._cacheList.push(n)},t.unRegCacheByFunction=function(e,i){var n=0,s=0;for(s=t._cacheList.length,n=0;s>n;n++)if(t._cacheList[n].tryDispose==e&&t._cacheList[n].getCacheList==i)return void t._cacheList.splice(n,1)},t.forceDispose=function(){var e=0,i=t._cacheList.length;for(e=0;i>e;e++)t._cacheList[e].tryDispose(!0)},t.beginCheck=function(e){void 0===e&&(e=15e3),Laya.timer.loop(e,null,t._checkLoop)},t.stopCheck=function(){Laya.timer.clear(null,t._checkLoop)},t._checkLoop=function(){var e=t._cacheList;if(!(e.length<1)){var i=Browser.now(),n=0,s=0;for(s=n=e.length;n>0&&(t._index++,t._index=t._index%s,e[t._index].tryDispose(!1),!(Browser.now()-i>t.loopTimeLimit));)n--}},t.loopTimeLimit=2,t._cacheList=[],t._index=0,t}(),ClassUtils=function(){function t(){}return __class(t,"laya.utils.ClassUtils"),t.regClass=function(e,i){t._classMap[e]=i},t.getRegClass=function(e){return t._classMap[e]},t.getInstance=function(e){var i=t.getClass(e);return i?new i:(console.log("[error] Undefined class:",e),null)},t.createByJson=function(e,i,n,s,r){"string"==typeof e&&(e=JSON.parse(e));var a=e.props;if(!i&&(i=r?r.runWith(e):t.getInstance(a.runtime||e.type),!i))return null;var o=e.child;if(o)for(var h=0,l=o.length;l>h;h++){var u=o[h];if("render"!==u.props.name&&"render"!==u.props.renderType||!i._$set_itemRender)if("Graphic"==u.type)t.addGraphicsToSprite(u,i);else if(t.isDrawType(u.type))t.addGraphicToSprite(u,i,!0);else{var c=t.createByJson(u,null,n,s,r);"Script"==u.type?c.owner=i:"mask"==u.props.renderType?i.mask=c:i.addChild(c)}else i.itemRender=u}if(a)for(var _ in a){var d=a[_];"var"===_&&n?n[d]=i:d instanceof Array&&"function"==typeof i[_]?i[_].apply(i,d):i[_]=d}return s&&e.customProps&&s.runWith([i,e]),i.created&&i.created(),i},t.addGraphicsToSprite=function(e,i){var n;if(n=e.child,n&&!(n.length<1)){var s;s=t._getGraphicsFromSprite(e,i);var r=0,a=0;e.props&&(r=t._getObjVar(e.props,"x",0),a=t._getObjVar(e.props,"y",0)),0!=r&&0!=a&&s.translate(r,a);var o=0,h=0;for(h=n.length,o=0;h>o;o++)t._addGraphicToGraphics(n[o],s);0!=r&&0!=a&&s.translate(-r,-a)}},t.addGraphicToSprite=function(e,i,n){void 0===n&&(n=!1);var s;s=n?t._getGraphicsFromSprite(e,i):i.graphics,t._addGraphicToGraphics(e,s)},t._getGraphicsFromSprite=function(t,e){var i;if(!t||!t.props)return e.graphics;var n;switch(n=t.props.renderType){case"hit":case"unHit":var s;e.hitArea||(e.hitArea=new HitArea),s=e.hitArea,s[n]||(s[n]=new Graphics),i=s[n]}return i||(i=e.graphics),i},t._getTransformData=function(e){var i;(e.hasOwnProperty("pivotX")||e.hasOwnProperty("pivotY"))&&(i=i||new Matrix,i.translate(-t._getObjVar(e,"pivotX",0),-t._getObjVar(e,"pivotY",0)));var n=t._getObjVar(e,"scaleX",1),s=t._getObjVar(e,"scaleY",1),r=t._getObjVar(e,"rotation",0);t._getObjVar(e,"skewX",0),t._getObjVar(e,"skewY",0);return 1==n&&1==s&&0==r||(i=i||new Matrix,i.scale(n,s),i.rotate(.0174532922222222*r)),i},t._addGraphicToGraphics=function(e,i){var n;if(n=e.props){var s;if(s=t.DrawTypeDic[e.type]){var r;r=i;var a,o=t._getParams(n,s[1],s[2],s[3]);a=t._tM,(a||1!=t._alpha)&&(r.save(),a&&r.transform(a),1!=t._alpha&&r.alpha(t._alpha)),r[s[0]].apply(r,o),(a||1!=t._alpha)&&r.restore()}}},t._adptLineData=function(t){return t[2]=parseFloat(t[0])+parseFloat(t[2]),t[3]=parseFloat(t[1])+parseFloat(t[3]),t},t._adptTextureData=function(t){return t[0]=Loader.getRes(t[0]),t},t._adptLinesData=function(e){return e[2]=t._getPointListByStr(e[2]),e},t.isDrawType=function(e){return"Image"==e?!1:t.DrawTypeDic.hasOwnProperty(e)},t._getParams=function(e,i,n,s){void 0===n&&(n=0);var r;r=t._temParam,r.length=i.length;var a=0,o=0;for(o=i.length,a=0;o>a;a++)r[a]=t._getObjVar(e,i[a][0],i[a][1]);t._alpha=t._getObjVar(e,"alpha",1);var h;return h=t._getTransformData(e),h?(n||(n=0),h.translate(r[n],r[n+1]),r[n]=r[n+1]=0,t._tM=h):t._tM=null,s&&t[s]&&(r=t[s](r)),r},t._getPointListByStr=function(t){var e;e=t.split(",");var i=0,n=0;for(n=e.length,i=0;n>i;i++)e[i]=parseFloat(e[i]);return e},t._getObjVar=function(t,e,i){return t.hasOwnProperty(e)?t[e]:i},t._temParam=[],t._classMap={Sprite:"laya.display.Sprite",Text:"laya.display.Text",Animation:"laya.display.Animation",Skeleton:"laya.ani.bone.Skeleton",Particle2D:"laya.particle.Particle2D",div:"laya.html.dom.HTMLDivElement",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"},t.getClass=function(e){var i=t._classMap[e]||e;return"string"==typeof i?Laya.__classmap[i]:i},t._tM=null,t._alpha=NaN,__static(t,["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"]}}]),t}(),Color=function(){function t(e){if(this._color=[],"string"==typeof e){this.strColor=e,null===e&&(e="#000000"),"#"==e.charAt(0)&&(e=e.substr(1));var i=this.numColor=parseInt(e,16),n=8==e.length;if(n)return void(this._color=[parseInt(e.substr(0,2),16)/255,((16711680&i)>>16)/255,((65280&i)>>8)/255,(255&i)/255])}else i=this.numColor=e,this.strColor=Utils.toHexColor(i);this._color=[((16711680&i)>>16)/255,((65280&i)>>8)/255,(255&i)/255,1],this._color.__id=++t._COLODID}return __class(t,"laya.utils.Color"),t._initDefault=function(){t._DEFAULT={};for(var e in t._COLOR_MAP)t._SAVE[e]=t._DEFAULT[e]=new t(t._COLOR_MAP[e]);return t._DEFAULT},t._initSaveMap=function(){t._SAVE_SIZE=0,t._SAVE={};for(var e in t._DEFAULT)t._SAVE[e]=t._DEFAULT[e]},t.create=function(e){var i=t._SAVE[e+""];return null!=i?i:(t._SAVE_SIZE<1e3||t._initSaveMap(),t._SAVE[e+""]=new t(e))},t._SAVE={},t._SAVE_SIZE=0,t._COLOR_MAP={white:"#FFFFFF",red:"#FF0000",green:"#00FF00",blue:"#0000FF",black:"#000000",yellow:"#FFFF00",gray:"#AAAAAA"},t._DEFAULT=t._initDefault(),t._COLODID=1,t}(),Dictionary=function(){function t(){this._values=[],this._keys=[]}__class(t,"laya.utils.Dictionary");var e=t.prototype;return e.set=function(t,e){var i=this.indexOf(t);return i>=0?void(this._values[i]=e):(this._keys.push(t),void this._values.push(e))},e.indexOf=function(t){var e=this._keys.indexOf(t);return e>=0?e:(t="string"==typeof t?Number(t):"number"==typeof t?t.toString():t,this._keys.indexOf(t))},e.get=function(t){var e=this.indexOf(t);return 0>e?null:this._values[e]},e.remove=function(t){var e=this.indexOf(t);return e>=0?(this._keys.splice(e,1),this._values.splice(e,1),!0):!1},e.clear=function(){this._values.length=0,this._keys.length=0},__getset(0,e,"values",function(){return this._values}),__getset(0,e,"keys",function(){return this._keys}),t}(),Dragging=function(){function t(){this.ratio=.92,this.maxOffset=60,this._dragging=!1,this._clickOnly=!0}__class(t,"laya.utils.Dragging");var e=t.prototype;return e.start=function(t,e,i,n,s,r,a,o){void 0===o&&(o=.92),this.clearTimer(),this.target=t,this.area=e,this.hasInertia=i,this.elasticDistance=e?n:0,this.elasticBackTime=s,this.data=r,this._disableMouseEvent=a,this.ratio=o,1!=t.globalScaleX||1!=t.globalScaleY?this._parent=t.parent:this._parent=Laya.stage,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.timer.frameLoop(1,this,this.loop)},e.clearTimer=function(){Laya.timer.clear(this,this.loop),Laya.timer.clear(this,this.tweenMove),this._tween&&(this._tween.recover(),this._tween=null)},e.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())},e.loop=function(){var t=this._parent.getMousePoint(),e=t.x,i=t.y,n=e-this._lastX,s=i-this._lastY;if(this._clickOnly){if(!(Math.abs(n*Laya.stage._canvasTransform.getScaleX())>1||Math.abs(s*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,this.target._set$P("$_MOUSEDOWN",!1)}else this._offsets.push(n,s);0===n&&0===s||(this._lastX=e,this._lastY=i,this.target.x+=n*this._elasticRateX,this.target.y+=s*this._elasticRateY,this.area&&this.checkArea(),this.target.event("dragmove",this.data))},e.checkArea=function(){if(this.elasticDistance<=0)this.backToArea();else{if(this.target.x<this.area.x)var t=this.area.x-this.target.x;else t=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-t/this.elasticDistance),this.target.y<this.area.y)var e=this.area.y-this.target.y;else e=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-e/this.elasticDistance)}},e.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)},e.onStageMouseUp=function(t){if(MouseManager.instance.disableMouseEvent=!1,Laya.stage.off("mouseup",this,this.onStageMouseUp),Laya.stage.off("mouseout",this,this.onStageMouseUp),Laya.timer.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 e=this._offsets.length,i=Math.min(e,6),n=this._offsets.length-i,s=e-1;s>n;s--)this._offsetY+=this._offsets[s--],this._offsetX+=this._offsets[s];this._offsetX=this._offsetX/i*2,this._offsetY=this._offsetY/i*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.timer.frameLoop(1,this,this.tweenMove)}else this.elasticDistance>0?this.checkElastic():this.clear()},e.checkElastic=function(){var t=NaN,e=NaN;if(this.target.x<this.area.x?t=this.area.x:this.target.x>this.area.x+this.area.width&&(t=this.area.x+this.area.width),this.target.y<this.area.y?e=this.area.y:this.target.y>this.area.y+this.area.height&&(e=this.area.y+this.area.height),isNaN(t)&&isNaN(e))this.clear();else{var i={};isNaN(t)||(i.x=t),isNaN(e)||(i.y=e),this._tween=Tween.to(this.target,i,this.elasticBackTime,Ease.sineOut,Handler.create(this,this.clear),0,!1,!1)}},e.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.timer.clear(this,this.tweenMove),this.elasticDistance>0?this.checkElastic():this.clear())},e.clear=function(){if(this.target){this.clearTimer();var t=this.target;this.target=null,this._parent=null,t.event("dragend",this.data)}},t}(),Ease=function(){function t(){}return __class(t,"laya.utils.Ease"),t.linearNone=function(t,e,i,n){return i*t/n+e},t.linearIn=function(t,e,i,n){return i*t/n+e},t.linearInOut=function(t,e,i,n){return i*t/n+e},t.linearOut=function(t,e,i,n){return i*t/n+e},t.bounceIn=function(e,i,n,s){return n-t.bounceOut(s-e,0,n,s)+i},t.bounceInOut=function(e,i,n,s){return.5*s>e?.5*t.bounceIn(2*e,0,n,s)+i:.5*t.bounceOut(2*e-s,0,n,s)+.5*n+i},t.bounceOut=function(t,e,i,n){return(t/=n)<1/2.75?i*(7.5625*t*t)+e:2/2.75>t?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:2.5/2.75>t?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},t.backIn=function(t,e,i,n,s){return void 0===s&&(s=1.70158),i*(t/=n)*t*((s+1)*t-s)+e},t.backInOut=function(t,e,i,n,s){return void 0===s&&(s=1.70158),(t/=.5*n)<1?.5*i*(t*t*(((s*=1.525)+1)*t-s))+e:i/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+e},t.backOut=function(t,e,i,n,s){return void 0===s&&(s=1.70158),i*((t=t/n-1)*t*((s+1)*t+s)+1)+e},t.elasticIn=function(e,i,n,s,r,a){void 0===r&&(r=0),void 0===a&&(a=0);var o;return 0==e?i:1==(e/=s)?i+n:(a||(a=.3*s),!r||n>0&&n>r||0>n&&-n>r?(r=n,o=a/4):o=a/t.PI2*Math.asin(n/r),-(r*Math.pow(2,10*(e-=1))*Math.sin((e*s-o)*t.PI2/a))+i)},t.elasticInOut=function(e,i,n,s,r,a){void 0===r&&(r=0),void 0===a&&(a=0);var o;return 0==e?i:2==(e/=.5*s)?i+n:(a||(a=s*(.3*1.5)),!r||n>0&&n>r||0>n&&-n>r?(r=n,o=a/4):o=a/t.PI2*Math.asin(n/r),1>e?-.5*(r*Math.pow(2,10*(e-=1))*Math.sin((e*s-o)*t.PI2/a))+i:r*Math.pow(2,-10*(e-=1))*Math.sin((e*s-o)*t.PI2/a)*.5+n+i)},t.elasticOut=function(e,i,n,s,r,a){void 0===r&&(r=0),void 0===a&&(a=0);var o;return 0==e?i:1==(e/=s)?i+n:(a||(a=.3*s),!r||n>0&&n>r||0>n&&-n>r?(r=n,o=a/4):o=a/t.PI2*Math.asin(n/r),r*Math.pow(2,-10*e)*Math.sin((e*s-o)*t.PI2/a)+n+i)},t.strongIn=function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},t.strongInOut=function(t,e,i,n){return(t/=.5*n)<1?.5*i*t*t*t*t*t+e:.5*i*((t-=2)*t*t*t*t+2)+e},t.strongOut=function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},t.sineInOut=function(t,e,i,n){return.5*-i*(Math.cos(Math.PI*t/n)-1)+e},t.sineIn=function(e,i,n,s){return-n*Math.cos(e/s*t.HALF_PI)+n+i},t.sineOut=function(e,i,n,s){return n*Math.sin(e/s*t.HALF_PI)+i},t.quintIn=function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},t.quintInOut=function(t,e,i,n){return(t/=.5*n)<1?.5*i*t*t*t*t*t+e:.5*i*((t-=2)*t*t*t*t+2)+e},t.quintOut=function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},t.quartIn=function(t,e,i,n){return i*(t/=n)*t*t*t+e},t.quartInOut=function(t,e,i,n){return(t/=.5*n)<1?.5*i*t*t*t*t+e:.5*-i*((t-=2)*t*t*t-2)+e},t.quartOut=function(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e},t.cubicIn=function(t,e,i,n){return i*(t/=n)*t*t+e},t.cubicInOut=function(t,e,i,n){return(t/=.5*n)<1?.5*i*t*t*t+e:.5*i*((t-=2)*t*t+2)+e},t.cubicOut=function(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e},t.quadIn=function(t,e,i,n){return i*(t/=n)*t+e},t.quadInOut=function(t,e,i,n){return(t/=.5*n)<1?.5*i*t*t+e:.5*-i*(--t*(t-2)-1)+e},t.quadOut=function(t,e,i,n){return-i*(t/=n)*(t-2)+e},t.expoIn=function(t,e,i,n){return 0==t?e:i*Math.pow(2,10*(t/n-1))+e-.001*i},t.expoInOut=function(t,e,i,n){return 0==t?e:t==n?e+i:(t/=.5*n)<1?.5*i*Math.pow(2,10*(t-1))+e:.5*i*(-Math.pow(2,-10*--t)+2)+e},t.expoOut=function(t,e,i,n){return t==n?e+i:i*(-Math.pow(2,-10*t/n)+1)+e},t.circIn=function(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e},t.circInOut=function(t,e,i,n){return(t/=.5*n)<1?.5*-i*(Math.sqrt(1-t*t)-1)+e:.5*i*(Math.sqrt(1-(t-=2)*t)+1)+e},t.circOut=function(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e},t.HALF_PI=.5*Math.PI,t.PI2=2*Math.PI,t}(),HitArea=function(){function t(){this._hit=null,this._unHit=null}__class(t,"laya.utils.HitArea");var e=t.prototype;return e.isHit=function(e,i){return t.isHitGraphic(e,i,this.hit)?!t.isHitGraphic(e,i,this.unHit):!1},__getset(0,e,"hit",function(){return this._hit||(this._hit=new Graphics),this._hit},function(t){this._hit=t}),__getset(0,e,"unHit",function(){return this._unHit||(this._unHit=new Graphics),this._unHit},function(t){this._unHit=t}),t.isHitGraphic=function(e,i,n){if(!n)return!1;var s;if(s=n.cmds,!s&&n._one&&(s=t._cmds,s.length=1,s[0]=n._one),!s)return!1;var r=0,a=0;a=s.length;var o;for(r=0;a>r;r++)if(o=s[r]){var h=Render._context;switch(o.callee){case h._translate:case 6:e-=o[0],i-=o[1]}if(t.isHitCmd(e,i,o))return!0}return!1},t.isHitCmd=function(e,i,n){if(!n)return!1;var s=Render._context,r=!1;switch(n.callee){case s._drawRect:case 13:t._rec.setTo(n[0],n[1],n[2],n[3]),r=t._rec.contains(e,i);break;case s._drawCircle:case s._fillCircle:case 14:var a=NaN;e-=n[0],i-=n[1],a=e*e+i*i,r=a<n[2]*n[2];break;case s._drawPoly:case 18:e-=n[0],i-=n[1],r=t.ptInPolygon(e,i,n[2])}return r},t.ptInPolygon=function(e,i,n){var s;s=t._ptPoint,s.setTo(e,i);var r=0,a=NaN,o=NaN,h=NaN,l=NaN,u=0;u=n.length;for(var c=0;u>c;c+=2)if(a=n[c],o=n[c+1],h=n[(c+2)%u],l=n[(c+3)%u],o!=l&&!(s.y<Math.min(o,l)||s.y>=Math.max(o,l))){var _=(s.y-o)*(h-a)/(l-o)+a;_>s.x&&r++}return r%2==1},t._cmds=[],__static(t,["_rec",function(){return this._rec=new Rectangle},"_ptPoint",function(){return this._ptPoint=new Point}]),t}(),HTMLChar=function(){function t(e,i,n,s){this["char"]=e,this.charNum=e.charCodeAt(0),this._x=this._y=0,this.width=i,this.height=n,this.style=s,this.isWord=!t._isWordRegExp.test(e)}__class(t,"laya.utils.HTMLChar");var e=t.prototype;return Laya.imps(e,{"laya.display.ILayout":!0}),e.setSprite=function(t){this._sprite=t},e.getSprite=function(){return this._sprite},e._isChar=function(){return!0},e._getCSSStyle=function(){return this.style},__getset(0,e,"width",function(){return this._w},function(t){this._w=t}),__getset(0,e,"x",function(){return this._x},function(t){this._sprite&&(this._sprite.x=t),this._x=t}),__getset(0,e,"y",function(){return this._y},function(t){this._sprite&&(this._sprite.y=t),this._y=t}),__getset(0,e,"height",function(){return this._h},function(t){this._h=t}),t._isWordRegExp=new RegExp("[\\w.]",""),t}(),Log=function(){function t(){}return __class(t,"laya.utils.Log"),t.enable=function(){t._logdiv||(t._logdiv=Browser.window.document.createElement("div"),Browser.window.document.body.appendChild(t._logdiv),t._logdiv.style.cssText="pointer-events:none;border:white;overflow:hidden;z-index:1000000;background:rgba(100,100,100,0.6);color:white;position: absolute;left:0px;top:0px;width:50%;height:50%;")},t.toggle=function(){var e=t._logdiv.style;"1px"==e.width?e.width=e.height="50%":e.width=e.height="1px"},t.print=function(e){t._logdiv&&(t._count>=t.maxCount&&t.clear(),t._count++,t._logdiv.innerText+=e+"\n",t._logdiv.scrollTop=t._logdiv.scrollHeight)},t.clear=function(){t._logdiv.innerText="",t._count=0},t._logdiv=null,t._count=0,t.maxCount=20,t}(),Mouse=function(){function t(){}return __class(t,"laya.utils.Mouse"),__getset(1,t,"cursor",function(){return t._style.cursor},function(e){t._style.cursor=e}),t.hide=function(){"none"!=t.cursor&&(t._preCursor=t.cursor,t.cursor="none")},t.show=function(){"none"==t.cursor&&(t._preCursor?t.cursor=t._preCursor:t.cursor="auto")},t._preCursor=null,__static(t,["_style",function(){return this._style=Browser.document.body.style}]),t}(),Pool=function(){function t(){}return __class(t,"laya.utils.Pool"),t.getPoolBySign=function(e){return t._poolDic[e]||(t._poolDic[e]=[])},t.clearBySign=function(e){t._poolDic[e]&&(t._poolDic[e].length=0)},t.recover=function(e,i){i.__InPool||(i.__InPool=!0,t.getPoolBySign(e).push(i))},t.getItemByClass=function(e,i){var n=t.getPoolBySign(e),s=n.length?n.pop():new i;return s.__InPool=!1,s},t.getItemByCreateFun=function(e,i){var n=t.getPoolBySign(e),s=n.length?n.pop():i();return s.__InPool=!1,s},t.getItem=function(e){var i=t.getPoolBySign(e),n=i.length?i.pop():null;return n&&(n.__InPool=!1),n},t._poolDic={},t.InPoolSign="__InPool",t}(),PoolCache=function(){function t(){this.sign=null,this.maxCount=1e3}__class(t,"laya.utils.PoolCache");var e=t.prototype;return e.getCacheList=function(){return Pool.getPoolBySign(this.sign)},e.tryDispose=function(t){var e;e=Pool.getPoolBySign(this.sign),e.length>this.maxCount&&e.splice(this.maxCount,e.length-this.maxCount)},t.addPoolCacheManager=function(e,i){void 0===i&&(i=100);var n;n=new t,n.sign=e,n.maxCount=i,CacheManger.regCacheByFunction(Utils.bind(n.tryDispose,n),Utils.bind(n.getCacheList,n))},t}(),Stat=function(){function t(){}return __class(t,"laya.utils.Stat"),__getset(1,t,"onclick",null,function(e){t._canvas.source.onclick=e,t._canvas.source.style.pointerEvents=""}),t.show=function(e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),Render.isConchApp)return void(conch.showFPS&&conch.showFPS(e,i));var n=Browser.pixelRatio;t._width=120*n,t._vx=70*n,t._view[0]={title:"FPS(Canvas)",value:"_fpsStr",color:"yellow",units:"int"},t._view[1]={title:"Sprite",value:"spriteCount",color:"white",units:"int"},t._view[2]={title:"DrawCall",value:"drawCall",color:"white",units:"int"},t._view[3]={title:"CurMem",value:"currentMemorySize",color:"yellow",units:"M"},Render.isWebGL?(t._view[4]={title:"Shader",value:"shaderCall",color:"white",units:"int"},Render.is3DMode?(t._view[0].title="FPS(3D)",t._view[5]={title:"TriFaces",value:"trianglesFaces",color:"white",units:"int"}):(t._view[0].title="FPS(WebGL)",t._view[5]={title:"Canvas",value:"_canvasStr",color:"white",units:"int"})):t._view[4]={title:"Canvas",value:"_canvasStr",color:"white",units:"int"},t._fontSize=12*n;for(var s=0;s<t._view.length;s++)t._view[s].x=4,t._view[s].y=s*t._fontSize+2*n;t._height=n*(12*t._view.length+3*n),t._canvas||(t._canvas=new HTMLCanvas("2D"),t._canvas.size(t._width,t._height),t._ctx=t._canvas.getContext("2d"),t._ctx.textBaseline="top",t._ctx.font=t._fontSize+"px Sans-serif",t._canvas.source.style.cssText="pointer-events:none;background:rgba(150,150,150,0.8);z-index:100000;position: absolute;left:"+e+"px;top:"+i+"px;width:"+t._width/n+"px;height:"+t._height/n+"px;"),t._first=!0,t.loop(),t._first=!1,Browser.container.appendChild(t._canvas.source),t.enable()},t.enable=function(){Laya.timer.frameLoop(1,t,t.loop)},t.hide=function(){Browser.removeElement(t._canvas.source),Laya.timer.clear(t,t.loop)},t.clear=function(){t.trianglesFaces=t.drawCall=t.shaderCall=t.spriteCount=t.canvasNormal=t.canvasBitmap=t.canvasReCache=0},t.loop=function(){t._count++;var e=Browser.now();if(!(e-t._timer<1e3)){var i=t._count;if(t.FPS=Math.round(1e3*i/(e-t._timer)),t._canvas){t.trianglesFaces=Math.round(t.trianglesFaces/i),t.drawCall=Math.round(t.drawCall/i)-2,t.shaderCall=Math.round(t.shaderCall/i),t.spriteCount=Math.round(t.spriteCount/i)-1,t.canvasNormal=Math.round(t.canvasNormal/i),t.canvasBitmap=Math.round(t.canvasBitmap/i),t.canvasReCache=Math.ceil(t.canvasReCache/i),t._fpsStr=t.FPS+(t.renderSlow?" slow":""),t._canvasStr=t.canvasReCache+"/"+t.canvasNormal+"/"+t.canvasBitmap,t.currentMemorySize=ResourceManager.systemResourceManager.memorySize;var n=t._ctx;n.clearRect(t._first?0:t._vx,0,t._width,t._height);for(var s=0;s<t._view.length;s++){var r=t._view[s];t._first&&(n.fillStyle="white",n.fillText(r.title,r.x,r.y,null,null,null)),n.fillStyle=r.color;var a=t[r.value];"M"==r.units&&(a=Math.floor(a/1048576*100)/100+" M"),n.fillText(a+"",r.x+t._vx,r.y,null,null,null)}t.clear()}t._count=0,t._timer=e}},t.loopCount=0,t.shaderCall=0,t.drawCall=0,t.trianglesFaces=0,t.spriteCount=0,t.FPS=0,t.canvasNormal=0,t.canvasBitmap=0,t.canvasReCache=0,t.renderSlow=!1,t.currentMemorySize=0,t._fpsStr=null,t._canvasStr=null,t._canvas=null,t._ctx=null,t._timer=0,t._count=0,t._width=120,t._height=100,t._view=[],t._fontSize=12,t._first=!1,t._vx=NaN,t}(),StringKey=function(){function t(){this._strs={},this._length=0}__class(t,"laya.utils.StringKey");var e=t.prototype;return e.add=function(t){var e=this._strs[t];return null!=e?e:this._strs[t]=this._length++},e.get=function(t){var e=this._strs[t];return null==e?-1:e},t}(),Timer=function(){function t(){this._delta=0,this.scale=1,this.currFrame=0,this._mid=1,this._map=[],this._laters=[],this._handlers=[],this._temp=[],this._count=0,this.currTimer=Browser.now(),this._lastTimer=Browser.now(),Laya.timer&&Laya.timer.frameLoop(1,this,this._update)}var e;__class(t,"laya.utils.Timer");var i=t.prototype;return i._update=function(){if(this.scale<=0)return void(this._lastTimer=Browser.now());var t=this.currFrame=this.currFrame+this.scale,e=Browser.now();this._delta=(e-this._lastTimer)*this.scale;var i=this.currTimer=this.currTimer+this._delta;this._lastTimer=e;var n=this._handlers;for(this._count=0,a=0,o=n.length;o>a;a++)if(h=n[a],null!==h.method){var s=h.userFrame?t:i;s>=h.exeTime&&(h.repeat?s>h.exeTime&&(h.exeTime+=h.delay,h.run(!1),s>h.exeTime&&(h.exeTime+=Math.ceil((s-h.exeTime)/h.delay)*h.delay)):h.run(!0))}else this._count++;(this._count>30||t%200===0)&&this._clearHandlers();for(var r=this._laters,a=0,o=r.length-1;o>=a;a++){var h=r[a];null!==h.method&&h.run(!1),this._recoverHandler(h),a===o&&(o=r.length-1)}r.length=0},i._clearHandlers=function(){for(var t=this._handlers,e=0,i=t.length;i>e;e++){var n=t[e];null!==n.method?this._temp.push(n):this._recoverHandler(n)}this._handlers=this._temp,this._temp=t,this._temp.length=0},i._recoverHandler=function(e){this._map[e.key]=null,e.clear(),t._pool.push(e)},i._create=function(i,n,s,r,a,o,h){if(!s)return void a.apply(r,o);if(h){var l=this._getHandler(r,a);if(l)return l.repeat=n,l.userFrame=i,l.delay=s,l.caller=r,l.method=a,l.args=o,void(l.exeTime=s+(i?this.currFrame:this.currTimer))}l=t._pool.length>0?t._pool.pop():new e,l.repeat=n,l.userFrame=i,l.delay=s,l.caller=r,l.method=a,l.args=o,l.exeTime=s+(i?this.currFrame:this.currTimer),this._indexHandler(l),this._handlers.push(l)},i._indexHandler=function(t){var e=t.caller,i=t.method,n=e?e.$_GID||(e.$_GID=Utils.getGID()):0,s=i.$_TID||(i.$_TID=1e5*this._mid++);t.key=n+s,this._map[t.key]=t},i.once=function(t,e,i,n,s){void 0===s&&(s=!0),this._create(!1,!1,t,e,i,n,s)},i.loop=function(t,e,i,n,s){void 0===s&&(s=!0),this._create(!1,!0,t,e,i,n,s)},i.frameOnce=function(t,e,i,n,s){void 0===s&&(s=!0),this._create(!0,!1,t,e,i,n,s)},i.frameLoop=function(t,e,i,n,s){void 0===s&&(s=!0),this._create(!0,!0,t,e,i,n,s)},i.toString=function(){return"callLater:"+this._laters.length+" handlers:"+this._handlers.length+" pool:"+t._pool.length},i.clear=function(t,e){var i=this._getHandler(t,e);i&&(this._map[i.key]=null,i.key=0,i.clear())},i.clearAll=function(t){for(var e=0,i=this._handlers.length;i>e;e++){var n=this._handlers[e];n.caller===t&&(this._map[n.key]=null,n.key=0,n.clear())}},i._getHandler=function(t,e){var i=t?t.$_GID||(t.$_GID=Utils.getGID()):0,n=e.$_TID||(e.$_TID=1e5*this._mid++);return this._map[i+n]},i.callLater=function(i,n,s){if(null==this._getHandler(i,n)){if(t._pool.length)var r=t._pool.pop();else r=new e;r.caller=i,r.method=n,r.args=s,this._indexHandler(r),this._laters.push(r)}},i.runCallLater=function(t,e){var i=this._getHandler(t,e);i&&null!=i.method&&(this._map[i.key]=null,i.run(!0))},__getset(0,i,"delta",function(){return this._delta}),t._pool=[],t.__init$=function(){e=function(){function t(){this.key=0,this.repeat=!1,this.delay=0,this.userFrame=!1,this.exeTime=0,this.caller=null,this.method=null,this.args=null}__class(t,"");var e=t.prototype;return e.clear=function(){this.caller=null,this.method=null,this.args=null},e.run=function(t){var e=this.caller;if(e&&e.destroyed)return this.clear();var i=this.method,n=this.args;t&&this.clear(),null!=i&&(n?i.apply(e,n):i.call(e))},t}()},t}(),Tween=function(){function t(){this.gid=0}__class(t,"laya.utils.Tween");var e=t.prototype;return e.to=function(t,e,i,n,s,r,a){return void 0===r&&(r=0),void 0===a&&(a=!1),this._create(t,e,i,n,s,r,a,!0,!1,!0)},e.from=function(t,e,i,n,s,r,a){return void 0===r&&(r=0),void 0===a&&(a=!1),this._create(t,e,i,n,s,r,a,!1,!1,!0)},e._create=function(e,i,n,s,r,a,o,h,l,u){if(!e)throw new Error("Tween:target is null");this._target=e,this._duration=n,this._ease=s||i.ease||t.easeNone,this._complete=r||i.complete,this._delay=a,this._props=[],this._usedTimer=0,this._startTimer=Browser.now(),this._usedPool=l,this.update=i.update;var c=e.$_GID||(e.$_GID=Utils.getGID());return t.tweenMap[c]?(o&&t.clearTween(e),t.tweenMap[c].push(this)):t.tweenMap[c]=[this],u?0>=a?this.firstStart(e,i,h):Laya.timer.once(a,this,this.firstStart,[e,i,h]):this._initProps(e,i,h),this},e.firstStart=function(t,e,i){this._initProps(t,e,i),this._beginLoop()},e._initProps=function(t,e,i){for(var n in e)if("number"==typeof t[n]){var s=i?t[n]:e[n],r=i?e[n]:t[n];this._props.push([n,s,r-s])}},e._beginLoop=function(){Laya.timer.frameLoop(1,this,this._doEase)},e._doEase=function(){this._updateEase(Browser.now())},e._updateEase=function(e){var i=this._target;if(i.destroyed)return t.clearTween(i);var n=this._usedTimer=e-this._startTimer-this._delay;if(!(0>n)){if(n>=this._duration)return this.complete();for(var s=n>0?this._ease(n,0,1,this._duration):0,r=this._props,a=0,o=r.length;o>a;a++){var h=r[a];i[h[0]]=h[1]+s*h[2]}this.update&&this.update.run()}},e.complete=function(){if(this._target){for(var t=this._target,e=this._props,i=this._complete,n=0,s=e.length;s>n;n++){
|
||
var r=e[n];t[r[0]]=r[1]+r[2]}this.update&&this.update.run(),this.clear(),i&&i.run()}},e.pause=function(){Laya.timer.clear(this,this._beginLoop),Laya.timer.clear(this,this._doEase)},e.setStartTime=function(t){this._startTimer=t},e.clear=function(){this._target&&(this._remove(),this._clear())},e._clear=function(){this.pause(),Laya.timer.clear(this,this.firstStart),this._complete=null,this._target=null,this._ease=null,this._props=null,this._usedPool&&(this.update=null,Pool.recover("tween",this))},e.recover=function(){this._usedPool=!0,this._clear()},e._remove=function(){var e=t.tweenMap[this._target.$_GID];if(e)for(var i=0,n=e.length;n>i;i++)if(e[i]===this){e.splice(i,1);break}},e.restart=function(){this.pause(),this._usedTimer=0,this._startTimer=Browser.now();for(var t=this._props,e=0,i=t.length;i>e;e++){var n=t[e];this._target[n[0]]=n[1]}Laya.timer.once(this._delay,this,this._beginLoop)},e.resume=function(){this._usedTimer>=this._duration||(this._startTimer=Browser.now()-this._usedTimer-this._delay,this._beginLoop())},__getset(0,e,"progress",null,function(t){var e=t*this._duration;this._startTimer=Browser.now()-this._delay-e}),t.to=function(e,i,n,s,r,a,o,h){return void 0===a&&(a=0),void 0===o&&(o=!1),void 0===h&&(h=!0),Pool.getItemByClass("tween",t)._create(e,i,n,s,r,a,o,!0,h,!0)},t.from=function(e,i,n,s,r,a,o,h){return void 0===a&&(a=0),void 0===o&&(o=!1),void 0===h&&(h=!0),Pool.getItemByClass("tween",t)._create(e,i,n,s,r,a,o,!1,h,!0)},t.clearAll=function(e){if(e&&e.$_GID){var i=t.tweenMap[e.$_GID];if(i){for(var n=0,s=i.length;s>n;n++)i[n]._clear();i.length=0}}},t.clear=function(t){t.clear()},t.clearTween=function(e){t.clearAll(e)},t.easeNone=function(t,e,i,n){return i*t/n+e},t.tweenMap={},t}(),Utils=function(){function t(){}return __class(t,"laya.utils.Utils"),t.toRadian=function(e){return e*t._pi2},t.toAngle=function(e){return e*t._pi},t.toHexColor=function(t){if(0>t||isNaN(t))return null;for(var e=t.toString(16);e.length<6;)e="0"+e;return"#"+e},t.getGID=function(){return t._gid++},t.concatArray=function(t,e){if(!e)return t;if(!t)return e;var i=0,n=e.length;for(i=0;n>i;i++)t.push(e[i]);return t},t.clearArray=function(t){return t?(t.length=0,t):t},t.copyArray=function(t,e){if(t||(t=[]),!e)return t;t.length=e.length;var i=0,n=e.length;for(i=0;n>i;i++)t[i]=e[i];return t},t.getGlobalRecByPoints=function(t,e,i,n,s){var r;r=new Point(e,i),r=t.localToGlobal(r);var a;return a=new Point(n,s),a=t.localToGlobal(a),Rectangle._getWrapRec([r.x,r.y,a.x,a.y])},t.getGlobalPosAndScale=function(e){return t.getGlobalRecByPoints(e,0,0,1,1)},t.bind=function(t,e){var i=t;return i=t.bind(e)},t.measureText=function(t,e){return RunDriver.measureText(t,e)},t.updateOrder=function(t){if(!t||t.length<2)return!1;for(var e,i=1,n=0,s=t.length,r=NaN;s>i;){for(n=i,e=t[n],r=t[n]._zOrder;--n>-1&&t[n]._zOrder>r;)t[n+1]=t[n];t[n+1]=e,i++}var a=e.parent.model;if(a)if(a.updateZOrder)a.updateZOrder();else{for(i=0;s>i;i++)a.removeChild(t[i].model);for(i=0;s>i;i++)a.addChildAt(t[i].model,i)}return!0},t.transPointList=function(t,e,i){var n=0,s=t.length;for(n=0;s>n;n+=2)t[n]+=e,t[n+1]+=i},t.parseInt=function(t,e){void 0===e&&(e=0);var i=Browser.window.parseInt(t,e);return isNaN(i)?0:i},t.getFileExtension=function(e){t._extReg.lastIndex=e.lastIndexOf(".");var i=t._extReg.exec(e);return i&&i.length>1?i[1].toLowerCase():null},t._gid=1,t._pi=180/Math.PI,t._pi2=Math.PI/180,t._extReg=/\.(\w+)\??/g,t.parseXMLFromString=function(t){var e;if(t=t.replace(/>\s+</g,"><"),e=(new DOMParser).parseFromString(t,"text/xml"),e.firstChild.textContent.indexOf("This page contains the following errors")>-1)throw new Error(e.firstChild.firstChild.textContent);return e},t}(),VectorGraphManager=function(){function t(){this.useDic={},this.shapeDic={},this.shapeLineDic={},this._id=0,this._checkKey=!1,this._freeIdArray=[],Render.isWebGL&&CacheManger.regCacheByFunction(Utils.bind(this.startDispose,this),Utils.bind(this.getCacheList,this))}__class(t,"laya.utils.VectorGraphManager");var e=t.prototype;return e.getId=function(){return this._id++},e.addShape=function(t,e){this.shapeDic[t]=e,this.useDic[t]||(this.useDic[t]=!0)},e.addLine=function(t,e){this.shapeLineDic[t]=e,this.shapeLineDic[t]||(this.shapeLineDic[t]=!0)},e.getShape=function(t){this._checkKey&&null!=this.useDic[t]&&(this.useDic[t]=!0)},e.deleteShape=function(t){this.shapeDic[t]&&(this.shapeDic[t]=null,delete this.shapeDic[t]),this.shapeLineDic[t]&&(this.shapeLineDic[t]=null,delete this.shapeLineDic[t]),null!=this.useDic[t]&&delete this.useDic[t]},e.getCacheList=function(){var t,e=[];for(t in this.shapeDic)e.push(this.shapeDic[t]);for(t in this.shapeLineDic)e.push(this.shapeLineDic[t]);return e},e.startDispose=function(t){var e;for(e in this.useDic)this.useDic[e]=!1;this._checkKey=!0},e.endDispose=function(){if(this._checkKey){var t;for(t in this.useDic)this.useDic[t]||this.deleteShape(t);this._checkKey=!1}},t.getInstance=function(){return t.instance=t.instance||new t},t.instance=null,t}(),WordText=function(){function t(){this.id=NaN,this.save=[],this.toUpperCase=null,this.changed=!1,this._text=null}__class(t,"laya.utils.WordText");var e=t.prototype;return e.setText=function(t){this.changed=!0,this._text=t},e.toString=function(){return this._text},e.charCodeAt=function(t){return this._text?this._text.charCodeAt(t):NaN},e.charAt=function(t){return this._text?this._text.charAt(t):null},__getset(0,e,"length",function(){return this._text?this._text.length:0}),t}(),Node=function(t){function e(){this.name="",this.destroyed=!1,this._displayedInStage=!1,this._parent=null,this.model=null,e.__super.call(this),this._childs=e.ARRAY_EMPTY,this.timer=Laya.timer,this._$P=e.PROP_EMPTY,this.model=Render.isConchNode?new ConchNode:null}__class(e,"laya.display.Node",t);var i=e.prototype;return i.destroy=function(t){void 0===t&&(t=!0),this.destroyed=!0,this._parent&&this._parent.removeChild(this),this._childs&&(t?this.destroyChildren():this.removeChildren()),this._childs=null,this._$P=null,this.offAll()},i.destroyChildren=function(){if(this._childs)for(var t=this._childs.length-1;t>-1;t--)this._childs[t].destroy(!0)},i.addChild=function(t){return this.destroyed||t===this?t:(t._parent===this?(this._childs.splice(this.getChildIndex(t),1),this._childs.push(t),this.model&&(this.model.removeChild(t.model),this.model.addChildAt(t.model,this._childs.length-1)),this._childChanged()):(t.parent&&t.parent.removeChild(t),this._childs===e.ARRAY_EMPTY&&(this._childs=[]),this._childs.push(t),this.model&&this.model.addChildAt(t.model,this._childs.length-1),t.parent=this,this._childChanged()),t)},i.addChildren=function(t){for(var e=arguments,i=0,n=e.length;n>i;)this.addChild(e[i++])},i.addChildAt=function(t,i){if(this.destroyed||t===this)return t;if(i>=0&&i<=this._childs.length){if(t._parent===this){var n=this.getChildIndex(t);this._childs.splice(n,1),this._childs.splice(i,0,t),this.model&&(this.model.removeChild(t.model),this.model.addChildAt(t.model,i)),this._childChanged()}else t.parent&&t.parent.removeChild(t),this._childs===e.ARRAY_EMPTY&&(this._childs=[]),this._childs.splice(i,0,t),this.model&&this.model.addChildAt(t.model,i),t.parent=this;return t}throw new Error("appendChildAt:The index is out of bounds")},i.getChildIndex=function(t){return this._childs.indexOf(t)},i.getChildByName=function(t){for(var e=this._childs,i=0,n=e.length;n>i;i++){var s=e[i];if(s.name===t)return s}return null},i._get$P=function(t){return this._$P[t]},i._set$P=function(t,i){return this.destroyed||(this._$P===e.PROP_EMPTY&&(this._$P={}),this._$P[t]=i),i},i.getChildAt=function(t){return this._childs[t]},i.setChildIndex=function(t,e){var i=this._childs;if(0>e||e>=i.length)throw new Error("setChildIndex:The index is out of bounds.");var n=this.getChildIndex(t);if(0>n)throw new Error("setChildIndex:node is must child of this object.");return i.splice(n,1),i.splice(e,0,t),this.model&&(this.model.removeChild(t.model),this.model.addChildAt(t.model,e)),this._childChanged(),t},i._childChanged=function(t){},i.removeChild=function(t){if(!this._childs)return t;var e=this._childs.indexOf(t);return this.removeChildAt(e)},i.removeSelf=function(){return this._parent&&this._parent.removeChild(this),this},i.removeChildByName=function(t){var e=this.getChildByName(t);return e&&this.removeChild(e),e},i.removeChildAt=function(t){var e=this.getChildAt(t);return e&&(this._childs.splice(t,1),this.model&&this.model.removeChild(e.model),e.parent=null),e},i.removeChildren=function(t,i){if(void 0===t&&(t=0),void 0===i&&(i=2147483647),this._childs&&this._childs.length>0){var n=this._childs;if(0===t&&i>=a){var s=n;this._childs=e.ARRAY_EMPTY}else s=n.splice(t,i-t);for(var r=0,a=s.length;a>r;r++)s[r].parent=null,this.model&&this.model.removeChild(s[r].model)}return this},i.replaceChild=function(t,e){var i=this._childs.indexOf(e);return i>-1?(this._childs.splice(i,1,t),this.model&&(this.model.removeChild(e.model),this.model.addChildAt(t.model,i)),e.parent=null,t.parent=this,t):null},i._setDisplay=function(t){this._displayedInStage!==t&&(this._displayedInStage=t,t?this.event("display"):this.event("undisplay"))},i._displayChild=function(t,e){var i=t._childs;if(i)for(var n=i.length-1;n>-1;n--){var s=i[n];s._setDisplay(e),s._childs.length&&this._displayChild(s,e)}t._setDisplay(e)},i.contains=function(t){if(t===this)return!0;for(;t;){if(t.parent===this)return!0;t=t.parent}return!1},i.timerLoop=function(t,e,i,n,s){void 0===s&&(s=!0),this.timer._create(!1,!0,t,e,i,n,s)},i.timerOnce=function(t,e,i,n,s){void 0===s&&(s=!0),this.timer._create(!1,!1,t,e,i,n,s)},i.frameLoop=function(t,e,i,n,s){void 0===s&&(s=!0),this.timer._create(!0,!0,t,e,i,n,s)},i.frameOnce=function(t,e,i,n,s){void 0===s&&(s=!0),this.timer._create(!0,!1,t,e,i,n,s)},i.clearTimer=function(t,e){this.timer.clear(t,e)},__getset(0,i,"numChildren",function(){return this._childs.length}),__getset(0,i,"parent",function(){return this._parent},function(t){this._parent!==t&&(t?(this._parent=t,this.event("added"),t.displayedInStage&&this._displayChild(this,!0),t._childChanged(this)):(this.event("removed"),this._parent._childChanged(),this._displayChild(this,!1),this._parent=t))}),__getset(0,i,"displayedInStage",function(){return this._displayedInStage}),e.ARRAY_EMPTY=[],e.PROP_EMPTY={},e}(EventDispatcher),CSSStyle=function(t){function e(t){this._bgground=null,this._border=null,this._rect=null,this.lineHeight=0,e.__super.call(this),this._padding=e._PADDING,this._spacing=e._SPACING,this._aligns=e._ALIGNS,this._font=Font.EMPTY,this._ower=t}__class(e,"laya.display.css.CSSStyle",t);var i=e.prototype;return i.destroy=function(){this._ower=null,this._font=null,this._rect=null},i.inherit=function(t){this._font=t._font,this._spacing=t._spacing===e._SPACING?e._SPACING:t._spacing.slice(),this.lineHeight=t.lineHeight},i._widthAuto=function(){return 0!==(262144&this._type)},i.widthed=function(t){return 0!=(8&this._type)},i._calculation=function(t,e){function i(t,e,i){return t*i[0]+e*i[1]+i[2]}function n(t){var e=r.width,n=s.width;a.width&&(s.width=i(e,n,a.width)),a.height&&(s.height=i(e,n,a.height)),a.left&&(s.x=i(e,n,a.left)),a.top&&(s.y=i(e,n,a.top))}if(e.indexOf("%")<0)return!1;var s=this._ower,r=s.parent,a=this._rect;null===a&&(r._getCSSStyle()._type|=524288,r.on("resize",this,n),this._rect=a={input:{}});var o=e.split(" ");return o[0]=parseFloat(o[0])/100,1==o.length?o[1]=o[2]=0:(o[1]=parseFloat(o[1])/100,o[2]=parseFloat(o[2])),a[t]=o,a.input[t]=e,n(t),!0},i.heighted=function(t){return 0!=(8192&this._type)},i.size=function(t,e){var i=this._ower,n=!1;-1!==t&&t!=this._ower.width&&(this._type|=8,this._ower.width=t,n=!0),-1!==e&&e!=this._ower.height&&(this._type|=8192,this._ower.height=e,n=!0),n&&(i._layoutLater(),524288&this._type&&i.event("resize",this))},i._getAlign=function(){return this._aligns[0]},i._getValign=function(){return this._aligns[1]},i._getCssFloat=function(){return 0!=(32768&this._type)?32768:0},i._createFont=function(){return 4096&this._type?this._font:(this._type|=4096,this._font=new Font(this._font))},i.render=function(t,e,i,n){var s=t.width,r=t.height;i-=t.pivotX,n-=t.pivotY,this._bgground&&null!=this._bgground.color&&e.ctx.fillRect(i,n,s,r,this._bgground.color),this._border&&this._border.color&&e.drawRect(i,n,s,r,this._border.color.strColor,this._border.size)},i.getCSSStyle=function(){return this},i.cssText=function(t){this.attrs(e.parseOneCSS(t,";"))},i.attrs=function(t){if(t)for(var e=0,i=t.length;i>e;e++){var n=t[e];this[n[0]]=n[1]}},i.setTransform=function(t){"none"===t?this._tf=Style._TF_EMPTY:this.attrs(e.parseOneCSS(t,","))},i.translate=function(t,e){this._tf===Style._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.translateX=t,this._tf.translateY=e},i.scale=function(t,e){this._tf===Style._TF_EMPTY&&(this._tf=new TransformInfo),this._tf.scaleX=t,this._tf.scaleY=e},i._enableLayout=function(){return 0===(2&this._type)&&0===(4&this._type)},__getset(0,i,"block",t.prototype._$get_block,function(t){t?this._type|=1:this._type&=-2}),__getset(0,i,"valign",function(){return e._valigndef[this._aligns[1]]},function(t){this._aligns===e._ALIGNS&&(this._aligns=[0,0,0]),this._aligns[1]=e._valigndef[t]}),__getset(0,i,"height",null,function(t){if(this._type|=8192,"string"==typeof t){if(this._calculation("height",t))return;t=parseInt(t)}this.size(-1,t)}),__getset(0,i,"width",null,function(t){if(this._type|=8,"string"==typeof t){var e=t.indexOf("auto");if(e>=0&&(this._type|=262144,t=t.substr(0,e)),this._calculation("width",t))return;t=parseInt(t)}this.size(t,-1)}),__getset(0,i,"fontWeight",function(){return this._font.weight},function(t){this._createFont().weight=t}),__getset(0,i,"left",null,function(t){var e=this._ower;if("string"==typeof t){if("center"===t?t="50% -50% 0":"right"===t&&(t="100% -100% 0"),this._calculation("left",t))return;t=parseInt(t)}e.x=t}),__getset(0,i,"_translate",null,function(t){this.translate(t[0],t[1])}),__getset(0,i,"absolute",function(){return 0!==(4&this._type)}),__getset(0,i,"top",null,function(t){var e=this._ower;if("string"==typeof t){if("middle"===t?t="50% -50% 0":"bottom"===t&&(t="100% -100% 0"),this._calculation("top",t))return;t=parseInt(t)}e.y=t}),__getset(0,i,"align",function(){return e._aligndef[this._aligns[0]]},function(t){this._aligns===e._ALIGNS&&(this._aligns=[0,0,0]),this._aligns[0]=e._aligndef[t]}),__getset(0,i,"bold",function(){return this._font.bold},function(t){this._createFont().bold=t}),__getset(0,i,"padding",function(){return this._padding},function(t){this._padding=t}),__getset(0,i,"leading",function(){return this._spacing[1]},function(t){"string"==typeof t&&(t=parseInt(t+"")),this._spacing===e._SPACING&&(this._spacing=[0,0]),this._spacing[1]=t}),__getset(0,i,"lineElement",function(){return 0!=(65536&this._type)},function(t){t?this._type|=65536:this._type&=-65537}),__getset(0,i,"cssFloat",function(){return 0!=(32768&this._type)?"right":"left"},function(t){this.lineElement=!1,"right"===t?this._type|=32768:this._type&=-32769}),__getset(0,i,"textDecoration",function(){return this._font.decoration},function(t){this._createFont().decoration=t}),__getset(0,i,"whiteSpace",function(){return 131072&this._type?"nowrap":""},function(t){"nowrap"===t&&(this._type|=131072),"none"===t&&(this._type&=-131073)}),__getset(0,i,"background",null,function(t){return t?(this._bgground||(this._bgground={}),this._bgground.color=t,this._ower.model&&this._ower.model.bgColor(t),this._type|=16384,void(this._ower._renderType|=128)):void(this._bgground=null)}),__getset(0,i,"wordWrap",function(){return 0===(131072&this._type)},function(t){t?this._type&=-131073:this._type|=131072}),__getset(0,i,"color",function(){return this._font.color},function(t){this._createFont().color=t}),__getset(0,i,"password",function(){return this._font.password},function(t){this._createFont().password=t}),__getset(0,i,"backgroundColor",function(){return this._bgground?this._bgground.color:null},function(t){"none"===t?this._bgground=null:(this._bgground||(this._bgground={}),this._bgground.color=t),this._ower.model&&this._ower.model.bgColor(t),this._ower._renderType|=128}),__getset(0,i,"font",function(){return this._font.toString()},function(t){this._createFont().set(t)}),__getset(0,i,"weight",null,function(t){this._createFont().weight=t}),__getset(0,i,"letterSpacing",function(){return this._spacing[0]},function(t){"string"==typeof t&&(t=parseInt(t+"")),this._spacing===e._SPACING&&(this._spacing=[0,0]),this._spacing[0]=t}),__getset(0,i,"fontSize",function(){return this._font.size},function(t){this._createFont().size=t}),__getset(0,i,"italic",function(){return this._font.italic},function(t){this._createFont().italic=t}),__getset(0,i,"fontFamily",function(){return this._font.family},function(t){this._createFont().family=t}),__getset(0,i,"stroke",function(){return this._font.stroke[0]},function(t){this._createFont().stroke===Font._STROKE&&(this._font.stroke=[0,"#000000"]),this._font.stroke[0]=t}),__getset(0,i,"strokeColor",function(){return this._font.stroke[1]},function(t){this._createFont().stroke===Font._STROKE&&(this._font.stroke=[0,"#000000"]),this._font.stroke[1]=t}),__getset(0,i,"border",function(){return this._border?this._border.value:""},function(t){if("none"==t)return void(this._border=null);this._border||(this._border={}),this._border.value=t;var e=t.split(" ");if(this._border.color=Color.create(e[e.length-1]),1==e.length)return this._border.size=1,void(this._border.type="solid");var i=0;e[0].indexOf("px")>0?(this._border.size=parseInt(e[0]),i++):this._border.size=1,this._border.type=e[i],this._ower._renderType|=128}),__getset(0,i,"borderColor",function(){return this._border&&this._border.color?this._border.color.strColor:null},function(t){return t?(this._border||(this._border={size:1,type:"solid"}),this._border.color=null==t?null:Color.create(t),this._ower.model&&this._ower.model.border(this._border.color.strColor),void(this._ower._renderType|=128)):void(this._border=null)}),__getset(0,i,"position",function(){return 4&this._type?"absolute":""},function(t){"absolute"==t?this._type|=4:this._type&=-5}),__getset(0,i,"display",null,function(t){switch(t){case"":this._type&=-3,this.visible=!0;break;case"none":this._type|=2,this.visible=!1,this._ower._layoutLater()}}),__getset(0,i,"paddingLeft",function(){return this.padding[3]}),__getset(0,i,"paddingTop",function(){return this.padding[0]}),__getset(0,i,"_scale",null,function(t){this._ower.scale(t[0],t[1])}),__getset(0,i,"_rotate",null,function(t){this._ower.rotation=t}),e.parseOneCSS=function(t,i){for(var n,s=[],r=t.split(i),a=0,o=r.length;o>a;a++){var h=r[a],l=h.indexOf(":"),u=h.substr(0,l).replace(/^\s+|\s+$/g,"");if(0!=u.length){var c=h.substr(l+1).replace(/^\s+|\s+$/g,""),_=[u,c];switch(u){case"italic":case"bold":_[1]="true"==c;break;case"line-height":_[0]="lineHeight",_[1]=parseInt(c);break;case"font-size":_[0]="fontSize",_[1]=parseInt(c);break;case"padding":n=c.split(" "),n.length>1||(n[1]=n[2]=n[3]=n[0]),_[1]=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])];break;case"rotate":_[0]="_rotate",_[1]=parseFloat(c);break;case"scale":n=c.split(" "),_[0]="_scale",_[1]=[parseFloat(n[0]),parseFloat(n[1])];break;case"translate":n=c.split(" "),_[0]="_translate",_[1]=[parseInt(n[0]),parseInt(n[1])];break;default:(_[0]=e._CSSTOVALUE[u])||(_[0]=u)}s.push(_)}}return s},e.parseCSS=function(t,i){for(var n;null!=(n=e._parseCSSRegExp.exec(t));)e.styleSheets[n[1]]=e.parseOneCSS(n[2],";")},e.EMPTY=new e(null),e._CSSTOVALUE={"letter-spacing":"letterSpacing","line-spacing":"lineSpacing","white-space":"whiteSpace","line-height":"lineHeight","scale-x":"scaleX","scale-y":"scaleY","translate-x":"translateX","translate-y":"translateY","font-family":"fontFamily","font-weight":"fontWeight","vertical-align":"valign","text-decoration":"textDecoration","background-color":"backgroundColor","border-color":"borderColor","float":"cssFloat"},e._parseCSSRegExp=new RegExp("([.#]\\w+)\\s*{([\\s\\S]*?)}","g"),e._aligndef={left:0,center:1,right:2,0:"left",1:"center",2:"right"},e._valigndef={top:0,middle:1,bottom:2,0:"top",1:"middle",2:"bottom"},e.styleSheets={},e.ALIGN_CENTER=1,e.ALIGN_RIGHT=2,e.VALIGN_MIDDLE=1,e.VALIGN_BOTTOM=2,e._CSS_BLOCK=1,e._DISPLAY_NONE=2,e._ABSOLUTE=4,e._WIDTH_SET=8,e._PADDING=[0,0,0,0],e._RECT=[-1,-1,-1,-1],e._SPACING=[0,0],e._ALIGNS=[0,0,0],e.ADDLAYOUTED=512,e._NEWFONT=4096,e._HEIGHT_SET=8192,e._BACKGROUND_SET=16384,e._FLOAT_RIGHT=32768,e._LINE_ELEMENT=65536,e._NOWARP=131072,e._WIDTHAUTO=262144,e._LISTERRESZIE=524288,e}(Style),AudioSound=function(t){function e(){this.url=null,this.audio=null,this.loaded=!1,e.__super.call(this)}__class(e,"laya.media.h5audio.AudioSound",t);var i=e.prototype;return i.dispose=function(){var t=e._audioCache[this.url];t&&(t.src="",delete e._audioCache[this.url])},i.load=function(t){function i(){s(),a.loaded=!0,a.event("complete")}function n(){s(),a.event("error")}function s(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",n)}this.url=t;var r=e._audioCache[t];if(r&&r.readyState>=2)return void this.event("complete");r||(r=Browser.createElement("audio"),r.src=t,e._audioCache[t]=r),r.addEventListener("canplaythrough",i),r.addEventListener("error",n);var a=this;this.audio=r,r.load?r.load():n()},i.play=function(t,i){if(void 0===t&&(t=0),void 0===i&&(i=0),!this.url)return null;var n;if(n=e._audioCache[this.url],!n)return null;var s;s=Pool.getItem("audio:"+this.url),s=s?s:n.cloneNode(!0);var r=new AudioSoundChannel(s);return r.url=this.url,r.loops=i,r.startTime=t,r.play(),SoundManager.addChannel(r),r},__getset(0,i,"duration",function(){var t;return t=e._audioCache[this.url],t?t.duration:0}),e._audioCache={},e}(EventDispatcher),SoundChannel=function(t){function e(){this.url=null,this.loops=0,this.startTime=NaN,this.isStopped=!1,this.completeHandler=null,e.__super.call(this)}__class(e,"laya.media.SoundChannel",t);var i=e.prototype;return i.play=function(){},i.stop=function(){},i.__runComplete=function(t){t&&t.run()},__getset(0,i,"volume",function(){return 1},function(t){}),__getset(0,i,"position",function(){return 0}),__getset(0,i,"duration",function(){return 0}),e}(EventDispatcher),Sound=function(t){function e(){e.__super.call(this)}__class(e,"laya.media.Sound",t);var i=e.prototype;return i.load=function(t){},i.play=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),null},i.dispose=function(){},__getset(0,i,"duration",function(){return 0}),e}(EventDispatcher),WebAudioSound=function(t){function e(){this.url=null,this.loaded=!1,this.data=null,this.audioBuffer=null,this.__toPlays=null,e.__super.call(this)}__class(e,"laya.media.webaudio.WebAudioSound",t);var i=e.prototype;return i.load=function(t){var i=this;if(this.url=t,this.audioBuffer=e._dataCache[t],this.audioBuffer)return void this._loaded(this.audioBuffer);if(e.e.on("loaded:"+t,this,this._loaded),e.e.on("err:"+t,this,this._err),!e.__loadingSound[t]){e.__loadingSound[t]=!0;var n=new Browser.window.XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){i.data=n.response,e.buffs.push({buffer:i.data,url:i.url}),e.decode()},n.onerror=function(t){i._err()},n.send()}},i._err=function(){this._removeLoadEvents(),e.__loadingSound[this.url]=!1,this.event("error")},i._loaded=function(t){this._removeLoadEvents(),this.audioBuffer=t,e._dataCache[this.url]=this.audioBuffer,this.loaded=!0,this.event("complete")},i._removeLoadEvents=function(){e.e.off("loaded:"+this.url,this,this._loaded),e.e.off("err:"+this.url,this,this._err)},i.__playAfterLoaded=function(){if(this.__toPlays){var t,e=0,i=0;t=this.__toPlays,i=t.length;var n;for(e=0;i>e;e++)n=t[e],n[2]&&!n[2].isStopped&&this.play(n[0],n[1],n[2]);this.__toPlays.length=0}},i.play=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),i=i?i:new WebAudioSoundChannel,this.audioBuffer||this.url&&(this.__toPlays||(this.__toPlays=[]),this.__toPlays.push([t,e,i]),this.once("complete",this,this.__playAfterLoaded),this.load(this.url)),i.url=this.url,i.loops=e,i.audioBuffer=this.audioBuffer,i.startTime=t,i.play(),SoundManager.addChannel(i),i},i.dispose=function(){delete e._dataCache[this.url],delete e.__loadingSound[this.url]},__getset(0,i,"duration",function(){return this.audioBuffer?this.audioBuffer.duration:0}),e.decode=function(){e.buffs.length<=0||e.isDecoding||(e.isDecoding=!0,e.tInfo=e.buffs.shift(),e.ctx.decodeAudioData(e.tInfo.buffer,e._done,e._fail))},e._done=function(t){e.e.event("loaded:"+e.tInfo.url,t),e.isDecoding=!1,e.decode()},e._fail=function(){e.e.event("err:"+e.tInfo.url,null),e.isDecoding=!1,e.decode()},e._playEmptySound=function(){if(null!=e.ctx){var t=e.ctx.createBufferSource();t.buffer=e._miniBuffer,t.connect(e.ctx.destination),t.start(0,0,0)}},e._unlock=function(){e._unlocked||(e._playEmptySound(),"running"==e.ctx.state&&(Browser.document.removeEventListener("mousedown",e._unlock,!0),Browser.document.removeEventListener("touchend",e._unlock,!0),e._unlocked=!0))},e.initWebAudio=function(){"running"!=e.ctx.state&&(e._unlock(),Browser.document.addEventListener("mousedown",e._unlock,!0),Browser.document.addEventListener("touchend",e._unlock,!0))},e._dataCache={},e.buffs=[],e.isDecoding=!1,e._unlocked=!1,e.tInfo=null,e.__loadingSound={},__static(e,["window",function(){return this.window=Browser.window},"webAudioEnabled",function(){return this.webAudioEnabled=e.window.AudioContext||e.window.webkitAudioContext||e.window.mozAudioContext},"ctx",function(){return this.ctx=e.webAudioEnabled?new(e.window.AudioContext||e.window.webkitAudioContext||e.window.mozAudioContext):void 0},"_miniBuffer",function(){return this._miniBuffer=e.ctx.createBuffer(1,1,22050)},"e",function(){return this.e=new EventDispatcher}]),e}(EventDispatcher),HttpRequest=function(t){function e(){this._responseType=null,this._data=null,e.__super.call(this),this._http=new Browser.window.XMLHttpRequest}__class(e,"laya.net.HttpRequest",t);var i=e.prototype;return i.send=function(t,e,i,n,s){void 0===i&&(i="get"),void 0===n&&(n="text"),this._responseType=n,this._data=null;var r=this,a=this._http;if(a.open(i,t,!0),s)for(var o=0;o<s.length;o++)a.setRequestHeader(s[o++],s[o]);else e&&"string"!=typeof e?a.setRequestHeader("Content-Type","application/json"):a.setRequestHeader("Content-Type","application/x-www-form-urlencoded");a.responseType="arraybuffer"!==n?"text":"arraybuffer",a.onerror=function(t){r._onError(t)},a.onabort=function(t){r._onAbort(t)},a.onprogress=function(t){r._onProgress(t)},a.onload=function(t){r._onLoad(t)},a.send(e)},i._onProgress=function(t){t&&t.lengthComputable&&this.event("progress",t.loaded/t.total)},i._onAbort=function(t){this.error("Request was aborted by user")},i._onError=function(t){this.error("Request failed Status:"+this._http.status+" text:"+this._http.statusText)},i._onLoad=function(t){var e=this._http,i=void 0!==e.status?e.status:200;200===i||204===i||0===i?this.complete():this.error("["+e.status+"]"+e.statusText+":"+e.responseURL)},i.error=function(t){this.clear(),this.event("error",t)},i.complete=function(){this.clear();var t=!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){t=!1,this.error(e.message)}t&&this.event("complete",this._data instanceof Array?[this._data]:this._data)},i.clear=function(){var t=this._http;t.onerror=t.onabort=t.onprogress=t.onload=null},__getset(0,i,"url",function(){return this._http.responseURL}),__getset(0,i,"http",function(){return this._http}),__getset(0,i,"data",function(){return this._data}),e}(EventDispatcher),Loader=function(t){function e(){this._data=null,this._url=null,this._type=null,this._cache=!1,this._http=null,e.__super.call(this)}__class(e,"laya.net.Loader",t);var i=e.prototype;return i.load=function(t,i,n,s,r){if(void 0===n&&(n=!0),void 0===r&&(r=!1),0===t.indexOf("data:image")&&(this._type="image"),t=URL.formatURL(t),this._url=t,this._type=i||(i=this.getTypeFromUrl(t)),this._cache=n,this._data=null,!r&&e.loadedMap[t])return this._data=e.loadedMap[t],this.event("progress",1),void this.event("complete",this._data);if(s&&e.setGroup(t,s),null!=e.parserMap[i])return void(e.parserMap[i]instanceof laya.utils.Handler?e.parserMap[i].runWith(this):e.parserMap[i].call(null,this));if("image"===i||"htmlimage"===i||"nativeimage"===i)return this._loadImage(t);if("sound"===i)return this._loadSound(t);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));var a;switch(i){case"atlas":a="json";break;case"font":a="xml";break;default:a=i}this._http.send(t,null,"get",a)},i.getTypeFromUrl=function(t){var i=Utils.getFileExtension(t);return i?e.typeMap[i]:(console.log("Not recognize the resources suffix",t),"text")},i._loadImage=function(t){function e(){i.onload=null,i.onerror=null}var i,n=this,s=function(){e(),n.onLoaded(i)},r=function(){e(),n.event("error","Load image filed")};"nativeimage"===this._type?(i=new Browser.window.Image,i.crossOrigin="",i.onload=s,i.onerror=r,i.src=t):new HTMLImage.create(t,{onload:s,onerror:r,onCreate:function(t){i=t}})},i._loadSound=function(t){function e(){n(),r.onLoaded(s)}function i(){n(),r.event("error","Load sound filed")}function n(){s.offAll()}var s=new SoundManager._soundClass,r=this;s.on("complete",this,e),s.on("error",this,i),s.load(t)},i.onProgress=function(t){"atlas"===this._type?this.event("progress",.3*t):this.event("progress",t)},i.onError=function(t){this.event("error",t)},i.onLoaded=function(t){var i=this._type;if("image"===i){var n=new Texture(t);n.url=this._url,this.complete(n)}else if("sound"===i||"htmlimage"===i||"nativeimage"===i)this.complete(t);else if("atlas"===i){if(!t.src){if(!this._data){if(this._data=t,t.meta&&t.meta.image){var s=t.meta.image.split(","),r=this._url.indexOf("/")>=0?"/":"\\",a=this._url.lastIndexOf(r),o=a>=0?this._url.substr(0,a+1):"";a=this._url.indexOf("?");var h;h=a>=0?this._url.substr(a):"";for(var l=0,u=s.length;u>l;l++)s[l]=o+s[l]+h}else s=[this._url.replace(".json",".png")];s.reverse(),t.toLoads=s,t.pics=[]}return this.event("progress",.3+1/s.length*.6),this._loadImage(URL.formatURL(s.pop()))}if(this._data.pics.push(t),this._data.toLoads.length>0)return this.event("progress",.3+1/this._data.toLoads.length*.6),this._loadImage(URL.formatURL(this._data.toLoads.pop()));var c=this._data.frames,_=this._url.split("?")[0],d=this._data.meta&&this._data.meta.prefix?URL.basePath+this._data.meta.prefix:_.substring(0,_.lastIndexOf("."))+"/",f=this._data.pics,p=e.atlasMap[this._url]||(e.atlasMap[this._url]=[]);p.dir=d;for(var g in c){var m=c[g],v=f[m.frame.idx?m.frame.idx:0],y=d+g;e.cacheRes(y,Texture.create(v,m.frame.x,m.frame.y,m.frame.w,m.frame.h,m.spriteSourceSize.x,m.spriteSourceSize.y,m.sourceSize.w,m.sourceSize.h)),e.loadedMap[y].url=y,p.push(y)}this.complete(this._data)}else if("font"==i){if(!t.src)return this._data=t,this.event("progress",.5),this._loadImage(URL.formatURL(this._url.replace(".fnt",".png")));var x;x=new BitmapFont,x.parseFont(this._data,t);var w=this._url.split(".fnt")[0].split("/"),b=w[w.length-1];Text.registerBitmapFont(b,x),this._data=x,this.complete(this._data)}else this.complete(t)},i.complete=function(t){this._data=t,e._loaders.push(this),e._isWorking||e.checkNext()},i.endLoad=function(t){t&&(this._data=t),this._cache&&e.cacheRes(this._url,this._data),this.event("progress",1),this.event("complete",this.data instanceof Array?[this.data]:this.data)},__getset(0,i,"url",function(){return this._url}),__getset(0,i,"data",function(){return this._data}),__getset(0,i,"cache",function(){return this._cache}),__getset(0,i,"type",function(){return this._type}),e.checkNext=function(){e._isWorking=!0;for(var t=Browser.now(),i=t;e._startIndex<e._loaders.length;)if(i=Browser.now(),e._loaders[e._startIndex].endLoad(),e._startIndex++,Browser.now()-t>e.maxTimeOut)return console.log("loader callback cost a long time:"+(Browser.now()-t)+" url="+e._loaders[e._startIndex-1].url),void Laya.timer.frameOnce(1,null,e.checkNext);e._loaders.length=0,
|
||
e._startIndex=0,e._isWorking=!1},e.clearRes=function(t,i){void 0===i&&(i=!1),t=URL.formatURL(t);var n=e.atlasMap[t];if(n){for(var s=0,r=n.length;r>s;s++){var a=n[s],o=e.getRes(a);o&&o.destroy(i),delete e.loadedMap[a]}n.length=0,delete e.atlasMap[t],delete e.loadedMap[t]}else{var h=e.loadedMap[t];h&&(h instanceof laya.resource.Texture&&h.bitmap&&h.destroy(i),delete e.loadedMap[t])}},e.getRes=function(t){return e.loadedMap[URL.formatURL(t)]},e.getAtlas=function(t){return e.atlasMap[URL.formatURL(t)]},e.cacheRes=function(t,i){t=URL.formatURL(t),null!=e.loadedMap[t]?console.log("Resources already exist,is repeated loading:",t):e.loadedMap[t]=i},e.setGroup=function(t,i){e.groupMap[i]||(e.groupMap[i]=[]),e.groupMap[i].push(t)},e.clearResByGroup=function(t){if(e.groupMap[t]){var i=e.groupMap[t],n=0,s=i.length;for(n=0;s>n;n++)e.clearRes(i[n]);i.length=0}},e.TEXT="text",e.JSON="json",e.XML="xml",e.BUFFER="arraybuffer",e.IMAGE="image",e.SOUND="sound",e.ATLAS="atlas",e.FONT="font",e.typeMap={png:"image",jpg:"image",jpeg:"image",txt:"text",json:"json",xml:"xml",als:"atlas",mp3:"sound",ogg:"sound",wav:"sound",part:"json",fnt:"font"},e.parserMap={},e.loadedMap={},e.groupMap={},e.maxTimeOut=100,e.atlasMap={},e._loaders=[],e._isWorking=!1,e._startIndex=0,e}(EventDispatcher),ColorFilter=function(t){function e(t){e.__super.call(this),t||(t=[.3,.59,.11,0,0,.3,.59,.11,0,0,.3,.59,.11,0,0,0,0,0,1,0]),this._mat=new Float32Array(16),this._alpha=new Float32Array(4);for(var i=0,n=0,s=0;20>s;s++)s%5!=4?this._mat[i++]=t[s]:this._alpha[n++]=t[s];this._action=RunDriver.createFilterAction(32),this._action.data=this}__class(e,"laya.filters.ColorFilter",t);var i=e.prototype;return Laya.imps(i,{"laya.filters.IFilter":!0}),i.callNative=function(t){t._$P.cf=this;t.model&&t.model.setFilterMatrix&&t.model.setFilterMatrix(this._mat,this._alpha)},__getset(0,i,"type",function(){return 32}),__getset(0,i,"action",function(){return this._action}),__getset(1,e,"DEFAULT",function(){return e._DEFAULT||(e._DEFAULT=new e([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0])),e._DEFAULT},laya.filters.Filter._$SET_DEFAULT),__getset(1,e,"GRAY",function(){return e._GRAY||(e._GRAY=new e([.3,.59,.11,0,0,.3,.59,.11,0,0,.3,.59,.11,0,0,0,0,0,1,0])),e._GRAY},laya.filters.Filter._$SET_GRAY),e._DEFAULT=null,e._GRAY=null,e}(Filter),LoaderManager=function(t){function e(){this.retryNum=1,this.maxLoader=5,this._loaders=[],this._loaderCount=0,this._resInfos=[],this._infoPool=[],this._maxPriority=5,this._failRes={},e.__super.call(this);for(var t=0;t<this._maxPriority;t++)this._resInfos[t]=[]}var i;__class(e,"laya.net.LoaderManager",t);var n=e.prototype;return n.create=function(t,e,i,n,s,r){function a(t,i){u++,t.progress=1,u===l&&e&&e.run()}function o(t,e){t.progress=e;for(var i=0,n=0;l>n;n++){var s=h[n];i+=s.progress}var r=i/l;c.runWith(r)}if(void 0===s&&(s=1),void 0===r&&(r=!0),t instanceof Array){var h=t,l=h.length,u=0;if(i)var c=Handler.create(i.caller,i.method,i.args,!1);for(var _=0;l>_;_++){var d=h[_];"string"==typeof d&&(d=h[_]={url:d}),d.progress=0;var f=i?Handler.create(null,o,[d],!1):null,p=i||e?Handler.create(null,a,[d]):null;this._create(d.url,p,f,d.clas||n,d.priority||s,r)}return!0}return this._create(t,e,i,n,s,r)},n._create=function(t,i,n,s,r,a){function o(e){h&&h.onAsynLoaded.call(h,t,e),i&&i.run()}void 0===r&&(r=1),void 0===a&&(a=!0);var h=this.getRes(t);if(h)n&&n.runWith(1),i&&i.run();else{var l=Utils.getFileExtension(t),u=e.createMap[l];s||(s=u[0]);var c=u[1];s===Texture&&(c="htmlimage"),h=s?new s:null,this.load(t,Handler.create(null,o),n,c,r,!1,null,!0),a&&e.cacheRes(t,h)}return h},n.load=function(t,n,s,r,a,o,h,l){if(void 0===a&&(a=1),void 0===o&&(o=!0),void 0===l&&(l=!1),t instanceof Array)return this._loadAssets(t,n,s,r,a,o,h);t=URL.formatURL(t);var u=Loader.getRes(t);if(null!=u)s&&s.runWith(1),n&&n.runWith(u),this._loaderCount||this.event("complete");else{var c=e._resMap[t];c?(n&&c._createListener("complete",n.caller,n.method,n.args,!1,!1),s&&c._createListener("progress",s.caller,s.method,s.args,!1,!1)):(c=this._infoPool.length?this._infoPool.pop():new i,c.url=t,c.type=r,c.cache=o,c.group=h,c.ignoreCache=l,n&&c.on("complete",n.caller,n.method,n.args),s&&c.on("progress",s.caller,s.method,s.args),e._resMap[t]=c,a=a<this._maxPriority?a:this._maxPriority-1,this._resInfos[a].push(c),this._next())}return this},n._next=function(){if(!(this._loaderCount>=this.maxLoader)){for(var t=0;t<this._maxPriority;t++){var e=this._resInfos[t];if(e.length>0){var i=e.shift();if(i)return this._doLoad(i)}}this._loaderCount||this.event("complete")}},n._doLoad=function(t){function e(e){i.offAll(),i._data=null,n._loaders.push(i),n._endLoad(t,e instanceof Array?[e]:e),n._loaderCount--,n._next()}this._loaderCount++;var i=this._loaders.length?this._loaders.pop():new Loader;i.on("complete",null,e),i.on("progress",null,function(e){t.event("progress",e)}),i.on("error",null,function(t){e(null)});var n=this;i.load(t.url,t.type,t.cache,t.group,t.ignoreCache)},n._endLoad=function(t,i){if(null===i){var n=this._failRes[t.url]||0;if(n<this.retryNum)return console.log("[warn]Retry to load:",t.url),this._failRes[t.url]=n+1,void this._resInfos[this._maxPriority-1].push(t);console.log("[error]Failed to load:",t.url),this.event("error",t.url)}delete e._resMap[t.url],t.event("complete",i),t.offAll(),this._infoPool.push(t)},n.clearRes=function(t,e){void 0===e&&(e=!1),Loader.clearRes(t,e)},n.getRes=function(t){return Loader.getRes(t)},n.clearUnLoaded=function(){for(var t=0;t<this._maxPriority;t++){for(var i=this._resInfos[t],n=i.length-1;n>-1;n--){var s=i[n];s&&(s.offAll(),this._infoPool.push(s))}i.length=0}this._loaderCount=0,e._resMap={}},n.cancelLoadByUrls=function(t){if(t)for(var e=0,i=t.length;i>e;e++)this.cancelLoadByUrl(t[e])},n.cancelLoadByUrl=function(t){t=URL.formatURL(t);for(var i=0;i<this._maxPriority;i++)for(var n=this._resInfos[i],s=n.length-1;s>-1;s--){var r=n[s];r&&r.url===t&&(n[s]=null,r.offAll(),this._infoPool.push(r))}e._resMap[t]&&delete e._resMap[t]},n._loadAssets=function(t,e,i,n,s,r,a){function o(t,i){u++,t.progress=1,u===l&&e&&e.run()}function h(t,e){if(null!=i){t.progress=e;for(var n=0,s=0;s<_.length;s++){var r=_[s];n+=r.size*r.progress}var a=n/c;i.runWith(a)}}void 0===s&&(s=1),void 0===r&&(r=!0);for(var l=t.length,u=0,c=0,_=[],d=n||"image",f=0;l>f;f++){var p=t[f];"string"==typeof p&&(p={url:p,type:d,size:1,priority:s}),p.size||(p.size=1),p.progress=0,c+=p.size,_.push(p);var g=i?Handler.create(null,h,[p],!1):null,m=e||i?Handler.create(null,o,[p]):null;this.load(p.url,m,g,p.type,p.priority||1,r,p.group||a)}return this},e.cacheRes=function(t,e){Loader.cacheRes(t,e)},e._resMap={},__static(e,["createMap",function(){return this.createMap={atlas:[null,"atlas"]}}]),e.__init$=function(){i=function(t){function e(){this.url=null,this.type=null,this.cache=!1,this.group=null,this.ignoreCache=!1,e.__super.call(this)}return __class(e,"",t),e}(EventDispatcher)},e}(EventDispatcher),Socket=function(t){function e(t,i,n){this._endian=null,this._stamp=NaN,this._socket=null,this._connected=!1,this._addInputPosition=0,this._input=null,this._output=null,this.timeout=0,this.objectEncoding=0,this.disableInput=!1,this._byteClass=null,void 0===i&&(i=0),e.__super.call(this),this._byteClass=n,this._byteClass=this._byteClass?this._byteClass:Byte,this.endian="bigEndian",this.timeout=2e4,this._addInputPosition=0,t&&i>0&&65535>i&&this.connect(t,i)}__class(e,"laya.net.Socket",t);var i=e.prototype;return i.connect=function(t,e){var i="ws://"+t+":"+e;this.connectByUrl(i)},i.connectByUrl=function(t){var e=this;null!=this._socket&&this.close(),this._socket&&this._cleanSocket(),this._socket=new Browser.window.WebSocket(t),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(t){e._onOpen(t)},this._socket.onmessage=function(t){e._onMessage(t)},this._socket.onclose=function(t){e._onClose(t)},this._socket.onerror=function(t){e._onError(t)}},i._cleanSocket=function(){try{this._socket.close()}catch(t){}this._connected=!1,this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null,this._socket=null},i.close=function(){null!=this._socket&&this._cleanSocket()},i._onOpen=function(t){this._connected=!0,this.event("open",t)},i._onMessage=function(t){if(t&&t.data){var e=t.data;if(this.disableInput&&e)return void this.event("message",e);this._input.length>0&&this._input.bytesAvailable<1&&(this._input.clear(),this._addInputPosition=0);var i=this._input.pos;!this._addInputPosition&&(this._addInputPosition=0),this._input.pos=this._addInputPosition,e&&("string"==typeof e?this._input.writeUTFBytes(e):this._input.writeArrayBuffer(e),this._addInputPosition=this._input.pos,this._input.pos=i),this.event("message",e)}},i._onClose=function(t){this._connected=!1,this.event("close",t)},i._onError=function(t){this.event("error",t)},i.send=function(t){this._socket.send(t)},i.flush=function(){if(this._output&&this._output.length>0){var t;try{this._socket&&this._socket.send(this._output.__getBuffer().slice(0,this._output.length))}catch(e){t=e}this._output.endian=this.endian,this._output.clear(),t&&this.event("error",t)}},__getset(0,i,"input",function(){return this._input}),__getset(0,i,"output",function(){return this._output}),__getset(0,i,"connected",function(){return this._connected}),__getset(0,i,"endian",function(){return this._endian},function(t){this._endian=t,null!=this._input&&(this._input.endian=t),null!=this._output&&(this._output.endian=t)}),e.LITTLE_ENDIAN="littleEndian",e.BIG_ENDIAN="bigEndian",e}(EventDispatcher),Resource=function(t){function e(){this._id=0,this._lastUseFrameCount=0,this._memorySize=0,this._name=null,this._loaded=!1,this._released=!1,this._resourceManager=null,this.lock=!1,e.__super.call(this),this._$1__id=++e._uniqueIDCounter,e._loadedResources.push(this),e._isLoadedResourcesSorted=!1,this._released=!0,this.lock=!1,this._memorySize=0,this._lastUseFrameCount=-1,ResourceManager.currentResourceManager&&ResourceManager.currentResourceManager.addResource(this)}__class(e,"laya.resource.Resource",t);var i=e.prototype;return Laya.imps(i,{"laya.resource.ICreateResource":!0,"laya.resource.IDispose":!0}),i.recreateResource=function(){this.startCreate(),this.completeCreate()},i.detoryResource=function(){},i.activeResource=function(t){void 0===t&&(t=!1),this._lastUseFrameCount=Stat.loopCount,(this._released||t)&&this.recreateResource()},i.releaseResource=function(t){return void 0===t&&(t=!1),!t&&this.lock?!1:!this._released||t?(this.detoryResource(),this._released=!0,this._lastUseFrameCount=-1,this.event("released",this),!0):!1},i.setUniqueName=function(t){for(var i=!0,n=0;n<e._loadedResources.length;n++)if(e._loadedResources[n]._name===t&&e._loadedResources[n]!==this)return void(i=!1);i?this.name!=t&&(this.name=t,e._isLoadedResourcesSorted=!1):this.setUniqueName(t.concat("-copy"))},i.onAsynLoaded=function(t,e){throw new Error("Resource: must override this function!")},i.dispose=function(){if(null!==this._resourceManager)throw new Error("附属于resourceManager的资源不能独立释放!");this.lock=!1,this.releaseResource();var t=e._loadedResources.indexOf(this);-1!==t&&(e._loadedResources.splice(t,1),e._isLoadedResourcesSorted=!1)},i.startCreate=function(){this.event("recovering",this)},i.completeCreate=function(){this._released=!1,this.event("recovered",this)},__getset(0,i,"loaded",function(){return this._loaded}),__getset(0,i,"id",function(){return this._$1__id}),__getset(0,i,"released",function(){return this._released}),__getset(0,i,"name",function(){return this._name},function(t){!t&&""===t||this.name===t||(this._name=t,e._isLoadedResourcesSorted=!1)}),__getset(0,i,"lastUseFrameCount",function(){return this._lastUseFrameCount}),__getset(0,i,"resourceManager",function(){return this._resourceManager}),__getset(0,i,"memorySize",function(){return this._memorySize},function(t){var e=t-this._memorySize;this._memorySize=t,this.resourceManager&&this.resourceManager.addSize(e)}),__getset(1,e,"sortedLoadedResourcesByName",function(){return e._isLoadedResourcesSorted||(e._isLoadedResourcesSorted=!0,e._loadedResources.sort(e.compareResourcesByName)),e._loadedResources},laya.events.EventDispatcher._$SET_sortedLoadedResourcesByName),e.getLoadedResourceByIndex=function(t){return e._loadedResources[t]},e.getLoadedResourcesCount=function(){return e._loadedResources.length},e.compareResourcesByName=function(t,e){if(t===e)return 0;var i=t.name,n=e.name;if(null===i)return null===n?0:-1;if(null==n)return 1;var s=i.localeCompare(n);return 0!=s?s:(e.setUniqueName(n),n=e.name,i.localeCompare(n))},e._uniqueIDCounter=0,e._loadedResources=[],e._isLoadedResourcesSorted=!1,e}(EventDispatcher),Texture=function(t){function e(t,i){this.offsetX=0,this.offsetY=0,this.sourceWidth=0,this.sourceHeight=0,this._w=0,this._h=0,this._uvID=0,e.__super.call(this),t&&t.useNum++,this.setTo(t,i)}__class(e,"laya.resource.Texture",t);var i=e.prototype;return i.setTo=function(t,i){if(this.bitmap=t,this.uv=i||e.DEF_UV,t){this._w=t.width,this._h=t.height,this.sourceWidth=this.sourceWidth||this._w,this.sourceHeight=this.sourceHeight||this._h,this._loaded=this._w>0;var n=this;if(this._loaded)RunDriver.addToAtlas&&RunDriver.addToAtlas(n);else{var s=t;s instanceof laya.resource.HTMLImage&&s.image&&s.image.addEventListener("load",function(t){RunDriver.addToAtlas&&RunDriver.addToAtlas(n)},!1)}}},i.active=function(){this.bitmap.activeResource()},i.destroy=function(t){void 0===t&&(t=!1),this.bitmap&&this.bitmap.useNum>0&&(t?(this.bitmap.dispose(),this.bitmap.useNum=0):(this.bitmap.useNum--,0==this.bitmap.useNum&&this.bitmap.dispose()),this.bitmap=null,this.url&&this===Laya.loader.getRes(this.url)&&Laya.loader.clearRes(this.url),this._loaded=!1)},i.load=function(t){var e=this;this._loaded=!1;var i=this.bitmap||(this.bitmap=HTMLImage.create(URL.formatURL(t)));i&&i.useNum++;var n=this;i.onload=function(){i.onload=null,n._loaded=!0,e.sourceWidth=e._w=i.width,e.sourceHeight=e._h=i.height,n.event("loaded",this),RunDriver.addToAtlas&&RunDriver.addToAtlas(n)}},i.addTextureToAtlas=function(t){RunDriver.addTextureToAtlas(this)},i.getPixels=function(t,e,i,n){if(Render.isWebGL)return RunDriver.getTexturePixels(this,t,e,i,n);Browser.canvas.size(i,n),Browser.canvas.clear(),Browser.context.drawTexture(this,-t,-e,this.width,this.height,0,0);var s=Browser.context.getImageData(0,0,i,n);return s.data},i.onAsynLoaded=function(t,e){e&&e.useNum++,this.setTo(e,this.uv)},__getset(0,i,"source",function(){return this.bitmap.activeResource(),this.bitmap.source}),__getset(0,i,"loaded",function(){return this._loaded}),__getset(0,i,"released",function(){return this.bitmap.released}),__getset(0,i,"width",function(){return this._w?this._w:this.uv&&this.uv!==e.DEF_UV?(this.uv[2]-this.uv[0])*this.bitmap.width:this.bitmap.width},function(t){this._w=t,this.sourceWidth||(this.sourceWidth=t)}),__getset(0,i,"repeat",function(){return Render.isWebGL&&this.bitmap?this.bitmap.repeat:!0},function(t){t&&Render.isWebGL&&this.bitmap&&(this.bitmap.repeat=t,t&&(this.bitmap.enableMerageInAtlas=!1))}),__getset(0,i,"height",function(){return this._h?this._h:this.uv&&this.uv!==e.DEF_UV?(this.uv[5]-this.uv[1])*this.bitmap.height:this.bitmap.height},function(t){this._h=t,this.sourceHeight||(this.sourceHeight=t)}),__getset(0,i,"isLinearSampling",function(){return Render.isWebGL?9728!=this.bitmap.minFifter:!0},function(t){!t&&Render.isWebGL&&(t||-1!=this.bitmap.minFifter||-1!=this.bitmap.magFifter||(this.bitmap.minFifter=9728,this.bitmap.magFifter=9728,this.bitmap.enableMerageInAtlas=!1))}),e.moveUV=function(t,e,i){for(var n=0;8>n;n+=2)i[n]+=t,i[n+1]+=e;return i},e.create=function(t,i,n,s,r,a,o,h,l){void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===l&&(l=0);var u=t instanceof laya.resource.Texture,c=u?t.uv:e.DEF_UV,_=u?t.bitmap:t,d=new e(_,null);d.width=s,d.height=r,d.offsetX=a,d.offsetY=o,d.sourceWidth=h||s,d.sourceHeight=l||r;var f=1/_.width,p=1/_.height;i*=f,n*=p,s*=f,r*=p;var g=d.uv[0],m=d.uv[1],v=d.uv[4],y=d.uv[5],x=v-g,w=y-m,b=e.moveUV(c[0],c[1],[i,n,i+s,n,i+s,n+r,i,n+r]);return d.uv=[g+b[0]*x,m+b[1]*w,v-(1-b[2])*x,m+b[3]*w,v-(1-b[4])*x,y-(1-b[5])*w,g+b[6]*x,y-(1-b[7])*w],d},e.createFromTexture=function(t,i,n,s,r){var a=Rectangle.TEMP.setTo(i-t.offsetX,n-t.offsetY,s,r),o=a.intersection(e._rect1.setTo(0,0,t.width,t.height),e._rect2);if(!o)return null;var h=e.create(t,o.x,o.y,o.width,o.height,o.x-a.x,o.y-a.y,s,r);return h.bitmap.useNum--,h},e.DEF_UV=[0,0,1,0,1,1,0,1],e.INV_UV=[0,1,1,1,1,0,0,0],e._rect1=new Rectangle,e._rect2=new Rectangle,e}(EventDispatcher),TimeLine=function(t){function e(){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,e.__super.call(this)}var i;__class(e,"laya.utils.TimeLine",t);var n=e.prototype;return n.to=function(t,e,i,n,s){return void 0===s&&(s=0),this._create(t,e,i,n,s,!0)},n.from=function(t,e,i,n,s){return void 0===s&&(s=0),this._create(t,e,i,n,s,!1)},n._create=function(t,e,n,s,r,a){var o=new i;return o.isTo=a,o.type=0,o.target=t,o.duration=n,o.data=e,o.startTime=this._startTime+r,o.endTime=o.startTime+o.duration,o.ease=s,this._startTime=Math.max(o.endTime,this._startTime),this._tweenDataList.push(o),this._startTimeSort=!0,this._endTimeSort=!0,this},n.addLabel=function(t,e){var n=new i;return n.type=1,n.data=t,n.endTime=n.startTime=this._startTime+e,this._labelDic||(this._labelDic={}),this._labelDic[t]=n,this._tweenDataList.push(n),this},n.removeLabel=function(t){if(this._labelDic&&this._labelDic[t]){var e=this._labelDic[t];if(e){var i=this._tweenDataList.indexOf(e);i>-1&&this._tweenDataList.splice(i,1)}delete this._labelDic[t]}},n.gotoTime=function(t){function e(t,e){return t.endTime>e.endTime?1:t.endTime<e.endTime?-1:0}if(null!=this._tweenDataList&&0!=this._tweenDataList.length){var i,n;for(var s in this._firstTweenDic)if(n=this._firstTweenDic[s])for(var r in n)n.diyTarget.hasOwnProperty(r)&&(n.diyTarget[r]=n[r]);for(s in this._tweenDic)i=this._tweenDic[s],i.clear(),delete this._tweenDic[s];this._index=0,this._gidIndex=0,this._currTime=t,this._lastTime=Browser.now();var a;null==this._endTweenDataList||this._endTimeSort?(this._endTimeSort=!1,this._endTweenDataList=a=this._tweenDataList.concat(),a.sort(e)):a=this._endTweenDataList;for(var o,h=0,l=a.length;l>h;h++)if(o=a[h],0==o.type){if(!(t>=o.endTime))break;this._index=Math.max(this._index,h+1);var u=o.data;for(var c in u)o.isTo&&(o.target[c]=u[c])}for(h=0,l=this._tweenDataList.length;l>h;h++)o=this._tweenDataList[h],0==o.type&&t>=o.startTime&&t<o.endTime&&(this._index=Math.max(this._index,h+1),this._gidIndex++,i=Pool.getItemByClass("tween",Tween),i._create(o.target,o.data,o.duration,o.ease,Handler.create(this,this._animComplete,[this._gidIndex]),0,!1,o.isTo,!0,!1),i.setStartTime(this._currTime-(t-o.startTime)),i._updateEase(this._currTime),i.gid=this._gidIndex,this._tweenDic[this._gidIndex]=i)}},n.gotoLabel=function(t){if(null!=this._labelDic){var e=this._labelDic[t];e&&this.gotoTime(e.startTime)}},n.pause=function(){Laya.timer.clear(this,this._update)},n.resume=function(){this.play(this._currTime,this._loopKey)},n.play=function(t,e){function i(t,e){return t.startTime>e.startTime?1:t.startTime<e.startTime?-1:0}if(void 0===t&&(t=0),void 0===e&&(e=!1),this._startTimeSort){this._startTimeSort=!1,this._tweenDataList.sort(i);for(var n=0,s=this._tweenDataList.length;s>n;n++){var r=this._tweenDataList[n];if(null!=r&&0==r.type){var a=r.target,o=a.$_GID||(a.$_GID=Utils.getGID()),h=null;null==this._firstTweenDic[o]?(h={},h.diyTarget=a,this._firstTweenDic[o]=h):h=this._firstTweenDic[o];for(var l in r.data)null==h[l]&&(h[l]=a[l])}}}"string"==typeof t?this.gotoLabel(t):this.gotoTime(t),this._loopKey=e,this._lastTime=Browser.now(),Laya.timer.frameLoop(1,this,this._update)},n._update=function(){if(this._currTime>=this._startTime){if(!this._loopKey)return this._complete(),void this.pause();this._complete(),this.gotoTime(0)}var t=Browser.now(),e=t-this._lastTime,i=this._currTime+=e*this.scale;this._lastTime=t;var n;if(0!=this._tweenDataList.length&&this._index<this._tweenDataList.length){var s=this._tweenDataList[this._index];i>=s.startTime&&(this._index++,0==s.type?(this._gidIndex++,n=Pool.getItemByClass("tween",Tween),n._create(s.target,s.data,s.duration,s.ease,new Handler(this,this._animComplete,[this._gidIndex]),0,!1,s.isTo,!0,!1),n.setStartTime(i),n.gid=this._gidIndex,this._tweenDic[this._gidIndex]=n):this.event("label",s.data))}for(var r in this._tweenDic)n=this._tweenDic[r],n._updateEase(i)},n._animComplete=function(t){var e=this._tweenDic[t];e&&delete this._tweenDic[t]},n._complete=function(){this.event("complete")},n.reset=function(){var t;if(this._labelDic)for(t in this._labelDic)delete this._labelDic[t];var e;for(t in this._tweenDic)e=this._tweenDic[t],e.clear(),delete this._tweenDic[t];for(t in this._firstTweenDic)delete this._firstTweenDic[t];this._endTweenDataList=null,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)},n.destroy=function(){this.reset(),this._labelDic=null,this._tweenDic=null,this._tweenDataList=null,this._firstTweenDic=null},__getset(0,n,"index",function(){return this._frameIndex},function(t){this._frameIndex=t,this.gotoTime(this._frameIndex/this._frameRate*1e3)}),__getset(0,n,"total",function(){return this._total=Math.floor(this._startTime/1e3*this._frameRate),this._total}),e.to=function(t,i,n,s,r){return void 0===r&&(r=0),(new e).to(t,i,n,s,r)},e.from=function(t,i,n,s,r){return void 0===r&&(r=0),(new e).from(t,i,n,s,r)},e.__init$=function(){i=function(){function t(){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(t,""),t}()},e}(EventDispatcher),Sprite=function(t){function e(){this.mouseThrough=!1,this._transform=null,this._tfChanged=!1,this._x=0,this._y=0,this._width=0,this._height=0,this._repaint=1,this._changeType=0,this._mouseEnableState=0,this._zOrder=0,this._graphics=null,this._renderType=0,this.autoSize=!1,this.hitTestPrior=!1,this.viewport=null,this._optimizeScrollRect=!1,this._texture=null,e.__super.call(this),this._style=Style.EMPTY}__class(e,"laya.display.Sprite",t);var i=e.prototype;return Laya.imps(i,{"laya.display.ILayout":!0}),i.destroy=function(e){void 0===e&&(e=!0),t.prototype.destroy.call(this,e),this._style&&this._style.destroy(),this._transform=null,this._style=null,this._graphics=null},i.updateZOrder=function(){Utils.updateOrder(this._childs)&&this.repaint()},i.reCache=function(){this._$P.cacheCanvas&&(this._$P.cacheCanvas.reCache=!0)},i.setBounds=function(t){this._set$P("uBounds",t)},i.getBounds=function(){return this._$P.mBounds||this._set$P("mBounds",new Rectangle),Rectangle._getWrapRec(this._boundPointsToParent(),this._$P.mBounds)},i.getSelfBounds=function(){return this._$P.mBounds||this._set$P("mBounds",new Rectangle),Rectangle._getWrapRec(this._getBoundPointsM(!1),this._$P.mBounds)},i._boundPointsToParent=function(t){void 0===t&&(t=!1);var e=0,i=0;this._style&&(e=this._style._tf.translateX,i=this._style._tf.translateY,t=t||0!==this._style._tf.rotate,this._style.scrollRect&&(e+=this._style.scrollRect.x,i+=this._style.scrollRect.y));var n=this._getBoundPointsM(t);if(!n||n.length<1)return n;if(8!=n.length&&(n=t?GrahamScan.scanPList(n):Rectangle._getWrapRec(n,Rectangle.TEMP)._getBoundPoints()),!this.transform)return Utils.transPointList(n,this.x-e,this.y-i),n;var s=Point.TEMP,r=0,a=n.length;for(r=0;a>r;r+=2)s.x=n[r],s.y=n[r+1],this.toParentPoint(s),n[r]=s.x,n[r+1]=s.y;return n},i.getGraphicBounds=function(){return this._graphics?this._graphics.getBounds():Rectangle.TEMP.setTo(0,0,0,0)},i._getBoundPointsM=function(t){if(void 0===t&&(t=!1),this._$P.uBounds)return this._$P.uBounds._getBoundPoints();if(this._$P.temBM||this._set$P("temBM",[]),this.scrollRect){var e=Utils.clearArray(this._$P.temBM),i=Rectangle.TEMP;return i.copyFrom(this.scrollRect),Utils.concatArray(e,i._getBoundPoints()),e}var n,s,r,a=this._graphics?this._graphics.getBoundPoints():Utils.clearArray(this._$P.temBM);r=this._childs;for(var o=0,h=r.length;h>o;o++)n=r[o],n instanceof laya.display.Sprite&&1==n.visible&&(s=n._boundPointsToParent(t),s&&(a=a?Utils.concatArray(a,s):s));return a},i.getStyle=function(){return this._style===Style.EMPTY&&(this._style=new Style),this._style},i.setStyle=function(t){this._style=t},i._adjustTransform=function(){"use strict";this._tfChanged=!1;var t,e=this._style,i=e._tf,n=i.scaleX,s=i.scaleY;if(i.rotate||1!==n||1!==s||i.skewX||i.skewY){if(t=this._transform||(this._transform=Matrix.create()),t.bTransform=!0,i.rotate){var r=.0174532922222222*i.rotate,a=t.cos=Math.cos(r),o=t.sin=Math.sin(r);return t.a=n*a,t.b=n*o,t.c=-s*o,t.d=s*a,t.tx=t.ty=0,t}return t.a=n,t.d=s,t.c=t.b=t.tx=t.ty=0,i.skewX||i.skewY?t.skew(.0174532922222222*i.skewX,.0174532922222222*i.skewY):t}return this._transform&&this._transform.destroy(),this._transform=null,this._renderType&=-5,t},i.pos=function(t,e){return this._x===t&&this._y===e||(this.x=t,this.y=e),this},i.pivot=function(t,e){return this.pivotX=t,this.pivotY=e,this},i.size=function(t,e){return this.width=t,this.height=e,this},i.scale=function(t,e){return this.scaleX=t,this.scaleY=e,this},i.skew=function(t,e){return this.skewX=t,this.skewY=e,this},i.render=function(t,e,i){Stat.spriteCount++,RenderSprite.renders[this._renderType]._fun(this,t,e+this._x,i+this._y),this._repaint=0},i.drawToCanvas=function(t,e,i,n){return RunDriver.drawToCanvas(this,this._renderType,t,e,i,n)},i.customRender=function(t,e,i){this._renderType|=512},i._applyFilters=function(){if(!Render.isWebGL){var t;if(t=this._$P.filters,t&&!(t.length<1))for(var e=0,i=t.length;i>e;e++)t[e].action.apply(this._$P.cacheCanvas)}},i._isHaveGlowFilter=function(){var t=0,e=0;if(this.filters)for(t=0;t<this.filters.length;t++)if(8==this.filters[t].type)return!0;for(t=0,e=this._childs.length;e>t;t++)if(this._childs[t]._isHaveGlowFilter())return!0;return!1},i.localToGlobal=function(t,e){if(void 0===e&&(e=!1),!this._displayedInStage||!t)return t;e===!0&&(t=new Point(t.x,t.y));for(var i=this;i&&i!=Laya.stage;)t=i.toParentPoint(t),i=i.parent;return t},i.globalToLocal=function(t,e){if(void 0===e&&(e=!1),!this._displayedInStage||!t)return t;e===!0&&(t=new Point(t.x,t.y));for(var i=this,n=[];i&&i!=Laya.stage;)n.push(i),i=i.parent;for(var s=n.length-1;s>=0;)i=n[s],t=i.fromParentPoint(t),s--;return t},i.toParentPoint=function(t){if(!t)return t;t.x-=this.pivotX,t.y-=this.pivotY,this.transform&&this._transform.transformPoint(t),t.x+=this._x,t.y+=this._y;var e=this._style.scrollRect;return e&&(t.x-=e.x,t.y-=e.y),t},i.fromParentPoint=function(t){if(!t)return t;t.x-=this._x,t.y-=this._y;var e=this._style.scrollRect;return e&&(t.x+=e.x,t.y+=e.y),this.transform&&this._transform.invertTransformPoint(t),t.x+=this.pivotX,t.y+=this.pivotY,t},i.on=function(t,e,i,n){return 1!==this._mouseEnableState&&this.isMouseEvent(t)&&(this._displayedInStage?this._$2__onDisplay():laya.events.EventDispatcher.prototype.once.call(this,"display",this,this._$2__onDisplay)),laya.events.EventDispatcher.prototype.on.call(this,t,e,i,n)},i.once=function(t,e,i,n){return 1!==this._mouseEnableState&&this.isMouseEvent(t)&&(this._displayedInStage?this._$2__onDisplay():laya.events.EventDispatcher.prototype.once.call(this,"display",this,this._$2__onDisplay)),laya.events.EventDispatcher.prototype.once.call(this,t,e,i,n)},i._$2__onDisplay=function(){if(1!==this._mouseEnableState)for(var t=this;t&&1!==t._mouseEnableState;)t.mouseEnabled=!0,t=t.parent},i.loadImage=function(t,e,i,n,s,r){function a(t){o.destroyed||(o.size(e+(n||t.width),i+(s||t.height)),o.repaint(),r&&r.runWith(t))}var o=this;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),this.graphics.loadImage(t,e,i,n,s,a),this},i.repaint=function(){this.model&&this.model.repaint&&this.model.repaint(),0===this._repaint&&(this._repaint=1,this.parentRepaint()),this._$P&&this._$P.maskParent&&this._$P.maskParent.repaint()},i._needRepaint=function(){return 0!==this._repaint&&this._$P.cacheCanvas&&this._$P.cacheCanvas.reCache},i._childChanged=function(t){this._childs.length?this._renderType|=2048:this._renderType&=-2049,t&&t.zOrder&&Laya.timer.callLater(this,this.updateZOrder),this.repaint()},i.parentRepaint=function(){var t=this._parent;t&&0===t._repaint&&(t._repaint=1,t.parentRepaint())},i.startDrag=function(t,e,i,n,s,r,a){void 0===e&&(e=!1),void 0===i&&(i=0),void 0===n&&(n=300),void 0===r&&(r=!1),void 0===a&&(a=.92),this._$P.dragging||this._set$P("dragging",new Dragging),this._$P.dragging.start(this,t,e,i,n,s,r,a)},i.stopDrag=function(){this._$P.dragging&&this._$P.dragging.stop()},i._setDisplay=function(e){if(!e&&this._$P.cacheCanvas&&this._$P.cacheCanvas.ctx&&(Pool.recover("RenderContext",this._$P.cacheCanvas.ctx),this._$P.cacheCanvas.ctx=null),!e){var i=this._$P._filterCache;i&&(i.destroy(),i.recycle(),this._set$P("_filterCache",null)),this._$P._isHaveGlowFilter&&this._set$P("_isHaveGlowFilter",!1)}t.prototype._setDisplay.call(this,e)},i.hitTestPoint=function(t,e){var i=this.globalToLocal(Point.TEMP.setTo(t,e)),n=this._$P.hitArea?this._$P.hitArea:Rectangle.EMPTY.setTo(0,0,this._width,this._height);return n.contains(i.x,i.y)},i.getMousePoint=function(){return this.globalToLocal(Point.TEMP.setTo(Laya.stage.mouseX,Laya.stage.mouseY))},i._getWords=function(){return null},i._addChildsToLayout=function(t){var e=this._getWords();if(null==e&&0==this._childs.length)return!1;if(e)for(var i=0,n=e.length;n>i;i++)t.push(e[i]);return this._childs.forEach(function(e,i,n){e._style._enableLayout()&&e._addToLayout(t)}),!0},i._addToLayout=function(t){this._style.absolute||(this._style.block?t.push(this):this._addChildsToLayout(t)&&(this.x=this.y=0))},i._isChar=function(){return!1},i._getCSSStyle=function(){return this._style.getCSSStyle()},i._setAttributes=function(t,e){switch(t){case"x":this.x=parseFloat(e);break;case"y":this.y=parseFloat(e);break;case"width":this.width=parseFloat(e);break;case"height":this.height=parseFloat(e);break;default:this[t]=e}},i._layoutLater=function(){this.parent&&this.parent._layoutLater()},__getset(0,i,"optimizeScrollRect",function(){return this._optimizeScrollRect},function(t){this._optimizeScrollRect!=t&&(this._optimizeScrollRect=t,this.model&&this.model.optimizeScrollRect(t))}),__getset(0,i,"customRenderEnable",null,function(t){if(t&&(this._renderType|=512,Render.isConchNode)){laya.display.Sprite.CustomList.push(this);var e=new HTMLCanvas("2d");e._setContext(new CanvasRenderingContext2D),this.customContext=new RenderContext(0,0,e),e.context.setCanvasType&&e.context.setCanvasType(2),this.model.custom(e.context)}}),__getset(0,i,"cacheAsBitmap",function(){return"none"!==this.cacheAs},function(t){this.cacheAs=t?this._$P.hasFilter?"none":"normal":"none"}),__getset(0,i,"cacheAs",function(){return null==this._$P.cacheCanvas?"none":this._$P.cacheCanvas.type},function(t){var e=this._$P.cacheCanvas;t!==(e?e.type:"none")&&("none"!==t?(e||(e=this._set$P("cacheCanvas",Pool.getItemByClass("cacheCanvas",Object))),e.type=t,e.reCache=!0,this._renderType|=8,"bitmap"==t&&this.model&&this.model.cacheAs(1),this._set$P("cacheForFilters",!1)):this._$P.hasFilter?this._set$P("cacheForFilters",!0):(e&&Pool.recover("cacheCanvas",e),this._$P.cacheCanvas=null,this._renderType&=-9,this.model&&this.model.cacheAs(0)),this.repaint())}),__getset(0,i,"zOrder",function(){return this._zOrder},function(t){this._zOrder!=t&&(this._zOrder=t,this.model&&this.model.setZOrder&&this.model.setZOrder(t),this._parent&&Laya.timer.callLater(this._parent,this.updateZOrder))}),__getset(0,i,"rotation",function(){return this._style._tf.rotate},function(t){var e=this.getStyle();
|
||
if(e._tf.rotate!==t){this._changeType|=16,e.setRotate(t),this._tfChanged=!0,this.model&&this.model.rotate(t),this._renderType|=4;var i=this._parent;i&&0===i._repaint&&(i._repaint=1,i.parentRepaint())}}),__getset(0,i,"width",function(){return this.autoSize?this.getSelfBounds().width:this._width},function(t){this._width!==t&&(this._width=t,this.model&&this.model.size(t,this._height),this.repaint())}),__getset(0,i,"x",function(){return this._x},function(t){if(this._x!==t){if(this.destroyed)return;this._x=t,this.model&&this.model.pos(t,this._y);var e=this._parent;e&&0===e._repaint&&(e._repaint=1,e.parentRepaint()),this._$P.maskParent&&0===this._$P.maskParent._repaint&&(this._$P.maskParent._repaint=1,this._$P.maskParent.parentRepaint())}}),__getset(0,i,"globalScaleY",function(){for(var t=1,e=this;e&&e!==Laya.stage;)t*=e.scaleX,e=e.parent;return t}),__getset(0,i,"hitArea",function(){return this._$P.hitArea},function(t){this._set$P("hitArea",t)}),__getset(0,i,"staticCache",function(){return this._$P.staticCache},function(t){this._set$P("staticCache",t),!t&&this._$P.cacheCanvas&&(this._$P.cacheCanvas.reCache=!0)}),__getset(0,i,"texture",function(){return this._texture},function(t){this._texture!=t&&(this._texture=t,this.graphics.cleanByTexture(t,0,0))}),__getset(0,i,"y",function(){return this._y},function(t){if(this._y!==t){if(this.destroyed)return;this._y=t,this.model&&this.model.pos(this._x,t);var e=this._parent;e&&0===e._repaint&&(e._repaint=1,e.parentRepaint()),this._$P.maskParent&&0===this._$P.maskParent._repaint&&(this._$P.maskParent._repaint=1,this._$P.maskParent.parentRepaint())}}),__getset(0,i,"height",function(){return this.autoSize?this.getSelfBounds().height:this._height},function(t){this._height!==t&&(this._height=t,this.model&&this.model.size(this._width,t),this.repaint())}),__getset(0,i,"blendMode",function(){return this._style.blendMode},function(t){this.getStyle().blendMode=t,this.model&&this.model.blendMode(t),t&&"source-over"!=t?this._renderType|=32:this._renderType&=-33,this.parentRepaint()}),__getset(0,i,"scaleX",function(){return this._style._tf.scaleX},function(t){var e=this.getStyle();if(e._tf.scaleX!==t){e.setScaleX(t),this._changeType|=16,this._tfChanged=!0,this.model&&this.model.scale(t,e._tf.scaleY),this._renderType|=4;var i=this._parent;i&&0===i._repaint&&(i._repaint=1,i.parentRepaint())}}),__getset(0,i,"scaleY",function(){return this._style._tf.scaleY},function(t){var e=this.getStyle();if(e._tf.scaleY!==t){e.setScaleY(t),this._changeType|=16,this._tfChanged=!0,this.model&&this.model.scale(e._tf.scaleX,t),this._renderType|=4;var i=this._parent;i&&0===i._repaint&&(i._repaint=1,i.parentRepaint())}}),__getset(0,i,"stage",function(){return Laya.stage}),__getset(0,i,"skewX",function(){return this._style._tf.skewX},function(t){var e=this.getStyle();if(e._tf.skewX!==t){e.setSkewX(t),this._tfChanged=!0,this._renderType|=4;var i=this._parent;i&&0===i._repaint&&(i._repaint=1,i.parentRepaint())}}),__getset(0,i,"scrollRect",function(){return this._style.scrollRect},function(t){this.getStyle().scrollRect=t,this.viewport=t,this.repaint(),t?(this._renderType|=64,this.model&&this.model.scrollRect(t.x,t.y,t.width,t.height)):(this._renderType&=-65,this.model&&this.model.removeType(64))}),__getset(0,i,"skewY",function(){return this._style._tf.skewY},function(t){var e=this.getStyle();if(e._tf.skewY!==t){e.setSkewY(t),this._tfChanged=!0,this.model&&this.model.skew(e._tf.skewX,t),this._renderType|=4;var i=this._parent;i&&0===i._repaint&&(i._repaint=1,i.parentRepaint())}}),__getset(0,i,"transform",function(){return this._tfChanged?this._adjustTransform():this._transform},function(t){this._tfChanged=!1,this._transform=t,t&&(this._x=t.tx,this._y=t.ty,t.tx=t.ty=0,this.model&&this.model.transform(t.a,t.b,t.c,t.d,this._x,this._y)),t?this._renderType|=4:(this._renderType&=-5,this.model&&this.model.removeType(4)),this.parentRepaint()}),__getset(0,i,"pivotX",function(){return this._style._tf.translateX},function(t){this.getStyle().setTranslateX(t),this._changeType|=16,this.model&&this.model.pivot(t,this._style._tf.translateY),this.repaint()}),__getset(0,i,"pivotY",function(){return this._style._tf.translateY},function(t){this.getStyle().setTranslateY(t),this._changeType|=16,this.model&&this.model.pivot(this._style._tf.translateX,t),this.repaint()}),__getset(0,i,"alpha",function(){return this._style.alpha},function(t){this._style&&this._style.alpha!==t&&(t=0>t?0:t>1?1:t,this.getStyle().alpha=t,this.model&&this.model.alpha(t),1!==t?this._renderType|=2:this._renderType&=-3,this.parentRepaint())}),__getset(0,i,"visible",function(){return this._style.visible},function(t){this._style&&this._style.visible!==t&&(this.getStyle().visible=t,this.model&&this.model.visible(t),this.parentRepaint())}),__getset(0,i,"graphics",function(){return this._graphics||(this.graphics=RunDriver.createGraphics())},function(t){this._graphics&&(this._graphics._sp=null),this._graphics=t,t?(this._renderType&=-2,this._renderType|=256,t._sp=this,this.model&&this.model.graphics(this._graphics)):(this._renderType&=-257,this._renderType&=-2,this.model&&this.model.removeType(256)),this.repaint()}),__getset(0,i,"filters",function(){return this._$P.filters},function(t){t&&0===t.length&&(t=null),this._$P.filters!=t&&(this._set$P("filters",t?t.slice():null),Render.isConchApp&&(this.model&&this.model.removeType(16),this._$P.filters&&1==this._$P.filters.length&&this._$P.filters[0].callNative(this)),Render.isWebGL&&(t&&t.length?this._renderType|=16:this._renderType&=-17),t&&t.length>0?Render.isWebGL&&1==t.length&&t[0]instanceof laya.filters.ColorFilter||("bitmap"!=this.cacheAs&&(Render.isConchNode||(this.cacheAs="bitmap"),this._set$P("cacheForFilters",!0)),this._set$P("hasFilter",!0)):(this._set$P("hasFilter",!1),this._$P.cacheForFilters&&"bitmap"==this.cacheAs&&(this.cacheAs="none")),this.repaint())}),__getset(0,i,"mask",function(){return this._$P._mask},function(t){t&&this.mask&&this.mask._$P.maskParent||(t?(this.cacheAs="bitmap",this._set$P("_mask",t),t._set$P("maskParent",this)):(this.cacheAs="none",this.mask&&this.mask._set$P("maskParent",null),this._set$P("_mask",t)),this.model&&this.model.mask(t?t.model:null),this._renderType|=32,this.parentRepaint())}),__getset(0,i,"mouseEnabled",function(){return this._mouseEnableState>1},function(t){this._mouseEnableState=t?2:1}),__getset(0,i,"globalScaleX",function(){for(var t=1,e=this;e&&e!==Laya.stage;)t*=e.scaleX,e=e.parent;return t}),__getset(0,i,"mouseX",function(){return this.getMousePoint().x}),__getset(0,i,"mouseY",function(){return this.getMousePoint().y}),e.fromImage=function(t){return(new e).loadImage(t)},e.CHG_VIEW=16,e.CHG_SCALE=256,e.CHG_TEXTURE=4096,e.CustomList=[],e}(Node),AudioSoundChannel=function(t){function e(t){this._audio=null,this._onEnd=null,this._resumePlay=null,e.__super.call(this),this._onEnd=Utils.bind(this.__onEnd,this),this._resumePlay=Utils.bind(this.__resumePlay,this),t.addEventListener("ended",this._onEnd),this._audio=t}__class(e,"laya.media.h5audio.AudioSoundChannel",t);var i=e.prototype;return i.__onEnd=function(){return 1==this.loops?(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--,void this.play())},i.__resumePlay=function(){this._audio&&this._audio.removeEventListener("canplay",this._resumePlay);try{this._audio.currentTime=this.startTime,Browser.container.appendChild(this._audio),this._audio.play()}catch(t){this.event("error")}},i.play=function(){try{this._audio.currentTime=this.startTime}catch(t){return void this._audio.addEventListener("canplay",this._resumePlay)}Browser.container.appendChild(this._audio),"play"in this._audio&&this._audio.play()},i.stop=function(){this.isStopped=!0,SoundManager.removeChannel(this),this.completeHandler=null,this._audio&&("pause"in this._audio&&this._audio.pause(),this._audio.removeEventListener("ended",this._onEnd),this._audio.removeEventListener("canplay",this._resumePlay),Pool.recover("audio:"+this.url,this._audio),Browser.removeElement(this._audio),this._audio=null)},__getset(0,i,"position",function(){return this._audio?this._audio.currentTime:0}),__getset(0,i,"duration",function(){return this._audio?this._audio.duration:0}),__getset(0,i,"volume",function(){return this._audio?this._audio.volume:1},function(t){this._audio&&(this._audio.volume=t)}),e}(SoundChannel),WebAudioSoundChannel=function(t){function e(){this.audioBuffer=null,this.gain=null,this.bufferSource=null,this._currentTime=0,this._volume=1,this._startTime=0,this._onPlayEnd=null,this.context=WebAudioSound.ctx,e.__super.call(this),this._onPlayEnd=Utils.bind(this.__onPlayEnd,this),this.context.createGain?this.gain=this.context.createGain():this.gain=this.context.createGainNode()}__class(e,"laya.media.webaudio.WebAudioSoundChannel",t);var i=e.prototype;return i.play=function(){if(this._clearBufferSource(),this.audioBuffer){var t=this.context,e=this.gain,i=t.createBufferSource();this.bufferSource=i,i.buffer=this.audioBuffer,i.connect(e),e&&e.disconnect(),e.connect(t.destination),i.onended=this._onPlayEnd,this._startTime=Browser.now(),this.gain.gain.value=this._volume,0==this.loops&&(i.loop=!0),i.start(0,this.startTime),this._currentTime=0}},i.__onPlayEnd=function(){return 1==this.loops?(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--,void this.play())},i._clearBufferSource=function(){if(this.bufferSource){var t=this.bufferSource;t.stop?t.stop(0):t.noteOff(0),t.disconnect(0),t.onended=null,e._tryCleanFailed||this._tryClearBuffer(t),this.bufferSource=null}},i._tryClearBuffer=function(t){try{t.buffer=WebAudioSound._miniBuffer}catch(i){e._tryCleanFailed=!0}},i.stop=function(){this._clearBufferSource(),this.audioBuffer=null,this.gain&&this.gain.disconnect(),this.isStopped=!0,SoundManager.removeChannel(this),this.completeHandler=null},__getset(0,i,"position",function(){return this.bufferSource?(Browser.now()-this._startTime)/1e3+this.startTime:0}),__getset(0,i,"duration",function(){return this.audioBuffer?this.audioBuffer.duration:0}),__getset(0,i,"volume",function(){return this._volume},function(t){this.isStopped||(this._volume=t,this.gain.gain.value=t)}),e._tryCleanFailed=!1,e}(SoundChannel),Bitmap=function(t){function e(){this.useNum=0,e.__super.call(this),this._w=0,this._h=0}__class(e,"laya.resource.Bitmap",t);var i=e.prototype;return i.dispose=function(){this._resourceManager.removeResource(this),t.prototype.dispose.call(this)},__getset(0,i,"width",function(){return this._w}),__getset(0,i,"height",function(){return this._h}),__getset(0,i,"source",function(){return this._source}),e}(Resource),AnimationPlayerBase=function(t){function e(){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._controlNode=null,this._actionName=null,e.__super.call(this),this._interval=Config.animationInterval}__class(e,"laya.display.AnimationPlayerBase",t);var i=e.prototype;return i.play=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=!0),void 0===i&&(i=""),this._isPlaying=!0,this.index="string"==typeof t?this._getFrameByLabel(t):t,this.loop=e,this._actionName=i,this._isReverse=1==this.wrapMode,this.interval>0&&this.timerLoop(this.interval,this,this._frameLoop,null,!0)},i._getFrameByLabel=function(t){var e=0;for(e=0;e<this._count;e++)if(this._labels[e]==t)return e;return 0},i._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},i._setControlNode=function(t){this._controlNode&&(this._controlNode.off("display",this,this._$3__onDisplay),this._controlNode.off("undisplay",this,this._$3__onDisplay)),this._controlNode=t,t&&t!=this&&(t.on("display",this,this._$3__onDisplay),t.on("undisplay",this,this._$3__onDisplay))},i._setDisplay=function(e){t.prototype._setDisplay.call(this,e),this._$3__onDisplay()},i._$3__onDisplay=function(){this._isPlaying&&(this._controlNode.displayedInStage?this.play(this._index,this.loop,this._actionName):this.clearTimer(this,this._frameLoop))},i.stop=function(){this._isPlaying=!1,this.clearTimer(this,this._frameLoop)},i.addLabel=function(t,e){this._labels||(this._labels={}),this._labels[e]=t},i.removeLabel=function(t){if(t){if(this._labels)for(var e in this._labels)if(this._labels[e]===t){delete this._labels[e];break}}else this._labels=null},i.gotoAndStop=function(t){this.index="string"==typeof t?this._getFrameByLabel(t):t,this.stop()},i._displayToIndex=function(t){},i.clear=function(){this.stop(),this._labels=null},__getset(0,i,"interval",function(){return this._interval},function(t){this._interval!=t&&(this._frameRateChanged=!0,this._interval=t,this._isPlaying&&t>0&&this.timerLoop(t,this,this._frameLoop,null,!0))}),__getset(0,i,"isPlaying",function(){return this._isPlaying}),__getset(0,i,"index",function(){return this._index},function(t){this._index=t,this._displayToIndex(t),this._labels&&this._labels[t]&&this.event("label",this._labels[t])}),__getset(0,i,"count",function(){return this._count}),e}(Sprite),Text=function(t){function e(){this._clipPoint=null,this._currBitmapFont=null,this._text=null,this._isChanged=!1,this._textWidth=0,this._textHeight=0,this._lines=[],this._lineWidths=[],this._startX=NaN,this._startY=NaN,this._lastVisibleLineIndex=-1,this._words=null,this._charSize={},this.underline=!1,this._underlineColor=null,e.__super.call(this),this.overflow=e.VISIBLE,this._style=new CSSStyle(this),this._style.wordWrap=!1}__class(e,"laya.display.Text",t);var i=e.prototype;return i.destroy=function(e){void 0===e&&(e=!0),t.prototype.destroy.call(this,e),this._lines=null,this._words&&(this._words.length=0,this._words=null)},i._getBoundPointsM=function(t){void 0===t&&(t=!1);var e=Rectangle.TEMP;return e.setTo(0,0,this.width,this.height),e._getBoundPoints()},i.getGraphicBounds=function(){var t=Rectangle.TEMP;return t.setTo(0,0,this.width,this.height),t},i._getCSSStyle=function(){return this._style},i.lang=function(t,i,n,s,r,a,o,h,l,u,c){if(t=e.langPacks&&e.langPacks[t]?e.langPacks[t]:t,arguments.length<2)this._text=t;else{for(var _=0,d=arguments.length;d>_;_++)t=t.replace("{"+_+"}",arguments[_+1]);this._text=t}},i.renderText=function(t,e){var i=this.graphics;i.clear();var n=(this.italic?"italic ":"")+(this.bold?"bold ":"")+this.fontSize+"px "+this.font;Browser.context.font=n;var s=this.padding,r=s[3],a="left",o=this._lines,h=this.leading+this._charSize.height,l=this._currBitmapFont;l&&(h=this.leading+l.getMaxHeight());var u=s[0];if(!l&&this._width>0&&this._textWidth<=this._width&&("right"==this.align?(a="right",r=this._width-s[1]):"center"==this.align&&(a="center",r=.5*this._width+s[3]-s[1])),this._height>0){var c=this._textHeight>this._height?"top":this.valign;"middle"===c?u=.5*(this._height-e*h)+s[0]-s[2]:"bottom"===c&&(u=this._height-e*h-s[2])}var _=this._style;if(l&&l.autoScaleSize)var d=l.fontSize/this.fontSize;if(this._clipPoint)if(i.save(),l&&l.autoScaleSize){var f=0,p=0;f=this._width?this._width-s[3]-s[1]:this._textWidth,p=this._height?this._height-s[0]-s[2]:this._textHeight,f*=d,p*=d,i.clipRect(s[3],s[0],f,p)}else i.clipRect(s[3],s[0],this._width?this._width-s[3]-s[1]:this._textWidth,this._height?this._height-s[0]-s[2]:this._textHeight);var g=_.password;"prompt"in this&&this.prompt==this._text&&(g=!1);for(var m=0,v=0,y=Math.min(this._lines.length,e+t)||1,x=t;y>x;x++){var w,b=o[x];if(g){var T=b.length;b="";for(var S=T;S>0;S--)b+="●"}if(m=r-(this._clipPoint?this._clipPoint.x:0),v=u+h*x-(this._clipPoint?this._clipPoint.y:0),this.underline&&this.drawUnderline(a,m,v,x),l){var C=this.width;l.autoScaleSize&&(C=this.width*d),l.drawText(b,this,m,v,this.align,C)}else Render.isWebGL?(this._words||(this._words=[]),w=this._words.length>x-t?this._words[x-t]:new WordText,w.setText(b)):w=b,_.stroke?i.fillBorderText(w,m,v,n,this.color,_.strokeColor,_.stroke,a):i.fillText(w,m,v,n,this.color,a)}if(l&&l.autoScaleSize){var M=1/d;this.scale(M,M)}this._clipPoint&&i.restore(),this._startX=r,this._startY=u},i.drawUnderline=function(t,e,i,n){var s=this._lineWidths[n];switch(t){case"center":e-=s/2;break;case"right":e-=s;break;case"left":}i+=this._charSize.height,this._graphics.drawLine(e,i,e+s,i,this.underlineColor||this.color,1)},i.typeset=function(){if(this._isChanged=!1,!this._text)return this._clipPoint=null,this._textWidth=this._textHeight=0,void this.graphics.clear();Browser.context.font=this._getCSSStyle().font,this._lines.length=0,this._lineWidths.length=0,this.parseLines(this._text),this.evalTextSize(),this.checkEnabledViewportOrNot()?this._clipPoint||(this._clipPoint=new Point(0,0)):this._clipPoint=null;var t=this._lines.length;if(this.overflow!=e.VISIBLE){var i=this.overflow==e.HIDDEN?Math.floor:Math.ceil;t=Math.min(t,i((this.height-this.padding[0]-this.padding[2])/(this.leading+this._charSize.height)))}var n=this.scrollY/(this._charSize.height+this.leading)|0;this.renderText(n,t),this.repaint()},i.evalTextSize=function(){var t=NaN,e=NaN;t=Math.max.apply(this,this._lineWidths),e=this._currBitmapFont?this._lines.length*(this._currBitmapFont.getMaxHeight()+this.leading)+this.padding[0]+this.padding[2]:this._lines.length*(this._charSize.height+this.leading)+this.padding[0]+this.padding[2],t==this._textWidth&&e==this._textHeight||(this._textWidth=t,this._textHeight=e,this._width&&this._height||this.model&&this.model.size(this._width||this._textWidth,this._height||this._textHeight))},i.checkEnabledViewportOrNot=function(){return this.overflow==e.SCROLL&&(this._width>0&&this._textWidth>this._width||this._height>0&&this._textHeight>this._height)},i.changeText=function(t){this._text!==t&&(this.lang(t+""),this._graphics&&this._graphics.replaceText(this._text)||this.typeset())},i.parseLines=function(t){var i=this.wordWrap||this.overflow==e.HIDDEN;if(i)var n=this.getWordWrapWidth();var s=Browser.context.measureText("阳");this._charSize.width=s.width,this._charSize.height=s.height||this.fontSize;for(var r=t.replace(/\r\n/g,"\n").split("\n"),a=0,o=r.length;o>a;a++){o-1>a&&(r[a]+="\n");var h=r[a];i?this.parseLine(h,n):(this._lineWidths.push(this.getTextWidth(h)),this._lines.push(h))}},i.parseLine=function(t,i){var n,s=(Browser.context,this._lines),r=0,a=NaN,o=NaN,h=0;if(a=this.getTextWidth(t),i>=a)return s.push(t),void this._lineWidths.push(a);a=this._currBitmapFont?this._currBitmapFont.getMaxWidth():this._charSize.width,r=Math.floor(i/a),0==r&&(r=1),a=this.getTextWidth(t.substring(0,r)),o=a;for(var l=r,u=t.length;u>l;l++)if(a=this.getTextWidth(t.charAt(l)),o+=a,o>i)if(this.wordWrap){var c=t.substring(h,l);if(c.charCodeAt(c.length-1)<255&&(n=/[^\x20-]+$/.exec(c),n&&(l=n.index+h,0==n.index?l+=c.length:c=t.substring(h,l))),s.push(c),this._lineWidths.push(o-a),h=l,!(u>l+r)){s.push(t.substring(h,u)),this._lineWidths.push(this.getTextWidth(s[s.length-1])),h=-1;break}l+=r,a=this.getTextWidth(t.substring(h,l)),o=a,l--}else if(this.overflow==e.HIDDEN)return s.push(t.substring(0,l)),void this._lineWidths.push(this.getTextWidth(s[s.length-1]));this.wordWrap&&-1!=h&&(s.push(t.substring(h,u)),this._lineWidths.push(this.getTextWidth(s[s.length-1])))},i.getTextWidth=function(t){return this._currBitmapFont?this._currBitmapFont.getTextWidth(t):Browser.context.measureText(t).width},i.getWordWrapWidth=function(){var t=this.padding,e=NaN;return e=this._currBitmapFont&&this._currBitmapFont.autoScaleSize?this._width*(this._currBitmapFont.fontSize/this.fontSize):this._width,0>=e&&(e=this.wordWrap?100:Browser.width),0>=e&&(e=100),e-t[3]-t[1]},i.getCharPoint=function(t,e){this._isChanged&&Laya.timer.runCallLater(this,this.typeset);for(var i=0,n=this._lines,s=0,r=0,a=n.length;a>r;r++){if(i+=n[r].length,i>t){var o=r;break}s=i}var h=(this.italic?"italic ":"")+(this.bold?"bold ":"")+this.fontSize+"px "+this.font;Browser.context.font=h;var l=this.getTextWidth(this._text.substring(s,t)),u=e||new Point;return u.setTo(this._startX+l-(this._clipPoint?this._clipPoint.x:0),this._startY+o*(this._charSize.height+this.leading)-(this._clipPoint?this._clipPoint.y:0))},__getset(0,i,"width",function(){return this._width?this._width:this.textWidth+this.padding[1]+this.padding[3]},function(e){e!=this._width&&(t.prototype._$set_width.call(this,e),this.isChanged=!0)}),__getset(0,i,"textWidth",function(){return this._isChanged&&Laya.timer.runCallLater(this,this.typeset),this._textWidth}),__getset(0,i,"height",function(){return this._height?this._height:this.textHeight+this.padding[0]+this.padding[2]},function(e){e!=this._height&&(t.prototype._$set_height.call(this,e),this.isChanged=!0)}),__getset(0,i,"textHeight",function(){return this._isChanged&&Laya.timer.runCallLater(this,this.typeset),this._textHeight}),__getset(0,i,"padding",function(){return this._getCSSStyle().padding},function(t){this._getCSSStyle().padding=t,this.isChanged=!0}),__getset(0,i,"bold",function(){return this._getCSSStyle().bold},function(t){this._getCSSStyle().bold=t,this.isChanged=!0}),__getset(0,i,"text",function(){return this._text||""},function(t){this._text!==t&&(this.lang(t+""),this.isChanged=!0,this.event("change"))}),__getset(0,i,"color",function(){return this._getCSSStyle().color},function(t){this._getCSSStyle().color!=t&&(this._getCSSStyle().color=t,!this._isChanged&&this._graphics?this._graphics.replaceTextColor(this.color):this.isChanged=!0)}),__getset(0,i,"font",function(){return this._getCSSStyle().fontFamily},function(t){this._currBitmapFont&&(this._currBitmapFont=null,this.scale(1,1)),e._bitmapFonts&&e._bitmapFonts[t]&&(this._currBitmapFont=e._bitmapFonts[t]),this._getCSSStyle().fontFamily=t,this.isChanged=!0}),__getset(0,i,"fontSize",function(){return this._getCSSStyle().fontSize},function(t){this._getCSSStyle().fontSize=t,this.isChanged=!0}),__getset(0,i,"italic",function(){return this._getCSSStyle().italic},function(t){this._getCSSStyle().italic=t,this.isChanged=!0}),__getset(0,i,"align",function(){return this._getCSSStyle().align},function(t){this._getCSSStyle().align=t,this.isChanged=!0}),__getset(0,i,"valign",function(){return this._getCSSStyle().valign},function(t){this._getCSSStyle().valign=t,this.isChanged=!0}),__getset(0,i,"wordWrap",function(){return this._getCSSStyle().wordWrap},function(t){this._getCSSStyle().wordWrap=t,this.isChanged=!0}),__getset(0,i,"leading",function(){return this._getCSSStyle().leading},function(t){this._getCSSStyle().leading=t,this.isChanged=!0}),__getset(0,i,"bgColor",function(){return this._getCSSStyle().backgroundColor},function(t){this._getCSSStyle().backgroundColor=t,this.isChanged=!0}),__getset(0,i,"borderColor",function(){return this._getCSSStyle().borderColor},function(t){this._getCSSStyle().borderColor=t,this.isChanged=!0}),__getset(0,i,"stroke",function(){return this._getCSSStyle().stroke},function(t){this._getCSSStyle().stroke=t,this.isChanged=!0}),__getset(0,i,"strokeColor",function(){return this._getCSSStyle().strokeColor},function(t){this._getCSSStyle().strokeColor=t,this.isChanged=!0}),__getset(0,i,"isChanged",null,function(t){this._isChanged!==t&&(this._isChanged=t,t&&Laya.timer.callLater(this,this.typeset))}),__getset(0,i,"scrollX",function(){return this._clipPoint?this._clipPoint.x:0},function(t){if(!(this.overflow!=e.SCROLL||this.textWidth<this._width)&&this._clipPoint){t=t<this.padding[3]?this.padding[3]:t;var i=this._textWidth-this._width;t=t>i?i:t;var n=this._height/(this._charSize.height+this.leading)|1;this._clipPoint.x=t,this.renderText(this._lastVisibleLineIndex,n)}}),__getset(0,i,"scrollY",function(){return this._clipPoint?this._clipPoint.y:0},function(t){if(!(this.overflow!=e.SCROLL||this.textHeight<this._height)&&this._clipPoint){t=t<this.padding[0]?this.padding[0]:t;var i=this._textHeight-this._height;t=t>i?i:t;var n=t/(this._charSize.height+this.leading)|0;this._lastVisibleLineIndex=n;var s=(this._height/(this._charSize.height+this.leading)|0)+1;this._clipPoint.y=t,this.renderText(n,s)}}),__getset(0,i,"maxScrollX",function(){return this.textWidth<this._width?0:this._textWidth-this._width}),__getset(0,i,"maxScrollY",function(){return this.textHeight<this._height?0:this._textHeight-this._height}),__getset(0,i,"lines",function(){return this._lines}),__getset(0,i,"underlineColor",function(){return this._underlineColor},function(t){this._underlineColor=t,this._isChanged=!0,this.typeset()}),e.registerBitmapFont=function(t,i){e._bitmapFonts||(e._bitmapFonts={}),e._bitmapFonts[t]=i},e.unregisterBitmapFont=function(t,i){if(void 0===i&&(i=!0),e._bitmapFonts&&e._bitmapFonts[t]){var n=e._bitmapFonts[t];i&&n.destroy(),delete e._bitmapFonts[t]}},e.langPacks=null,e.VISIBLE="visible",e.SCROLL="scroll",e.HIDDEN="hidden",e._bitmapFonts=null,e}(Sprite),Stage=function(t){function e(){function t(){"hidden"==Browser.document[r]?(n.event("blur"),n._isInputting()&&(Input.inputElement.target.focus=!1)):n.event("focus")}this.focus=null,this.frameRate="fast",this.desginWidth=0,this.desginHeight=0,this.canvasRotation=!1,this.canvasDegree=0,this.renderingEnabled=!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=NaN,this._previousOrientation=0,this._scenes=null,e.__super.call(this),this.offset=new Point,this._canvasTransform=new Matrix;var i=this;this.transform=Matrix.create(),this._scenes=[],this.mouseEnabled=!0,this.hitTestPrior=!0,this.autoSize=!1,this._displayedInStage=!0;var n=this,s=Browser.window;s.addEventListener("focus",function(){n.event("focus")}),s.addEventListener("blur",function(){n.event("blur"),n._isInputting()&&(Input.inputElement.target.focus=!1)});var r="visibilityState",a="visibilitychange",o=s.document;"undefined"!=typeof o.hidden?(a="visibilitychange",r="visibilityState"):"undefined"!=typeof o.mozHidden?(a="mozvisibilitychange",r="mozVisibilityState"):"undefined"!=typeof o.msHidden?(a="msvisibilitychange",r="msVisibilityState"):"undefined"!=typeof o.webkitHidden&&(a="webkitvisibilitychange",r="webkitVisibilityState"),s.document.addEventListener(a,t),s.addEventListener("resize",function(){var t=Browser.window.orientation;null!=t&&t!=i._previousOrientation&&n._isInputting()&&(Input.inputElement.target.focus=!1),i._previousOrientation=t,n._isInputting()||(Browser.onSafari&&(n._safariOffsetY=(Browser.window.__innerHeight||Browser.document.body.clientHeight||Browser.document.documentElement.clientHeight)-Browser.window.innerHeight),n._resetCanvas())}),s.addEventListener("orientationchange",function(t){n._resetCanvas()}),this.on("mousemove",this,this._onmouseMove),Browser.onMobile&&this.on("mousedown",this,this._onmouseMove)}__class(e,"laya.display.Stage",t);var i=e.prototype;return i._isInputting=function(){return Browser.onMobile&&Input.isInputting},i._changeCanvasSize=function(){this.setScreenSize(Browser.clientWidth*Browser.pixelRatio,Browser.clientHeight*Browser.pixelRatio)},i._resetCanvas=function(){var t=Render._mainCanvas,e=t.source.style;t.size(1,1),e.transform=e.webkitTransform=e.msTransform=e.mozTransform=e.oTransform="",this.visible=!1,Laya.timer.once(100,this,this._changeCanvasSize)},i.setScreenSize=function(t,e){var i=!1;if("none"!==this._screenMode){var n=1>t/e?"vertical":"horizontal";if(i=n!==this._screenMode){var s=e;e=t,t=s}}this.canvasRotation=i;var r=Render._mainCanvas,a=r.source.style,o=this._canvasTransform.identity(),h=this._scaleMode,l=t/this.desginWidth,u=e/this.desginHeight,c=this.desginWidth,_=this.desginHeight,d=t,f=e,p=Browser.pixelRatio;switch(this._width=this.desginWidth,this._height=this.desginHeight,h){case"noscale":l=u=1,d=this.desginWidth,f=this.desginHeight;break;case"showall":l=u=Math.min(l,u),c=d=Math.round(this.desginWidth*l),_=f=Math.round(this.desginHeight*u);break;case"noborder":l=u=Math.max(l,u),d=Math.round(this.desginWidth*l),f=Math.round(this.desginHeight*u);break;case"full":l=u=1,this._width=c=t,this._height=_=e;break;case"fixedwidth":u=l,this._height=e/l,_=Math.round(e/l);break;case"fixedheight":l=u,this._width=t/u,c=Math.round(t/u)}l*=this.scaleX,u*=this.scaleY,1===l&&1===u?this.transform.identity():(this.transform.a=this._formatData(l/(d/c)),this.transform.d=this._formatData(u/(f/_)),this.model&&this.model.scale(this.transform.a,this.transform.d)),r.size(c,_),RunDriver.changeWebGLSize(c,_),o.scale(d/c/p,f/_/p),"left"===this._alignH?this.offset.x=0:"right"===this._alignH?this.offset.x=t-d:this.offset.x=.5*(t-d)/p,"top"===this._alignV?this.offset.y=0:"bottom"===this._alignV?this.offset.y=e-f:this.offset.y=.5*(e-f)/p,this.offset.x=Math.round(this.offset.x),this.offset.y=Math.round(this.offset.y),o.translate(this.offset.x,this.offset.y),this._safariOffsetY&&0===parseInt(a.top)&&(a.top=this._safariOffsetY+"px"),this.canvasDegree=0,i&&("horizontal"===this._screenMode?(o.rotate(Math.PI/2),o.translate(e/p,0),this.canvasDegree=90):(o.rotate(-Math.PI/2),o.translate(0,t/p),this.canvasDegree=-90)),o.a=this._formatData(o.a),o.d=this._formatData(o.d),o.tx=this._formatData(o.tx),o.ty=this._formatData(o.ty),a.transformOrigin=a.webkitTransformOrigin=a.msTransformOrigin=a.mozTransformOrigin=a.oTransformOrigin="0px 0px 0px",a.transform=a.webkitTransform=a.msTransform=a.mozTransform=a.oTransform="matrix("+o.toString()+")",o.translate(parseInt(a.left)||0,parseInt(a.top)||0),this.visible=!0,this._repaint=1,this.event("resize")},i._formatData=function(t){return Math.abs(t)<1e-6?0:Math.abs(1-t)<.001?t>0?1:-1:t},i.getMousePoint=function(){return Point.TEMP.setTo(this.mouseX,this.mouseY)},i.repaint=function(){this._repaint=1},i.parentRepaint=function(){},i._loop=function(){return this.render(Render.context,0,0),!0},i._onmouseMove=function(t){this._mouseMoveTime=Browser.now()},i.getTimeFromFrameStart=function(){return Browser.now()-this._frameStartTime},i.render=function(e,i,n){if("sleep"===this.frameRate){var s=Browser.now();if(!(s-this._frameStartTime>=1e3))return;this._frameStartTime=s}if(this._renderCount++,Render.isFlash&&this.repaint(),!this.visible)return void(this._renderCount%5===0&&(Stat.loopCount++,MouseManager.instance.runEvent(),Laya.timer._update()));this._frameStartTime=Browser.now();var r="mouse"===this.frameRate?this._frameStartTime-this._mouseMoveTime<2e3?"fast":"slow":this.frameRate,a="slow"!==r,o=this._renderCount%2===0;if(Stat.renderSlow=!a,a||o){Stat.loopCount++,MouseManager.instance.runEvent(),Laya.timer._update();var h=0,l=0;for(h=0,l=this._scenes.length;l>h;h++){var u=this._scenes[h];u&&u._updateScene()}if(Render.isConchNode){var c=Sprite.CustomList;for(h=0,l=c.length;l>h;h++){var _=c[h];_.customRender(_.customContext,0,0)}return}Render.isWebGL&&this.renderingEnabled&&(e.clear(),t.prototype.render.call(this,e,i,n))}Render.isConchNode||!this.renderingEnabled||!a&&o||(Render.isWebGL?(RunDriver.clear(this._bgColor),RunDriver.beginFlush(),e.flush(),RunDriver.endFinish(),VectorGraphManager.instance&&VectorGraphManager.getInstance().endDispose()):(RunDriver.clear(this._bgColor),t.prototype.render.call(this,e,i,n)))},i._requestFullscreen=function(){var t=Browser.document.documentElement;t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},i._fullScreenChanged=function(){Laya.stage.event("fullscreenchange")},i.exitFullscreen=function(){var t=Browser.document;t.exitFullscreen?t.exitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()},__getset(0,i,"mouseY",function(){return Math.round(MouseManager.instance.mouseY/this.clientScaleY);
|
||
}),__getset(0,i,"clientScaleY",function(){return this._transform?this._transform.getScaleY():1}),__getset(0,i,"width",t.prototype._$get_width,function(e){this.desginWidth=e,t.prototype._$set_width.call(this,e),Laya.timer.callLater(this,this._changeCanvasSize)}),__getset(0,i,"alignH",function(){return this._alignH},function(t){this._alignH=t,Laya.timer.callLater(this,this._changeCanvasSize)}),__getset(0,i,"height",t.prototype._$get_height,function(e){this.desginHeight=e,t.prototype._$set_height.call(this,e),Laya.timer.callLater(this,this._changeCanvasSize)}),__getset(0,i,"scaleMode",function(){return this._scaleMode},function(t){this._scaleMode=t,Laya.timer.callLater(this,this._changeCanvasSize)}),__getset(0,i,"alignV",function(){return this._alignV},function(t){this._alignV=t,Laya.timer.callLater(this,this._changeCanvasSize)}),__getset(0,i,"bgColor",function(){return this._bgColor},function(t){this._bgColor=t,this.model&&this.model.bgColor(t),t?Render.canvas.style.background=t:Render.canvas.style.background="none"}),__getset(0,i,"clientScaleX",function(){return this._transform?this._transform.getScaleX():1}),__getset(0,i,"mouseX",function(){return Math.round(MouseManager.instance.mouseX/this.clientScaleX)}),__getset(0,i,"screenMode",function(){return this._screenMode},function(t){this._screenMode=t}),__getset(0,i,"visible",t.prototype._$get_visible,function(e){if(this.visible!==e){t.prototype._$set_visible.call(this,e);var i=Render._mainCanvas.source.style;i.visibility=e?"visible":"hidden"}}),__getset(0,i,"fullScreenEnabled",null,function(t){var e=Browser.document,i=Render.canvas;t?(i.addEventListener("mousedown",this._requestFullscreen),i.addEventListener("touchstart",this._requestFullscreen),e.addEventListener("fullscreenchange",this._fullScreenChanged),e.addEventListener("mozfullscreenchange",this._fullScreenChanged),e.addEventListener("webkitfullscreenchange",this._fullScreenChanged),e.addEventListener("msfullscreenchange",this._fullScreenChanged)):(i.removeEventListener("mousedown",this._requestFullscreen),i.removeEventListener("touchstart",this._requestFullscreen),e.removeEventListener("fullscreenchange",this._fullScreenChanged),e.removeEventListener("mozfullscreenchange",this._fullScreenChanged),e.removeEventListener("webkitfullscreenchange",this._fullScreenChanged),e.removeEventListener("msfullscreenchange",this._fullScreenChanged))}),e.SCALE_NOSCALE="noscale",e.SCALE_EXACTFIT="exactfit",e.SCALE_SHOWALL="showall",e.SCALE_NOBORDER="noborder",e.SCALE_FULL="full",e.SCALE_FIXED_WIDTH="fixedwidth",e.SCALE_FIXED_HEIGHT="fixedheight",e.ALIGN_LEFT="left",e.ALIGN_RIGHT="right",e.ALIGN_CENTER="center",e.ALIGN_TOP="top",e.ALIGN_MIDDLE="middle",e.ALIGN_BOTTOM="bottom",e.SCREEN_NONE="none",e.SCREEN_HORIZONTAL="horizontal",e.SCREEN_VERTICAL="vertical",e.FRAME_FAST="fast",e.FRAME_SLOW="slow",e.FRAME_MOUSE="mouse",e.FRAME_SLEEP="sleep",e}(Sprite),SoundNode=function(t){function e(){this.url=null,this._channel=null,this._tar=null,this._playEvents=null,this._stopEvents=null,e.__super.call(this),this.visible=!1,this.on("added",this,this._onParentChange),this.on("removed",this,this._onParentChange)}__class(e,"laya.media.SoundNode",t);var i=e.prototype;return i._onParentChange=function(){this.target=this.parent},i.play=function(t,e){void 0===t&&(t=1),isNaN(t)&&(t=1),this.url&&(this.stop(),this._channel=SoundManager.playSound(this.url,t,e))},i.stop=function(){this._channel&&!this._channel.isStopped&&this._channel.stop(),this._channel=null},i._setPlayAction=function(t,e,i,n){void 0===n&&(n=!0),this[i]&&t&&(n?t.on(e,this,this[i]):t.off(e,this,this[i]))},i._setPlayActions=function(t,e,i,n){if(void 0===n&&(n=!0),t&&e){var s=e.split(","),r=0,a=0;for(a=s.length,r=0;a>r;r++)this._setPlayAction(t,s[r],i,n)}},__getset(0,i,"playEvent",null,function(t){this._playEvents=t,t&&this._tar&&this._setPlayActions(this._tar,t,"play")}),__getset(0,i,"target",null,function(t){this._tar&&(this._setPlayActions(this._tar,this._playEvents,"play",!1),this._setPlayActions(this._tar,this._stopEvents,"stop",!1)),this._tar=t,this._tar&&(this._setPlayActions(this._tar,this._playEvents,"play",!0),this._setPlayActions(this._tar,this._stopEvents,"stop",!0))}),__getset(0,i,"stopEvent",null,function(t){this._stopEvents=t,t&&this._tar&&this._setPlayActions(this._tar,t,"stop")}),e}(Sprite),Scene2D=function(t){function e(){e.__super.call(this),this.createChildren()}__class(e,"laya.scene.Scene2D",t);var i=e.prototype;return i.createChildren=function(){},i.createView=function(t){ClassUtils.createByJson(t,this,this)},e}(Sprite),FileBitmap=function(t){function e(){this._src=null,this._onload=null,this._onerror=null,e.__super.call(this)}__class(e,"laya.resource.FileBitmap",t);var i=e.prototype;return __getset(0,i,"src",function(){return this._src},function(t){this._src=t}),__getset(0,i,"onload",null,function(t){}),__getset(0,i,"onerror",null,function(t){}),e}(Bitmap),HTMLCanvas=function(t){function e(t,i){this._is2D=!1,e.__super.call(this);var n=this;if(this._source=this,"2D"===t||"AUTO"===t&&!Render.isWebGL){this._is2D=!0,this._source=i||Browser.createElement("canvas");var s=this;s.getContext=function(t,e){if(n._ctx)return n._ctx;var i=n._ctx=n._source.getContext(t,e);return i&&(i._canvas=s,Render.isFlash||(i.size=function(t,e){})),i}}else this._source={}}__class(e,"laya.resource.HTMLCanvas",t);var i=e.prototype;return i.clear=function(){this._ctx&&this._ctx.clear()},i.destroy=function(){this._ctx&&this._ctx.destroy(),this._ctx=null},i.release=function(){},i._setContext=function(t){this._ctx=t},i.getContext=function(t,i){return this._ctx?this._ctx:this._ctx=e._createContext(this)},i.getMemSize=function(){return 0},i.size=function(t,e){this._w==t&&this._h==e||(this._w=t,this._h=e,this._ctx&&this._ctx.size(t,e),this._source&&(this._source.height=e,this._source.width=t))},__getset(0,i,"context",function(){return this._ctx}),__getset(0,i,"asBitmap",null,function(t){}),e.create=function(t,i){return new e(t,i)},e.TYPE2D="2D",e.TYPE3D="3D",e.TYPEAUTO="AUTO",e._createContext=null,e}(Bitmap),HTMLSubImage=function(t){function e(t,i,n,s,r,a,o,h){throw e.__super.call(this),new Error("不允许new!")}return __class(e,"laya.resource.HTMLSubImage",t),e.create=function(t,i,n,s,r,a,o,h){return void 0===h&&(h=!1),new e(t,i,n,s,r,a,o,h)},e}(Bitmap),Animation=function(t){function e(){this._frames=null,this._url=null,e.__super.call(this),this._setControlNode(this)}__class(e,"laya.display.Animation",t);var i=e.prototype;return i.destroy=function(t){void 0===t&&(t=!0),this.stop(),laya.display.Sprite.prototype.destroy.call(this,t),this._frames=null,this._labels=null},i.play=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=!0),void 0===i&&(i=""),i&&this._setFramesFromCache(i),this._isPlaying=!0,this.index="string"==typeof t?this._getFrameByLabel(t):t,this.loop=e,this._actionName=i,this._isReverse=1==this.wrapMode,this._frames&&this.interval>0&&this.timerLoop(this.interval,this,this._frameLoop,null,!0)},i._setFramesFromCache=function(t){return this._url&&(t=this._url+"#"+t),t&&e.framesMap[t]?(this._frames=e.framesMap[t],this._count=this._frames.length,!this._frameRateChanged&&e.framesMap[t+"$len"]&&(this._interval=e.framesMap[t+"$len"]),!0):!1},i._frameLoop=function(){this._style.visible&&this._style.alpha>.01&&t.prototype._frameLoop.call(this)},i._displayToIndex=function(t){this._frames&&(this.graphics=this._frames[t])},i.clear=function(){this.stop(),this.graphics=null,this._frames=null,this._labels=null},i.loadImages=function(t,i){return void 0===i&&(i=""),this._url="",this._setFramesFromCache(i)||(this.frames=e.framesMap[i]?e.framesMap[i]:e.createFrames(t,i)),this},i.loadAtlas=function(t,i,n){function s(s){t===s&&(r.frames=e.framesMap[n]?e.framesMap[n]:e.createFrames(t,n),i&&i.run())}void 0===n&&(n=""),this._url="";var r=this;return r._setFramesFromCache(n)||(Loader.getAtlas(t)?s(t):Laya.loader.load(t,Handler.create(null,s,[t]),null,"atlas")),this},i.loadAnimation=function(t,i){function n(n){if(t===n){if(e.framesMap[t+"#"])s._frameRateChanged||(s._interval=e.framesMap[t+"#$len"]),s.frames=e.framesMap[t+"#"];else{var r=s._parseGraphicAnimation(Loader.getRes(t));if(!r)return;var a=r.animationDic,o=!0;for(var h in a){var l=a[h];l.frames.length?(e.framesMap[t+"#"+h]=l.frames,e.framesMap[t+"#"+h+"$len"]=l.interval):o=!1}s._frameRateChanged||(s._interval=r.animationList[0].interval),s.frames=r.animationList[0].frames,o&&(e.framesMap[t+"#$len"]=r.animationList[0].interval,e.framesMap[t+"#"]=s.frames)}i&&i.run()}}this._url=t;var s=this;return s._setFramesFromCache("")||(Loader.getRes(t)?n(t):Laya.loader.load(t,Handler.create(null,n,[t]),null,"json"),Loader.clearRes(t)),this},i._parseGraphicAnimation=function(t){return GraphicAnimation.parseAnimationData(t)},__getset(0,i,"frames",function(){return this._frames},function(t){this._frames=t,t&&(this._count=t.length,this._isPlaying?this.play(this._index,this.loop,this._actionName):this.index=this._index)}),__getset(0,i,"autoPlay",null,function(t){t?this.play():this.stop()}),__getset(0,i,"source",null,function(t){t.indexOf(".ani")>-1?this.loadAnimation(t):t.indexOf(".json")>-1||t.indexOf("als")>-1?this.loadAtlas(t):this.loadImages(t.split(","))}),e.createFrames=function(t,i){var n;if("string"==typeof t){var s=Loader.getAtlas(t);if(s&&s.length){n=[];for(var r=0,a=s.length;a>r;r++){var o=new Graphics;o.drawTexture(Loader.getRes(s[r]),0,0),n.push(o)}}}else if(t instanceof Array)for(n=[],r=0,a=t.length;a>r;r++)o=new Graphics,o.loadImage(t[r],0,0),n.push(o);return i&&(e.framesMap[i]=n),n},e.clearCache=function(t){var i,n=e.framesMap,s=t+"#";for(i in n)i!==t&&0!=i.indexOf(s)||delete e.framesMap[i]},e.framesMap={},e}(AnimationPlayerBase),FrameAnimation=function(t){function e(){this._targetDic=null,this._animationData=null,e.__super.call(this),null==e._sortIndexFun&&(e._sortIndexFun=MathUtil.sortByKey("index",!1,!0))}__class(e,"laya.display.FrameAnimation",t);var i=e.prototype;return i._setUp=function(t,e){this._labels=null,this._targetDic=t,this._animationData=e,this.interval=1e3/e.frameRate,e.parsed?this._count=e.count:this._calculateDatas(),e.parsed=!0,e.count=this._count},i.clear=function(){t.prototype.clear.call(this),this._targetDic=null,this._animationData=null},i._displayToIndex=function(t){if(this._animationData){0>t&&(t=0),t>this._count&&(t=this._count);var e=this._animationData.nodes,i=0,n=e.length;for(i=0;n>i;i++)this._displayNodeToFrame(e[i],t)}},i._displayNodeToFrame=function(t,e,i){i||(i=this._targetDic);var n=i[t.target];if(n){var s,r,a,o=t.frames,h=t.keys,l=0,u=h.length;for(l=0;u>l;l++)s=h[l],r=o[s],a=r.length>e?r[e]:r[r.length-1],n[s]=a}},i._calculateDatas=function(){if(this._animationData){var t,e=this._animationData.nodes,i=0,n=e.length;for(this._count=0,i=0;n>i;i++)t=e[i],this._calculateNodeKeyFrames(t);this._count+=1}},i._calculateNodeKeyFrames=function(t){var i,n,s=t.keyframes,r=t.target;t.frames||(t.frames={}),t.keys?t.keys.length=0:t.keys=[];for(i in s)n=s[i],t.frames[i]||(t.frames[i]=[]),n.sort(e._sortIndexFun),t.keys.push(i),this._calculateNodePropFrames(n,t.frames[i],i,r)},i._calculateNodePropFrames=function(t,e,i,n){var s=0,r=t.length-1;for(e.length=t[r].index+1,s=0;r>s;s++)this._dealKeyFrame(t[s]),this._calculateFrameValues(t[s],t[s+1],e);0==r&&(e[0]=t[0].value),this._dealKeyFrame(t[s])},i._dealKeyFrame=function(t){t.label&&""!=t.label&&this.addLabel(t.label,t.index)},i._calculateFrameValues=function(t,e,i){var n,s=0,r=t.index,a=e.index,o=t.value,h=e.value-t.value,l=a-r;if(a>this._count&&(this._count=a),t.tween)for(n=Ease[t.tweenMethod],null==n&&(n=Ease.linearNone),s=r;a>s;s++)i[s]=n(s-r,o,h,l);else for(s=r;a>s;s++)i[s]=o;i[e.index]=e.value},e._sortIndexFun=null,e}(AnimationPlayerBase),Input=function(t){function e(){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="",e.__super.call(this),this._maxChars=1e5,this._width=100,this._height=20,this.multiline=!1,this.overflow=Text.SCROLL,this.on("mousedown",this,this._onMouseDown),this.on("undisplay",this,this._onUnDisplay)}__class(e,"laya.display.Input",t);var i=e.prototype;return i.setSelection=function(t,e){laya.display.Input.inputElement.selectionStart=t,laya.display.Input.inputElement.selectionEnd=e},i._onUnDisplay=function(t){this.focus=!1},i._onMouseDown=function(t){this.focus=!0,Laya.stage.on("mousedown",this,this._checkBlur)},i._checkBlur=function(t){t.nativeEvent.target!=laya.display.Input.input&&t.nativeEvent.target!=laya.display.Input.area&&t.target!=this&&(this.focus=!1)},i.render=function(t,e,i){laya.display.Sprite.prototype.render.call(this,t,e,i)},i._syncInputTransform=function(){var t,i=(this.nativeInput.style,Laya.stage);t=Utils.getGlobalPosAndScale(this);var n=i._canvasTransform.clone(),s=n.clone();s.rotate(-Math.PI/180*Laya.stage.canvasDegree),s.scale(Laya.stage.clientScaleX,Laya.stage.clientScaleY);var r=Laya.stage.canvasDegree%180!=0,a=r?s.d:s.a,o=r?s.a:s.d;s.destroy();var h=this.padding[3],l=this.padding[0];0==Laya.stage.canvasDegree?(h+=t.x,l+=t.y,h*=a,l*=o,h+=n.tx,l+=n.ty):90==Laya.stage.canvasDegree?(h+=t.y,l+=t.x,h*=a,l*=o,h=n.tx-h,l+=n.ty):(h+=t.y,l+=t.x,h*=a,l*=o,h+=n.tx,l=n.ty-l);var u=.785,c=Math.atan2(t.height,t.width)-u,_=Math.sin(c),d=Math.cos(c),f=d*t.width+_*t.height,p=d*t.height-_*t.width;a*=r?p:f,o*=r?f:p,n.tx=0,n.ty=0,c*=180/3.1415,e.inputContainer.style.transform="scale("+a+","+o+") rotate("+(Laya.stage.canvasDegree+c)+"deg)",e.inputContainer.style.webkitTransform="scale("+a+","+o+") rotate("+(Laya.stage.canvasDegree+c)+"deg)",e.inputContainer.setPos(h,l),n.destroy();var g=this._width-this.padding[1]-this.padding[3],m=this._height-this.padding[0]-this.padding[2];this.nativeInput.setSize(g,m),Render.isConchApp&&(this.nativeInput.setPos(h,l),this.nativeInput.setScale(a,o))},i.select=function(){this.nativeInput.select()},i._setInputMethod=function(){e.input.parentElement&&e.inputContainer.removeChild(e.input),e.area.parentElement&&e.inputContainer.removeChild(e.area),e.inputElement=this._multiline?e.area:e.input,e.inputContainer.appendChild(e.inputElement)},i._focusIn=function(){laya.display.Input.isInputting=!0;var t=this.nativeInput;this._focus=!0;var e=t.style;e.whiteSpace=this.wordWrap?"pre-wrap":"nowrap",this._setPromptColor(),t.readOnly=!this._editable,t.maxLength=this._maxChars;this.padding;t.type=this._type,t.value=this._content,t.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&&t.focus();this._text;this._text=null,this.typeset(),t.setColor(this._originColor),t.setFontSize(this.fontSize),t.setFontFace(this.font),Render.isConchApp&&t.setMultiAble&&t.setMultiAble(this._multiline),e.lineHeight=this.leading+this.fontSize+"px",e.fontStyle=this.italic?"italic":"normal",e.fontWeight=this.bold?"bold":"normal",e.textAlign=this.align,e.padding="0 0",this._syncInputTransform(),!Render.isConchApp&&Browser.onPC&&Laya.timer.frameLoop(1,this,this._syncInputTransform)},i._setPromptColor=function(){e.promptStyleDOM=Browser.getElementById("promptStyle"),e.promptStyleDOM||(e.promptStyleDOM=Browser.createElement("style"),Browser.document.head.appendChild(e.promptStyleDOM)),e.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+"}"},i._focusOut=function(){laya.display.Input.isInputting=!1,this._focus=!1,this._text=null,this._content=this.nativeInput.value,this._content?(t.prototype._$set_text.call(this,this._content),t.prototype._$set_color.call(this,this._originColor)):(t.prototype._$set_text.call(this,this._prompt),t.prototype._$set_color.call(this,this._promptColor)),Laya.stage.off("keydown",this,this._onKeyDown),Laya.stage.focus=null,this.event("blur"),Render.isConchApp&&this.nativeInput.blur(),Browser.onPC&&Laya.timer.clear(this,this._syncInputTransform),Laya.stage.off("mousedown",this,this._checkBlur)},i._onKeyDown=function(t){13===t.keyCode&&(Browser.onMobile&&!this._multiline&&(this.focus=!1),this.event("enter"))},i.changeText=function(e){this._content=e,this._focus?(this.nativeInput.value=e||"",this.event("change")):t.prototype.changeText.call(this,e)},__getset(0,i,"color",t.prototype._$get_color,function(e){this._focus&&this.nativeInput.setColor(e),t.prototype._$set_color.call(this,this._content?e:this._promptColor),this._originColor=e}),__getset(0,i,"inputElementYAdjuster",function(){return console.warn("deprecated: 由于即使设置了该值,在各平台和浏览器之间也不一定一致,inputElementYAdjuster已弃用。"),0},function(t){console.warn("deprecated: 由于即使设置了该值,在各平台和浏览器之间也不一定一致,inputElementYAdjuster已弃用。")}),__getset(0,i,"multiline",function(){return this._multiline},function(t){this._multiline=t,this.valign=t?"top":"middle"}),__getset(0,i,"maxChars",function(){return this._maxChars},function(t){0>=t&&(t=1e5),this._maxChars=t}),__getset(0,i,"text",function(){return this._focus?this.nativeInput.value:this._content||""},function(e){t.prototype._$set_color.call(this,this._originColor),e+="",this._focus?(this.nativeInput.value=e||"",this.event("change")):(this._multiline||(e=e.replace(/\r?\n/g,"")),this._content=e,e?t.prototype._$set_text.call(this,e):(t.prototype._$set_text.call(this,this._prompt),t.prototype._$set_color.call(this,this.promptColor)))}),__getset(0,i,"nativeInput",function(){return this._multiline?e.area:e.input}),__getset(0,i,"prompt",function(){return this._prompt},function(e){!this._text&&e&&t.prototype._$set_color.call(this,this._promptColor),this.promptColor=this._promptColor,this._text?t.prototype._$set_text.call(this,this._text==this._prompt?e:this._text):t.prototype._$set_text.call(this,e),this._prompt=e}),__getset(0,i,"focus",function(){return this._focus},function(t){var i=this.nativeInput;this._focus!==t&&(t?(i.target&&(i.target.focus=!1),i.target=this,this._setInputMethod(),this._focusIn()):(i.target=null,this._focusOut(),i.blur(),Render.isConchApp?i.setPos(-1e4,-1e4):e.inputContainer.contains(i)&&e.inputContainer.removeChild(i)))}),__getset(0,i,"restrict",function(){return this._restrictPattern?this._restrictPattern.source:""},function(t){t?(t="[^"+t+"]",t.indexOf("^^")>-1&&(t=t.replace("^^","")),this._restrictPattern=new RegExp(t,"g")):this._restrictPattern=null}),__getset(0,i,"editable",function(){return this._editable},function(t){this._editable=t}),__getset(0,i,"promptColor",function(){return this._promptColor},function(e){this._promptColor=e,this._content||t.prototype._$set_color.call(this,e)}),__getset(0,i,"type",function(){return this._type},function(t){"password"==t?this._getCSSStyle().password=!0:this._getCSSStyle().password=!1,this._type=t}),__getset(0,i,"inputElementXAdjuster",function(){return console.warn("deprecated: 由于即使设置了该值,在各平台和浏览器之间也不一定一致,inputElementXAdjuster已弃用。"),0},function(t){console.warn("deprecated: 由于即使设置了该值,在各平台和浏览器之间也不一定一致,inputElementXAdjuster已弃用。")}),__getset(0,i,"asPassword",function(){return this._getCSSStyle().password},function(t){this._getCSSStyle().password=t,this._type="password",console.warn('deprecated: 使用type="password"替代设置asPassword, asPassword将在下次重大更新时删去'),this.isChanged=!0}),e.__init__=function(){e._createInputElement(),Browser.onMobile&&Render.canvas.addEventListener(e.IOS_IFRAME?"click":"touchend",e._popupInputMethod)},e._popupInputMethod=function(t){if(laya.display.Input.isInputting){var e=laya.display.Input.inputElement;e.focus()}},e._createInputElement=function(){e._initInput(e.area=Browser.createElement("textarea")),e._initInput(e.input=Browser.createElement("input")),e.inputContainer=Browser.createElement("div"),e.inputContainer.style.position="absolute",e.inputContainer.style.zIndex=1e5,Browser.container.appendChild(e.inputContainer),e.inputContainer.setPos=function(t,i){e.inputContainer.style.left=t+"px",e.inputContainer.style.top=i+"px"}},e._initInput=function(t){var i=t.style;i.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;",i.resize="none",i.backgroundColor="transparent",i.border="none",i.outline="none",i.zIndex=1,t.addEventListener("input",e._processInputting),t.addEventListener("mousemove",e._stopEvent),t.addEventListener("mousedown",e._stopEvent),t.addEventListener("touchmove",e._stopEvent),Render.isConchApp||(t.setColor=function(e){t.style.color=e},t.setFontSize=function(e){t.style.fontSize=e+"px"},t.setSize=function(e,i){t.style.width=e+"px",t.style.height=i+"px"}),t.setFontFace=function(e){t.style.fontFamily=e}},e._processInputting=function(t){var e=laya.display.Input.inputElement.target;if(e){var i=laya.display.Input.inputElement.value;e._restrictPattern&&(i=i.replace(/\u2006|\x27/g,""),e._restrictPattern.test(i)&&(i=i.replace(e._restrictPattern,""),laya.display.Input.inputElement.value=i)),e._text=i,e.event("input")}},e._stopEvent=function(t){"touchmove"==t.type&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},e.TYPE_TEXT="text",e.TYPE_PASSWORD="password",e.TYPE_EMAIL="email",e.TYPE_URL="url",e.TYPE_NUMBER="number",e.TYPE_RANGE="range",e.TYPE_DATE="date",e.TYPE_MONTH="month",e.TYPE_WEEK="week",e.TYPE_TIME="time",e.TYPE_DATE_TIME="datetime",e.TYPE_DATE_TIME_LOCAL="datetime-local",e.TYPE_SEARCH="search",e.input=null,e.area=null,e.inputElement=null,e.inputContainer=null,e.confirmButton=null,e.promptStyleDOM=null,e.inputHeight=45,e.isInputting=!1,__static(e,["IOS_IFRAME",function(){return this.IOS_IFRAME=Browser.onIOS&&Browser.window.top!=Browser.window.self}]),e}(Text),HTMLImage=function(t){function e(t,i){this._recreateLock=!1,this._needReleaseAgain=!1,e.__super.call(this),this._init_(t,i)}__class(e,"laya.resource.HTMLImage",t);var i=e.prototype;return i._init_=function(t,e){this._src=t,this._source=new Browser.window.Image,e&&(e.onload&&(this.onload=e.onload),e.onerror&&(this.onerror=e.onerror),e.onCreate&&e.onCreate(this)),0!=t.indexOf("data:image")&&(this._source.crossOrigin=""),t&&(this._source.src=t)},i.recreateResource=function(){var t=this;if(""===this._src)throw new Error("src no null!");if(this._needReleaseAgain=!1,this._source){if(this._recreateLock)return;this.startCreate(),this.memorySize=this._w*this._h*4,this._recreateLock=!1,this.completeCreate()}else{this._recreateLock=!0,this.startCreate();var e=this;this._source=new Browser.window.Image,this._source.crossOrigin="",this._source.onload=function(){return e._needReleaseAgain?(e._needReleaseAgain=!1,e._source.onload=null,void(e._source=null)):(e._source.onload=null,e.memorySize=t._w*t._h*4,e._recreateLock=!1,void e.completeCreate())},this._source.src=this._src}},i.detoryResource=function(){this._recreateLock&&(this._needReleaseAgain=!0),this._source&&(this._source=null,this.memorySize=0)},i.onresize=function(){this._w=this._source.width,this._h=this._source.height},__getset(0,i,"onload",null,function(t){var e=this;this._onload=t,this._source&&(this._source.onload=null!=this._onload?function(){e.onresize(),e._onload()}:null)}),__getset(0,i,"onerror",null,function(t){var e=this;this._onerror=t,this._source&&(this._source.onerror=null!=this._onerror?function(){e._onerror()}:null)}),e.create=function(t,i){return new e(t,i)},e}(FileBitmap),GraphicAnimation=function(t){function e(){this.animationList=null,this.animationDic=null,this._nodeList=null,this._nodeDefaultProps=null,this._gList=null,this._nodeIDAniDic={},e.__super.call(this)}__class(e,"laya.display.GraphicAnimation",t);var i=e.prototype;return i._parseNodeList=function(t){this._nodeList||(this._nodeList=[]),this._nodeDefaultProps[t.compId]=t.props,t.compId&&this._nodeList.push(t.compId);var e=t.child;if(e){var i=0,n=e.length;for(i=0;n>i;i++)this._parseNodeList(e[i])}},i._calGraphicData=function(t){this._setUp(null,t),this._createGraphicData()},i._createGraphicData=function(){var t=[],e=0,i=this.count;for(e=0;i>e;e++)t.push(this._createFrameGraphic(e));this._gList=t},i._createFrameGraphic=function(t){var e=new Graphics,i=0,n=this._nodeList.length,s=0;for(i=0;n>i;i++)s=this._nodeList[i],this._addNodeGraphic(s,e,t);return e},i._calculateNodeKeyFrames=function(e){t.prototype._calculateNodeKeyFrames.call(this,e),this._nodeIDAniDic[e.target]=e},i.getNodeDataByID=function(t){return this._nodeIDAniDic[t]},i._getParams=function(t,i,n,s){var r=e._temParam;r.length=i.length;var a=0,o=i.length;for(a=0;o>a;a++)r[a]=this._getObjVar(t,i[a][0],n,i[a][1],s);return r},i._getObjVar=function(t,e,i,n,s){if(t.hasOwnProperty(e)){var r=t[e];return i>=r.length&&(i=r.length-1),t[e][i]}return s.hasOwnProperty(e)?s[e]:n},i._addNodeGraphic=function(t,i,n){var s=this.getNodeDataByID(t);if(s){var r=s.frames,a=this._getParams(r,e._drawTextureCmd,n,this._nodeDefaultProps[t]),o=a[0];if(o){if(a[0]=this._getTextureByUrl(o),!a[0])throw console.log("lost:",o),new Error("texture not loaded:"+o);var h,l=a[5],u=a[6];0==l&&0==u||(h=h||new Matrix,h.translate(-l,-u));var c=a[7],_=a[8],d=a[9];1==c&&1==_&&0==d||(h=h||new Matrix,h.scale(c,_),h.rotate(.0174532922222222*d)),h&&(h.translate(a[1],a[2]),a[1]=a[2]=0),i.drawTexture(a[0],a[1],a[2],a[3],a[4],h,a[10])}}},i._getTextureByUrl=function(t){return Loader.getRes(t)},i.setAniData=function(t){if(t.animations){this._nodeDefaultProps={},this._nodeList&&(this._nodeList.length=0),this._parseNodeList(t);var i,n={},s=[],r=t.animations,a=0,o=r.length;for(a=0;o>a;a++)if(i=r[a]){try{this._calGraphicData(i)}catch(h){console.log("parse animation fail:"+i.name+",empty animation created"),this._gList=[]}var l={};l.interval=1e3/i.frameRate,l.frames=this._gList,s.push(l),n[i.name]=l}this.animationList=s,this.animationDic=n}e._temParam.length=0},i._clear=function(){this.animationList=null,this.animationDic=null,this._gList=null},e.parseAnimationData=function(t){e._I||(e._I=new e),e._I.setAniData(t);var i;return i={},i.animationList=e._I.animationList,i.animationDic=e._I.animationDic,e._I._clear(),i},e._temParam=[],e._I=null,__static(e,["_drawTextureCmd",function(){return this._drawTextureCmd=[["skin",null],["x",0],["y",0],["width",0],["height",0],["pivotX",0],["pivotY",0],["scaleX",1],["scaleY",1],["rotation",0],["alpha",1]]}]),e}(FrameAnimation);Laya.__init([EventDispatcher,LoaderManager,Render,Browser,Timer,LocalStorage,TimeLine])}(window,document,Laya),function(t,e,i){var n=(i.un,i.uns,i["static"]),s=i["class"],r=i.getset,a=i.__newvec,o=laya.maths.Arith,h=laya.maths.Bezier,l=laya.resource.Bitmap,u=laya.utils.Browser,c=laya.utils.Color,_=(laya.filters.ColorFilter,i.Config),d=laya.resource.Context,f=(laya.events.Event,laya.filters.Filter),p=laya.display.Graphics,g=laya.resource.HTMLCanvas,m=(laya.utils.HTMLChar,laya.resource.HTMLImage),v=(laya.utils.Handler,laya.maths.Matrix),y=laya.maths.Point,x=laya.maths.Rectangle,w=laya.renders.Render,b=(laya.renders.RenderContext,laya.renders.RenderSprite),T=laya.resource.Resource,S=laya.resource.ResourceManager,C=laya.utils.RunDriver,M=laya.display.Sprite,A=laya.utils.Stat,L=laya.utils.StringKey,P=(laya.display.css.Style,laya.system.System),R=laya.resource.Texture,I=laya.utils.Utils,E=laya.utils.VectorGraphManager;laya.utils.WordText;i["interface"]("laya.webgl.shapes.IShape"),i["interface"]("laya.webgl.submit.ISubmit"),i["interface"]("laya.webgl.text.ICharSegment"),i["interface"]("laya.webgl.canvas.save.ISaveData"),i["interface"]("laya.webgl.resource.IMergeAtlasBitmap"),i["interface"]("laya.filters.IFilterActionGL","laya.filters.IFilterAction");var D=function(){function t(){}return s(t,"LayaMain"),t}(),F=function(){function t(){}s(t,"laya.filters.webgl.FilterActionGL");var e=t.prototype;return i.imps(e,{"laya.filters.IFilterActionGL":!0}),e.setValue=function(t){},e.setValueMix=function(t){},e.apply3d=function(t,e,i,n,s){return null},e.apply=function(t){return null},r(0,e,"typeMix",function(){return 0}),t}(),B=function(){function t(){}return s(t,"laya.webgl.shader.ShaderValue"),t}(),k=function(){function t(t,e,n){this._atlasID=0,this._width=0,this._height=0,this._texCount=0,this._rowInfo=null,this._cells=null,this._failSize=new i,void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),this._cells=null,this._rowInfo=null,this._init(t,e),this._atlasID=n}var e,i;s(t,"laya.webgl.atlas.AtlasGrid");var n=t.prototype;return n.getAltasID=function(){return this._atlasID},n.setAltasID=function(t){t>=0&&(this._atlasID=t)},n.addTex=function(t,e,i){var n=this._get(e,i);return 0==n.ret?n:(this._fill(n.x,n.y,e,i,t),this._texCount++,n)},n._release=function(){null!=this._cells&&(this._cells.length=0,this._cells=null),this._rowInfo&&(this._rowInfo.length=0,this._rowInfo=null)},n._init=function(t,i){if(this._width=t,this._height=i,this._release(),0==this._width)return!1;this._cells=new Uint8Array(this._width*this._height*3),this._rowInfo=a(this._height);for(var n=0;n<this._height;n++)this._rowInfo[n]=new e;return this._clear(),!0},n._get=function(t,e){var i=new N;if(t>=this._failSize.width&&e>=this._failSize.height)return i;for(var n=-1,s=-1,r=this._width,a=this._height,o=this._cells,h=0;a>h;h++)if(!(this._rowInfo[h].spaceCount<t))for(var l=0;r>l;){var u=3*(h*r+l);if(0!=o[u]||o[u+1]<t||o[u+2]<e)l+=o[u+1];else{n=l,s=h;for(var c=0;t>c;c++)if(o[3*c+u+2]<e){n=-1;break}if(!(0>n))return i.ret=!0,i.x=n,i.y=s,i;l+=o[u+1]}}return i},n._fill=function(t,e,i,n,s){var r=this._width,a=this._height;this._check(r>=t+i&&a>=e+n);for(var o=e;n+e>o;++o){this._check(this._rowInfo[o].spaceCount>=i),this._rowInfo[o].spaceCount-=i;for(var h=0;i>h;h++){var l=3*(t+o*r+h);this._check(0==this._cells[l]),this._cells[l]=s,this._cells[l+1]=i,this._cells[l+2]=n}}if(t>0)for(o=0;n>o;++o){var u=0;for(h=t-1;h>=0&&0==this._cells[3*((e+o)*r+h)];--h,++u);for(h=u;h>0;--h)this._cells[3*((e+o)*r+t-h)+1]=h,this._check(h>0)}if(e>0)for(h=t;t+i>h;++h){for(u=0,o=e-1;o>=0&&0==this._cells[3*(h+o*r)];--o,u++);for(o=u;o>0;--o)this._cells[3*(h+(e-o)*r)+2]=o,this._check(o>0)}},n._check=function(t){0==t&&console.log("xtexMerger 错误啦")},n._clear=function(){this._texCount=0;for(var t=0;t<this._height;t++)this._rowInfo[t].spaceCount=this._width;for(var e=0;e<this._height;e++)for(var i=0;i<this._width;i++){var n=3*(e*this._width+i);this._cells[n]=0,this._cells[n+1]=this._width-i,this._cells[n+2]=this._width-e}this._failSize.width=this._width+1,this._failSize.height=this._height+1},t.__init$=function(){e=function(){function t(){this.spaceCount=0}return s(t,""),t}(),i=function(){function t(){this.width=0,this.height=0}return s(t,""),t}()},t}(),O=function(){function t(t,e,i,n){this._currentAtlasCount=0,this._maxAtlaserCount=0,this._width=0,this._height=0,this._gridSize=0,this._gridNumX=0,this._gridNumY=0,this._init=!1,this._curAtlasIndex=0,this._setAtlasParam=!1,this._atlaserArray=null,this._needGC=!1,this._setAtlasParam=!0,this._width=t,this._height=e,this._gridSize=i,this._maxAtlaserCount=n,this._gridNumX=t/i,this._gridNumY=e/i,this._curAtlasIndex=0,this._atlaserArray=[]}s(t,"laya.webgl.atlas.AtlasResourceManager");var e=t.prototype;return e.setAtlasParam=function(e,i,n,s){if(1==this._setAtlasParam)return t._sid_=0,this._width=e,this._height=i,this._gridSize=n,this._maxAtlaserCount=s,this._gridNumX=e/n,this._gridNumY=i/n,this._curAtlasIndex=0,this.freeAll(),!0;throw console.log("设置大图合集参数错误,只能在开始页面设置各种参数"),-1},e.pushData=function(e){this._setAtlasParam=!1;for(var i=Math.ceil((e.bitmap.width+2)/this._gridSize),n=Math.ceil((e.bitmap.height+2)/this._gridSize),s=!1,r=0;2>r;r++){for(var a=this._maxAtlaserCount,o=0;a>o;o++){var h=(this._curAtlasIndex+o)%a;this._atlaserArray.length-1>=h||this._atlaserArray.push(new wt(this._gridNumX,this._gridNumY,this._width,this._height,t._sid_++));var l=this._atlaserArray[h],u=e.bitmap,c=l.inAtlasWebGLImagesKey.indexOf(u),_=0,d=0;if(-1!=c){var f=l.InAtlasWebGLImagesOffsetValue[c];_=f[0],d=f[1],l.addToAtlas(e,_,d),s=!0,this._curAtlasIndex=h;break}var p=l.addTex(1,i,n);if(p.ret){_=p.x*this._gridSize+1,d=p.y*this._gridSize+1,
|
||
u.lock=!0,l.addToAtlasTexture(u,_,d),l.addToAtlas(e,_,d),s=!0,this._curAtlasIndex=h;break}}if(s)break;this._atlaserArray.push(new wt(this._gridNumX,this._gridNumY,this._width,this._height,t._sid_++)),this._needGC=!0,this.garbageCollection(),this._curAtlasIndex=this._atlaserArray.length-1}return s||console.log(">>>AtlasManager pushData error"),s},e.addToAtlas=function(t){laya.webgl.atlas.AtlasResourceManager.instance.pushData(t)},e.garbageCollection=function(){if(this._needGC===!0){for(var t=this._atlaserArray.length-this._maxAtlaserCount,e=0;t>e;e++)this._atlaserArray[e].dispose();this._atlaserArray.splice(0,t),this._needGC=!1}return!0},e.freeAll=function(){for(var t=0,e=this._atlaserArray.length;e>t;t++)this._atlaserArray[t].dispose();this._atlaserArray.length=0,this._curAtlasIndex=0},e.getAtlaserCount=function(){return this._atlaserArray.length},e.getAtlaserByIndex=function(t){return this._atlaserArray[t]},r(1,t,"instance",function(){return t._Instance||(t._Instance=new t(laya.webgl.atlas.AtlasResourceManager.atlasTextureWidth,laya.webgl.atlas.AtlasResourceManager.atlasTextureHeight,16,laya.webgl.atlas.AtlasResourceManager.maxTextureCount)),t._Instance}),r(1,t,"enabled",function(){return t._enabled}),r(1,t,"atlasLimitWidth",function(){return t._atlasLimitWidth},function(e){t._atlasLimitWidth=e}),r(1,t,"atlasLimitHeight",function(){return t._atlasLimitHeight},function(e){t._atlasLimitHeight=e}),t._enable=function(){t._enabled=!0,_.atlasEnable=!0},t._disable=function(){t._enabled=!1,_.atlasEnable=!1},t.__init__=function(){t.atlasTextureWidth=2048,t.atlasTextureHeight=2048,t.maxTextureCount=6,t.atlasLimitWidth=512,t.atlasLimitHeight=512},t._enabled=!1,t._atlasLimitWidth=0,t._atlasLimitHeight=0,t.gridSize=16,t.atlasTextureWidth=0,t.atlasTextureHeight=0,t.maxTextureCount=0,t._atlasRestore=0,t.BOARDER_TYPE_NO=0,t.BOARDER_TYPE_RIGHT=1,t.BOARDER_TYPE_LEFT=2,t.BOARDER_TYPE_BOTTOM=4,t.BOARDER_TYPE_TOP=8,t.BOARDER_TYPE_ALL=15,t._sid_=0,t._Instance=null,t}(),N=function(){function t(){this.x=0,this.y=0,this.ret=!1,this.ret=!1,this.x=0,this.y=0}return s(t,"laya.webgl.atlas.MergeFillInfo"),t}(),W=function(){function t(){}return s(t,"laya.webgl.canvas.BlendMode"),t._init_=function(e){t.fns=[t.BlendNormal,t.BlendAdd,t.BlendMultiply,t.BlendScreen,t.BlendOverlay,t.BlendLight,t.BlendMask,t.BlendDestinationOut],t.targetFns=[t.BlendNormalTarget,t.BlendAddTarget,t.BlendMultiplyTarget,t.BlendScreenTarget,t.BlendOverlayTarget,t.BlendLightTarget,t.BlendMask,t.BlendDestinationOut]},t.BlendNormal=function(t){t.blendFuncSeparate(770,771,1,1)},t.BlendAdd=function(t){t.blendFunc(770,772)},t.BlendMultiply=function(t){t.blendFunc(774,771)},t.BlendScreen=function(t){t.blendFunc(770,1)},t.BlendOverlay=function(t){t.blendFunc(1,769)},t.BlendLight=function(t){t.blendFunc(770,1)},t.BlendNormalTarget=function(t){t.blendFuncSeparate(770,771,1,771)},t.BlendAddTarget=function(t){t.blendFunc(770,772)},t.BlendMultiplyTarget=function(t){t.blendFunc(774,771)},t.BlendScreenTarget=function(t){t.blendFunc(770,1)},t.BlendOverlayTarget=function(t){t.blendFunc(1,769)},t.BlendLightTarget=function(t){t.blendFunc(770,1)},t.BlendMask=function(t){t.blendFunc(0,770)},t.BlendDestinationOut=function(t){t.blendFunc(0,0)},t.activeBlendFunction=null,t.NAMES=["normal","add","multiply","screen","overlay","light","mask","destination-out"],t.TOINT={normal:0,add:1,multiply:2,screen:3,lighter:1,overlay:4,light:5,mask:6,"destination-out":7},t.NORMAL="normal",t.ADD="add",t.MULTIPLY="multiply",t.SCREEN="screen",t.LIGHT="light",t.OVERLAY="overlay",t.DESTINATIONOUT="destination-out",t.fns=[],t.targetFns=[],t}(),U=function(){function t(t){this._color=c.create("black"),this.setValue(t)}s(t,"laya.webgl.canvas.DrawStyle");var e=t.prototype;return e.setValue=function(t){if(t){if("string"==typeof t)return void(this._color=c.create(t));if(t instanceof laya.utils.Color)return void(this._color=t)}},e.reset=function(){this._color=c.create("black")},e.equal=function(t){return"string"==typeof t?this._color.strColor===t:t instanceof laya.utils.Color?this._color.numColor===t.numColor:!1},e.toColorStr=function(){return this._color.strColor},t.create=function(e){if(e){var i;if("string"==typeof e?i=c.create(e):e instanceof laya.utils.Color&&(i=e),i)return i._drawStyle||(i._drawStyle=new t(e))}return null},t.DEFAULT=new t("#000000"),t}(),V=function(){function t(){this._x=0,this._y=0,this.dirty=!1,this.offset=0,this.count=0,this.geoStart=0,this.tempArray=[],this.closePath=!1,this.geomatrys=[];ft.mainContext;this.ib=Ht.create(35048),this.vb=zt.create(5)}s(t,"laya.webgl.canvas.Path");var e=t.prototype;return e.addPoint=function(t,e){this.tempArray.push(t,e)},e.getEndPointX=function(){return this.tempArray[this.tempArray.length-2]},e.getEndPointY=function(){return this.tempArray[this.tempArray.length-1]},e.polygon=function(t,e,i,n,s,r){var a;return this.geomatrys.push(this._curGeomatry=a=new Ct(t,e,i,n,s,r)),n||(a.fill=!1),void 0==r&&(a.borderWidth=0),a},e.setGeomtry=function(t){this.geomatrys.push(this._curGeomatry=t)},e.drawLine=function(t,e,i,n,s){var r;return this.closePath?this.geomatrys.push(this._curGeomatry=r=new St(t,e,i,n,s)):this.geomatrys.push(this._curGeomatry=r=new Tt(t,e,i,n,s)),r.fill=!1,r},e.update=function(){var t=this.ib.byteLength,e=this.geomatrys.length;this.offset=t;for(var i=this.geoStart;e>i;i++)this.geomatrys[i].getData(this.ib,this.vb,this.vb.byteLength/20);this.geoStart=e,this.count=(this.ib.byteLength-t)/ut.BYTES_PIDX},e.reset=function(){this.vb.clear(),this.ib.clear(),this.offset=this.count=this.geoStart=0,this.geomatrys.length=0},t}(),H=function(){function t(){}s(t,"laya.webgl.canvas.save.SaveBase");var e=t.prototype;return i.imps(e,{"laya.webgl.canvas.save.ISaveData":!0}),e.isSaveMark=function(){return!1},e.restore=function(e){this._dataObj[this._valueName]=this._value,t._cache[t._cache._length++]=this,this._newSubmit&&(e._curSubmit=J.RENDERBASE,e._renderKey=0)},t._createArray=function(){var t=[];return t._length=0,t},t._init=function(){var e=t._namemap={};return e[1]="ALPHA",e[2]="fillStyle",e[8]="font",e[256]="lineWidth",e[512]="strokeStyle",e[8192]="_mergeID",e[1024]=e[2048]=e[4096]=[],e[16384]="textBaseline",e[32768]="textAlign",e[65536]="_nBlendType",e[524288]="shader",e[1048576]="filters",e},t.save=function(e,i,n,s){if((e._saveMark._saveuse&i)!==i){e._saveMark._saveuse|=i;var r=t._cache,a=r._length>0?r[--r._length]:new t;a._value=n[a._valueName=t._namemap[i]],a._dataObj=n,a._newSubmit=s;var o=e._save;o[o._length++]=a}},t._cache=laya.webgl.canvas.save.SaveBase._createArray(),t._namemap=t._init(),t}(),z=function(){function t(){this._clipRect=new x}s(t,"laya.webgl.canvas.save.SaveClipRect");var e=t.prototype;return i.imps(e,{"laya.webgl.canvas.save.ISaveData":!0}),e.isSaveMark=function(){return!1},e.restore=function(e){e._clipRect=this._clipSaveRect,t._cache[t._cache._length++]=this,this._submitScissor.submitLength=e._submits._length-this._submitScissor.submitIndex,e._curSubmit=J.RENDERBASE,e._renderKey=0},t.save=function(e,i){if(131072!=(131072&e._saveMark._saveuse)){e._saveMark._saveuse|=131072;var n=t._cache,s=n._length>0?n[--n._length]:new t;s._clipSaveRect=e._clipRect,e._clipRect=s._clipRect.copyFrom(e._clipRect),s._submitScissor=i;var r=e._save;r[r._length++]=s}},t._cache=H._createArray(),t}(),G=function(){function t(){this._saveuse=0}s(t,"laya.webgl.canvas.save.SaveMark");var e=t.prototype;return i.imps(e,{"laya.webgl.canvas.save.ISaveData":!0}),e.isSaveMark=function(){return!0},e.restore=function(e){e._saveMark=this._preSaveMark,t._no[t._no._length++]=this},t.Create=function(e){var i=t._no,n=i._length>0?i[--i._length]:new t;return n._saveuse=0,n._preSaveMark=e._saveMark,e._saveMark=n,n},t._no=H._createArray(),t}(),Y=function(){function t(){this._matrix=new v}s(t,"laya.webgl.canvas.save.SaveTransform");var e=t.prototype;return i.imps(e,{"laya.webgl.canvas.save.ISaveData":!0}),e.isSaveMark=function(){return!1},e.restore=function(e){e._curMat=this._savematrix,t._no[t._no._length++]=this},t.save=function(e){var i=e._saveMark;if(2048!==(2048&i._saveuse)){i._saveuse|=2048;var n=t._no,s=n._length>0?n[--n._length]:new t;s._savematrix=e._curMat,e._curMat=e._curMat.copyTo(s._matrix);var r=e._save;r[r._length++]=s}},t._no=H._createArray(),t}(),X=function(){function t(){}s(t,"laya.webgl.canvas.save.SaveTranslate");var e=t.prototype;return i.imps(e,{"laya.webgl.canvas.save.ISaveData":!0}),e.isSaveMark=function(){return!1},e.restore=function(e){e._curMat;e._x=this._x,e._y=this._y,t._no[t._no._length++]=this},t.save=function(e){var i=t._no,n=i._length>0?i[--i._length]:new t;n._x=e._x,n._y=e._y;var s=e._save;s[s._length++]=n},t._no=H._createArray(),t}(),$=function(){function t(){this.targets=null,this.oneTargets=null,this.repaint=!1,this._width=NaN,this._height=NaN,this._clipRect=new x}var e;s(t,"laya.webgl.resource.RenderTargetMAX");var i=t.prototype;return i.size=function(t,i){this._width===t&&this._height===i||(this.repaint=!0,this._width=t,this._height=i,this.oneTargets?this.oneTargets.target.size(t,i):this.oneTargets=new e(t,i))},i._flushToTarget=function(e,i){var n=_t.worldScissorTest,s=_t.worldClipRect;_t.worldClipRect=this._clipRect,this._clipRect.x=this._clipRect.y=0,this._clipRect.width=this._width,this._clipRect.height=this._height,_t.worldScissorTest=!1,ft.mainContext.disable(3089);var r=_t.worldAlpha,a=_t.worldMatrix4,o=_t.worldMatrix,h=_t.worldFilters,l=_t.worldShaderDefines;if(_t.worldMatrix=t._matrixDefault,_t.restoreTempArray(),_t.worldMatrix4=_t.TEMPMAT4_ARRAY,_t.worldAlpha=1,_t.worldFilters=null,_t.worldShaderDefines=null,Lt.activeShader=null,i.start(),_.showCanvasMark?i.clear(0,1,0,.3):i.clear(0,0,0,0),e.flush(),i.end(),Lt.activeShader=null,_t.worldAlpha=r,_t.worldMatrix4=a,_t.worldMatrix=o,_t.worldFilters=h,_t.worldShaderDefines=l,_t.worldScissorTest=n,n){var u=_t.height-s.y-s.height;ft.mainContext.scissor(s.x,u,s.width,s.height),ft.mainContext.enable(3089)}_t.worldClipRect=s},i.flush=function(t){this.repaint&&(this._flushToTarget(t,this.oneTargets.target),this.repaint=!1)},i.drawTo=function(t,e,i,n,s){t.drawTexture(this.oneTargets.target.getTexture(),e,i,n,s,0,0)},i.destroy=function(){this.oneTargets&&(this.oneTargets.target.destroy(),this.oneTargets.target=null,this.oneTargets=null)},n(t,["_matrixDefault",function(){return this._matrixDefault=new v}]),t.__init$=function(){e=function(){function t(t,e){this.width=t,this.height=e,this.target=Pt.create(t,e)}return s(t,""),t}()},t}(),K=function(){function t(){this.ALPHA=1,this.shaderType=0,this.defines=new bt}return s(t,"laya.webgl.shader.d2.Shader2D"),t.__init__=function(){Lt.addInclude("parts/ColorFilter_ps_uniform.glsl","uniform vec4 colorAlpha;\nuniform mat4 colorMat;"),Lt.addInclude("parts/ColorFilter_ps_logic.glsl","gl_FragColor = gl_FragColor * colorMat + colorAlpha/255.0;"),Lt.addInclude("parts/GlowFilter_ps_uniform.glsl","uniform vec4 u_color;\nuniform float u_strength;\nuniform float u_blurX;\nuniform float u_blurY;\nuniform float u_offsetX;\nuniform float u_offsetY;\nuniform float u_textW;\nuniform float u_textH;"),Lt.addInclude("parts/GlowFilter_ps_logic.glsl","const float c_IterationTime = 10.0;\nfloat floatIterationTotalTime = c_IterationTime * c_IterationTime;\nvec4 vec4Color = vec4(0.0,0.0,0.0,0.0);\nvec2 vec2FilterDir = vec2(-(u_offsetX)/u_textW,-(u_offsetY)/u_textH);\nvec2 vec2FilterOff = vec2(u_blurX/u_textW/c_IterationTime * 2.0,u_blurY/u_textH/c_IterationTime * 2.0);\nfloat maxNum = u_blurX * u_blurY;\nvec2 vec2Off = vec2(0.0,0.0);\nfloat floatOff = c_IterationTime/2.0;\nfor(float i = 0.0;i<=c_IterationTime; ++i){\n for(float j = 0.0;j<=c_IterationTime; ++j){\n vec2Off = vec2(vec2FilterOff.x * (i - floatOff),vec2FilterOff.y * (j - floatOff));\n vec4Color += texture2D(texture, v_texcoord + vec2FilterDir + vec2Off)/floatIterationTotalTime;\n }\n}\ngl_FragColor = vec4(u_color.rgb,vec4Color.a * u_strength);"),Lt.addInclude("parts/BlurFilter_ps_logic.glsl","gl_FragColor=vec4(0.0);\ngl_FragColor += texture2D(texture, vBlurTexCoords[ 0])*0.004431848411938341;\ngl_FragColor += texture2D(texture, vBlurTexCoords[ 1])*0.05399096651318985;\ngl_FragColor += texture2D(texture, vBlurTexCoords[ 2])*0.2419707245191454;\ngl_FragColor += texture2D(texture, v_texcoord )*0.3989422804014327;\ngl_FragColor += texture2D(texture, vBlurTexCoords[ 3])*0.2419707245191454;\ngl_FragColor += texture2D(texture, vBlurTexCoords[ 4])*0.05399096651318985;\ngl_FragColor += texture2D(texture, vBlurTexCoords[ 5])*0.004431848411938341;"),Lt.addInclude("parts/BlurFilter_ps_uniform.glsl","varying vec2 vBlurTexCoords[6];"),Lt.addInclude("parts/BlurFilter_vs_uniform.glsl","uniform float strength;\nvarying vec2 vBlurTexCoords[6];"),Lt.addInclude("parts/BlurFilter_vs_logic.glsl","\nvBlurTexCoords[ 0] = v_texcoord + vec2(-0.012 * strength, 0.0);\nvBlurTexCoords[ 1] = v_texcoord + vec2(-0.008 * strength, 0.0);\nvBlurTexCoords[ 2] = v_texcoord + vec2(-0.004 * strength, 0.0);\nvBlurTexCoords[ 3] = v_texcoord + vec2( 0.004 * strength, 0.0);\nvBlurTexCoords[ 4] = v_texcoord + vec2( 0.008 * strength, 0.0);\nvBlurTexCoords[ 5] = v_texcoord + vec2( 0.012 * strength, 0.0);"),Lt.addInclude("parts/ColorAdd_ps_uniform.glsl","uniform vec4 colorAdd;\n"),Lt.addInclude("parts/ColorAdd_ps_logic.glsl","gl_FragColor = vec4(colorAdd.rgb,colorAdd.a*gl_FragColor.a);");var t,e;t='attribute vec4 position;\nattribute vec2 texcoord;\nuniform vec2 size;\n\n#ifdef WORLDMAT\nuniform mat4 mmat;\n#endif\nvarying vec2 v_texcoord;\n\n#include?BLUR_FILTER "parts/BlurFilter_vs_uniform.glsl";\nvoid main() {\n #ifdef WORLDMAT\n vec4 pos=mmat*position;\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 #else\n gl_Position =vec4((position.x/size.x-0.5)*2.0,(0.5-position.y/size.y)*2.0,position.z,1.0);\n #endif\n \n v_texcoord = texcoord;\n #include?BLUR_FILTER "parts/BlurFilter_vs_logic.glsl";\n}',e='precision mediump float;\n//precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D texture;\nuniform float alpha;\n#include?BLUR_FILTER "parts/BlurFilter_ps_uniform.glsl";\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\n#include?GLOW_FILTER "parts/GlowFilter_ps_uniform.glsl";\n#include?COLOR_ADD "parts/ColorAdd_ps_uniform.glsl";\n\nvoid main() {\n vec4 color= texture2D(texture, v_texcoord);\n color.a*=alpha;\n gl_FragColor=color;\n #include?COLOR_ADD "parts/ColorAdd_ps_logic.glsl"; \n #include?BLUR_FILTER "parts/BlurFilter_ps_logic.glsl";\n #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n #include?GLOW_FILTER "parts/GlowFilter_ps_logic.glsl";\n}',Lt.preCompile2D(0,1,t,e,null),t="attribute vec4 position;\nuniform vec2 size;\nuniform mat4 mmat;\nvoid main() {\n vec4 pos=mmat*position;\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}",e='precision mediump float;\nuniform vec4 color;\nuniform float alpha;\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\nvoid main() {\n vec4 a = vec4(color.r, color.g, color.b, color.a);\n a.w = alpha;\n gl_FragColor = a;\n #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n}',Lt.preCompile2D(0,2,t,e,null),t="attribute vec4 position;\nattribute vec3 a_color;\nuniform mat4 mmat;\nuniform mat4 u_mmat2;\nuniform vec2 u_pos;\nuniform vec2 size;\nvarying vec3 color;\nvoid main(){\n vec4 tPos = vec4(position.x + u_pos.x,position.y + u_pos.y,position.z,position.w);\n vec4 pos=mmat*u_mmat2*tPos;\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 color=a_color;\n}",e="precision mediump float;\n//precision mediump float;\nvarying vec3 color;\nuniform float alpha;\nvoid main(){\n //vec4 a=vec4(color.r, color.g, color.b, 1);\n //a.a*=alpha;\n gl_FragColor=vec4(color.r, color.g, color.b, alpha);\n}",Lt.preCompile2D(0,4,t,e,null),t='attribute vec4 position;\nattribute vec2 texcoord;\nuniform vec2 size;\n\n#ifdef WORLDMAT\nuniform mat4 mmat;\n#endif\nvarying vec2 v_texcoord;\n\n#include?BLUR_FILTER "parts/BlurFilter_vs_uniform.glsl";\nvoid main() {\n #ifdef WORLDMAT\n vec4 pos=mmat*position;\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 #else\n gl_Position =vec4((position.x/size.x-0.5)*2.0,(0.5-position.y/size.y)*2.0,position.z,1.0);\n #endif\n \n v_texcoord = texcoord;\n #include?BLUR_FILTER "parts/BlurFilter_vs_logic.glsl";\n}',e='precision mediump float;\n//precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D texture;\nuniform float alpha;\nuniform vec4 u_TexRange;\nuniform vec2 u_offset;\n#include?BLUR_FILTER "parts/BlurFilter_ps_uniform.glsl";\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\n#include?GLOW_FILTER "parts/GlowFilter_ps_uniform.glsl";\n#include?COLOR_ADD "parts/ColorAdd_ps_uniform.glsl";\n\nvoid main() {\n vec2 newTexCoord;\n newTexCoord.x = mod(u_offset.x + v_texcoord.x,u_TexRange.y) + u_TexRange.x;\n newTexCoord.y = mod(u_offset.y + v_texcoord.y,u_TexRange.w) + u_TexRange.z;\n vec4 color= texture2D(texture, newTexCoord);\n color.a*=alpha;\n gl_FragColor=color;\n #include?COLOR_ADD "parts/ColorAdd_ps_logic.glsl"; \n #include?BLUR_FILTER "parts/BlurFilter_ps_logic.glsl";\n #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n #include?GLOW_FILTER "parts/GlowFilter_ps_logic.glsl";\n}',Lt.preCompile2D(0,256,t,e,null),t="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_texcoord = texcoord; \n}",e="precision mediump float;\nvarying vec2 v_texcoord;\nvarying vec4 v_color;\nuniform sampler2D texture;\nuniform float alpha;\nvoid main() {\n vec4 t_color = texture2D(texture, v_texcoord);\n gl_FragColor = t_color.rgba * v_color;\n gl_FragColor.a = gl_FragColor.a * alpha;\n}",Lt.preCompile2D(0,512,t,e,null)},t}(),j=function(){function t(t,e,i){this._value=0,this._name2int=t,this._int2name=e,this._int2nameMap=i}s(t,"laya.webgl.shader.ShaderDefines");var e=t.prototype;return e.add=function(t){return"string"==typeof t&&(t=this._name2int[t]),this._value|=t,this._value},e.addInt=function(t){return this._value|=t,this._value},e.remove=function(t){return"string"==typeof t&&(t=this._name2int[t]),this._value&=~t,this._value},e.isDefine=function(t){return(this._value&t)===t},e.getValue=function(){return this._value},e.setValue=function(t){this._value=t},e.toNameDic=function(){var e=this._int2nameMap[this._value];return e?e:t._toText(this._value,this._int2name,this._int2nameMap)},t._reg=function(t,e,i,n){i[t]=e,n[e]=t},t._toText=function(t,e,i){var n=i[t];if(n)return n;for(var s={},r=1,a=0;32>a&&(r=1<<a,!(r>t));a++)if(t&r){var o=e[r];o&&(s[o]="")}return i[t]=s,s},t._toInt=function(t,e){for(var i=t.split("."),n=0,s=0,r=i.length;r>s;s++){var a=e[i[s]];if(!a)throw new Error("Defines to int err:"+t+"/"+i[s]);n|=a}return n},t}(),q=function(){function t(){this.mVBBuffer=null,this.mIBBuffer=null,this.mVBData=null,this.mIBData=null,this.mEleNum=0,this.mTexture=null,this.transform=null,this._vs=null,this._ps=null,this._resultPs=null,this._start=-1,this._indexStart=-1,this._tempMatrix=new v}s(t,"laya.webgl.shader.d2.skinAnishader.SkinMesh");var e=t.prototype;return e.init=function(t,e,i){if(e)this._vs=e;else{this._vs=[];var n=t.width,s=t.height,r=1,a=1,o=1,h=1;this._vs.push(0,0,0,0,r,a,o,h),this._vs.push(n,0,1,0,r,a,o,h),this._vs.push(n,s,1,1,r,a,o,h),this._vs.push(0,s,0,1,r,a,o,h)}i?this._ps=i:(this._ps=[],this._ps.push(0,1,3,3,1,2)),this.mVBData=new Float32Array(this._vs),this.mEleNum=this._ps.length,this.mTexture=t},e.getData=function(t,e,i){this.mVBBuffer=t,this.mIBBuffer=e,t.append(this.mVBData),this._start=i,this._indexStart=e.byteLength,null==this._resultPs&&(this._resultPs=[]),this._resultPs.length=0;for(var n=0,s=this._ps.length;s>n;n++)this._resultPs.push(this._ps[n]+i);this.mIBData=new Uint16Array(this._resultPs),e.append(this.mIBData)},e.render=function(t,e,i){if(w.isWebGL&&this.mTexture){t._renderKey=0,t._shader2D.glTexture=null,Q.getInstance().addSkinMesh(this);var n=J.createShape(t,this.mIBBuffer,this.mVBBuffer,this.mEleNum,this._indexStart,vt.create(512,0));this.transform||(this.transform=v.EMPTY),this.transform.translate(e,i),v.mul(this.transform,t._curMat,this._tempMatrix),this.transform.translate(-e,-i);var s=_t.getMatrArray();_t.mat2MatArray(this._tempMatrix,s);var r=n.shaderValue;r.textureHost=this.mTexture,r.offsetX=0,r.offsetY=0,r.u_mmat2=s,r.ALPHA=t._shader2D.ALPHA,t._submits[t._submits._length++]=n}else w.isConchApp&&this.mTexture&&(this.transform||(this.transform=v.EMPTY),t.setSkinMesh&&t.setSkinMesh(e,i,this._ps,this.mVBData,this.mEleNum,0,this.mTexture,this.transform))},t}(),Q=function(){function t(){this.ib=null,this.vb=null;ft.mainContext;this.ib=Ht.create(35048),this.vb=zt.create(8)}s(t,"laya.webgl.shader.d2.skinAnishader.SkinMeshBuffer");var e=t.prototype;return e.addSkinMesh=function(t){t.getData(this.vb,this.ib,this.vb.byteLength/32)},e.reset=function(){this.vb.clear(),this.ib.clear()},t.getInstance=function(){return t.instance=t.instance||new t},t.instance=null,t}(),Z=function(){function t(t,e,i,n,s,r,a,o,h){this.r0=0,this.fill=!0,this.r1=Math.PI/2,void 0===h&&(h=0),this.x=t,this.y=e,this.width=i,this.height=n,this.edges=s,this.color=r,this.borderWidth=a,this.borderColor=o}s(t,"laya.webgl.shapes.BasePoly");var e=t.prototype;return i.imps(e,{"laya.webgl.shapes.IShape":!0}),e.getData=function(t,e,i){},e.sector=function(t,e,i){var n=this.x,s=this.y,r=this.edges,a=(this.r1-this.r0)/r,o=this.width,h=this.height,l=this.color,u=(l>>16&255)/255,c=(l>>8&255)/255,_=(255&l)/255;t.push(n,s,u,c,_);for(var d=0;r+1>d;d++)t.push(n+Math.sin(a*d+this.r0)*o,s+Math.cos(a*d+this.r0)*h),t.push(u,c,_);for(d=0;r>d;d++)e.push(i,i+d+1,i+d+2)},e.createLine2=function(t,e,i,n,s,r){var a,o,h,l,u,c,_,d,f,p,g,m,v,y,x,w,b,T,S,C,M,A=t.concat(),L=s,P=this.borderColor,R=(P>>16&255)/255,I=(P>>8&255)/255,E=(255&P)/255,D=A.length/2,F=n,B=i/2;h=A[0],l=A[1],u=A[2],c=A[3],f=-(l-c),p=h-u,M=Math.sqrt(f*f+p*p),f=f/M*B,p=p/M*B,L.push(h-f+this.x,l-p+this.y,R,I,E,h+f+this.x,l+p+this.y,R,I,E);for(var k=1;D-1>k;k++)h=A[2*(k-1)],l=A[2*(k-1)+1],u=A[2*k],c=A[2*k+1],_=A[2*(k+1)],d=A[2*(k+1)+1],f=-(l-c),p=h-u,M=Math.sqrt(f*f+p*p),f=f/M*B,p=p/M*B,g=-(c-d),m=u-_,M=Math.sqrt(g*g+m*m),g=g/M*B,m=m/M*B,v=-p+l-(-p+c),y=-f+u-(-f+h),x=(-f+h)*(-p+c)-(-f+u)*(-p+l),w=-m+d-(-m+c),b=-g+u-(-g+_),T=(-g+_)*(-m+c)-(-g+u)*(-m+d),S=v*b-w*y,Math.abs(S)<.1?(S+=10.1,L.push(u-f+this.x,c-p+this.y,R,I,E,u+f+this.x,c+p+this.y,R,I,E)):(a=(y*T-b*x)/S,o=(w*x-v*T)/S,C=(a-u)*(a-u)+(o-c)+(o-c),L.push(a+this.x,o+this.y,R,I,E,u-(a-u)+this.x,c-(o-c)+this.y,R,I,E));h=A[A.length-4],l=A[A.length-3],u=A[A.length-2],c=A[A.length-1],f=-(l-c),p=h-u,M=Math.sqrt(f*f+p*p),f=f/M*B,p=p/M*B,L.push(u-f+this.x,c-p+this.y,R,I,E,u+f+this.x,c+p+this.y,R,I,E);var O=r;for(k=1;O>k;k++)e.push(F+2*(k-1),F+2*(k-1)+1,F+2*k+1,F+2*k+1,F+2*k,F+2*(k-1));return L},e.createLine=function(t,e,i,n){var s=t.concat(),r=t,a=this.borderColor,o=(a>>16&255)/255,h=(a>>8&255)/255,l=(255&a)/255;s.splice(0,5);var u,c,_,d,f,p,g,m,v,y,x,w,b,T,S,C,M,A,L,P,R,I=s.length/5,E=n,D=i/2;_=s[0],d=s[1],f=s[5],p=s[6],v=-(d-p),y=_-f,R=Math.sqrt(v*v+y*y),v=v/R*D,y=y/R*D,r.push(_-v,d-y,o,h,l,_+v,d+y,o,h,l);for(var F=1;I-1>F;F++)_=s[5*(F-1)],d=s[5*(F-1)+1],f=s[5*F],p=s[5*F+1],g=s[5*(F+1)],m=s[5*(F+1)+1],v=-(d-p),y=_-f,R=Math.sqrt(v*v+y*y),v=v/R*D,y=y/R*D,x=-(p-m),w=f-g,R=Math.sqrt(x*x+w*w),x=x/R*D,w=w/R*D,b=-y+d-(-y+p),T=-v+f-(-v+_),S=(-v+_)*(-y+p)-(-v+f)*(-y+d),C=-w+m-(-w+p),M=-x+f-(-x+g),A=(-x+g)*(-w+p)-(-x+f)*(-w+m),L=b*M-C*T,Math.abs(L)<.1?(L+=10.1,r.push(f-v,p-y,o,h,l,f+v,p+y,o,h,l)):(u=(T*A-M*S)/L,c=(C*S-b*A)/L,P=(u-f)*(u-f)+(c-p)+(c-p),r.push(u,c,o,h,l,f-(u-f),p-(c-p),o,h,l));_=s[s.length-10],d=s[s.length-9],f=s[s.length-5],p=s[s.length-4],v=-(d-p),y=_-f,R=Math.sqrt(v*v+y*y),v=v/R*D,y=y/R*D,r.push(f-v,p-y,o,h,l,f+v,p+y,o,h,l);var B=this.edges+1;for(F=1;B>F;F++)e.push(E+2*(F-1),E+2*(F-1)+1,E+2*F+1,E+2*F+1,E+2*F,E+2*(F-1));return r},e.createLoopLine=function(t,e,i,n,s,r){var a=t.concat(),o=s?s:t,h=this.borderColor,l=(h>>16&255)/255,u=(h>>8&255)/255,c=(255&h)/255;a.splice(0,5);var _=[a[0],a[1]],d=[a[a.length-5],a[a.length-4]],f=d[0]+.5*(_[0]-d[0]),p=d[1]+.5*(_[1]-d[1]);a.unshift(f,p,0,0,0),a.push(f,p,0,0,0);var g,m,v,y,x,w,b,T,S,C,M,A,L,P,R,I,E,D,F,B,k,O=a.length/5,N=n,W=i/2;v=a[0],y=a[1],x=a[5],w=a[6],S=-(y-w),C=v-x,k=Math.sqrt(S*S+C*C),S=S/k*W,C=C/k*W,o.push(v-S,y-C,l,u,c,v+S,y+C,l,u,c);for(var U=1;O-1>U;U++)v=a[5*(U-1)],y=a[5*(U-1)+1],x=a[5*U],w=a[5*U+1],b=a[5*(U+1)],T=a[5*(U+1)+1],S=-(y-w),C=v-x,k=Math.sqrt(S*S+C*C),S=S/k*W,C=C/k*W,M=-(w-T),A=x-b,k=Math.sqrt(M*M+A*A),M=M/k*W,A=A/k*W,L=-C+y-(-C+w),P=-S+x-(-S+v),R=(-S+v)*(-C+w)-(-S+x)*(-C+y),I=-A+T-(-A+w),E=-M+x-(-M+b),D=(-M+b)*(-A+w)-(-M+x)*(-A+T),F=L*E-I*P,Math.abs(F)<.1?(F+=10.1,o.push(x-S,w-C,l,u,c,x+S,w+C,l,u,c)):(g=(P*D-E*R)/F,m=(I*R-L*D)/F,B=(g-x)*(g-x)+(m-w)+(m-w),o.push(g,m,l,u,c,x-(g-x),w-(m-w),l,u,c));r&&(e=r);var V=this.edges+1;for(U=1;V>U;U++)e.push(N+2*(U-1),N+2*(U-1)+1,N+2*U+1,N+2*U+1,N+2*U,N+2*(U-1));return e.push(N+2*(U-1),N+2*(U-1)+1,N+1,N+1,N,N+2*(U-1)),o},t}(),J=(function(){function t(t,e,i,n,s,r,a){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this.fillColor=n,this.fillAlpha=s,this.shape=a,this.fill=r}s(t,"laya.webgl.shapes.GeometryData");var e=t.prototype;return e.clone=function(){return new t(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.fill,this.shape)},e.getIndexData=function(){return null},e.getVertexData=function(){return null},e.destroy=function(){this.shape=null},t}(),function(){function t(t){if(t instanceof Float32Array)this.points=t;else if(t instanceof Array){t.length;this.points=new Float32Array(t)}}s(t,"laya.webgl.shapes.Vertex");var e=t.prototype;return i.imps(e,{"laya.webgl.shapes.IShape":!0}),e.getData=function(t,e,i){},t}(),function(){function t(t){void 0===t&&(t=1e4),this._renderType=t}s(t,"laya.webgl.submit.Submit");var e=t.prototype;return i.imps(e,{"laya.webgl.submit.ISubmit":!0}),e.releaseRender=function(){var e=t._cache;e[e._length++]=this,this.shaderValue.release(),this._vb=null},e.getRenderType=function(){return this._renderType},e.renderSubmit=function(){if(0===this._numEle)return 1;var t=this.shaderValue.textureHost;if(t){var e=t.source;if(!t.bitmap||!e)return 1;this.shaderValue.texture=e}this._vb.bind_upload(this._ib);var i=ft.mainContext;return this.shaderValue.upload(),W.activeBlendFunction!==this._blendFn&&(i.enable(3042),this._blendFn(i),W.activeBlendFunction=this._blendFn),A.drawCall++,A.trianglesFaces+=this._numEle/3,i.drawElements(4,this._numEle,5123,this._startIdx),1},t.__init__=function(){var e=t.RENDERBASE=new t(-1);e.shaderValue=new vt(0,0),e.shaderValue.ALPHA=-1234},t.create=function(e,i,n,s,r){var a=t._cache._length?t._cache[--t._cache._length]:new t;null==n&&(n=a._selfVb||(a._selfVb=zt.create(-1)),n.clear(),s=0),a._ib=i,a._vb=n,a._startIdx=s*ut.BYTES_PIDX,a._numEle=0;var o=e._nBlendType;a._blendFn=e._targets?W.targetFns[o]:W.fns[o],a.shaderValue=r,a.shaderValue.setValue(e._shader2D);var h=e._shader2D.filters;return h&&a.shaderValue.setFilters(h),a},t.createShape=function(e,i,n,s,r,a){var o=t._cache._length?t._cache[--t._cache._length]:new t;o._ib=i,o._vb=n,o._numEle=s,o._startIdx=r,o.shaderValue=a,o.shaderValue.setValue(e._shader2D);var h=e._nBlendType;return o._blendFn=e._targets?W.targetFns[h]:W.fns[h],o},t.TYPE_2D=1e4,t.TYPE_CANVAS=10003,t.TYPE_CMDSETRT=10004,t.TYPE_CUSTOM=10005,t.TYPE_BLURRT=10006,t.TYPE_CMDDESTORYPRERT=10007,t.TYPE_DISABLESTENCIL=10008,t.TYPE_OTHERIBVB=10009,t.TYPE_PRIMITIVE=10010,t.TYPE_RT=10011,t.TYPE_BLUR_RT=10012,t.TYPE_TARGET=10013,t.TYPE_CHANGE_VALUE=10014,t.TYPE_SHAPE=10015,t.TYPE_TEXTURE=10016,t.RENDERBASE=null,t._cache=(t._cache=[],t._cache._length=0,t._cache),t}()),tt=function(){function t(){this.fun=null,this.args=null}s(t,"laya.webgl.submit.SubmitCMD");var e=t.prototype;return i.imps(e,{"laya.webgl.submit.ISubmit":!0}),e.renderSubmit=function(){return this.fun.apply(null,this.args),1},e.getRenderType=function(){return 0},e.releaseRender=function(){var e=t._cache;e[e._length++]=this},t.create=function(e,i){var n=t._cache._length?t._cache[--t._cache._length]:new t;return n.fun=i,n.args=e,n},t._cache=(t._cache=[],t._cache._length=0,t._cache),t}(),et=function(){function t(){this.variables={}}s(t,"laya.webgl.submit.SubmitCMDScope");var e=t.prototype;return e.getValue=function(t){return this.variables[t]},e.addValue=function(t,e){return this.variables[t]=e},e.setValue=function(t,e){return this.variables.hasOwnProperty(t)?this.variables[t]=e:null},e.clear=function(){for(var t in this.variables)delete this.variables[t]},e.recycle=function(){this.clear(),t.POOL.push(this)},t.create=function(){var e=t.POOL.pop();return e||(e=new t),e},t.POOL=[],t}(),it=function(){function t(){this.offset=0,this.startIndex=0,this._mat=v.create()}s(t,"laya.webgl.submit.SubmitOtherIBVB");var e=t.prototype;return i.imps(e,{"laya.webgl.submit.ISubmit":!0}),e.releaseRender=function(){var e=t._cache;e[e._length++]=this},e.getRenderType=function(){return 10009},e.renderSubmit=function(){var e=this._shaderValue.textureHost;if(e){var i=e.source;if(!e.bitmap||!i)return 1;this._shaderValue.texture=i}this._vb.bind_upload(this._ib);var n=_t.worldMatrix4,s=v.TEMP;v.mulPre(this._mat,n[0],n[1],n[4],n[5],n[12],n[13],s);var r=_t.worldMatrix4=t.tempMatrix4;r[0]=s.a,r[1]=s.b,r[4]=s.c,r[5]=s.d,r[12]=s.tx,r[13]=s.ty,this._shader._offset=this.offset,this._shaderValue.refresh(),this._shader.upload(this._shaderValue),this._shader._offset=0;var a=ft.mainContext;return W.activeBlendFunction!==this._blendFn&&(a.enable(3042),this._blendFn(a),W.activeBlendFunction=this._blendFn),A.drawCall++,A.trianglesFaces+=this._numEle/3,a.drawElements(4,this._numEle,5123,this.startIndex),_t.worldMatrix4=n,Lt.activeShader=null,1},t.create=function(e,i,n,s,r,a,o,h,l){void 0===l&&(l=0);var u=t._cache._length?t._cache[--t._cache._length]:new t;u._ib=n,u._vb=i,u._numEle=s,u._shader=r,u._shaderValue=a;var c=e._nBlendType;switch(u._blendFn=e._targets?W.targetFns[c]:W.fns[c],l){case 0:u.offset=0,u.startIndex=h/(ut.BYTES_PE*i.vertexStride)*1.5,u.startIndex*=ut.BYTES_PIDX;break;case 1:u.startIndex=o,u.offset=h}return u},t._cache=(t._cache=[],t._cache._length=0,t._cache),t.tempMatrix4=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t}(),nt=function(){function t(){this.submitIndex=0,this.submitLength=0,this.context=null,this.clipRect=new x,this.screenRect=new x}s(t,"laya.webgl.submit.SubmitScissor");var e=t.prototype;return i.imps(e,{"laya.webgl.submit.ISubmit":!0}),e._scissor=function(t,e,i,n){var s=_t.worldMatrix4,r=s[0],a=s[5],o=s[12],h=s[13];if(t=t*r+o,e=e*a+h,i*=r,n*=a,1>i||1>n)return!1;var l=t+i,u=e+n;0>t&&(t=0,i=l-t),0>e&&(e=0,n=u-e);var c=_t.worldClipRect;if(t=Math.max(t,c.x),e=Math.max(e,c.y),i=Math.min(l,c.right)-t,n=Math.min(u,c.bottom)-e,1>i||1>n)return!1;var _=_t.worldScissorTest;return this.screenRect.copyFrom(c),c.x=t,c.y=e,c.width=i,c.height=n,_t.worldScissorTest=!0,e=_t.height-e-n,ft.mainContext.scissor(t,e,i,n),ft.mainContext.enable(3089),this.context.submitElement(this.submitIndex,this.submitIndex+this.submitLength),_?(e=_t.height-this.screenRect.y-this.screenRect.height,ft.mainContext.scissor(this.screenRect.x,e,this.screenRect.width,this.screenRect.height),ft.mainContext.enable(3089)):(ft.mainContext.disable(3089),_t.worldScissorTest=!1),c.copyFrom(this.screenRect),!0},e._scissorWithTagart=function(t,e,i,n){if(1>i||1>n)return!1;var s=t+i,r=e+n;0>t&&(t=0,i=s-t),0>e&&(e=0,n=r-e);var a=_t.worldClipRect;if(t=Math.max(t,a.x),e=Math.max(e,a.y),i=Math.min(s,a.right)-t,n=Math.min(r,a.bottom)-e,1>i||1>n)return!1;var o=_t.worldScissorTest;return this.screenRect.copyFrom(a),_t.worldScissorTest=!0,a.x=t,a.y=e,a.width=i,a.height=n,e=_t.height-e-n,ft.mainContext.scissor(t,e,i,n),ft.mainContext.enable(3089),
|
||
this.context.submitElement(this.submitIndex,this.submitIndex+this.submitLength),o?(e=_t.height-this.screenRect.y-this.screenRect.height,ft.mainContext.scissor(this.screenRect.x,e,this.screenRect.width,this.screenRect.height),ft.mainContext.enable(3089)):(ft.mainContext.disable(3089),_t.worldScissorTest=!1),a.copyFrom(this.screenRect),!0},e.renderSubmit=function(){return this.submitLength=Math.min(this.context._submits._length-1,this.submitLength),this.submitLength<1||this.clipRect.width<1||this.clipRect.height<1?this.submitLength+1:(this.context._targets?this._scissorWithTagart(this.clipRect.x,this.clipRect.y,this.clipRect.width,this.clipRect.height):this._scissor(this.clipRect.x,this.clipRect.y,this.clipRect.width,this.clipRect.height),this.submitLength+1)},e.getRenderType=function(){return 0},e.releaseRender=function(){var e=t._cache;e[e._length++]=this,this.context=null},t.create=function(e){var i=t._cache._length?t._cache[--t._cache._length]:new t;return i.context=e,i},t._cache=(t._cache=[],t._cache._length=0,t._cache),t}(),st=function(){function t(){this.step=0,this.blendMode=null,this.level=0}s(t,"laya.webgl.submit.SubmitStencil");var e=t.prototype;return i.imps(e,{"laya.webgl.submit.ISubmit":!0}),e.renderSubmit=function(){switch(this.step){case 1:this.do1();break;case 2:this.do2();break;case 3:this.do3();break;case 4:this.do4();break;case 5:this.do5();break;case 6:this.do6()}return 1},e.getRenderType=function(){return 0},e.releaseRender=function(){var e=t._cache;e[e._length++]=this},e.do1=function(){var t=ft.mainContext;t.enable(2960),t.clear(1024),t.colorMask(!1,!1,!1,!1),t.stencilFunc(514,this.level,255),t.stencilOp(7680,7680,7682)},e.do2=function(){var t=ft.mainContext;t.stencilFunc(514,this.level+1,255),t.colorMask(!0,!0,!0,!0),t.stencilOp(7680,7680,7680)},e.do3=function(){var t=ft.mainContext;t.colorMask(!0,!0,!0,!0),t.stencilOp(7680,7680,7680),t.clear(1024),t.disable(2960)},e.do4=function(){var t=ft.mainContext;t.enable(2960),t.clear(1024),t.colorMask(!1,!1,!1,!1),t.stencilFunc(519,this.level,255),t.stencilOp(7680,7680,5386)},e.do5=function(){var t=ft.mainContext;t.stencilFunc(514,255,255),t.colorMask(!0,!0,!0,!0),t.stencilOp(7680,7680,7680)},e.do6=function(){var t=ft.mainContext;W.targetFns[W.TOINT[this.blendMode]](t)},t.create=function(e){var i=t._cache._length?t._cache[--t._cache._length]:new t;return i.step=e,i},t._cache=(t._cache=[],t._cache._length=0,t._cache),t}(),rt=function(){function t(){this._renderType=0,this._vb=null,this._ib=null,this._startIdx=0,this._numEle=0,this.shaderValue=null,this.blendType=0,this.proName=null,this.scope=null}s(t,"laya.webgl.submit.SubmitTarget");var e=t.prototype;return i.imps(e,{"laya.webgl.submit.ISubmit":!0}),e.renderSubmit=function(){this._vb.bind_upload(this._ib);var t=this.scope.getValue(this.proName);return t&&(this.shaderValue.texture=t.source,this.shaderValue.upload(),this.blend(),A.drawCall++,A.trianglesFaces+=this._numEle/3,ft.mainContext.drawElements(4,this._numEle,5123,this._startIdx)),1},e.blend=function(){if(W.activeBlendFunction!==W.fns[this.blendType]){var t=ft.mainContext;t.enable(3042),W.fns[this.blendType](t),W.activeBlendFunction=W.fns[this.blendType]}},e.getRenderType=function(){return 0},e.releaseRender=function(){var e=t._cache;e[e._length++]=this},t.create=function(e,i,n,s,r,a){var o=t._cache._length?t._cache[--t._cache._length]:new t;return o._ib=i,o._vb=n,o.proName=a,o._startIdx=s*ut.BYTES_PIDX,o._numEle=0,o.blendType=e._nBlendType,o.shaderValue=r,o.shaderValue.setValue(e._shader2D),o},t._cache=(t._cache=[],t._cache._length=0,t._cache),t}(),at=function(){function t(){this._sourceStr=null}s(t,"laya.webgl.text.CharSegment");var e=t.prototype;return i.imps(e,{"laya.webgl.text.ICharSegment":!0}),e.textToSpit=function(t){this._sourceStr=t},e.getChar=function(t){return this._sourceStr.charAt(t)},e.getCharCode=function(t){return this._sourceStr.charCodeAt(t)},e.length=function(){return this._sourceStr.length},t}(),ot=function(){function t(){}var e;return s(t,"laya.webgl.text.DrawText"),t.__init__=function(){t._charsTemp=new Array,t._drawValue=new e,t._charSeg=new at},t.customCharSeg=function(e){t._charSeg=e},t.getChar=function(e,i,n){return t._charsCache[i]=ht.createOneChar(e,n)},t._drawSlow=function(e,i,n,s,r,a,o,h,l,u,c,_,d,f){var p,g,m=t._drawValue.value(a,h,l,u,d,f),v=0,y=0,x=t._charsTemp,w=0,b=NaN;if(s)for(x.length=s.length,v=0,y=s.length;y>v;v++)g=s[v],b=g.charNum+m.txtID,x[v]=p=t._charsCache[b]||t.getChar(g["char"],b,m),p.active();else{n instanceof laya.utils.WordText?t._charSeg.textToSpit(n.toString()):t._charSeg.textToSpit(n);var T=t._charSeg.length();for(x.length=T,v=0,y=T;y>v;v++)b=t._charSeg.getCharCode(v)+m.txtID,x[v]=p=t._charsCache[b]||t.getChar(t._charSeg.getChar(v),b,m),p.active(),w+=p.width}var S=0;null!==o&&"left"!==o&&(S=-("center"==o?w/2:w));var C,M,A=NaN,L=0;if(s)for(v=0,y=x.length;y>v;v++)p=x[v],p.isSpace||(g=s[v],A=p.borderSize,C=p.texture,i._drawText(C,c+S+g.x*d-A,_+g.y*f-A,C.width,C.height,r,0,0,0,0));else{for(v=0,y=x.length;y>v;v++)p=x[v],p.isSpace||(A=p.borderSize,C=p.texture,i._drawText(C,c+S-A,_-A,C.width,C.height,r,0,0,0,0),e&&(M=e[L++],M||(M=e[L-1]=[]),M[0]=C,M[1]=S-A,M[2]=-A)),S+=p.width;e&&(e.length=L)}},t._drawFast=function(t,e,i,n,s){for(var r,a,o=0,h=t.length;h>o;o++)a=t[o],r=a[0],r.active(),e._drawText(r,n+a[1],s+a[2],r.width,r.height,i,0,0,0,0)},t.drawText=function(e,n,s,r,a,o,h,l,u,c,d){if(!(n&&0===n.length||s&&0===s.length)){var f=r.a,p=r.d;(0!==r.b||0!==r.c)&&(f=p=1);var g=1!==f||1!==p;if(g&&i.stage.transform){var m=i.stage.transform;g=m.a===f&&m.d===p}else g=!1;if(g?(r=r.copyTo(mt._tmpMatrix),r.scale(1/f,1/p),r._checkTransform(),c*=f,d*=p):f=p=1,s)t._drawSlow(null,e,n,s,r,a,o,h,l,u,c,d,f,p);else{if(null===n.toUpperCase){var v=f+1e5*p,y=n;return void(y.changed||y.id!==v?(y.id=v,y.changed=!1,t._drawSlow(y.save,e,n,s,r,a,o,h,l,u,c,d,f,p)):t._drawFast(y.save,e,r,c,d))}var x=n+a.toString()+h+l+u+f+p+o,w=t._textsCache[x];w?t._drawFast(w,e,r,c,d):(t._textsCache.__length||(t._textsCache.__length=0),t._textsCache.__length>_.WebGLTextCacheCount&&(t._textsCache={},t._textsCache.__length=0,t._curPoolIndex=0),t._textCachesPool[t._curPoolIndex]?(w=t._textsCache[x]=t._textCachesPool[t._curPoolIndex],w.length=0):t._textCachesPool[t._curPoolIndex]=w=t._textsCache[x]=[],t._textsCache.__length++,t._curPoolIndex++,t._drawSlow(w,e,n,s,r,a,o,h,l,u,c,d,f,p))}}},t._charsTemp=null,t._textCachesPool=[],t._curPoolIndex=0,t._charsCache={},t._textsCache={},t._drawValue=null,t.d=[],t._charSeg=null,t.__init$=function(){e=function(){function t(){}s(t,"");var e=t.prototype;return e.value=function(e,i,n,s,r,a){this.font=e,this.fillColor=i,this.borderColor=n,this.lineWidth=s,this.scaleX=r,this.scaleY=a;var o=e.toString()+r+a+s+i+n;return this.txtID=t._keymap[o],this.txtID||(this.txtID=1e-7*++t._keymapCount,t._keymap[o]=this.txtID),this},t.clear=function(){t._keymap={},t._keymapCount=1},t._keymap={},t._keymapCount=1,t}()},t}(),ht=function(){function t(t,e){this["char"]=t,this.isSpace=" "===t,this.xs=e.scaleX,this.ys=e.scaleY,this.font=e.font.toString(),this.fontSize=e.font.size,this.fillColor=e.fillColor,this.borderColor=e.borderColor,this.lineWidth=e.lineWidth;var i=w.isConchApp;if(i){var n=ConchTextCanvas;n._source=ConchTextCanvas,n._source.canvas=ConchTextCanvas,this.texture=new R(new Ot(n,this))}else this.texture=new R(new Ot(u.canvas.source,this))}s(t,"laya.webgl.text.DrawTextChar");var e=t.prototype;return e.active=function(){this.texture.active()},t.createOneChar=function(e,i){var n=new t(e,i);return n},t}(),lt=function(){function t(t){this._index=0,this._size=14,this._italic=-2,this.setFont(t||"14px Arial")}s(t,"laya.webgl.text.FontInContext");var e=t.prototype;return e.setFont=function(t){this._words=t.split(" ");for(var e=0,i=this._words.length;i>e;e++)if(this._words[e].indexOf("px")>0){this._index=e;break}this._size=parseInt(this._words[this._index]),this._text=null,this._italic=-2},e.getItalic=function(){return-2===this._italic&&(this._italic=this.hasType("italic")),this._italic},e.hasType=function(t){for(var e=0,i=this._words.length;i>e;e++)if(this._words[e]===t)return e;return-1},e.removeType=function(t){for(var e=0,i=this._words.length;i>e;e++)if(this._words[e]===t){this._words.splice(e,1),this._index>e&&this._index--;break}this._text=null,this._italic=-2},e.copyTo=function(t){return t._text=this._text,t._size=this._size,t._index=this._index,t._words=this._words.slice(),t._italic=-2,t},e.toString=function(){return this._text?this._text:this._text=this._words.join(" ")},r(0,e,"size",function(){return this._size},function(t){this._size=t,this._words[this._index]=t+"px",this._text=null}),t.create=function(e){var i=t._cache[e];return i?i:i=t._cache[e]=new t(e)},t.EMPTY=new t,t._cache={},t}(),ut=function(){function t(){}return s(t,"laya.webgl.utils.CONST3D2D"),t.defaultMatrix4=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t.defaultMinusYMatrix4=[1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1],t.uniformMatrix3=[1,0,0,0,0,1,0,0,0,0,1,0],t._TMPARRAY=[],t._OFFSETX=0,t._OFFSETY=0,n(t,["BYTES_PE",function(){return this.BYTES_PE=Float32Array.BYTES_PER_ELEMENT},"BYTES_PIDX",function(){return this.BYTES_PIDX=Uint16Array.BYTES_PER_ELEMENT}]),t}(),ct=function(){function t(){}return s(t,"laya.webgl.utils.GlUtils"),t.make2DProjection=function(t,e,i){return[2/t,0,0,0,0,-2/e,0,0,0,0,2/i,0,-1,1,0,1]},t.fillIBQuadrangle=function(t,e){if(e>65535/4)throw Error("IBQuadrangle count:"+e+" must<:"+Math.floor(65535/4));e=Math.floor(e),t._resizeBuffer(6*(e+1)*2,!1),t.byteLength=t.bufferLength;for(var i=t.getUint16Array(),n=0,s=0;e>s;s++)i[n++]=4*s,i[n++]=4*s+2,i[n++]=4*s+1,i[n++]=4*s,i[n++]=4*s+3,i[n++]=4*s+2;return t.setNeedUpload(),!0},t.expandIBQuadrangle=function(e,i){e.bufferLength>=6*i*2||t.fillIBQuadrangle(e,i)},t.mathCeilPowerOfTwo=function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t},t.fillQuadrangleImgVb=function(t,e,i,n,s,r,a,o){"use strict";var h=(t._byteLength>>2)+16;t.byteLength=h<<2;var l=t.getFloat32Array();h-=16,l[h+2]=s[0],l[h+3]=s[1],l[h+6]=s[2],l[h+7]=s[3],l[h+10]=s[4],l[h+11]=s[5],l[h+14]=s[6],l[h+15]=s[7];var u=r.a,c=r.b,_=r.c,d=r.d;if(1!==u||0!==c||0!==_||1!==d){r.bTransform=!0;var f=r.tx+a,p=r.ty+o;l[h]=(n[0]+e)*u+(n[1]+i)*_+f,l[h+1]=(n[0]+e)*c+(n[1]+i)*d+p,l[h+4]=(n[2]+e)*u+(n[3]+i)*_+f,l[h+5]=(n[2]+e)*c+(n[3]+i)*d+p,l[h+8]=(n[4]+e)*u+(n[5]+i)*_+f,l[h+9]=(n[4]+e)*c+(n[5]+i)*d+p,l[h+12]=(n[6]+e)*u+(n[7]+i)*_+f,l[h+13]=(n[6]+e)*c+(n[7]+i)*d+p}else r.bTransform=!1,e+=r.tx+a,i+=r.ty+o,l[h]=e+n[0],l[h+1]=i+n[1],l[h+4]=e+n[2],l[h+5]=i+n[3],l[h+8]=e+n[4],l[h+9]=i+n[5],l[h+12]=e+n[6],l[h+13]=i+n[7];return t._upload=!0,!0},t.fillTranglesVB=function(t,e,i,n,s,r,a){"use strict";var o=(t._byteLength>>2)+n.length;t.byteLength=o<<2;var h=t.getFloat32Array();o-=n.length;for(var l=n.length,u=s.a,c=s.b,_=s.c,d=s.d,f=0;l>f;f+=4)if(h[o+f+2]=n[f+2],h[o+f+3]=n[f+3],1!==u||0!==c||0!==_||1!==d){s.bTransform=!0;var p=s.tx+r,g=s.ty+a;h[o+f]=(n[f]+e)*u+(n[f+1]+i)*_+p,h[o+f+1]=(n[f]+e)*c+(n[f+1]+i)*d+g}else s.bTransform=!1,e+=s.tx+r,i+=s.ty+a,h[o+f]=e+n[f],h[o+f+1]=i+n[f+1];return t._upload=!0,!0},t.copyPreImgVb=function(t,e,i){var n=t._byteLength>>2;t.byteLength=n+16<<2;for(var s=t.getFloat32Array(),r=0,a=n-16;4>r;r++)s[n]=s[a]+e,++n,++a,s[n]=s[a]+i,++n,++a,s[n]=s[a],++n,++a,s[n]=s[a],++n,++a;t._upload=!0},t.fillRectImgVb=function(t,e,i,n,s,r,a,o,h,l,u,c,_){void 0===_&&(_=!1);var d,f,p,g,m,v,y,x,w,b,T,S,C,M,A,L,P=1,R=o.a,I=o.b,E=o.c,D=o.d,F=e.width<99999999;if(1!==R||0!==I||0!==E||1!==D?(o.bTransform=!0,0===I&&0===E&&(P=23,w=s+i,b=r+n,T=o.tx+h,S=o.ty+l,d=R*i+T,p=R*w+T,f=D*n+S,g=D*b+S)):(P=23,o.bTransform=!1,d=i+o.tx+h,p=d+s,f=n+o.ty+l,g=f+r),F&&(m=e.x,v=e.y,y=e.width+m,x=e.height+v),1!==P&&(d>=y||f>=x||m>=p||v>=g))return!1;var B=t._byteLength>>2;t.byteLength=B+16<<2;var k=t.getFloat32Array();switch(k[B+2]=a[0],k[B+3]=a[1],k[B+6]=a[2],k[B+7]=a[3],k[B+10]=a[4],k[B+11]=a[5],k[B+14]=a[6],k[B+15]=a[7],P){case 1:T=o.tx+h,S=o.ty+l,w=s+i,b=r+n;var O=i,N=n,W=R*O,U=E*N,V=D*N,H=I*O,z=R*w,G=E*b,Y=D*b,X=I*w;_?(C=W+U+T,A=Math.round(C)-C,M=V+H+S,L=Math.round(M)-M,k[B]=C+A,k[B+1]=M+L,k[B+4]=z+U+T+A,k[B+5]=V+X+S+L,k[B+8]=z+G+T+A,k[B+9]=Y+X+S+L,k[B+12]=W+G+T+A,k[B+13]=Y+H+S+L):(k[B]=W+U+T,k[B+1]=V+H+S,k[B+4]=z+U+T,k[B+5]=V+X+S,k[B+8]=z+G+T,k[B+9]=Y+X+S,k[B+12]=W+G+T,k[B+13]=Y+H+S);break;case 23:_?(C=d+u,A=Math.round(C)-C,M=f,L=Math.round(M)-M,k[B]=C+A,k[B+1]=M+L,k[B+4]=p+u+A,k[B+5]=f+L,k[B+8]=p+A,k[B+9]=g+L,k[B+12]=d+A,k[B+13]=g+L):(k[B]=d+u,k[B+1]=f,k[B+4]=p+u,k[B+5]=f,k[B+8]=p,k[B+9]=g,k[B+12]=d,k[B+13]=g)}return t._upload=!0,!0},t.fillLineVb=function(e,i,n,s,r,a,o,h){"use strict";var l=.5*o,u=t._fillLineArray,c=-(s-a),_=n-r,d=Math.sqrt(c*c+_*_);c/=d,_/=d,c*=l,_*=l,u[0]=n-c,u[1]=s-_,u[4]=n+c,u[5]=s+_,u[8]=r+c,u[9]=a+_,u[12]=r-c,u[13]=a-_,h&&h.transformPointArray(u,u);var f=(e._byteLength>>2)+16;return e.byteLength=f<<2,e.insertData(u,f-16),!0},t._fillLineArray=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],t}(),_t=(function(){function t(){}return s(t,"laya.webgl.utils.MatirxArray"),t.ArrayMul=function(e,i,n){if(!e)return void t.copyArray(i,n);if(!i)return void t.copyArray(e,n);for(var s=NaN,r=NaN,a=NaN,o=NaN,h=0;4>h;h++)s=e[h],r=e[h+4],a=e[h+8],o=e[h+12],n[h]=s*i[0]+r*i[1]+a*i[2]+o*i[3],n[h+4]=s*i[4]+r*i[5]+a*i[6]+o*i[7],n[h+8]=s*i[8]+r*i[9]+a*i[10]+o*i[11],n[h+12]=s*i[12]+r*i[13]+a*i[14]+o*i[15]},t.copyArray=function(t,e){if(t&&e)for(var i=0;i<t.length;i++)e[i]=t[i]},t}(),function(){function t(){}return s(t,"laya.webgl.utils.RenderState2D"),t.getMatrArray=function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},t.mat2MatArray=function(t,e){var i=t,n=e;return n[0]=i.a,n[1]=i.b,n[4]=i.c,n[5]=i.d,n[12]=i.tx,n[13]=i.ty,e},t.restoreTempArray=function(){t.TEMPMAT4_ARRAY[0]=1,t.TEMPMAT4_ARRAY[1]=0,t.TEMPMAT4_ARRAY[4]=0,t.TEMPMAT4_ARRAY[5]=1,t.TEMPMAT4_ARRAY[12]=0,t.TEMPMAT4_ARRAY[13]=0},t.clear=function(){t.worldScissorTest=!1,t.worldShaderDefines=null,t.worldFilters=null,t.worldAlpha=1,t.worldClipRect.x=t.worldClipRect.y=0,t.worldClipRect.width=t.width,t.worldClipRect.height=t.height,t.curRenderTarget=null},t._MAXSIZE=99999999,t.TEMPMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t.worldMatrix4=t.TEMPMAT4_ARRAY,t.worldAlpha=1,t.worldScissorTest=!1,t.worldFilters=null,t.worldShaderDefines=null,t.worldClipRect=new x(0,0,99999999,99999999),t.curRenderTarget=null,t.width=0,t.height=0,n(t,["worldMatrix",function(){return this.worldMatrix=new v}]),t}()),dt=function(){function t(t,i,n,s,r){function a(t){for(var e=t.split(" "),i=[],n=0;n<e.length;n++)e[n].length>0&&i.push(e[n]);return i}function o(t){var i,n,s=0,o=0,h=0,l=new e(0,null,null,null),u=l,c=t.split("\n");for(s=0,o=c.length;o>s;s++){var _=c[s];if(_.indexOf("#ifdef")>=0)i=a(_),u=new e(1,i[1],"",u);else if(_.indexOf("#else")>=0)n=u.condition,u=new e(2,null,"",u.parent),u.condition=n;else if(_.indexOf("#endif")>=0)u=u.parent;else if(_.indexOf("#include")>=0){i=a(_);var d=i[1],f=d.charAt(0);'"'!==f&&"'"!==f||(d=d.substr(1,d.length-2),h=d.lastIndexOf(f),h>0&&(d=d.substr(0,h))),h=i[0].indexOf("?");var p=h>0?i[0].substr(h+1):i[0];new e(1,p,r[d],u)}else u.childs.length>0&&0===u.childs[u.childs.length-1].type?u.childs[u.childs.length-1].text+="\n"+_:new e(0,null,_,u)}return l}this._VSTXT=i,this._PSTXT=n,this._VS=o(i),this._PS=o(n),this._nameMap=s}var e;s(t,"laya.webgl.utils.ShaderCompile");var i=t.prototype;return i.createShader=function(t,e,i){var n={},s="";if(t)for(var r in t)s+="#define "+r+"\n",n[r]=!0;var a=this._VS.toscript(n,[]),o=this._PS.toscript(n,[]);return(i||Lt.create)(s+a.join("\n"),s+o.join("\n"),e,this._nameMap)},t.IFDEF_NO=0,t.IFDEF_YES=1,t.IFDEF_ELSE=2,t.__init$=function(){e=function(){function t(t,e,i,n){if(this.childs=new Array,this.type=t,this.text=i,this.parent=n,n&&n.childs.push(this),e){for(var s="",r=!1,a=!1,o=0,h=e.length;h>o;o++){var l=e.charAt(o);a="!&|() ".indexOf(l)<0,r!=a&&(a&&(s+="this."),r=a),s+=l}this.condition=C.createShaderCondition(s)}}s(t,"");var e=t.prototype;return e.toscript=function(t,e){if(0===this.type&&this.text&&e.push(this.text),this.childs.length<1&&!this.text)return e;if(0!==this.type){var i=!!this.condition.call(t);if(2===this.type&&(i=!i),!i)return e;this.text&&e.push(this.text)}return this.childs.length>0&&this.childs.forEach(function(i,n,s){i.toscript(t,e)}),e},t}()},t}(),ft=(function(){function t(){this._data=[],this._length=0,this._data._length=0}s(t,"laya.webgl.utils.ValusArray");var e=t.prototype;return e.pushValue=function(t,e){this.setValue(this._length,t,e),this._length+=2},e.setValue=function(t,e,i){this._data[t++]=e,this._data[t]=i},e.pushArray=function(t){for(var e=this._data,i=this._length,n=t._data,s=0,r=t.length;r>s;s++,i++)e[i++]=n[s++],e[i]=n[s];this._length=i},r(0,e,"data",function(){return this._data}),r(0,e,"length",function(){return this._length},function(t){this._length=t}),t}(),function(){function t(){}return s(t,"laya.webgl.WebGL"),t._float32ArraySlice=function(){for(var t=this,e=t.length,i=new Float32Array(t.length),n=0;e>n;n++)i[n]=t[n];return i},t._uint16ArraySlice=function(t){var e,i=arguments,n=this,s=0,r=0;if(0===i.length)for(s=n.length,e=new Uint16Array(s),r=0;s>r;r++)e[r]=n[r];else if(2===i.length){var a=i[0],o=i[1];if(o>a)for(s=o-a,e=new Uint16Array(s),r=a;o>r;r++)e[r-a]=n[r];else e=new Uint16Array(0)}return e},t.expandContext=function(){var t=d.prototype,e=CanvasRenderingContext2D.prototype;e.fillTrangles=t.fillTrangles,Ut.__int__(null),e.setIBVB=function(t,e,i,n,s,r,a,o,h,l){void 0===h&&(h=0),void 0===l&&(l=0),null===i&&(this._ib=this._ib||Ht.QuadrangleIB,i=this._ib,ct.expandIBQuadrangle(i,n.byteLength/64+8)),this._setIBVB(t,e,i,n,s,r,a,o,h,l)},e.fillTrangles=function(t,e,i,n,s){this._curMat=this._curMat||v.create(),this._vb=this._vb||zt.create(),this._ib||(this._ib=Ht.create(),ct.fillIBQuadrangle(this._ib,a/4));var r=this._vb,a=n.length>>4;ct.fillTranglesVB(r,e,i,n,s||this._curMat,0,0),ct.expandIBQuadrangle(this._ib,r.byteLength/64+8);var o=new vt(1,0);o.textureHost=t;var h=new Wt("attribute vec2 position; attribute vec2 texcoord; uniform vec2 size; uniform mat4 mmat; varying vec2 v_texcoord; void main() { vec4 p=vec4(position.xy,0.0,1.0);vec4 pos=mmat*p; gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0); v_texcoord = texcoord; }","precision mediump float; varying vec2 v_texcoord; uniform sampler2D texture; void main() {vec4 color= texture2D(texture, v_texcoord); color.a*=1.0; gl_FragColor= color;}");r._vertType=3,this._setIBVB(e,i,this._ib,r,6*a,s,h,o,0,0)}},t.enable=function(){if(w.isConchApp&&!w.isConchWebGL)return C.skinAniSprite=function(){var t=new q;return t},t.expandContext(),!1;if(!t.isWebGLSupported())return!1;if(w.isWebGL)return!0;m.create=function(t,e){return new Gt(t,e)},w.WebGL=t,w.isWebGL=!0,ot.__init__(),C.createRenderSprite=function(t,e){return new yt(t,e)},C.createWebGLContext2D=function(t){return new mt(t)},C.changeWebGLSize=function(t,e){laya.webgl.WebGL.onStageResize(t,e)},C.createGraphics=function(){return new gt};var e=C.createFilterAction;return C.createFilterAction=e?e:function(t){return new xt},C.clear=function(t){if(_t.worldScissorTest&&laya.webgl.WebGL.mainContext.disable(3089),null==t)w.context.ctx.clearBG(0,0,0,0);else{var e=c.create(t)._color;w.context.ctx.clearBG(e[0],e[1],e[2],e[3])}_t.clear()},C.addToAtlas=function(t,e){void 0===e&&(e=!1);var n=t.bitmap;return w.optimizeTextureMemory(t.url,t)?void(i.__typeof(n,"laya.webgl.resource.IMergeAtlasBitmap")&&n.allowMerageInAtlas&&n.on("recovered",t,t.addTextureToAtlas)):void(n.enableMerageInAtlas=!1)},O._enable(),C.beginFlush=function(){for(var t=O.instance,e=t.getAtlaserCount(),i=0;e>i;i++){var n=t.getAtlaserByIndex(i).texture;n._flashCacheImageNeedFlush&&C.flashFlushImage(n)}},C.drawToCanvas=function(t,e,i,n,s,r){var a=new Pt(i,n,6408,5121,0,!1);a.start(),a.clear(1,0,0,1),t.render(w.context,-s,_t.height-n-r),w.context.flush(),a.end();var o=a.getData(0,0,a.width,a.height);return a.dispose(),o},C.createFilterAction=function(t){var e;switch(t){case 32:e=new xt}return e},C.addTextureToAtlas=function(t){t._uvID++,O._atlasRestore++,t.bitmap.enableMerageInAtlas&&O.instance.addToAtlas(t)},C.getTexturePixels=function(t,e,i,n,s){w.context.ctx.clear();var r=new M;r.graphics.drawTexture(t,-e,-i);var a=Pt.create(n,s);a.start(),a.clear(0,0,0,0),r.render(w.context,0,0),w.context.ctx.flush(),a.end();for(var o=a.getData(0,0,n,s),h=[],l=0,u=s-1;u>=0;u--)for(var c=0;n>c;c++)l=4*(u*n+c),h.push(o[l]),h.push(o[l+1]),h.push(o[l+2]),h.push(o[l+3]);return h},C.skinAniSprite=function(){var t=new q;return t},f._filterStart=function(t,e,i,n,s){var r=t.getValue("bounds"),a=Pt.create(r.width,r.height);if(a.start(),a.clear(0,0,0,0),t.addValue("src",a),t.addValue("ScissorTest",_t.worldScissorTest),_t.worldScissorTest){var o=new x;o.copyFrom(i.ctx._clipRect),t.addValue("clipRect",o),_t.worldScissorTest=!1,laya.webgl.WebGL.mainContext.disable(3089)}},f._filterEnd=function(t,e,i,n,s){var r=t.getValue("bounds"),a=t.getValue("src");a.end();var o=Pt.create(r.width,r.height);o.start(),o.clear(0,0,0,0),t.addValue("out",o),e._set$P("_filterCache",o),e._set$P("_isHaveGlowFilter",t.getValue("_isHaveGlowFilter"))},f._EndTarget=function(t,e){var i=t.getValue("src");i.recycle();var n=t.getValue("out");n.end();var s=t.getValue("ScissorTest");if(s){_t.worldScissorTest=!0,laya.webgl.WebGL.mainContext.enable(3089),e.ctx.save();var r=t.getValue("clipRect");e.ctx.clipRect(r.x,r.y,r.width,r.height)}},f._useSrc=function(t){var e=t.getValue("out");e.end(),e=t.getValue("src"),e.start(),e.clear(0,0,0,0)},f._endSrc=function(t){var e=t.getValue("src");e.end()},f._useOut=function(t){var e=t.getValue("src");e.end(),e=t.getValue("out"),e.start(),e.clear(0,0,0,0)},f._endOut=function(t){var e=t.getValue("out");e.end()},f._recycleScope=function(t){t.recycle()},f._filter=function(t,e,i,n){var s=this._next;if(s){var r=t.filters,a=r.length;if(1==a&&32==r[0].type)return e.ctx.save(),e.ctx.setFilters([r[0]]),s._fun.call(s,t,e,i,n),void e.ctx.restore();var o,h,l=et.create(),u=y.TEMP,c=e.ctx._getTransformMatrix(),_=v.create();c.copyTo(_);var d=0,p=0,g=!1,m=t._$P._filterCache?t._$P._filterCache:null;if(!m||t._repaint){g=t._isHaveGlowFilter(),l.addValue("_isHaveGlowFilter",g),g&&(d=50,p=25),h=new x,h.copyFrom(t.getBounds());var w=h.x,b=h.y;if(h.width+=d,h.height+=d,u.x=h.x*_.a+h.y*_.c,u.y=h.y*_.d+h.x*_.b,h.x=u.x,h.y=u.y,u.x=h.width*_.a+h.height*_.c,u.y=h.height*_.d+h.width*_.b,h.width=u.x,h.height=u.y,h.width<=0||h.height<=0)return;m&&m.recycle(),l.addValue("bounds",h);var T=tt.create([l,t,e,0,0],f._filterStart);e.addRenderObject(T),e.ctx._renderKey=0,e.ctx._shader2D.glTexture=null;var S=t.x-w+p,C=t.y-b+p;s._fun.call(s,t,e,S,C),T=tt.create([l,t,e,0,0],f._filterEnd),e.addRenderObject(T);for(var M=0;a>M;M++){0!=M&&(T=tt.create([l],f._useSrc),e.addRenderObject(T),o=vt.create(1,0),v.TEMP.identity(),e.ctx.drawTarget(l,0,0,h.width,h.height,v.TEMP,"out",o,null,W.TOINT.overlay),T=tt.create([l],f._useOut),e.addRenderObject(T));var A=r[M];A.action.apply3d(l,t,e,0,0)}T=tt.create([l,e],f._EndTarget),e.addRenderObject(T)}else{if(g=t._$P._isHaveGlowFilter?t._$P._isHaveGlowFilter:!1,g&&(d=50,p=25),h=t.getBounds(),h.width<=0||h.height<=0)return;h.width+=d,h.height+=d,u.x=h.x*_.a+h.y*_.c,u.y=h.y*_.d+h.x*_.b,h.x=u.x,h.y=u.y,u.x=h.width*_.a+h.height*_.c,u.y=h.height*_.d+h.width*_.b,h.width=u.x,h.height=u.y,l.addValue("out",m)}i=i-p-t.x,n=n-p-t.y,u.setTo(i,n),_.transformPoint(u),i=u.x+h.x,n=u.y+h.y,o=vt.create(1,0),v.TEMP.identity(),e.ctx.drawTarget(l,i,n,h.width,h.height,v.TEMP,"out",o,null,W.TOINT.overlay),T=tt.create([l],f._recycleScope),e.addRenderObject(T),_.destroy()}},Float32Array.prototype.slice||(Float32Array.prototype.slice=t._float32ArraySlice),Uint16Array.prototype.slice||(Uint16Array.prototype.slice=t._uint16ArraySlice),!0},t.isWebGLSupported=function(){for(var t,e=u.createElement("canvas"),i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=0;n<i.length;n++){try{t=e.getContext(i[n])}catch(s){}if(t)return i[n]}return null},t.onStageResize=function(e,i){t.mainContext.viewport(0,0,e,i),_t.width=e,_t.height=i},t.isExperimentalWebgl=function(){return t._isExperimentalWebgl},t.addRenderFinish=function(){(t._isExperimentalWebgl||w.isFlash)&&(C.endFinish=function(){w.context.ctx.finish()})},t.removeRenderFinish=function(){t._isExperimentalWebgl&&(C.endFinish=function(){})},t.onInvalidGLRes=function(){O.instance.freeAll(),S.releaseContentManagers(!0),t.doNodeRepaint(i.stage),t.mainContext.viewport(0,0,_t.width,_t.height),i.stage.event("devicelost")},t.doNodeRepaint=function(e){0==e.numChildren&&e.repaint();for(var i=0;i<e.numChildren;i++)t.doNodeRepaint(e.getChildAt(i))},t.init=function(e,i,n){t.mainCanvas=e,g._createContext=function(t){return new mt(t)};var s=t.isWebGLSupported(),r=t.mainContext=C.newWebGLContext(e,s);t._isExperimentalWebgl="webgl"!=s&&(u.onWeiXin||u.onMQQBrowser),t.frameShaderHighPrecision=!1;try{var a=laya.webgl.WebGL.mainContext.getShaderPrecisionFormat(35632,36338);a.precision?t.frameShaderHighPrecision=!0:t.frameShaderHighPrecision=!1}catch(o){}if(u.window.SetupWebglContext&&u.window.SetupWebglContext(r),t.onStageResize(i,n),null==t.mainContext)throw new Error("webGL getContext err!");P.__init__(),O.__init__(),bt.__init__(),J.__init__(),mt.__init__(),vt.__init__(),K.__init__(),Ut.__int__(r),W._init_(r),w.isConchApp&&conch.setOnInvalidGLRes(t.onInvalidGLRes)},t.mainCanvas=null,t.mainContext=null,t.antialias=!0,t.frameShaderHighPrecision=!1,t._bg_null=[0,0,0,0],t._isExperimentalWebgl=!1,t}()),pt=function(){function t(){}return s(t,"laya.webgl.WebGLContext"),t.UseProgram=function(e){return t._useProgram===e?!1:(ft.mainContext.useProgram(e),t._useProgram=e,!0)},t.setDepthTest=function(e,i){i!==t._depthTest&&(t._depthTest=i,i?e.enable(2929):e.disable(2929))},t.setDepthMask=function(e,i){i!==t._depthMask&&(t._depthMask=i,e.depthMask(i))},t.setDepthFunc=function(e,i){i!==t._depthFunc&&(t._depthFunc=i,e.depthFunc(i))},t.setBlend=function(e,i){i!==t._blend&&(t._blend=i,i?e.enable(3042):e.disable(3042))},t.setBlendFunc=function(e,i,n){(i!==t._sFactor||n!==t._dFactor)&&(t._sFactor=i,t._dFactor=n,e.blendFunc(i,n))},t.setCullFace=function(e,i){i!==t._cullFace&&(t._cullFace=i,i?e.enable(2884):e.disable(2884))},t.setFrontFaceCCW=function(e,i){i!==t._frontFace&&(t._frontFace=i,e.frontFace(i))},t.bindTexture=function(e,i,n){e.bindTexture(i,n),t.curBindTexTarget=i,t.curBindTexValue=n},t._useProgram=null,t._depthTest=!0,t._depthMask=1,t._blend=!1,t._cullFace=!1,t.curBindTexTarget=null,t.curBindTexValue=null,n(t,["_depthFunc",function(){return this._depthFunc=513},"_sFactor",function(){return this._sFactor=1},"_dFactor",function(){return this._dFactor=0},"_frontFace",function(){return this._frontFace=2305}]),t.__init$=function(){},t}(),gt=function(t){function e(){e.__super.call(this)}s(e,"laya.webgl.display.GraphicsGL",t);var i=e.prototype;return i.setShader=function(t){this._saveToCmd(w.context._setShader,[t])},i.setIBVB=function(t,e,i,n,s,r){this._saveToCmd(w.context._setIBVB,[t,e,i,n,s,r])},i.drawParticle=function(t,e,i){var n=C.createParticleTemplate2D(i);n.x=t,n.y=e,this._saveToCmd(w.context._drawParticle,[n])},e}(p),mt=function(t){function e(t){this._x=0,this._y=0,this._id=++e._COUNT,this._path=null,this._drawCount=1,this._maxNumEle=0,this._clear=!1,this._isMain=!1,this._atlasResourceChange=0,this._submits=[],this._curSubmit=null,this._ib=null,this._vb=null,this._nBlendType=0,this._saveMark=null,this.mId=-1,this.mHaveKey=!1,this.mHaveLineKey=!1,this.mX=0,this.mY=0,e.__super.call(this),this._width=99999999,this._height=99999999,this._clipRect=e.MAXCLIPRECT,this._shader2D=new K,this.mOutPoint,this._canvas=t,this._curMat=v.create(),w.isFlash?(this._ib=Ht.create(35044),ct.fillIBQuadrangle(this._ib,16)):this._ib=Ht.QuadrangleIB,this._vb=zt.create(-1),this._other=a.DEFAULT,this._save=[G.Create(this)],this._save.length=10,this.clear()}var a;s(e,"laya.webgl.canvas.WebGLContext2D",t);var o=e.prototype;return o.setIsMainContext=function(){this._isMain=!0},o.clearBG=function(t,e,i,n){var s=ft.mainContext;s.clearColor(t,e,i,n),s.clear(16640)},o._getSubmits=function(){return this._submits},o.destroy=function(){this._curMat&&this._curMat.destroy(),this._targets&&this._targets.destroy(),this._vb&&this._vb.releaseResource(),this._ib&&this._ib!=Ht.QuadrangleIB&&this._ib.releaseResource()},o.clear=function(){this._vb.clear(),this._targets&&(this._targets.repaint=!0),this._other=a.DEFAULT,this._clear=!0,this._repaint=!1,this._drawCount=1,this._renderKey=0,this._other.lineWidth=this._shader2D.ALPHA=1,this._nBlendType=0,this._clipRect=e.MAXCLIPRECT,this._curSubmit=J.RENDERBASE,this._shader2D.glTexture=null,this._shader2D.fillStyle=this._shader2D.strokeStyle=U.DEFAULT;for(var t=0,i=this._submits._length;i>t;t++)this._submits[t].releaseRender();this._submits._length=0,this._curMat.identity(),this._other.clear(),this._saveMark=this._save[0],this._save._length=1},o.size=function(t,e){this._width=t,this._height=e,this._targets&&this._targets.size(t,e)},o._getTransformMatrix=function(){return this._curMat},o.translate=function(t,e){0===t&&0===e||(X.save(this),this._curMat.bTransform&&(Y.save(this),this._curMat.transformPoint(y.TEMP.setTo(t,e)),t=y.TEMP.x,e=y.TEMP.y),this._x+=t,this._y+=e)},o.save=function(){this._save[this._save._length++]=G.Create(this)},o.restore=function(){var t=this._save._length;if(!(1>t))for(var e=t-1;e>=0;e--){var i=this._save[e];if(i.restore(this),i.isSaveMark())return void(this._save._length=e)}},o.measureText=function(t){return C.measureText(t,this._other.font.toString())},o._fillText=function(t,e,i,n,s,r,a){var o=this._shader2D,h=this._curSubmit.shaderValue,l=s?lt.create(s):this._other.font;if(O.enabled)o.ALPHA!==h.ALPHA&&(o.glTexture=null),ot.drawText(this,t,e,this._curMat,l,a||this._other.textAlign,r,null,-1,i,n);else{var u=(this._shader2D.defines.getValue(),r?c.create(r)._color:o.colorAdd);o.ALPHA===h.ALPHA&&u===o.colorAdd&&h.colorAdd===o.colorAdd||(o.glTexture=null,o.colorAdd=u),ot.drawText(this,t,e,this._curMat,l,a||this._other.textAlign,r,null,-1,i,n)}},o.fillWords=function(t,e,i,n,s){t.length>0&&this._fillText(null,t,e,i,n,s,null)},o.fillText=function(t,e,i,n,s,r){t.length>0&&this._fillText(t,null,e,i,n,s,r)},o.strokeText=function(t,i,n,s,r,a,o){if(0!==t.length){var h=this._shader2D,l=this._curSubmit.shaderValue,u=s?(e._fontTemp.setFont(s),e._fontTemp):this._other.font;if(O.enabled)h.ALPHA!==l.ALPHA&&(h.glTexture=null),ot.drawText(this,t,null,this._curMat,u,o||this._other.textAlign,null,r,a||1,i,n);else{var _=(this._shader2D.defines.getValue(),r?c.create(r)._color:h.colorAdd);h.ALPHA===l.ALPHA&&_===h.colorAdd&&l.colorAdd===h.colorAdd||(h.glTexture=null,h.colorAdd=_),ot.drawText(this,t,null,this._curMat,u,o||this._other.textAlign,null,r,a||1,i,n)}}},o.fillBorderText=function(t,i,n,s,r,a,o,h){if(0!==t.length){if(!O.enabled)return this.strokeText(t,i,n,s,a,o,h),void this.fillText(t,i,n,s,r,h);var l=this._shader2D,u=this._curSubmit.shaderValue;l.ALPHA!==u.ALPHA&&(l.glTexture=null);var c=s?(e._fontTemp.setFont(s),e._fontTemp):this._other.font;ot.drawText(this,t,null,this._curMat,c,h||this._other.textAlign,r,a,o||1,i,n)}},o.fillRect=function(t,e,i,n,s){var r=this._vb;if(ct.fillRectImgVb(r,this._clipRect,t,e,i,n,R.DEF_UV,this._curMat,this._x,this._y,0,0)){this._renderKey=0;var a=this._shader2D.fillStyle;s&&(this._shader2D.fillStyle=U.create(s));var o=this._shader2D,h=this._curSubmit.shaderValue;if(o.fillStyle!==h.fillStyle||o.ALPHA!==h.ALPHA){o.glTexture=null;var l=this._curSubmit=J.create(this,this._ib,r,(r._byteLength-64)/32*3,vt.create(2,0));l.shaderValue.color=o.fillStyle._color._color,l.shaderValue.ALPHA=o.ALPHA,this._submits[this._submits._length++]=l}this._curSubmit._numEle+=6,this._shader2D.fillStyle=a}},o.fillTexture=function(t,e,i,n,s,r,a,o){var h=this._vb,l=t.bitmap.width,u=t.bitmap.height,c=t.uv;if(l!=o.w||u!=o.h){switch(r){case"repeat":o.width=n,o.height=s;break;case"repeat-x":o.width=n,o.height=t.height>s?s:t.height;break;case"repeat-y":o.width=t.width>n?n:t.width,o.height=s;break;default:o.width=n,o.height=s}o.w=l,o.h=u,o.uv=[0,0,o.width/l,0,o.width/l,o.height/u,0,o.height/u]}if(ct.fillRectImgVb(h,this._clipRect,e,i,o.width,o.height,o.uv,this._curMat,this._x,this._y,0,0)){
|
||
this._renderKey=0;var _=this._curSubmit=J.create(this,this._ib,h,(h._byteLength-64)/32*3,vt.create(256,0));this._submits[this._submits._length++]=_;var d=_.shaderValue;d.textureHost=t;var f=c[0]*l,p=c[1]*u,g=(c[2]-c[0])*l,m=(c[5]-c[3])*u,v=-a.x/l,y=-a.y/u;d.u_TexRange[0]=f/l,d.u_TexRange[1]=g/l,d.u_TexRange[2]=p/u,d.u_TexRange[3]=m/u,d.u_offset[0]=v,d.u_offset[1]=y,_._renderType=10016,this._curSubmit._numEle+=6}},o.setShader=function(t){H.save(this,524288,this._shader2D,!0),this._shader2D.shader=t},o.setFilters=function(t){H.save(this,1048576,this._shader2D,!0),this._shader2D.filters=t,this._curSubmit=J.RENDERBASE,this._renderKey=0,this._drawCount++},o.drawTexture=function(t,e,i,n,s,r,a){this._drawTextureM(t,e,i,n,s,r,a,null,1)},o.addTextureVb=function(t,e,i){var n=this._curSubmit._vb||this._vb,s=n._byteLength>>2;n.byteLength=s+16<<2;for(var r=n.getFloat32Array(),a=0;16>a;a+=4)r[s++]=t[a]+e,r[s++]=t[a+1]+i,r[s++]=t[a+2],r[s++]=t[a+3];this._curSubmit._numEle+=6,this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle),n._upload=!0},o.willDrawTexture=function(t,e){if(!(t.loaded&&t.bitmap&&t.source))return this.sprite&&i.timer.callLater(this,this._repaintSprite),0;var n=t.bitmap,s=n.id+this._shader2D.ALPHA*e+10016;if(s==this._renderKey)return s;var r=this._shader2D,a=r.ALPHA,o=this._curSubmit.shaderValue;r.ALPHA*=e,this._renderKey=s,this._drawCount++,r.glTexture=n;var h=this._vb,l=null,u=h._byteLength/32*3;return l=At.create(this,this._ib,h,u,vt.create(1,0)),this._submits[this._submits._length++]=l,l.shaderValue.textureHost=t,l._renderType=10016,l._preIsSameTextureShader=10016===this._curSubmit._renderType&&r.ALPHA===o.ALPHA,this._curSubmit=l,r.ALPHA=a,s},o.drawTextures=function(t,n,s,r){if(!(t.loaded&&t.bitmap&&t.source))return void(this.sprite&&i.timer.callLater(this,this._repaintSprite));var a=this._clipRect;if(this._clipRect=e.MAXCLIPRECT,!this._drawTextureM(t,n[0],n[1],t.width,t.height,s,r,null,1))return void alert("drawTextures err");if(this._clipRect=a,A.drawCall+=n.length/2,!(n.length<4)){for(var o=this._curSubmit._vb||this._vb,h=this._curMat.a,l=this._curMat.d,u=2,c=n.length;c>u;u+=2)ct.copyPreImgVb(o,(n[u]-n[u-2])*h,(n[u+1]-n[u-1])*l),this._curSubmit._numEle+=6;this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle)}},o._drawTextureM=function(t,e,n,s,r,a,o,h,l){if(!(t.loaded&&t.bitmap&&t.source))return this.sprite&&i.timer.callLater(this,this._repaintSprite),!1;var u=this._curSubmit._vb||this._vb,c=t.bitmap;e+=a,n+=o,this._drawCount++;var _=c.id+this._shader2D.ALPHA*l+10016;if(_!=this._renderKey){this._renderKey=_;var d=this._curSubmit.shaderValue,f=this._shader2D,p=f.ALPHA;f.ALPHA*=l,f.glTexture=c;var g=this._vb,m=null,v=g._byteLength/32*3;m=At.create(this,this._ib,g,v,vt.create(1,0)),this._submits[this._submits._length++]=m,m.shaderValue.textureHost=t,m._renderType=10016,m._preIsSameTextureShader=10016===this._curSubmit._renderType&&f.ALPHA===d.ALPHA,this._curSubmit=m,u=this._curSubmit._vb||this._vb,f.ALPHA=p}return ct.fillRectImgVb(u,this._clipRect,e,n,s||t.width,r||t.height,t.uv,h||this._curMat,this._x,this._y,0,0)?(O.enabled&&!this._isMain&&this._curSubmit.addTexture(t,(u._byteLength>>2)-16),this._curSubmit._numEle+=6,this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle),!0):!1},o._repaintSprite=function(){this.sprite.repaint()},o._drawText=function(t,e,i,n,s,r,a,o,h,l){var u=t.bitmap;this._drawCount++;var c=u.id+this._shader2D.ALPHA+10016;if(c!=this._renderKey){this._renderKey=c;var _=this._curSubmit.shaderValue,d=this._shader2D;d.glTexture=u;var f=this._vb,p=null,g=f._byteLength/32*3;p=O.enabled?At.create(this,this._ib,f,g,vt.create(1,0)):At.create(this,this._ib,f,g,Vt.create()),p._preIsSameTextureShader=10016===this._curSubmit._renderType&&d.ALPHA===_.ALPHA,this._submits[this._submits._length++]=p,p.shaderValue.textureHost=t,p._renderType=10016,this._curSubmit=p}t.active();var m=this._curSubmit._vb||this._vb;ct.fillRectImgVb(m,this._clipRect,e+a,i+o,n||t.width,s||t.height,t.uv,r||this._curMat,this._x,this._y,h,l,!0)&&(O.enabled&&!this._isMain&&this._curSubmit.addTexture(t,(m._byteLength>>2)-16),this._curSubmit._numEle+=6,this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle))},o.drawTextureWithTransform=function(t,i,n,s,r,a,o,h,l){var u=this._curMat;(0!==o||0!==h)&&(this._x=o*u.a+h*u.c,this._y=h*u.d+o*u.b),a&&u.bTransform?(v.mul(a,u,e._tmpMatrix),a=e._tmpMatrix,a._checkTransform()):(this._x+=u.tx,this._y+=u.ty),this._drawTextureM(t,i,n,s,r,0,0,a,l),this._x=this._y=0},o.fillQuadrangle=function(t,e,i,n,s){var r=this._curSubmit,a=this._vb,o=this._shader2D,h=r.shaderValue;if(this._renderKey=0,t.bitmap){var l=t.bitmap;o.glTexture==l&&o.ALPHA===h.ALPHA||(o.glTexture=l,r=this._curSubmit=J.create(this,this._ib,a,a._byteLength/32*3,vt.create(1,0)),r.shaderValue.glTexture=l,this._submits[this._submits._length++]=r),ct.fillQuadrangleImgVb(a,e,i,n,t.uv,s||this._curMat,this._x,this._y)}else r.shaderValue.fillStyle&&r.shaderValue.fillStyle.equal(t)&&o.ALPHA===h.ALPHA||(o.glTexture=null,r=this._curSubmit=J.create(this,this._ib,a,a._byteLength/32*3,vt.create(2,0)),r.shaderValue.defines.add(2),r.shaderValue.fillStyle=U.create(t),this._submits[this._submits._length++]=r),ct.fillQuadrangleImgVb(a,e,i,n,R.DEF_UV,s||this._curMat,this._x,this._y);r._numEle+=6},o.drawTexture2=function(t,i,n,s,r,a,o,h){var l=this._curMat;if(this._x=t*l.a+i*l.c,this._y=i*l.d+t*l.b,r&&(l.bTransform||r.bTransform?(v.mul(r,l,e._tmpMatrix),r=e._tmpMatrix):(this._x+=r.tx+l.tx,this._y+=r.ty+l.ty,r=v.EMPTY)),1!==a||o){var u=this._shader2D.ALPHA,c=this._nBlendType;this._shader2D.ALPHA=a,o&&(this._nBlendType=W.TOINT(o)),this._drawTextureM(h[0],h[1]-n,h[2]-s,h[3],h[4],0,0,r,1),this._shader2D.ALPHA=u,this._nBlendType=c}else this._drawTextureM(h[0],h[1]-n,h[2]-s,h[3],h[4],0,0,r,1);this._x=this._y=0},o.drawCanvas=function(t,e,i,n,s){var r=t.context;if(this._renderKey=0,r._targets)this._submits[this._submits._length++]=Mt.create(r,0,null),this._curSubmit=J.RENDERBASE,r._targets.drawTo(this,e,i,n,s);else{var a=this._submits[this._submits._length++]=Mt.create(r,this._shader2D.ALPHA,this._shader2D.filters),o=n/t.width,h=s/t.height,l=a._matrix;this._curMat.copyTo(l),1!=o&&1!=h&&l.scale(o,h);var u=l.tx,c=l.ty;l.tx=l.ty=0,l.transformPoint(y.TEMP.setTo(e,i)),l.translate(y.TEMP.x+u,y.TEMP.y+c),this._curSubmit=J.RENDERBASE}_.showCanvasMark&&(this.save(),this.lineWidth=4,this.strokeStyle=r._targets?"yellow":"green",this.strokeRect(e-1,i-1,n+2,s+2,1),this.strokeRect(e,i,n,s,1),this.restore())},o.drawTarget=function(t,e,i,n,s,r,a,o,h,l){void 0===l&&(l=-1);var u=this._vb;if(ct.fillRectImgVb(u,this._clipRect,e,i,n,s,h||R.DEF_UV,r||this._curMat,this._x,this._y,0,0)){this._renderKey=0;var c=this._shader2D;c.glTexture=null;var _=(this._curSubmit.shaderValue,this._curSubmit=rt.create(this,this._ib,u,(u._byteLength-64)/32*3,o,a));-1==l?_.blendType=this._nBlendType:_.blendType=l,_.scope=t,this._submits[this._submits._length++]=_,this._curSubmit._numEle+=6}},o.transform=function(t,e,i,n,s,r){Y.save(this),v.mul(v.TEMP.setTo(t,e,i,n,s,r),this._curMat,this._curMat),this._curMat._checkTransform()},o.setTransformByMatrix=function(t){t.copyTo(this._curMat)},o.transformByMatrix=function(t){Y.save(this),v.mul(t,this._curMat,this._curMat),this._curMat._checkTransform()},o.rotate=function(t){Y.save(this),this._curMat.rotateEx(t)},o.scale=function(t,e){Y.save(this),this._curMat.scaleEx(t,e)},o.clipRect=function(t,e,i,n){i*=this._curMat.a,n*=this._curMat.d;var s=y.TEMP;this._curMat.transformPoint(s.setTo(t,e)),this._renderKey=0;var r=this._curSubmit=nt.create(this);this._submits[this._submits._length++]=r,r.submitIndex=this._submits._length,r.submitLength=9999999,z.save(this,r);var a=this._clipRect,o=a.x,h=a.y,l=s.x+i,u=s.y+n;o<s.x&&(a.x=s.x),h<s.y&&(a.y=s.y),a.width=Math.min(l,o+a.width)-a.x,a.height=Math.min(u,h+a.height)-a.y,this._shader2D.glTexture=null,r.clipRect.copyFrom(a),this._curSubmit=J.RENDERBASE},o.setIBVB=function(t,e,i,n,s,r,a,o,h,l,u){if(void 0===h&&(h=0),void 0===l&&(l=0),void 0===u&&(u=0),null===i){if(w.isFlash){var c=n;c._selfIB||(c._selfIB=Ht.create(35044)),c._selfIB.clear(),i=c._selfIB}else i=this._ib;ct.expandIBQuadrangle(i,n.byteLength/(4*n.vertexStride*4))}if(!o||!a)throw Error("setIBVB must input:shader shaderValues");var _=it.create(this,n,i,s,a,o,h,l,u);r||(r=v.EMPTY),r.translate(t,e),v.mul(r,this._curMat,_._mat),r.translate(-t,-e),this._submits[this._submits._length++]=_,this._curSubmit=J.RENDERBASE,this._renderKey=0},o.addRenderObject=function(t){this._submits[this._submits._length++]=t},o.fillTrangles=function(t,e,i,n,s){var r=this._curSubmit,a=this._vb,o=this._shader2D,h=r.shaderValue,l=n.length>>4,u=t.bitmap;this._renderKey=0,o.glTexture==u&&o.ALPHA===h.ALPHA||(r=this._curSubmit=J.create(this,this._ib,a,a._byteLength/32*3,vt.create(1,0)),r.shaderValue.textureHost=t,this._submits[this._submits._length++]=r),ct.fillTranglesVB(a,e,i,n,s||this._curMat,this._x,this._y),r._numEle+=6*l},o.submitElement=function(t,e){var i=this._submits;for(0>e&&(e=i._length);e>t;)t+=i[t].renderSubmit()},o.finish=function(){ft.mainContext.finish()},o.flush=function(){var t=Math.max(this._vb.byteLength/64,this._maxNumEle/6)+8;if(t>this._ib.bufferLength/12&&ct.expandIBQuadrangle(this._ib,t),!this._isMain&&O.enabled&&O._atlasRestore>this._atlasResourceChange){this._atlasResourceChange=O._atlasRestore;for(var e=this._submits,i=0,n=e._length;n>i;i++){var s=e[i];10016===s.getRenderType()&&s.checkTexture()}}return this.submitElement(0,this._submits._length),this._path&&this._path.reset(),Q.instance&&Q.getInstance().reset(),this._curSubmit=J.RENDERBASE,this._renderKey=0,this._submits._length},o.setPathId=function(t){if(this.mId=t,-1!=this.mId){this.mHaveKey=!1;var e=E.getInstance();e.shapeDic[this.mId]&&(this.mHaveKey=!0),this.mHaveLineKey=!1,e.shapeLineDic[this.mId]&&(this.mHaveLineKey=!0)}},o.movePath=function(t,e){this.mX+=t,this.mY+=e},o.beginPath=function(){var t=this._getPath();t.tempArray.length=0,t.closePath=!1,this.mX=0,this.mY=0},o.closePath=function(){this._path.closePath=!0},o.fill=function(t){void 0===t&&(t=!1);var e=this._getPath();this.drawPoly(0,0,e.tempArray,this.fillStyle._color.numColor,0,0,t)},o.stroke=function(){var t=this._getPath();if(this.lineWidth>0){if(-1==this.mId)t.drawLine(0,0,t.tempArray,this.lineWidth,this.strokeStyle._color.numColor);else if(this.mHaveLineKey){var e=E.getInstance().shapeLineDic[this.mId];t.setGeomtry(e)}else E.getInstance().addLine(this.mId,t.drawLine(0,0,t.tempArray,this.lineWidth,this.strokeStyle._color.numColor));t.update();var i=_t.getMatrArray();_t.mat2MatArray(this._curMat,i);var n=[this.mX,this.mY],s=J.createShape(this,t.ib,t.vb,t.count,t.offset,vt.create(4,0));s.shaderValue.ALPHA=this._shader2D.ALPHA,s.shaderValue.u_pos=n,s.shaderValue.u_mmat2=i,this._submits[this._submits._length++]=s}},o.line=function(t,e,i,n,s,r){var a=this._curSubmit,o=this._vb;if(ct.fillLineVb(o,this._clipRect,t,e,i,n,s,r)){this._renderKey=0;var h=this._shader2D,l=a.shaderValue;h.strokeStyle===l.strokeStyle&&h.ALPHA===l.ALPHA||(h.glTexture=null,a=this._curSubmit=J.create(this,this._ib,o,(o._byteLength-64)/32*3,vt.create(2,0)),a.shaderValue.strokeStyle=h.strokeStyle,a.shaderValue.mainID=2,a.shaderValue.ALPHA=h.ALPHA,this._submits[this._submits._length++]=a),a._numEle+=6}},o.moveTo=function(t,e){var i=this._getPath();i.addPoint(t,e)},o.lineTo=function(t,e){var i=this._getPath();i.addPoint(t,e)},o.arcTo=function(t,e,i,n,s){if(-1==this.mId||!this.mHaveKey){var r=this._getPath(),a=r.getEndPointX(),o=r.getEndPointY(),h=NaN,l=NaN,u=NaN,c=NaN,_=NaN,d=NaN,f=NaN,p=NaN,g=NaN,m=NaN,v=!1;h=a-t,l=o-e,u=i-t,c=n-e,y.TEMP.setTo(h,l),y.TEMP.normalize(),h=y.TEMP.x,l=y.TEMP.y,y.TEMP.setTo(u,c),y.TEMP.normalize(),u=y.TEMP.x,c=y.TEMP.y,_=Math.acos(h*u+l*c);var x=Math.tan(_/2);if(d=s/x,d>1e4)return void this.lineTo(t,e);0>=h*c-u*l?(f=t+h*d+l*s,p=e+l*d-h*s,g=Math.atan2(h,-l),m=Math.atan2(-u,c),v=!1):(f=t+h*d-l*s,p=e+l*d+h*s,g=Math.atan2(-h,l),m=Math.atan2(u,-c),v=!0),this.arc(f,p,s,g,m,v)}},o.arc=function(t,e,i,n,s,r){if(void 0===r&&(r=!1),-1!=this.mId){if(this.mHaveKey)return;t=0,e=0}var a=0,o=0,h=0,l=0,u=0,c=0,_=0,d=0,f=0,p=0,g=0;if(o=s-n,r)if(Math.abs(o)>=2*Math.PI)o=2*-Math.PI;else for(;o>0;)o-=2*Math.PI;else if(Math.abs(o)>=2*Math.PI)o=2*Math.PI;else for(;0>o;)o+=2*Math.PI;p=101>i?Math.max(10,o*i/5):201>i?Math.max(10,o*i/20):Math.max(10,o*i/40),h=o/p/2,l=Math.abs(4/3*(1-Math.cos(h))/Math.sin(h)),r&&(l=-l),g=0;var m=this._getPath();for(f=0;p>=f;f++)a=n+o*(f/p),u=Math.cos(a),c=Math.sin(a),_=t+u*i,d=e+c*i,_==this._path.getEndPointX()&&d==this._path.getEndPointY()||m.addPoint(_,d);u=Math.cos(s),c=Math.sin(s),_=t+u*i,d=e+c*i,_==this._path.getEndPointX()&&d==this._path.getEndPointY()||m.addPoint(_,d)},o.quadraticCurveTo=function(t,e,i,n){for(var s=h.I,r=s.getBezierPoints([this._path.getEndPointX(),this._path.getEndPointY(),t,e,i,n],30,2),a=0,o=r.length/2;o>a;a++)this.lineTo(r[2*a],r[2*a+1]);this.lineTo(i,n)},o.rect=function(t,e,i,n){this._other=this._other.make(),this._other.path||(this._other.path=new V),this._other.path.rect(t,e,i,n)},o.strokeRect=function(t,e,i,n,s){var r=.5*s;this.line(t-r,e,t+i+r,e,s,this._curMat),this.line(t+i,e,t+i,e+n,s,this._curMat),this.line(t,e,t,e+n,s,this._curMat),this.line(t-r,e+n,t+i+r,e+n,s,this._curMat)},o.clip=function(){},o.drawPoly=function(t,e,i,n,s,r,a){void 0===a&&(a=!1),this._renderKey=0,this._shader2D.glTexture=null;var o=this._getPath();if(-1==this.mId)o.polygon(t,e,i,n,s?s:1,r);else if(this.mHaveKey){var h=E.getInstance().shapeDic[this.mId];o.setGeomtry(h)}else E.getInstance().addShape(this.mId,o.polygon(t,e,i,n,s?s:1,r));o.update();var l=[this.mX,this.mY],u=_t.getMatrArray();_t.mat2MatArray(this._curMat,u);var c;if(!a){var _=st.create(4);this.addRenderObject(_),c=J.createShape(this,o.ib,o.vb,o.count,o.offset,vt.create(4,0)),c.shaderValue.ALPHA=this._shader2D.ALPHA,c.shaderValue.u_pos=l,c.shaderValue.u_mmat2=u,this._submits[this._submits._length++]=c,_=st.create(5),this.addRenderObject(_)}if(c=J.createShape(this,o.ib,o.vb,o.count,o.offset,vt.create(4,0)),c.shaderValue.ALPHA=this._shader2D.ALPHA,c.shaderValue.u_pos=l,c.shaderValue.u_mmat2=u,this._submits[this._submits._length++]=c,a||(_=st.create(3),this.addRenderObject(_)),s>0){if(this.mHaveLineKey){var d=E.getInstance().shapeLineDic[this.mId];o.setGeomtry(d)}else E.getInstance().addShape(this.mId,o.drawLine(t,e,i,s,r));o.update(),c=J.createShape(this,o.ib,o.vb,o.count,o.offset,vt.create(4,0)),c.shaderValue.ALPHA=this._shader2D.ALPHA,c.shaderValue.u_mmat2=u,this._submits[this._submits._length++]=c}},o.drawParticle=function(t,e,i){i.x=t,i.y=e,this._submits[this._submits._length++]=i},o._getPath=function(){return this._path||(this._path=new V)},r(0,o,"globalCompositeOperation",function(){return W.NAMES[this._nBlendType]},function(t){var e=W.TOINT[t];null==e||this._nBlendType===e||(H.save(this,65536,this,!0),this._curSubmit=J.RENDERBASE,this._renderKey=0,this._nBlendType=e)}),r(0,o,"strokeStyle",function(){return this._shader2D.strokeStyle},function(t){this._shader2D.strokeStyle.equal(t)||(H.save(this,512,this._shader2D,!1),this._shader2D.strokeStyle=U.create(t))}),r(0,o,"globalAlpha",function(){return this._shader2D.ALPHA},function(t){t=Math.floor(1e3*t)/1e3,t!=this._shader2D.ALPHA&&(H.save(this,1,this._shader2D,!0),this._shader2D.ALPHA=t)}),r(0,o,"asBitmap",null,function(t){if(t){if(this._targets||(this._targets=new $),this._targets.repaint=!0,!this._width||!this._height)throw Error("asBitmap no size!");this._targets.size(this._width,this._height)}else this._targets=null}),r(0,o,"fillStyle",function(){return this._shader2D.fillStyle},function(t){this._shader2D.fillStyle.equal(t)||(H.save(this,2,this._shader2D,!1),this._shader2D.fillStyle=U.create(t))}),r(0,o,"textAlign",function(){return this._other.textAlign},function(t){this._other.textAlign===t||(this._other=this._other.make(),H.save(this,32768,this._other,!1),this._other.textAlign=t)}),r(0,o,"lineWidth",function(){return this._other.lineWidth},function(t){this._other.lineWidth===t||(this._other=this._other.make(),H.save(this,256,this._other,!1),this._other.lineWidth=t)}),r(0,o,"textBaseline",function(){return this._other.textBaseline},function(t){this._other.textBaseline===t||(this._other=this._other.make(),H.save(this,16384,this._other,!1),this._other.textBaseline=t)}),r(0,o,"font",null,function(t){t!=this._other.font.toString()&&(this._other=this._other.make(),H.save(this,8,this._other,!1),this._other.font===lt.EMPTY?this._other.font=new lt(t):this._other.font.setFont(t))}),e.__init__=function(){a.DEFAULT=new a},e._SUBMITVBSIZE=32e3,e._MAXSIZE=99999999,e._RECTVBSIZE=16,e.MAXCLIPRECT=new x(0,0,99999999,99999999),e._COUNT=0,e._tmpMatrix=new v,n(e,["_fontTemp",function(){return this._fontTemp=new lt},"_drawStyleTemp",function(){return this._drawStyleTemp=new U(null)}]),e.__init$=function(){a=function(){function t(){this.lineWidth=1,this.path=null,this.textAlign=null,this.textBaseline=null,this.font=lt.EMPTY}s(t,"");var e=t.prototype;return e.clear=function(){this.lineWidth=1,this.path&&this.path.clear(),this.textAlign=this.textBaseline=null,this.font=lt.EMPTY},e.make=function(){return this===t.DEFAULT?new t:this},t.DEFAULT=null,t}()},e}(d),vt=function(t){function e(t,i){this.size=[0,0],this.alpha=1,this.ALPHA=1,this.subID=0,this._cacheID=0,e.__super.call(this),this.defines=new bt,this.position=e._POSITION,this.mainID=t,this.subID=i,this.textureHost=null,this.texture=null,this.fillStyle=null,this.color=null,this.strokeStyle=null,this.colorAdd=null,this.glTexture=null,this.u_mmat2=null,this._cacheID=t|i,this._inClassCache=e._cache[this._cacheID],t>0&&!this._inClassCache&&(this._inClassCache=e._cache[this._cacheID]=[],this._inClassCache._length=0),this.clear()}s(e,"laya.webgl.shader.d2.value.Value2D",t);var i=e.prototype;return i.setValue=function(t){},i.refresh=function(){var t=this.size;return t[0]=_t.width,t[1]=_t.height,this.alpha=this.ALPHA*_t.worldAlpha,this.mmat=_t.worldMatrix4,this},i._ShaderWithCompile=function(){return Lt.withCompile2D(0,this.mainID,this.defines.toNameDic(),this.mainID|this.defines._value,Wt.create)},i._withWorldShaderDefines=function(){var t=_t.worldShaderDefines,e=Lt.sharders[this.mainID|this.defines._value|t.getValue()];if(!e){var i,n,s={};i=this.defines.toNameDic();for(n in i)s[n]="";i=t.toNameDic();for(n in i)s[n]="";e=Lt.withCompile2D(0,this.mainID,s,this.mainID|this.defines._value|t.getValue(),Wt.create)}var r=_t.worldFilters;if(!r)return e;for(var a,o=r.length,h=0;o>h;h++)(a=r[h])&&a.action.setValue(this);return e},i.upload=function(){var t=_t;this.alpha=this.ALPHA*t.worldAlpha,_t.worldMatrix4!==_t.TEMPMAT4_ARRAY&&this.defines.add(128);var e,i=t.worldShaderDefines?this._withWorldShaderDefines():Lt.sharders[this.mainID|this.defines._value]||this._ShaderWithCompile();this.size[0]=t.width,this.size[1]=t.height,this.mmat=t.worldMatrix4,Lt.activeShader!==i?(i._shaderValueWidth!==t.width||i._shaderValueHeight!==t.height?(i._shaderValueWidth=t.width,i._shaderValueHeight=t.height):e=i._params2dQuick2||i._make2dQuick2(),i.upload(this,e)):(i._shaderValueWidth!==t.width||i._shaderValueHeight!==t.height?(i._shaderValueWidth=t.width,i._shaderValueHeight=t.height):e=i._params2dQuick1||i._make2dQuick1(),i.upload(this,e))},i.setFilters=function(t){if(this.filters=t,t)for(var e,i=t.length,n=0;i>n;n++)e=t[n],e&&(this.defines.add(e.type),e.action.setValue(this))},i.clear=function(){this.defines.setValue(this.subID)},i.release=function(){this._inClassCache[this._inClassCache._length++]=this,this.fillStyle=null,this.strokeStyle=null,this.clear()},e._initone=function(t,i){e._typeClass[t]=i,e._cache[t]=[],e._cache[t]._length=0},e.__init__=function(){e._POSITION=[2,5126,!1,4*ut.BYTES_PE,0],e._TEXCOORD=[2,5126,!1,4*ut.BYTES_PE,2*ut.BYTES_PE],e._initone(2,Et),e._initone(4,Bt),e._initone(256,Dt),e._initone(512,It),e._initone(1,Ft),e._initone(65,Vt),e._initone(9,Ft)},e.create=function(t,i){var n=e._cache[t|i];return n._length?n[--n._length]:new e._typeClass[t|i](i)},e._POSITION=null,e._TEXCOORD=null,e._cache=[],e._typeClass=[],e.TEMPMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e}(B),yt=function(t){function e(t,i){e.__super.call(this,t,i)}s(e,"laya.webgl.utils.RenderSprite3D",t);var i=e.prototype;return i.onCreate=function(t){switch(t){case 32:return void(this._fun=this._blend);case 4:return void(this._fun=this._transform)}},i._blend=function(t,e,i,n){var s,r,a=t._style,o=this._next,h=t.mask;if(e.ctx.save(),h){var l=e.ctx.globalCompositeOperation,u=new x;if(u.copyFrom(h.getBounds()),u.width>0&&u.height>0){var c=et.create();c.addValue("bounds",u),s=tt.create([c,e],laya.webgl.utils.RenderSprite3D.tmpTarget),e.addRenderObject(s),h.render(e,-u.x,-u.y),s=tt.create([c],laya.webgl.utils.RenderSprite3D.endTmpTarget),e.addRenderObject(s),e.ctx.save(),e.clipRect(i+u.x,n+u.y,u.width,u.height),o._fun.call(o,t,e,i,n),e.ctx.restore(),r=st.create(6),l=e.ctx.globalCompositeOperation,r.blendMode="mask",e.addRenderObject(r),v.TEMP.identity();var _=vt.create(1,0);e.ctx.drawTarget(c,i+u.x,n+u.y,u.width,u.height,v.TEMP,"tmpTarget",_,R.INV_UV,6),s=tt.create([c],laya.webgl.utils.RenderSprite3D.recycleTarget),e.addRenderObject(s),r=st.create(6),r.blendMode=l,e.addRenderObject(r)}}else e.ctx.globalCompositeOperation=a.blendMode,o=this._next,o._fun.call(o,t,e,i,n);e.ctx.restore()},i._transform=function(t,e,i,n){"use strict";var s=t.transform,r=this._next;if(s&&r!=b.NORENDER){var a=e.ctx;t._style;s.tx=i,s.ty=n;var o=a._getTransformMatrix(),h=o.clone();v.mul(s,o,o),o._checkTransform(),r._fun.call(r,t,e,0,0),h.copyTo(o),h.destroy(),s.tx=s.ty=0}else r._fun.call(r,t,e,i,n)},e.tmpTarget=function(t,e){var i=t.getValue("bounds"),n=Pt.create(i.width,i.height);n.start(),n.clear(0,0,0,0),t.addValue("tmpTarget",n)},e.endTmpTarget=function(t){var e=t.getValue("tmpTarget");e.end()},e.recycleTarget=function(t){var e=t.getValue("tmpTarget");e.recycle(),t.recycle()},e}(b),xt=function(t){function e(){this.data=null,e.__super.call(this)}s(e,"laya.filters.webgl.ColorFilterActionGL",t);var n=e.prototype;return i.imps(n,{"laya.filters.IFilterActionGL":!0}),n.setValue=function(t){t.colorMat=this.data._mat,t.colorAlpha=this.data._alpha},n.apply3d=function(t,e,i,n,s){var r=t.getValue("bounds"),a=vt.create(1,0);a.setFilters([this.data]);var o=v.EMPTY;o.identity(),i.ctx.drawTarget(t,0,0,r.width,r.height,o,"src",a)},e}(F),wt=function(t){function e(t,i,n,s,r){this._atlasCanvas=null,this._inAtlasTextureKey=null,this._inAtlasTextureBitmapValue=null,this._inAtlasTextureOriUVValue=null,this._InAtlasWebGLImagesKey=null,this._InAtlasWebGLImagesOffsetValue=null,e.__super.call(this,t,i,r),this._inAtlasTextureKey=[],this._inAtlasTextureBitmapValue=[],this._inAtlasTextureOriUVValue=[],this._InAtlasWebGLImagesKey=[],this._InAtlasWebGLImagesOffsetValue=[],this._atlasCanvas=new kt,this._atlasCanvas.width=n,this._atlasCanvas.height=s,this._atlasCanvas.activeResource(),this._atlasCanvas.lock=!0}s(e,"laya.webgl.atlas.Atlaser",t);var i=e.prototype;return i.computeUVinAtlasTexture=function(t,e,i,n){var s=O.atlasTextureWidth,r=O.atlasTextureHeight,a=i/s,o=n/r,h=(i+t.bitmap.width)/s,l=(n+t.bitmap.height)/r,u=t.bitmap.width/s,c=t.bitmap.height/r;t.uv=[a+e[0]*u,o+e[1]*c,h-(1-e[2])*u,o+e[3]*c,h-(1-e[4])*u,l-(1-e[5])*c,a+e[6]*u,l-(1-e[7])*c]},i.addToAtlasTexture=function(t,e,i){t instanceof laya.webgl.resource.WebGLImage&&(this._InAtlasWebGLImagesKey.push(t),this._InAtlasWebGLImagesOffsetValue.push([e,i])),this._atlasCanvas.texSubImage2D(e,i,t.atlasSource),t.clearAtlasSource()},i.addToAtlas=function(t,e,i){var n=t.uv.slice(),s=t.bitmap;this._inAtlasTextureKey.push(t),this._inAtlasTextureOriUVValue.push(n),this._inAtlasTextureBitmapValue.push(s),this.computeUVinAtlasTexture(t,n,e,i),t.bitmap=this._atlasCanvas},i.clear=function(){for(var t=0,e=this._inAtlasTextureKey.length;e>t;t++)this._inAtlasTextureKey[t].bitmap=this._inAtlasTextureBitmapValue[t],this._inAtlasTextureKey[t].uv=this._inAtlasTextureOriUVValue[t],this._inAtlasTextureKey[t].bitmap.lock=!1,this._inAtlasTextureKey[t].bitmap.releaseResource();this._inAtlasTextureKey.length=0,this._inAtlasTextureBitmapValue.length=0,this._inAtlasTextureOriUVValue.length=0,this._InAtlasWebGLImagesKey.length=0,this._InAtlasWebGLImagesOffsetValue.length=0},i.dispose=function(){this.clear(),this._atlasCanvas.dispose()},r(0,i,"InAtlasWebGLImagesOffsetValue",function(){return this._InAtlasWebGLImagesOffsetValue}),r(0,i,"texture",function(){return this._atlasCanvas}),r(0,i,"inAtlasWebGLImagesKey",function(){return this._InAtlasWebGLImagesKey}),e}(k),bt=function(t){function e(){e.__super.call(this,e.__name2int,e.__int2name,e.__int2nameMap)}return s(e,"laya.webgl.shader.d2.ShaderDefines2D",t),e.__init__=function(){e.reg("TEXTURE2D",1),e.reg("COLOR2D",2),e.reg("PRIMITIVE",4),e.reg("GLOW_FILTER",8),e.reg("BLUR_FILTER",16),e.reg("COLOR_FILTER",32),e.reg("COLOR_ADD",64),e.reg("WORLDMAT",128),e.reg("FILLTEXTURE",256)},e.reg=function(t,i){j._reg(t,i,e.__name2int,e.__int2name)},e.toText=function(t,e,i){return j._toText(t,e,i)},e.toInt=function(t){return j._toInt(t,e.__name2int)},e.TEXTURE2D=1,e.COLOR2D=2,e.PRIMITIVE=4,e.FILTERGLOW=8,e.FILTERBLUR=16,e.FILTERCOLOR=32,e.COLORADD=64,e.WORLDMAT=128,e.FILLTEXTURE=256,e.SKINMESH=512,e.__name2int={},e.__int2name=[],e.__int2nameMap=[],e}(j),Tt=(function(t){function e(t,i,n,s,r,a,o){e.__super.call(this,t,i,n,s,40,r,a,o)}return s(e,"laya.webgl.shapes.Ellipse",t),e}(Z),function(t){function e(t,i,n,s,r){this._points=[];for(var a=NaN,o=NaN,h=-1,l=-1,u=n.length/2,c=0;u>c;c++)a=n[2*c],o=n[2*c+1],(Math.abs(h-a)>.01||Math.abs(l-o)>.01)&&this._points.push(a,o),h=a,l=o;e.__super.call(this,t,i,0,0,0,r,s,r,0)}s(e,"laya.webgl.shapes.Line",t);var i=e.prototype;return i.getData=function(t,e,i){var n=[],s=[];this.borderWidth>0&&this.createLine2(this._points,n,this.borderWidth,i,s,this._points.length/2),t.append(new Uint16Array(n)),e.append(new Float32Array(s))},e}(Z)),St=function(t){function e(t,i,n,s,r){this._points=[];for(var a=NaN,o=NaN,h=-1,l=-1,u=n.length/2-1,c=0;u>c;c++)a=n[2*c],o=n[2*c+1],(Math.abs(h-a)>.01||Math.abs(l-o)>.01)&&this._points.push(a,o),h=a,l=o;a=n[2*u],o=n[2*u+1],h=this._points[0],l=this._points[1],(Math.abs(h-a)>.01||Math.abs(l-o)>.01)&&this._points.push(a,o),e.__super.call(this,t,i,0,0,this._points.length/2,0,s,r)}s(e,"laya.webgl.shapes.LoopLine",t);var i=e.prototype;return i.getData=function(t,e,i){if(this.borderWidth>0){for(var n=this.color,s=(n>>16&255)/255,r=(n>>8&255)/255,a=(255&n)/255,o=[],h=0,l=0,u=[],c=Math.floor(this._points.length/2),_=0;c>_;_++)h=this._points[2*_],l=this._points[2*_+1],o.push(this.x+h,this.y+l,s,r,a);this.createLoopLine(o,u,this.borderWidth,i+o.length/5),t.append(new Uint16Array(u)),e.append(new Float32Array(o))}},i.createLoopLine=function(t,e,i,n,s,r){var a=(t.length/5,t.concat()),o=s?s:t,h=this.borderColor,l=(h>>16&255)/255,u=(h>>8&255)/255,c=(255&h)/255,_=[a[0],a[1]],d=[a[a.length-5],a[a.length-4]],f=d[0]+.5*(_[0]-d[0]),p=d[1]+.5*(_[1]-d[1]);a.unshift(f,p,0,0,0),a.push(f,p,0,0,0);var g,m,v,y,x,w,b,T,S,C,M,A,L,P,R,I,E,D,F,B,k,O=a.length/5,N=n,W=i/2;v=a[0],y=a[1],x=a[5],w=a[6],S=-(y-w),C=v-x,k=Math.sqrt(S*S+C*C),S=S/k*W,C=C/k*W,o.push(v-S,y-C,l,u,c,v+S,y+C,l,u,c);for(var U=1;O-1>U;U++)v=a[5*(U-1)],y=a[5*(U-1)+1],x=a[5*U],w=a[5*U+1],b=a[5*(U+1)],T=a[5*(U+1)+1],S=-(y-w),C=v-x,k=Math.sqrt(S*S+C*C),S=S/k*W,C=C/k*W,M=-(w-T),A=x-b,k=Math.sqrt(M*M+A*A),M=M/k*W,A=A/k*W,L=-C+y-(-C+w),P=-S+x-(-S+v),R=(-S+v)*(-C+w)-(-S+x)*(-C+y),I=-A+T-(-A+w),E=-M+x-(-M+b),D=(-M+b)*(-A+w)-(-M+x)*(-A+T),F=L*E-I*P,Math.abs(F)<.1?(F+=10.1,o.push(x-S,w-C,l,u,c,x+S,w+C,l,u,c)):(g=(P*D-E*R)/F,m=(I*R-L*D)/F,B=(g-x)*(g-x)+(m-w)+(m-w),o.push(g,m,l,u,c,x-(g-x),w-(m-w),l,u,c));r&&(e=r);var V=this.edges+1;for(U=1;V>U;U++)e.push(N+2*(U-1),N+2*(U-1)+1,N+2*U+1,N+2*U+1,N+2*U,N+2*(U-1));return e.push(N+2*(U-1),N+2*(U-1)+1,N+1,N+1,N,N+2*(U-1)),o},e}(Z),Ct=function(t){function e(t,i,n,s,r,a){this._points=null,this._start=-1,this.mUint16Array=null,this.mFloat32Array=null,this._points=n.slice(0,n.length),e.__super.call(this,t,i,0,0,this._points.length/2,s,r,a)}s(e,"laya.webgl.shapes.Polygon",t);var i=e.prototype;return i.getData=function(t,e,i){var n,s=0,r=this._points,a=0;if(this.mUint16Array&&this.mFloat32Array){if(this._start!=i){for(this._start=i,n=[],a=Math.floor(r.length/2),s=2;a>s;s++)n.push(i,i+s-1,i+s);this.mUint16Array=new Uint16Array(n)}}else{this._start=i,n=[];var o=[],h=this.color,l=(h>>16&255)/255,u=(h>>8&255)/255,c=(255&h)/255;for(a=Math.floor(r.length/2),s=0;a>s;s++)o.push(this.x+r[2*s],this.y+r[2*s+1],l,u,c);for(s=2;a>s;s++)n.push(i,i+s-1,i+s);this.mUint16Array=new Uint16Array(n),this.mFloat32Array=new Float32Array(o)}t.append(this.mUint16Array),e.append(this.mFloat32Array)},e}(Z),Mt=function(t){function e(){this._matrix=new v,this._matrix4=ut.defaultMatrix4.concat(),e.__super.call(this,1e4),this.shaderValue=new vt(0,0)}s(e,"laya.webgl.submit.SubmitCanvas",t);var i=e.prototype;return i.renderSubmit=function(){if(this._ctx_src._targets)return this._ctx_src._targets.flush(this._ctx_src),1;var t=_t.worldAlpha,e=_t.worldMatrix4,i=_t.worldMatrix,n=_t.worldFilters,s=_t.worldShaderDefines,r=this.shaderValue,a=this._matrix,o=this._matrix4,h=v.TEMP;return v.mul(a,i,h),o[0]=h.a,o[1]=h.b,o[4]=h.c,o[5]=h.d,o[12]=h.tx,o[13]=h.ty,_t.worldMatrix=h.clone(),_t.worldMatrix4=o,_t.worldAlpha=_t.worldAlpha*r.alpha,r.filters&&r.filters.length&&(_t.worldFilters=r.filters,_t.worldShaderDefines=r.defines),this._ctx_src.flush(),_t.worldAlpha=t,_t.worldMatrix4=e,_t.worldMatrix.destroy(),_t.worldMatrix=i,_t.worldFilters=n,_t.worldShaderDefines=s,1},i.releaseRender=function(){var t=e._cache;t[t._length++]=this},i.getRenderType=function(){return 10003},e.create=function(t,i,n){var s=e._cache._length?e._cache[--e._cache._length]:new e;s._ctx_src=t;var r=s.shaderValue;return r.alpha=i,r.defines.setValue(0),n&&n.length&&r.setFilters(n),s},e._cache=(e._cache=[],e._cache._length=0,e._cache),e}(J),At=function(t){function e(t){this._preIsSameTextureShader=!1,this._isSameTexture=!0,this._texs=new Array,this._texsID=new Array,this._vbPos=new Array,void 0===t&&(t=1e4),e.__super.call(this,t)}s(e,"laya.webgl.submit.SubmitTexture",t);var i=e.prototype;return i.releaseRender=function(){var t=e._cache;t[t._length++]=this,this.shaderValue.release(),this._preIsSameTextureShader=!1,this._vb=null,this._texs.length=0,this._isSameTexture=!0},i.addTexture=function(t,e){this._texsID[this._texs.length]=t._uvID,this._texs.push(t),this._vbPos.push(e)},i.checkTexture=function(){if(this._texs.length<1)return void(this._isSameTexture=!0);var t=this.shaderValue.textureHost,e=t.bitmap;if(null!==e)for(var i=this._vb.getFloat32Array(),n=0,s=this._texs.length;s>n;n++){var r=this._texs[n];r.active();var a=r.uv;if(this._texsID[n]!==r._uvID){this._texsID[n]=r._uvID;var o=this._vbPos[n];i[o+2]=a[0],i[o+3]=a[1],i[o+6]=a[2],i[o+7]=a[3],i[o+10]=a[4],i[o+11]=a[5],i[o+14]=a[6],i[o+15]=a[7],this._vb.setNeedUpload()}r.bitmap!==e&&(this._isSameTexture=!1)}},i.renderSubmit=function(){if(0===this._numEle)return 1;var t=this.shaderValue.textureHost;if(t){var i=t.source;if(!t.bitmap||!i)return e._shaderSet=!1,1;this.shaderValue.texture=i}this._vb.bind_upload(this._ib);var n=ft.mainContext;if(W.activeBlendFunction!==this._blendFn&&(n.enable(3042),this._blendFn(n),W.activeBlendFunction=this._blendFn),A.drawCall++,A.trianglesFaces+=this._numEle/3,this._preIsSameTextureShader&&Lt.activeShader&&e._shaderSet?Lt.activeShader.uploadTexture2D(this.shaderValue.texture):this.shaderValue.upload(),e._shaderSet=!0,this._texs.length>1&&!this._isSameTexture)for(var s=t.bitmap,r=0,a=Lt.activeShader,o=0,h=this._texs.length;h>o;o++){var l=this._texs[o];l.bitmap===s&&o+1!==h||(a.uploadTexture2D(l.source),n.drawElements(4,6*(o-r+1),5123,this._startIdx+6*r*ut.BYTES_PIDX),s=l.bitmap,r=o)}else n.drawElements(4,this._numEle,5123,this._startIdx);return 1},e.create=function(t,i,n,s,r){var a=e._cache._length?e._cache[--e._cache._length]:new e;null==n&&(n=a._selfVb||(a._selfVb=zt.create(-1)),n.clear(),s=0),a._ib=i,a._vb=n,a._startIdx=s*ut.BYTES_PIDX,a._numEle=0;var o=t._nBlendType;
|
||
a._blendFn=t._targets?W.targetFns[o]:W.fns[o],a.shaderValue=r,a.shaderValue.setValue(t._shader2D);var h=t._shader2D.filters;return h&&a.shaderValue.setFilters(h),a},e._cache=(e._cache=[],e._cache._length=0,e._cache),e._shaderSet=!0,e}(J),Lt=function(t){function e(t,i,n,s){if(this.customCompile=!1,this._curActTexIndex=0,this.tag={},this._program=null,this._params=null,this._paramsMap={},this._offset=0,e.__super.call(this),!t||!i)throw"Shader Error";(w.isConchApp||w.isFlash)&&(this.customCompile=!0),this._id=++e._count,this._vs=t,this._ps=i,this._nameMap=s?s:{},null!=n&&(e.sharders[n]=this)}s(e,"laya.webgl.shader.Shader",t);var i=e.prototype;return i.recreateResource=function(){this.startCreate(),this._compile(),this.completeCreate(),this.memorySize=0},i.detoryResource=function(){ft.mainContext.deleteShader(this._vshader),ft.mainContext.deleteShader(this._pshader),ft.mainContext.deleteProgram(this._program),this._vshader=this._pshader=this._program=null,this._params=null,this._paramsMap={},this.memorySize=0,this._curActTexIndex=0},i._compile=function(){if(this._vs&&this._ps&&!this._params){this._reCompile=!0,this._params=[];var t,i=[this._vs,this._ps];this.customCompile&&(t=this._preGetParams(this._vs,this._ps));var n=ft.mainContext;if(this._program=n.createProgram(),this._vshader=e._createShader(n,i[0],35633),this._pshader=e._createShader(n,i[1],35632),n.attachShader(this._program,this._vshader),n.attachShader(this._program,this._pshader),n.linkProgram(this._program),!this.customCompile&&!n.getProgramParameter(this._program,35714))throw n.getProgramInfoLog(this._program);var s,r,a=0,o=0,h=this.customCompile?t.attributes.length:n.getProgramParameter(this._program,35721);for(a=0;h>a;a++){var l=this.customCompile?t.attributes[a]:n.getActiveAttrib(this._program,a);r=n.getAttribLocation(this._program,l.name),s={vartype:"attribute",ivartype:0,attrib:l,location:r,name:l.name,type:l.type,isArray:!1,isSame:!1,preValue:null,indexOfParams:0},this._params.push(s)}var u=this.customCompile?t.uniforms.length:n.getProgramParameter(this._program,35718);for(a=0;u>a;a++){var c=this.customCompile?t.uniforms[a]:n.getActiveUniform(this._program,a);r=n.getUniformLocation(this._program,c.name),s={vartype:"uniform",ivartype:1,attrib:l,location:r,name:c.name,type:c.type,isArray:!1,isSame:!1,preValue:null,indexOfParams:0},s.name.indexOf("[0]")>0&&(s.name=s.name.substr(0,s.name.length-3),s.isArray=!0,s.location=n.getUniformLocation(this._program,s.name)),this._params.push(s)}for(a=0,o=this._params.length;o>a;a++)if(s=this._params[a],s.indexOfParams=a,s.index=1,s.value=[s.location,null],s.codename=s.name,s.name=this._nameMap[s.codename]?this._nameMap[s.codename]:s.codename,this._paramsMap[s.name]=s,s._this=this,s.uploadedValue=[],"attribute"!==s.vartype)switch(s.type){case 5124:s.fun=s.isArray?this._uniform1iv:this._uniform1i;break;case 5126:s.fun=s.isArray?this._uniform1fv:this._uniform1f;break;case 35664:s.fun=s.isArray?this._uniform_vec2v:this._uniform_vec2;break;case 35665:s.fun=s.isArray?this._uniform_vec3v:this._uniform_vec3;break;case 35666:s.fun=s.isArray?this._uniform_vec4v:this._uniform_vec4;break;case 35678:s.fun=this._uniform_sampler2D;break;case 35680:s.fun=this._uniform_samplerCube;break;case 35676:s.fun=this._uniformMatrix4fv;break;case 35670:s.fun=this._uniform1i;break;case 35674:case 35675:throw new Error("compile shader err!");default:throw new Error("compile shader err!")}else s.fun=this._attribute}},i.getUniform=function(t){return this._paramsMap[t]},i._attribute=function(t,e){var i=ft.mainContext;return i.enableVertexAttribArray(t.location),i.vertexAttribPointer(t.location,e[0],e[1],e[2],e[3],e[4]+this._offset),2},i._uniform1f=function(t,e){var i=t.uploadedValue;return i[0]!==e?(ft.mainContext.uniform1f(t.location,i[0]=e),1):0},i._uniform1fv=function(t,e){if(e.length<4){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(ft.mainContext.uniform1fv(t.location,e),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],1):0}return ft.mainContext.uniform1fv(t.location,e),1},i._uniform_vec2=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]?(ft.mainContext.uniform2f(t.location,i[0]=e[0],i[1]=e[1]),1):0},i._uniform_vec2v=function(t,e){if(e.length<2){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(ft.mainContext.uniform2fv(t.location,e),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],1):0}return ft.mainContext.uniform2fv(t.location,e),1},i._uniform_vec3=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]?(ft.mainContext.uniform3f(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2]),1):0},i._uniform_vec3v=function(t,e){return ft.mainContext.uniform3fv(t.location,e),1},i._uniform_vec4=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(ft.mainContext.uniform4f(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]),1):0},i._uniform_vec4v=function(t,e){return ft.mainContext.uniform4fv(t.location,e),1},i._uniformMatrix2fv=function(t,e){return ft.mainContext.uniformMatrix2fv(t.location,!1,e),1},i._uniformMatrix3fv=function(t,e){return ft.mainContext.uniformMatrix3fv(t.location,!1,e),1},i._uniformMatrix4fv=function(t,e){return ft.mainContext.uniformMatrix4fv(t.location,!1,e),1},i._uniform1i=function(t,e){var i=t.uploadedValue;return i[0]!==e?(ft.mainContext.uniform1i(t.location,i[0]=e),1):0},i._uniform1iv=function(t,e){return ft.mainContext.uniform1iv(t.location,e),1},i._uniform_ivec2=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]?(ft.mainContext.uniform2i(t.location,i[0]=e[0],i[1]=e[1]),1):0},i._uniform_ivec2v=function(t,e){return ft.mainContext.uniform2iv(t.location,e),1},i._uniform_vec3i=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]?(ft.mainContext.uniform3i(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2]),1):0},i._uniform_vec3vi=function(t,e){return ft.mainContext.uniform3iv(t.location,e),1},i._uniform_vec4i=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(ft.mainContext.uniform4i(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]),1):0},i._uniform_vec4vi=function(t,e){return ft.mainContext.uniform4iv(t.location,e),1},i._uniform_sampler2D=function(t,i){var n=ft.mainContext,s=t.uploadedValue;return null==s[0]?(s[0]=this._curActTexIndex,n.uniform1i(t.location,this._curActTexIndex),n.activeTexture(e._TEXTURES[this._curActTexIndex]),pt.bindTexture(n,3553,i),this._curActTexIndex++,1):(n.activeTexture(e._TEXTURES[s[0]]),pt.bindTexture(n,3553,i),0)},i._uniform_samplerCube=function(t,i){var n=ft.mainContext,s=t.uploadedValue;return null==s[0]?(s[0]=this._curActTexIndex,n.uniform1i(t.location,this._curActTexIndex),n.activeTexture(e._TEXTURES[this._curActTexIndex]),pt.bindTexture(n,34067,i),this._curActTexIndex++,1):(n.activeTexture(e._TEXTURES[s[0]]),pt.bindTexture(n,34067,i),0)},i._noSetValue=function(t){console.log("no....:"+t.name)},i.uploadOne=function(t,e){this.activeResource(),pt.UseProgram(this._program);var i=this._paramsMap[t];i.fun.call(this,i,e)},i.uploadTexture2D=function(t){A.shaderCall++;var e=ft.mainContext;e.activeTexture(33984),pt.bindTexture(e,3553,t)},i.upload=function(t,i){e.activeShader=this,this.activeResource(),pt.UseProgram(this._program),this._reCompile?(i=this._params,this._reCompile=!1):i=i||this._params;for(var n,s,r=i.length,a=0,o=0;r>o;o++)n=i[o],null!==(s=t[n.name])&&(a+=n.fun.call(this,n,s));A.shaderCall+=a},i.uploadArray=function(t,i,n){e.activeShader=this,this.activeResource(),pt.UseProgram(this._program);for(var s,r,a=(this._params,0),o=i-2;o>=0;o-=2)r=this._paramsMap[t[o]],r&&(s=t[o+1],null!=s&&(n&&n[r.name]&&n[r.name].bind(),a+=r.fun.call(this,r,s)));A.shaderCall+=a},i.getParams=function(){return this._params},i._preGetParams=function(t,e){var i=[t,e],n={},s=[],r=[],a={},o=[];n.attributes=s,n.uniforms=r,n.defines=a;for(var h=new RegExp("(/\\*([^*]|[\\r\\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)|(//.*)","g"),l=new RegExp("(\".*\")|('.*')|([#\\w\\*-\\.+/()=<>{}\\\\]+)|([,;:\\\\])","g"),u=0,c=0,_=0;2>_;_++){i[_]=i[_].replace(h,"");var d,f=i[_].match(l);for(u=0,c=f.length;c>u;u++){var p=f[u];if("attribute"==p||"uniform"==p)u=this.parseOne(s,r,f,u,p,!0);else{if("#define"==p){p=f[++u],o[p]=1;continue}if("#ifdef"==p){d=f[++u];a[d]=a[d]||[];for(u++;c>u;u++)if(p=f[u],"attribute"==p||"uniform"==p)u=this.parseOne(s,r,f,u,p,o[d]);else if("#else"==p)for(u++;c>u;u++)if(p=f[u],"attribute"==p||"uniform"==p)u=this.parseOne(s,r,f,u,p,!o[d]);else if("#endif"==p)break}}}}return n},i.parseOne=function(t,i,n,s,r,a){var o={type:e.shaderParamsMap[n[s+1]],name:n[s+2],size:isNaN(parseInt(n[s+3]))?1:parseInt(n[s+3])};return a&&("attribute"==r?t.push(o):i.push(o)),":"==n[s+3]&&(o.type=n[s+4],s+=2),s+=2},i.dispose=function(){this.resourceManager.removeResource(this),t.prototype.dispose.call(this)},e.getShader=function(t){return e.sharders[t]},e.create=function(t,i,n,s){return new e(t,i,n,s)},e.withCompile=function(t,i,n,s){if(n&&e.sharders[n])return e.sharders[n];var r=e._preCompileShader[2e-4*t];if(!r)throw new Error("withCompile shader err!"+t);return r.createShader(i,n,s)},e.withCompile2D=function(t,i,n,s,r){if(s&&e.sharders[s])return e.sharders[s];var a=e._preCompileShader[2e-4*t+i];if(!a)throw new Error("withCompile shader err!"+t+" "+i);return a.createShader(n,s,r)},e.addInclude=function(t,i){if(!i||0===i.length)throw new Error("add shader include file err:"+t);if(e._includeFiles[t])throw new Error("add shader include file err, has add:"+t);e._includeFiles[t]=i},e.preCompile=function(t,i,n,s){var r=2e-4*t;e._preCompileShader[r]=new dt(r,i,n,s,e._includeFiles)},e.preCompile2D=function(t,i,n,s,r){var a=2e-4*t+i;e._preCompileShader[a]=new dt(a,n,s,r,e._includeFiles)},e._createShader=function(t,e,i){var n=t.createShader(i);if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,35713))throw t.getShaderInfoLog(n);return n},e._TEXTURES=[33984,33985,33986,33987,33988,33989,33990,,33991,33992],e._includeFiles={},e._count=0,e._preCompileShader={},e.SHADERNAME2ID=2e-4,e.activeShader=null,e.sharders=(e.sharders=[],e.sharders.length=32,e.sharders),n(e,["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}},"nameKey",function(){return this.nameKey=new L}]),e}(T),Pt=function(t){function e(t,i,n,s,r,a,o,h,l){this._type=0,this._svWidth=NaN,this._svHeight=NaN,this._preRenderTarget=null,this._alreadyResolved=!1,this._looked=!1,this._surfaceFormat=0,this._surfaceType=0,this._depthStencilFormat=0,this._mipMap=!1,this._repeat=!1,this._minFifter=0,this._magFifter=0,this._destroy=!1,void 0===n&&(n=6408),void 0===s&&(s=5121),void 0===r&&(r=33189),void 0===a&&(a=!1),void 0===o&&(o=!1),void 0===h&&(h=-1),void 0===l&&(l=-1),this._type=1,this._w=t,this._h=i,this._surfaceFormat=n,this._surfaceType=s,this._depthStencilFormat=r,this._mipMap=a,this._repeat=o,this._minFifter=h,this._magFifter=l,this._createWebGLRenderTarget(),this.bitmap.lock=!0,e.__super.call(this,this.bitmap,R.INV_UV)}s(e,"laya.webgl.resource.RenderTarget2D",t);var n=e.prototype;return i.imps(n,{"laya.resource.IDispose":!0}),n.getType=function(){return this._type},n.getTexture=function(){return this},n.size=function(t,e){this.bitmap&&this._w==t&&this._h==e||(this._w=t,this._h=e,this.release(),this._createWebGLRenderTarget())},n.release=function(){this.destroy()},n.recycle=function(){e.POOL.push(this)},n.start=function(){var t=ft.mainContext;return this._preRenderTarget=_t.curRenderTarget,_t.curRenderTarget=this,t.bindFramebuffer(36160,this.bitmap.frameBuffer),this._alreadyResolved=!1,1==this._type&&(t.viewport(0,0,this._w,this._h),this._svWidth=_t.width,this._svHeight=_t.height,_t.width=this._w,_t.height=this._h,Lt.activeShader=null),this},n.clear=function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1);var s=ft.mainContext;s.clearColor(t,e,i,n);var r=16384;switch(this._depthStencilFormat){case 33189:r|=256;break;case 36168:r|=1024;break;case 34041:r|=256,r|=1024}s.clear(r)},n.end=function(){var t=ft.mainContext;t.bindFramebuffer(36160,this._preRenderTarget?this._preRenderTarget.bitmap.frameBuffer:null),this._alreadyResolved=!0,_t.curRenderTarget=this._preRenderTarget,1==this._type?(t.viewport(0,0,this._svWidth,this._svHeight),_t.width=this._svWidth,_t.height=this._svHeight,Lt.activeShader=null):t.viewport(0,0,i.stage.width,i.stage.height)},n.getData=function(t,e,i,n){var s=ft.mainContext;s.bindFramebuffer(36160,this.bitmap.frameBuffer);var r=36053===s.checkFramebufferStatus(36160);if(!r)return s.bindFramebuffer(36160,null),null;var a=new Uint8Array(this._w*this._h*4);return s.readPixels(t,e,i,n,this._surfaceFormat,this._surfaceType,a),s.bindFramebuffer(36160,null),a},n.destroy=function(e){void 0===e&&(e=!1),this._destroy||(this._loaded=!1,this.bitmap.dispose(),this.bitmap=null,this._destroy=!0,t.prototype.destroy.call(this))},n.dispose=function(){},n._createWebGLRenderTarget=function(){this.bitmap=new Nt(this.width,this.height,this._surfaceFormat,this._surfaceType,this._depthStencilFormat,this._mipMap,this._repeat,this._minFifter,this._magFifter),this.bitmap.activeResource(),this._alreadyResolved=!0,this._destroy=!1,this._loaded=!0},r(0,n,"surfaceFormat",function(){return this._surfaceFormat}),r(0,n,"magFifter",function(){return this._magFifter}),r(0,n,"surfaceType",function(){return this._surfaceType}),r(0,n,"mipMap",function(){return this._mipMap}),r(0,n,"depthStencilFormat",function(){return this._depthStencilFormat}),r(0,n,"minFifter",function(){return this._minFifter}),r(0,n,"source",function(){if(this._alreadyResolved)return t.prototype._$get_source.call(this);throw new Error("RenderTarget 还未准备好!")}),e.create=function(t,i,n,s,r,a,o,h,l){void 0===n&&(n=6408),void 0===s&&(s=5121),void 0===r&&(r=33189),void 0===a&&(a=!1),void 0===o&&(o=!1),void 0===h&&(h=-1),void 0===l&&(l=-1);var u=e.POOL.pop();return u||(u=new e(t,i)),u.bitmap&&u._w==t&&u._h==i&&u._surfaceFormat==n&&u._surfaceType==s&&u._depthStencilFormat==r&&u._mipMap==a&&u._repeat==o&&u._minFifter==h&&u._magFifter==l||(u._w=t,u._h=i,u._surfaceFormat=n,u._surfaceType=s,u._depthStencilFormat=r,u._mipMap=a,u._repeat=o,u._minFifter=h,u._magFifter=l,u.release(),u._createWebGLRenderTarget()),u},e.TYPE2D=1,e.TYPE3D=2,e.POOL=[],e}(R),Rt=function(t){function e(){this._glBuffer=null,this._buffer=null,this._bufferType=0,this._bufferUsage=0,this._byteLength=0,e.__super.call(this),e._gl=ft.mainContext}s(e,"laya.webgl.utils.Buffer",t);var i=e.prototype;return i._bind=function(){this.activeResource(),e._bindActive[this._bufferType]===this._glBuffer||(e._gl.bindBuffer(this._bufferType,e._bindActive[this._bufferType]=this._glBuffer),Lt.activeShader=null)},i.recreateResource=function(){this.startCreate(),this._glBuffer||(this._glBuffer=e._gl.createBuffer()),this.completeCreate()},i.detoryResource=function(){this._glBuffer&&(ft.mainContext.deleteBuffer(this._glBuffer),this._glBuffer=null),this.memorySize=0},i.dispose=function(){this.resourceManager.removeResource(this),t.prototype.dispose.call(this)},r(0,i,"byteLength",function(){return this._byteLength}),r(0,i,"bufferType",function(){return this._bufferType}),r(0,i,"bufferUsage",function(){return this._bufferUsage}),e._gl=null,e._bindActive={},e}(T),It=function(t){function e(t){this.texcoord=null,this.offsetX=300,this.offsetY=0,e.__super.call(this,512,0);var i=8*ut.BYTES_PE;this.position=[2,5126,!1,i,0],this.texcoord=[2,5126,!1,i,2*ut.BYTES_PE],this.color=[4,5126,!1,i,4*ut.BYTES_PE]}return s(e,"laya.webgl.shader.d2.skinAnishader.SkinSV",t),e}(vt),Et=function(t){function e(t){e.__super.call(this,2,0),this.color=[]}s(e,"laya.webgl.shader.d2.value.Color2dSV",t);var i=e.prototype;return i.setValue=function(t){t.fillStyle&&(this.color=t.fillStyle._color._color),t.strokeStyle&&(this.color=t.strokeStyle._color._color)},e}(vt),Dt=function(t){function e(t){this.u_colorMatrix=null,this.strength=0,this.colorMat=null,this.colorAlpha=null,this.u_TexRange=[0,1,0,1],this.u_offset=[0,0],this.texcoord=vt._TEXCOORD,e.__super.call(this,256,0)}s(e,"laya.webgl.shader.d2.value.FillTextureSV",t);var i=e.prototype;return i.setValue=function(t){this.ALPHA=t.ALPHA,t.filters&&this.setFilters(t.filters)},i.clear=function(){this.texture=null,this.shader=null,this.defines.setValue(0)},e}(vt),Ft=function(t){function e(t){this.u_colorMatrix=null,this.strength=0,this.colorMat=null,this.colorAlpha=null,this.texcoord=vt._TEXCOORD,void 0===t&&(t=0),e.__super.call(this,1,t)}s(e,"laya.webgl.shader.d2.value.TextureSV",t);var i=e.prototype;return i.setValue=function(t){this.ALPHA=t.ALPHA,t.filters&&this.setFilters(t.filters)},i.clear=function(){this.texture=null,this.shader=null,this.defines.setValue(0)},e}(vt),Bt=function(t){function e(t){this.a_color=null,this.u_pos=[0,0],e.__super.call(this,4,0),this.position=[2,5126,!1,5*ut.BYTES_PE,0],this.a_color=[3,5126,!1,5*ut.BYTES_PE,2*ut.BYTES_PE]}return s(e,"laya.webgl.shader.d2.value.PrimitiveSV",t),e}(vt),kt=function(t){function e(){this._flashCacheImage=null,this._flashCacheImageNeedFlush=!1,e.__super.call(this)}s(e,"laya.webgl.atlas.AtlasWebGLCanvas",t);var i=e.prototype;return i.recreateResource=function(){this.startCreate();var t=ft.mainContext,e=this._source=t.createTexture(),i=pt.curBindTexTarget,n=pt.curBindTexValue;pt.bindTexture(t,3553,e),t.texImage2D(3553,0,6408,this._w,this._h,0,6408,5121,null),t.texParameteri(3553,10241,9729),t.texParameteri(3553,10240,9729),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071),i&&n&&pt.bindTexture(t,i,n),this.memorySize=this._w*this._h*4,this.completeCreate()},i.detoryResource=function(){this._source&&(ft.mainContext.deleteTexture(this._source),this._source=null,this.memorySize=0)},i.texSubImage2D=function(t,e,i){if(w.isFlash){this._flashCacheImage||(this._flashCacheImage=m.create(null),this._flashCacheImage.image.createCanvas(this._w,this._h));var n=i.bitmapdata;t-1>=0&&this._flashCacheImage.image.copyPixels(n,0,0,n.width-1,n.height,t,e),t+1<=this._w&&this._flashCacheImage.image.copyPixels(n,0,0,n.width+1,n.height,t,e),e-1>=0&&this._flashCacheImage.image.copyPixels(n,0,0,n.width,n.height-1,t,e),e+1<=this._h&&this._flashCacheImage.image.copyPixels(n,0,0,n.width+1,n.height,t,e),this._flashCacheImage.image.copyPixels(n,0,0,n.width,n.height,t,e),this._flashCacheImageNeedFlush||(this._flashCacheImageNeedFlush=!0)}else{var s=ft.mainContext,r=pt.curBindTexTarget,a=pt.curBindTexValue;pt.bindTexture(s,3553,this._source),t-1>=0&&s.texSubImage2D(3553,0,t-1,e,6408,5121,i),t+1<=this._w&&s.texSubImage2D(3553,0,t+1,e,6408,5121,i),e-1>=0&&s.texSubImage2D(3553,0,t,e-1,6408,5121,i),e+1<=this._h&&s.texSubImage2D(3553,0,t,e+1,6408,5121,i),s.texSubImage2D(3553,0,t,e,6408,5121,i),r&&a&&pt.bindTexture(s,r,a)}},i.texSubImage2DPixel=function(t,e,i,n,s){var r=ft.mainContext,a=pt.curBindTexTarget,o=pt.curBindTexValue;pt.bindTexture(r,3553,this._source);var h=new Uint8Array(s.data);r.texSubImage2D(3553,0,t,e,i,n,6408,5121,h),a&&o&&pt.bindTexture(r,a,o)},r(0,i,"width",t.prototype._$get_width,function(t){this._w=t}),r(0,i,"height",t.prototype._$get_height,function(t){this._h=t}),e}(l),Ot=(function(t){function e(t){this._is2D=!1;var i=this;if(e.__super.call(this),this._canvas=this,"2D"===t||"AUTO"===t&&!w.isWebGL){this._is2D=!0,this._canvas=this._source=u.createElement("canvas"),this.iscpuSource=!0;var n=this;n.getContext=function(t,e){if(i._ctx)return i._ctx;var s=i._ctx=i._canvas.getContext(t,e);return s&&(s._canvas=n,s.size=function(){}),s}}else this._canvas={}}s(e,"laya.webgl.resource.WebGLCanvas",t);var i=e.prototype;return i.clear=function(){this._ctx&&this._ctx.clear()},i.destroy=function(){this._ctx&&this._ctx.destroy(),this._ctx=null},i._setContext=function(t){this._ctx=t},i.getContext=function(t,i){return this._ctx?this._ctx:this._ctx=e._createContext(this)},i.size=function(t,e){this._w==t&&this._h==e||(this._w=t,this._h=e,this._ctx&&this._ctx.size(t,e),this._canvas&&(this._canvas.height=e,this._canvas.width=t))},i.recreateResource=function(){this.startCreate(),this.createWebGlTexture(),this.completeCreate()},i.detoryResource=function(){this._source&&!this.iscpuSource&&(ft.mainContext.deleteTexture(this._source),this._source=null,this.memorySize=0)},i.createWebGlTexture=function(){var t=ft.mainContext;if(!this._canvas)throw"create GLTextur err:no data:"+this._canvas;var e=this._source=t.createTexture();this.iscpuSource=!1;var i=pt.curBindTexTarget,n=pt.curBindTexValue;pt.bindTexture(t,3553,e),t.texImage2D(3553,0,6408,this._w,this._h,0,6408,5121,null),t.texParameteri(3553,10240,9729),t.texParameteri(3553,10241,9729),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071),this.memorySize=this._w*this._h*4,i&&n&&pt.bindTexture(t,i,n),this._canvas=null},i.texSubImage2D=function(t,e,i){var n=ft.mainContext,s=pt.curBindTexTarget,r=pt.curBindTexValue;pt.bindTexture(n,3553,this._source),n.texSubImage2D(3553,0,e,i,6408,5121,t._source),s&&r&&pt.bindTexture(n,s,r)},r(0,i,"canvas",function(){return this._canvas}),r(0,i,"context",function(){return this._ctx}),r(0,i,"asBitmap",null,function(t){this._ctx&&(this._ctx.asBitmap=t)}),e.create=function(t){return new e(t)},e._createContext=null,e}(l),function(t){function e(t,i){this.borderSize=12,e.__super.call(this),this.canvas=t,this["char"]=i,this._enableMerageInAtlas=!0;var n=w.isConchApp;n?this._ctx=t:this._ctx=t.getContext("2d",void 0);var s=i.xs,r=i.ys,a=null;n?(this._ctx.font=i.font,a=this._ctx.measureText(i["char"]),i.width=a.width*s,i.height=a.height*r):(a=I.measureText(i["char"],i.font),i.width=a.width*s,i.height=a.height*r),this.onresize(i.width+2*this.borderSize,i.height+2*this.borderSize)}s(e,"laya.webgl.resource.WebGLCharImage",t);var n=e.prototype;return i.imps(n,{"laya.webgl.resource.IMergeAtlasBitmap":!0}),n.recreateResource=function(){this.startCreate();var t=this["char"],e=w.isConchApp,i=t.xs,n=t.ys;if(this.onresize(t.width+2*this.borderSize,t.height+2*this.borderSize),this.canvas&&(this.canvas.height=this._h,this.canvas.width=this._w),e){var s=t.fontSize;1==i&&1==n||(s=parseInt(s*(i>n?i:n)+""));var r="normal 100 "+s+"px Arial";t.borderColor&&(r+=" 1 "+t.borderColor),this._ctx.font=r,this._ctx.textBaseline="top",this._ctx.fillStyle=t.fillColor,this._ctx.fillText(t["char"],this.borderSize,this.borderSize,null,null,null)}else this._ctx.save(),this._ctx.clearRect(0,0,t.width+2*this.borderSize,t.height+2*this.borderSize),this._ctx.font=t.font,this._ctx.textBaseline="top",this._ctx.translate(this.borderSize,this.borderSize),1==i&&1==n||this._ctx.scale(i,n),t.fillColor&&t.borderColor?(this._ctx.strokeStyle=t.borderColor,this._ctx.lineWidth=t.lineWidth,this._ctx.strokeText(t["char"],0,0,null,null,0,null),this._ctx.fillStyle=t.fillColor,this._ctx.fillText(t["char"],0,0,null,null,null)):-1===t.lineWidth?(this._ctx.fillStyle=t.fillColor?t.fillColor:"white",this._ctx.fillText(t["char"],0,0,null,null,null)):(this._ctx.strokeStyle=t.borderColor?t.borderColor:"white",this._ctx.lineWidth=t.lineWidth,this._ctx.strokeText(t["char"],0,0,null,null,0,null)),this._ctx.restore();t.borderSize=this.borderSize,this.completeCreate()},n.onresize=function(t,e){if(this._w=t,this._h=e,!(this._w<O.atlasLimitWidth&&this._h<O.atlasLimitHeight))throw this._allowMerageInAtlas=!1,new Error("文字尺寸超出大图合集限制!");this._allowMerageInAtlas=!0},n.clearAtlasSource=function(){},r(0,n,"allowMerageInAtlas",function(){return this._allowMerageInAtlas}),r(0,n,"atlasSource",function(){return this.canvas}),r(0,n,"enableMerageInAtlas",function(){return this._enableMerageInAtlas},function(t){this._enableMerageInAtlas=t}),e}(l)),Nt=function(t){function e(t,i,n,s,r,a,o,h,l){void 0===n&&(n=6408),void 0===s&&(s=5121),void 0===r&&(r=33189),void 0===a&&(a=!1),void 0===o&&(o=!1),void 0===h&&(h=-1),void 0===l&&(l=1),e.__super.call(this),this._w=t,this._h=i,this._surfaceFormat=n,this._surfaceType=s,this._depthStencilFormat=r,this._mipMap=a,this._repeat=o,this._minFifter=h,this._magFifter=l}s(e,"laya.webgl.resource.WebGLRenderTarget",t);var i=e.prototype;return i.recreateResource=function(){this.startCreate();var t=ft.mainContext;this._frameBuffer||(this._frameBuffer=t.createFramebuffer()),this._source||(this._source=t.createTexture());var e=pt.curBindTexTarget,i=pt.curBindTexValue;pt.bindTexture(t,3553,this._source),t.texImage2D(3553,0,6408,this._w,this._h,0,this._surfaceFormat,this._surfaceType,null);var n=this._minFifter,s=this._magFifter,r=this._repeat?10497:33071,a=o.isPOT(this._w,this._h);if(a?(this._mipMap?-1!==n||(n=9987):-1!==n||(n=9729),-1!==s||(s=9729),t.texParameteri(3553,10241,n),t.texParameteri(3553,10240,s),t.texParameteri(3553,10242,r),t.texParameteri(3553,10243,r),this._mipMap&&t.generateMipmap(3553)):(-1!==n||(n=9729),-1!==s||(s=9729),t.texParameteri(3553,10241,n),t.texParameteri(3553,10240,s),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071)),t.bindFramebuffer(36160,this._frameBuffer),t.framebufferTexture2D(36160,36064,3553,this._source,0),this._depthStencilFormat)switch(this._depthStencilBuffer||(this._depthStencilBuffer=t.createRenderbuffer()),t.bindRenderbuffer(36161,this._depthStencilBuffer),t.renderbufferStorage(36161,this._depthStencilFormat,this._w,this._h),this._depthStencilFormat){case 33189:t.framebufferRenderbuffer(36160,36096,36161,this._depthStencilBuffer);break;case 36168:t.framebufferRenderbuffer(36160,36128,36161,this._depthStencilBuffer);break;case 34041:t.framebufferRenderbuffer(36160,33306,36161,this._depthStencilBuffer)}t.bindFramebuffer(36160,null),e&&i&&pt.bindTexture(t,e,i),t.bindRenderbuffer(36161,null),this.memorySize=this._w*this._h*4,this.completeCreate()},i.detoryResource=function(){this._frameBuffer&&(ft.mainContext.deleteTexture(this._source),ft.mainContext.deleteFramebuffer(this._frameBuffer),ft.mainContext.deleteRenderbuffer(this._depthStencilBuffer),this._source=null,this._frameBuffer=null,this._depthStencilBuffer=null,this.memorySize=0)},r(0,i,"depthStencilBuffer",function(){return this._depthStencilBuffer}),r(0,i,"frameBuffer",function(){return this._frameBuffer}),e}(l),Wt=(function(t){function e(t,i,n,s,r,a,o,h){this.offsetX=0,this.offsetY=0,void 0===h&&(h=!0),e.__super.call(this),this.repeat=!0,this.mipmap=!1,this.minFifter=-1,this.magFifter=-1,this.atlasImage=a,this.canvas=t,this._ctx=t.getContext("2d",void 0),this._w=s,this._h=r,this.offsetX=i,this.offsetY=n,this.src=o,this._enableMerageInAtlas=h}s(e,"laya.webgl.resource.WebGLSubImage",t);var n=e.prototype;return i.imps(n,{"laya.webgl.resource.IMergeAtlasBitmap":!0}),n.size=function(t,e){this._w=t,this._h=e,this._ctx&&this._ctx.size(t,e),this.canvas&&(this.canvas.height=e,this.canvas.width=t)},n.recreateResource=function(){this.startCreate(),this.size(this._w,this._h),this._ctx.drawImage(this.atlasImage,this.offsetX,this.offsetY,this._w,this._h,0,0,this._w,this._h),!(O.enabled&&this._allowMerageInAtlas)&&this.createWebGlTexture(),this.completeCreate()},n.createWebGlTexture=function(){var t=ft.mainContext;if(!this.canvas)throw"create GLTextur err:no data:"+this.canvas;var e=this._source=t.createTexture(),i=pt.curBindTexTarget,n=pt.curBindTexValue;pt.bindTexture(t,3553,e),t.texImage2D(3553,0,6408,6408,5121,this.canvas);var s=this.minFifter,r=this.magFifter,a=this.repeat?10497:33071,h=o.isPOT(this.width,this.height);h?(this.mipmap?-1!==s||(s=9987):-1!==s||(s=9729),-1!==r||(r=9729),t.texParameteri(3553,10240,r),t.texParameteri(3553,10241,s),t.texParameteri(3553,10242,a),t.texParameteri(3553,10243,a),this.mipmap&&t.generateMipmap(3553)):(-1!==s||(s=9729),-1!==r||(r=9729),t.texParameteri(3553,10241,s),t.texParameteri(3553,10240,r),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071)),i&&n&&pt.bindTexture(t,i,n),this.canvas=null,this.memorySize=this._w*this._h*4},n.detoryResource=function(){O.enabled&&this._allowMerageInAtlas||!this._source||(ft.mainContext.deleteTexture(this._source),this._source=null,this.memorySize=0)},n.clearAtlasSource=function(){this.canvas=null},n.dispose=function(){this.resourceManager.removeResource(this),t.prototype.dispose.call(this)},r(0,n,"allowMerageInAtlas",function(){return this._allowMerageInAtlas}),r(0,n,"atlasSource",function(){return this.canvas}),r(0,n,"enableMerageInAtlas",function(){return this._allowMerageInAtlas},function(t){this._allowMerageInAtlas=t}),e}(l),function(t){function e(t,i,n,s){this._params2dQuick1=null,this._params2dQuick2=null,this._shaderValueWidth=NaN,this._shaderValueHeight=NaN,e.__super.call(this,t,i,n,s)}s(e,"laya.webgl.shader.d2.Shader2X",t);var i=e.prototype;return i.upload2dQuick1=function(t){this.upload(t,this._params2dQuick1||this._make2dQuick1())},i._make2dQuick1=function(){if(!this._params2dQuick1){this.activeResource(),this._params2dQuick1=[];for(var t,e=this._params,i=0,n=e.length;n>i;i++)t=e[i],(w.isFlash||"size"!==t.name&&"mmat"!==t.name&&"position"!==t.name&&"texcoord"!==t.name)&&this._params2dQuick1.push(t)}return this._params2dQuick1},i.detoryResource=function(){t.prototype.detoryResource.call(this),this._params2dQuick1=null,this._params2dQuick2=null},i.upload2dQuick2=function(t){this.upload(t,this._params2dQuick2||this._make2dQuick2())},i._make2dQuick2=function(){if(!this._params2dQuick2){this.activeResource(),this._params2dQuick2=[];for(var t,e=this._params,i=0,n=e.length;n>i;i++)t=e[i],(w.isFlash||"size"!==t.name)&&this._params2dQuick2.push(t)}return this._params2dQuick2},e.create=function(t,i,n,s){return new e(t,i,n,s)},e}(Lt)),Ut=function(t){function e(){this._maxsize=0,this._upload=!0,this._uploadSize=0,e.__super.call(this),this.lock=!0}s(e,"laya.webgl.utils.Buffer2D",t);var i=e.prototype;return i._bufferData=function(){this._maxsize=Math.max(this._maxsize,this._byteLength),A.loopCount%30==0&&(this._buffer.byteLength>this._maxsize+64&&(this.memorySize=this._buffer.byteLength,this._buffer=this._buffer.slice(0,this._maxsize+64),this._checkArrayUse()),this._maxsize=this._byteLength),this._uploadSize<this._buffer.byteLength&&(this._uploadSize=this._buffer.byteLength,Rt._gl.bufferData(this._bufferType,this._uploadSize,this._bufferUsage),this.memorySize=this._uploadSize),Rt._gl.bufferSubData(this._bufferType,0,this._buffer)},i._bufferSubData=function(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._maxsize=Math.max(this._maxsize,this._byteLength),A.loopCount%30==0&&(this._buffer.byteLength>this._maxsize+64&&(this.memorySize=this._buffer.byteLength,this._buffer=this._buffer.slice(0,this._maxsize+64),this._checkArrayUse()),this._maxsize=this._byteLength),this._uploadSize<this._buffer.byteLength&&(this._uploadSize=this._buffer.byteLength,Rt._gl.bufferData(this._bufferType,this._uploadSize,this._bufferUsage),this.memorySize=this._uploadSize),e||i){var n=this._buffer.slice(e,i);Rt._gl.bufferSubData(this._bufferType,t,n)}else Rt._gl.bufferSubData(this._bufferType,t,this._buffer)},i._checkArrayUse=function(){},i._bind_upload=function(){return this._upload?(this._upload=!1,this._bind(),this._bufferData(),!0):!1},i._bind_subUpload=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._upload?(this._upload=!1,this._bind(),this._bufferSubData(t,e,i),!0):!1},i._resizeBuffer=function(t,e){if(t<this._buffer.byteLength)return this;if(this.memorySize=t,e&&this._buffer&&this._buffer.byteLength>0){var i=new ArrayBuffer(t),n=new Uint8Array(i);n.set(new Uint8Array(this._buffer),0),this._buffer=i}else this._buffer=new ArrayBuffer(t);return this._checkArrayUse(),this._upload=!0,this},i.append=function(t){this._upload=!0;var e,i=0;i=t.byteLength,t instanceof Uint8Array?(this._resizeBuffer(this._byteLength+i,!0),e=new Uint8Array(this._buffer,this._byteLength)):t instanceof Uint16Array?(this._resizeBuffer(this._byteLength+i,!0),e=new Uint16Array(this._buffer,this._byteLength)):t instanceof Float32Array&&(this._resizeBuffer(this._byteLength+i,!0),e=new Float32Array(this._buffer,this._byteLength)),e.set(t,0),this._byteLength+=i,this._checkArrayUse();
|
||
},i.getBuffer=function(){return this._buffer},i.setNeedUpload=function(){this._upload=!0},i.getNeedUpload=function(){return this._upload},i.upload=function(){var t=this._bind_upload();return Rt._gl.bindBuffer(this._bufferType,null),Rt._bindActive[this._bufferType]=null,Lt.activeShader=null,t},i.subUpload=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0);var n=this._bind_subUpload();return Rt._gl.bindBuffer(this._bufferType,null),Rt._bindActive[this._bufferType]=null,Lt.activeShader=null,n},i.detoryResource=function(){t.prototype.detoryResource.call(this),this._upload=!0,this._uploadSize=0},i.clear=function(){this._byteLength=0,this._upload=!0},r(0,i,"bufferLength",function(){return this._buffer.byteLength}),r(0,i,"byteLength",t.prototype._$get_byteLength,function(t){this._byteLength!==t&&(t<=this._buffer.byteLength||this._resizeBuffer(2*t+256,!0),this._byteLength=t)}),e.__int__=function(t){Ht.QuadrangleIB=Ht.create(35044),ct.fillIBQuadrangle(Ht.QuadrangleIB,16)},e.FLOAT32=4,e.SHORT=2,e}(Rt),Vt=(function(t){function e(t){this.u_blurX=!1,this.u_color=null,this.u_offset=null,this.u_strength=NaN,this.u_texW=0,this.u_texH=0,e.__super.call(this,9)}s(e,"laya.webgl.shader.d2.value.GlowSV",t);var i=e.prototype;return i.setValue=function(e){t.prototype.setValue.call(this,e)},i.clear=function(){t.prototype.clear.call(this)},e}(Ft),function(t){function e(t){e.__super.call(this,64),this.defines.add(64)}s(e,"laya.webgl.shader.d2.value.TextSV",t);var i=e.prototype;return i.release=function(){e.pool[e._length++]=this,this.clear()},i.clear=function(){t.prototype.clear.call(this)},e.create=function(){return e._length?e.pool[--e._length]:new e(null)},e.pool=[],e._length=0,e}(Ft)),Ht=function(t){function e(t){this._uint8Array=null,this._uint16Array=null,void 0===t&&(t=35044),e.__super.call(this),this._bufferUsage=t,this._bufferType=34963,w.isFlash||(this._buffer=new ArrayBuffer(8))}s(e,"laya.webgl.utils.IndexBuffer2D",t);var i=e.prototype;return i._checkArrayUse=function(){this._uint8Array&&(this._uint8Array=new Uint8Array(this._buffer)),this._uint16Array&&(this._uint16Array=new Uint16Array(this._buffer))},i.getUint8Array=function(){return this._uint8Array||(this._uint8Array=new Uint8Array(this._buffer))},i.getUint16Array=function(){return this._uint16Array||(this._uint16Array=new Uint16Array(this._buffer))},e.QuadrangleIB=null,e.create=function(t){return void 0===t&&(t=35044),new e(t)},e}(Ut),zt=function(t){function e(t,i){this._floatArray32=null,this._vertexStride=0,e.__super.call(this),this._vertexStride=t,this._bufferUsage=i,this._bufferType=34962,w.isFlash||(this._buffer=new ArrayBuffer(8)),this.getFloat32Array()}s(e,"laya.webgl.utils.VertexBuffer2D",t);var i=e.prototype;return i.getFloat32Array=function(){return this._floatArray32||(this._floatArray32=new Float32Array(this._buffer))},i.bind=function(t){t&&t._bind(),this._bind()},i.insertData=function(t,e){var i=this.getFloat32Array();i.set(t,e),this._upload=!0},i.bind_upload=function(t){t._bind_upload()||t._bind(),this._bind_upload()||this._bind()},i._checkArrayUse=function(){this._floatArray32&&(this._floatArray32=new Float32Array(this._buffer))},i.detoryResource=function(){t.prototype.detoryResource.call(this);for(var e=0;10>e;e++)ft.mainContext.disableVertexAttribArray(e)},r(0,i,"vertexStride",function(){return this._vertexStride}),e.create=function(t,i){return void 0===i&&(i=35048),new e(t,i)},e}(Ut),Gt=function(t){function e(t,i){this._image=null,this._allowMerageInAtlas=!1,this._enableMerageInAtlas=!1,this.repeat=!1,this.mipmap=!1,this.minFifter=0,this.magFifter=0,e.__super.call(this,t,i),this.repeat=!1,this.mipmap=!1,this.minFifter=-1,this.magFifter=-1,this._src=t,this._image=new u.window.Image,i&&(i.onload&&(this.onload=i.onload),i.onerror&&(this.onerror=i.onerror),i.onCreate&&i.onCreate(this)),this._image.crossOrigin=t&&0==t.indexOf("data:")?null:"",t&&(this._image.src=t),this._enableMerageInAtlas=!0}s(e,"laya.webgl.resource.WebGLImage",t);var n=e.prototype;return i.imps(n,{"laya.webgl.resource.IMergeAtlasBitmap":!0}),n._init_=function(t,e){},n._createWebGlTexture=function(){if(!this._image)throw"create GLTextur err:no data:"+this._image;var t=ft.mainContext,e=this._source=t.createTexture(),i=pt.curBindTexTarget,n=pt.curBindTexValue;pt.bindTexture(t,3553,e),t.texImage2D(3553,0,6408,6408,5121,this._image);var s=this.minFifter,r=this.magFifter,a=this.repeat?10497:33071,h=o.isPOT(this._w,this._h);h?(this.mipmap?-1!==s||(s=9987):-1!==s||(s=9729),-1!==r||(r=9729),t.texParameteri(3553,10241,s),t.texParameteri(3553,10240,r),t.texParameteri(3553,10242,a),t.texParameteri(3553,10243,a),this.mipmap&&t.generateMipmap(3553)):(-1!==s||(s=9729),-1!==r||(r=9729),t.texParameteri(3553,10241,s),t.texParameteri(3553,10240,r),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071)),i&&n&&pt.bindTexture(t,i,n),this._image.onload=null,this._image=null,h?this.memorySize=this._w*this._h*4*(1+1/3):this.memorySize=this._w*this._h*4,this._recreateLock=!1},n.recreateResource=function(){var t=this;if(null!=this._src&&""!==this._src)if(this._needReleaseAgain=!1,this._image){if(this._recreateLock)return;this.startCreate(),this._allowMerageInAtlas&&this._enableMerageInAtlas?(this.memorySize=0,this._recreateLock=!1):this._createWebGlTexture(),this.completeCreate()}else{this._recreateLock=!0,this.startCreate();var e=this;this._image=new u.window.Image,this._image.crossOrigin=0==this._src.indexOf("data:")?null:"",this._image.onload=function(){return e._needReleaseAgain?(e._needReleaseAgain=!1,e._image.onload=null,void(e._image=null)):(e._allowMerageInAtlas&&e._enableMerageInAtlas?(t.memorySize=0,t._recreateLock=!1):e._createWebGlTexture(),void e.completeCreate())},this._image.src=this._src}},n.detoryResource=function(){this._recreateLock&&(this._needReleaseAgain=!0),this._source&&(ft.mainContext.deleteTexture(this._source),this._source=null,this._image=null,this.memorySize=0)},n.onresize=function(){this._w=this._image.width,this._h=this._image.height,O.enabled&&this._w<O.atlasLimitWidth&&this._h<O.atlasLimitHeight?this._allowMerageInAtlas=!0:this._allowMerageInAtlas=!1},n.clearAtlasSource=function(){this._image=null},r(0,n,"image",function(){return this._image}),r(0,n,"allowMerageInAtlas",function(){return this._allowMerageInAtlas}),r(0,n,"atlasSource",function(){return this._image}),r(0,n,"enableMerageInAtlas",function(){return this._enableMerageInAtlas},function(t){this._enableMerageInAtlas=t}),r(0,n,"onload",null,function(t){var e=this;this._onload=t,this._image&&(this._image.onload=null!=this._onload?function(){e.onresize(),e._onload()}:null)}),r(0,n,"onerror",null,function(t){var e=this;this._onerror=t,this._image&&(this._image.onerror=null!=this._onerror?function(){e._onerror()}:null)}),e}(m);i.__init([ot,pt,k,mt,$,dt]),new D}(window,document,Laya); |