window.vvMiniGame=function(e,t){"use strict";class i{static isLocalNativeFile(e){for(var t=0,i=r.nativefiles.length;t=52428800&&(t.size>r.minClearSize&&(r.minClearSize=t.size),i.onClearCacheRes()),i.deleteFile(e,a,n,s,t.size)},fail:function(e){null!=n&&n.runWith([1,e])}}):null!=n&&n.runWith([0]):i.fs.getFileInfo({filePath:e,success:function(t){t.length&&(t.size=t.length),o&&f+4194304+t.size>=52428800&&(t.size>r.minClearSize&&(r.minClearSize=t.size),i.onClearCacheRes()),i.fs.copyFile({srcPath:e,destPath:h,success:function(e){i.onSaveFile(a,d,!0,s,n,t.size)},fail:function(e){null!=n&&n.runWith([1,e])}})},fail:function(e){null!=n&&n.runWith([1,e])}})}static onClearCacheRes(){var e=r.minClearSize,t=[];for(var a in i.filesListObj)"fileUsedSize"!=a&&t.push(i.filesListObj[a]);i.sortOn(t,"times",i.NUMERIC);for(var n=0,s=1,o=t.length;s=e)break;n+=l.size,i.deleteFile("",l.readyUrl)}}static sortOn(e,t,a=0){return a==i.NUMERIC?e.sort((function(e,i){return e[t]-i[t]})):a==(i.NUMERIC|i.DESCENDING)?e.sort((function(e,i){return i[t]-e[t]})):e.sort((function(e,i){return e[t]-i[t]}))}static getFileNativePath(e){return i.fileNativeDir+"/"+e}static deleteFile(e,t="",a=null,n="",s=0){var o=i.getFileInfo(t),r=i.getFileNativePath(o.md5),l=""!=e;i.onSaveFile(t,e,l,n,a,s),i.fs.unlink({filePath:r,success:function(t){if(""!=e){var n=i.getFileNativePath(e);i.fs.copyFile({srcPath:e,destPath:n,success:function(e){},fail:function(e){null!=a&&a.runWith([1,e])}})}},fail:function(e){}})}static deleteAll(){var e=[];for(var t in i.filesListObj)"fileUsedSize"!=t&&e.push(i.filesListObj[t]);for(var a=1,n=e.length;a0&&this.loops--,this.startTime=0,this.play()}play(){this.isStopped=!1,t.SoundManager.addChannel(this),this._audio.play()}set startTime(e){this._audio&&(this._audio.startTime=e)}set autoplay(e){this._audio.autoplay=e}get autoplay(){return this._audio.autoplay}get position(){return this._audio?this._audio.currentTime:0}get duration(){return this._audio?this._audio.duration:0}stop(){this.isStopped=!0,t.SoundManager.removeChannel(this),this.completeHandler=null,this._audio&&(this._audio.stop(),this.loop||(this._audio.offEnded(null),this._miniSound.dispose(),this._audio=null,this._miniSound=null,this._onEnd=null))}pause(){this.isStopped=!0,this._audio.pause()}get loop(){return this._audio.loop}set loop(e){this._audio.loop=e}resume(){this._audio&&(this.isStopped=!1,t.SoundManager.addChannel(this),this._audio.play())}set volume(e){this._audio&&(this._audio.volume=e)}get volume(){return this._audio?this._audio.volume:1}}class n extends t.EventDispatcher{constructor(){super(),this.loaded=!1}static _createSound(){return n._id++,r.window.qg.createInnerAudioContext()}load(e){if(n._musicAudio||(n._musicAudio=n._createSound()),i.isLocalNativeFile(e)){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))if(""!=i.loadPath)e=e.split(i.loadPath)[1];else{var a=""!=t.URL.rootPath?t.URL.rootPath:t.URL._basePath;""!=a&&(e=e.split(a)[1])}}else e=t.URL.formatURL(e);if(this.url=e,this.readyUrl=e,n._audioCache[this.readyUrl])this.event(t.Event.COMPLETE);else if(r.autoCacheFile&&i.getFileInfo(e))this.onDownLoadCallBack(e,0);else if(r.autoCacheFile)if(i.isLocalNativeFile(e)){var s=e;if(""!=(a=""!=t.URL.rootPath?t.URL.rootPath:t.URL._basePath)&&(e=e.split(a)[1]),e||(e=s),r.subNativeFiles&&0==r.subNativeheads.length)for(var o in r.subNativeFiles){var l=r.subNativeFiles[o];r.subNativeheads=r.subNativeheads.concat(l);for(var d=0;d0&&this.onCanPlay(),t.Laya.timer.clear(this,this.onCheckComplete)}onError(e){try{console.log("-----1---------------minisound-----id:"+n._id),console.log(e)}catch(e){console.log("-----2---------------minisound-----id:"+n._id),console.log(e)}this.event(t.Event.ERROR),this._sound.offError(null)}onCanPlay(){this.loaded=!0,this.event(t.Event.COMPLETE),this._sound.offCanpla&&this._sound.offCanplay(null)}static bindToThis(e,t){return e.bind(t)}play(e=0,s=0){var o;if(this.url==t.SoundManager._bgMusic?(n._musicAudio||(n._musicAudio=n._createSound()),o=n._musicAudio):o=n._audioCache[this.readyUrl]?n._audioCache[this.readyUrl]._sound:n._createSound(),!o)return null;if(r.autoCacheFile&&i.getFileInfo(this.url)){var l=i.getFileInfo(this.url).md5;o.src=this.url=i.getFileNativePath(l)}else o.src=encodeURI(this.url);var d=new a(o,this);return d.url=this.url,d.loops=s,d.loop=0===s,d.startTime=e,d.play(),t.SoundManager.addChannel(d),d}get duration(){return this._sound.duration}dispose(){var e=n._audioCache[this.readyUrl];e&&(e.src="",e._sound&&(e._sound.destroy(),e._sound=null,e=null),delete n._audioCache[this.readyUrl]),this._sound&&(this._sound.destroy(),this._sound=null,this.readyUrl=this.url=null)}}n._id=0,n._audioCache={};class s{constructor(){}static _createInputElement(){t.Input._initInput(t.Input.area=t.Browser.createElement("textarea")),t.Input._initInput(t.Input.input=t.Browser.createElement("input")),t.Input.inputContainer=t.Browser.createElement("div"),t.Input.inputContainer.style.position="absolute",t.Input.inputContainer.style.zIndex=1e5,t.Browser.container.appendChild(t.Input.inputContainer),t.Laya.stage.on("resize",null,s._onStageResize),r.window.qg.onWindowResize&&r.window.qg.onWindowResize((function(e){})),t.SoundManager._soundClass=n,t.SoundManager._musicClass=n,t.Browser.onAndroid=!0,t.Browser.onIPhone=!1,t.Browser.onIOS=!1,t.Browser.onIPad=!1}static _onStageResize(){t.Laya.stage._canvasTransform.identity().scale(t.Browser.width/t.Render.canvas.width/t.Browser.pixelRatio,t.Browser.height/t.Render.canvas.height/t.Browser.pixelRatio)}static wxinputFocus(e){var i=t.Input.inputElement.target;i&&!i.editable||(r.window.qg.offKeyboardConfirm(),r.window.qg.offKeyboardInput(),r.window.qg.showKeyboard({defaultValue:i.text,maxLength:i.maxChars,multiple:i.multiline,confirmHold:!0,confirmType:i.confirmType||"done",success:function(e){},fail:function(e){}}),r.window.qg.onKeyboardConfirm((function(e){var a=e?e.value:"";i._restrictPattern&&(a=a.replace(/\u2006|\x27/g,""),i._restrictPattern.test(a)&&(a=a.replace(i._restrictPattern,""))),i.text=a,i.event(t.Event.INPUT),s.inputEnter(),i.event("confirm")})),r.window.qg.onKeyboardInput((function(e){var a=e?e.value:"";i.multiline||-1==a.indexOf("\n")?(i._restrictPattern&&(a=a.replace(/\u2006|\x27/g,""),i._restrictPattern.test(a)&&(a=a.replace(i._restrictPattern,""))),i.text=a,i.event(t.Event.INPUT)):s.inputEnter()})))}static inputEnter(){t.Input.inputElement.target.focus=!1}static wxinputblur(){s.hideKeyboard()}static hideKeyboard(){r.window.qg.offKeyboardConfirm(),r.window.qg.offKeyboardInput(),r.window.qg.hideKeyboard({success:function(e){console.log("隐藏键盘")},fail:function(e){console.log("隐藏键盘出错:"+(e?e.errMsg:""))}})}}class o extends t.EventDispatcher{constructor(){super()}_loadResourceFilter(e,a){if(this.sourceUrl=t.URL.formatURL(a),-1==a.indexOf("http://usr/")&&(-1!=a.indexOf("http://")||-1!=a.indexOf("https://")))if(""!=i.loadPath)a=a.split(i.loadPath)[1];else{var n=""!=t.URL.rootPath?t.URL.rootPath:t.URL._basePath,s=a;""!=n&&(a=a.split(n)[1]),a||(a=s)}if(r.subNativeFiles&&0==r.subNativeheads.length)for(var l in r.subNativeFiles){var d=r.subNativeFiles[l];r.subNativeheads=r.subNativeheads.concat(d);for(var u=0;u=0?"/":"\\",s=e.lastIndexOf(n),o=s>=0?e.substr(0,s+1):"",l=0,d=a.length;l\s+<");try{t=(new DOMParser).parseFromString(e,"text/xml")}catch(e){throw"需要引入xml解析库文件"}return t},r.idx=1;class l extends t.EventDispatcher{constructor(){super()}static __init__(){try{var e;if(!(e=t.Accelerator))return;e.prototype.on=l.prototype.on,e.prototype.off=l.prototype.off}catch(e){}}static startListen(e){if(l._callBack=e,!l._isListening){l._isListening=!0;try{r.window.qg.onAccelerometerChange(l.onAccelerometerChange)}catch(e){}}}static stopListen(){l._isListening=!1;try{r.window.qg.stopAccelerometer({})}catch(e){}}static onAccelerometerChange(e){var t;(t={}).acceleration=e,t.accelerationIncludingGravity=e,t.rotationRate={},null!=l._callBack&&l._callBack(t)}on(e,t,i,a=null){return super.on(e,t,i,a),l.startListen(this.onDeviceOrientationChange),this}off(e,t,i,a=!1){return this.hasListener(e)||l.stopListen(),super.off(e,t,i,a)}}l._isListening=!1;class d{_loadImage(e){if(r.isZiYu)d.onCreateImage(e,this,!0);else{var a;if(i.isLocalNativeFile(e)){if(-1==e.indexOf("http://usr/")&&(-1!=e.indexOf("http://")||-1!=e.indexOf("https://")))if(""!=i.loadPath)e=e.split(i.loadPath)[1];else{var n=""!=t.URL.rootPath?t.URL.rootPath:t.URL._basePath,s=e;""!=n&&(e=e.split(n)[1]),e||(e=s)}if(r.subNativeFiles&&0==r.subNativeheads.length)for(var o in r.subNativeFiles){var l=r.subNativeFiles[o];r.subNativeheads=r.subNativeheads.concat(l);for(var u=0;u