Subversion Repository Public Repository

Nextrek

Diff Revisions 1085 vs 1086 for /s2s/data/ENGINE.js

Diff revisions: vs.
  @@ -1,10 +1 @@
1 - function AutotileExpander(){}function GSAutotileExpanderDrawImage(t,e,i,r,o,s,n,a,h,l){var u=GSAutotileExpanderDrawImage.sourceOriginX,c=GSAutotileExpanderDrawImage.sourceOriginY,d=GSAutotileExpanderDrawImage.originX,p=GSAutotileExpanderDrawImage.originY;t.drawImage(e.image,u+n,c+a,h-n,l-a,d+i,p+r,h-n,l-a)}function GSAutotileExpanderDrawLeftTopSmall(t,e,i,r){GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(Math.floor(tw/2)),e+Math.floor(th/2),0,th,Math.floor(tw/2),th+Math.floor(th/2))}function GSAutotileExpanderDrawRightTopSmall(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=th,n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftBottomSmall(t,e,i,r){var o=0,s=3*th+Math.floor(th/2),n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawRightBottomSmall(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=3*th+Math.floor(th/2),n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftTopCorner(t,e,i,r){var o=2*tw,s=0,n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawRightTopCorner(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=0,n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftBottomCorner(t,e,i,r){var o=2*tw,s=Math.floor(th/2),n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawRightBottomCorner(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=Math.floor(th/2),n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftSideTop(t,e,i,r){var o=0,s=th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawRightSideTop(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawLeftSideBottom(t,e,i,r){var o=0,s=3*th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawRightSideBottom(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=3*th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawUpSideLeft(t,e,i,r){var o=0,s=th,n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawUpSideRight(t,e,i,r){var o=2*tw,s=th,n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawDownSideLeft(t,e,i,r){var o=0,s=3*th+Math.floor(th/2),n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawDownSideRight(t,e,i,r){var o=2*tw,s=3*th+Math.floor(th/2),n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftSideSmall(t,e,i,r){var o=0,s=2*th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawRightSideSmall(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=2*th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawUpSideSmall(t,e,i,r){var o=tw,s=th,n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawDownSideSmall(t,e,i,r){var o=tw,s=3*th+Math.floor(th/2),n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftSide(t,e,i,r){var o=0,s=2*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawRightSide(t,e,i,r){var o=2*tw,s=2*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawUpSide(t,e,i,r){var o=tw,s=th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawDownSide(t,e,i,r){var o=tw,s=3*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawLeftTop(t,e,i,r){var o=0,s=th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawRightTop(t,e,i,r){var o=2*tw,s=th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawLeftBottom(t,e,i,r){var o=0,s=3*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawRightBottom(t,e,i,r){var o=2*tw,s=3*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawBackground(t,e,i,r){var o=tw,s=2*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function Utf8ArrayToStr(t){var e,i,r,o,s,n;for(e="",r=t.length,i=0;r>i;)switch(o=t[i++],o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=String.fromCharCode(o);break;case 12:case 13:s=t[i++],e+=String.fromCharCode((31&o)<<6|63&s);break;case 14:s=t[i++],n=t[i++],e+=String.fromCharCode((15&o)<<12|(63&s)<<6|(63&n)<<0)}return e}function MAX(t,e){return Math.max(t,e)}function MIN(t,e){return Math.min(t,e)}(function(){var t;window.GS={dataCache:{}},window.gs={},window.$MOBILE=!1,t=function(){function t(){this.onExit=null,this.onReady=null}return t.prototype.initialize=function(){return gs.Platform={},void 0!==typeof window&&window.navigator&&(gs.Platform.isEdge=-1!==window.navigator.userAgent.indexOf("Edge"),gs.Platform.isChrome=!gs.Platform.isEdge&&-1!==window.navigator.userAgent.indexOf("Chrome"),gs.Platform.isSafari=!gs.Platform.isEdge&&!gs.Platform.isChrome&&-1!==window.navigator.userAgent.indexOf("Safari"),gs.Platform.isSafariMobile=!!window.navigator.userAgent.match(/iPad/i)||!!window.navigator.userAgent.match(/iPhone/i),gs.Platform.isCordova="undefined"!=typeof cordova,gs.Platform.isAndroid=gs.Platform.isCordova&&"android"===cordova.platformId,gs.Platform.isAtsumaru="undefined"!=typeof RPGAtsumaru),gs.Platform.isCordova?document.addEventListener("deviceready",function(t){return function(){return"function"==typeof t.onReady?t.onReady():void 0}}(this),!1):jQuery(document).ready(function(t){return function(){return"function"==typeof t.onReady?t.onReady():void 0}}(this))},t.prototype.exit=function(){var t;return $PARAMS.platform.isSteamOS?window.close():$PARAMS.isOffline&&null!=window.require?(t=require("nw.gui"),t.App.quit()):null!=this.onExit?this.onExit():void 0},t.prototype.getPlatformSpecificGraphicsFilePath=function(t,e){var i,r,o,s,n;return n=GS.dataCache.RESOURCES.items.resources,o=t+"_"+e,i=null,r=null,s=null,n[o]?(s=o,r=n[o]||".png"):(s=t,r=n[t]||".png"),i=r,i=".fnt"===i?".png":i,gs.Platform.isCordova&&gs.Platform.isAndroid&&$PARAMS.usePlayStoreExpansionFile?"content://"+$PARAMS.gameIdentifier+"/main_expansion/resources/"+GS.DataPreparer.prepareFilePath(s+i):"resources/"+GS.DataPreparer.prepareFilePath(s+i)},t.prototype.getPlatformSpecificVideoFilePath=function(t,e){var i,r,o,s,n;return n=GS.dataCache.RESOURCES.items.resources,o=t+"_"+e,i=null,r=null,s=null,n[o]?(s=o,r=n[o]||[".webm"]):(s=t,r=n[t]||[".webm"]),gs.Platform.isSafari||gs.Platform.isEdge||gs.Platform.isSafariMobile?(i=-1!==r.indexOf(".mp4")?".mp4":"",i=i?i:r[0]):(i=-1!==r.indexOf(".webm")?".webm":"",i=i?".webm":r[0]||".webm"),gs.Platform.isCordova&&gs.Platform.isAndroid&&$PARAMS.usePlayStoreExpansionFile?"content://"+$PARAMS.gameIdentifier+"/main_expansion/resources/"+GS.DataPreparer.prepareFilePath(s+i):"resources/"+GS.DataPreparer.prepareFilePath(s+i)},t.prototype.getPlatformSpecificAudioFilePath=function(t,e){var i,r,o,s,n;return n=GS.dataCache.RESOURCES.items.resources,o=t+"_"+e,i=null,r=null,s=null,n[o]?(s=o,r=n[o]||[".wav"]):(s=t,r=n[t]||[".wav"]),gs.Platform.isSafari||gs.Platform.isEdge||gs.Platform.isSafariMobile?(i=-1!==r.indexOf(".m4a")?".m4a":"",i=i||-1===r.indexOf(".mp4")?i:".mp4",i=i||-1===r.indexOf(".mp3")?i:".mp3",i=i||-1===r.indexOf(".aac")?i:".aac",i=i?i:r[0]):i=r[0],gs.Platform.isCordova&&gs.Platform.isAndroid&&$PARAMS.usePlayStoreExpansionFile?"content://"+$PARAMS.gameIdentifier+"/main_expansion/resources/"+GS.DataPreparer.prepareFilePath(s+i):"resources/"+GS.DataPreparer.prepareFilePath(s+i)},t.prototype.loadData=function(t,e,i,r,o){var s;return gs.Platform.isSafariMobile&&gs.Platform.isCordova?resolveLocalFileSystemURL(cordova.file.applicationDirectory+"/www/"+t,function(t){return t.file(function(t){var o;return o=new FileReader,o.onloadend=function(){return e(this.result)},o.onerror=function(t){return i(t)},1===r?o.readAsDataURL(t):o.readAsArrayBuffer(t)})},function(t){return i(t)}):(s=new XMLHttpRequest,s.open("GET",t,!0),s.responseType="arraybuffer",s.onload=function(){return function(){return e(s.response,o)}}(this),s.onerror=function(){return function(t){return i(t)}}(this),s.send())},t}(),window.gs||(window.gs={}),window.Application=new t,gs.Application=window.Application,gs.CallBack=function(t,e,i){var r,o;return null!=i?(o=e[t],r=function(){var t,r,s,n;for(t=new Array(arguments.length+1),r=s=0,n=arguments.length;n>=0?n>s:s>n;r=n>=0?++s:--s)t[r]=arguments[r];return t[t.length-1]=i,o.apply(e,t)}):r=function(){return e[t].apply(e,arguments)},r.$vnm_cb=!0,r.funcName=t,r.object=e,r.data=i,r}}).call(this),function(){var t;t=function(){function t(){this.handlerList={}}return t.prototype.on=function(t,e,i){return this.handlerList[t]||(this.handlerList[t]=[]),this.handlerList[t].push({once:!1,data:e,callback:i})},t.prototype.once=function(t,e,i){return this.handlerList[t]||(this.handlerList[t]=[]),this.handlerList[t].push({once:!0,data:e,callback:i})},t.prototype.emit=function(t,e){var i,r,o,s,n,a,h;if(o=this.handlerList[t],i=[],o)for(s=0,a=o.length;a>s;s++)r=o[s],r.callback({sender:this,params:e,data:r.data}),r.once&&i.push(r);for(n=0,h=i.length;h>n;n++)r=i[n],o.remove(r);return null},t}(),gs.EventEmitter=t}.call(this),function(){var ObjectCodec,ObjectCodecContext;ObjectCodecContext=function(){function t(t,e,i){this.mode=0,this.decodedObjectStore=null!=t?t:[],this.encodedObjectStore=null!=e?e:[],this.tempObjectStore=null!=i?i:[],this.restoreEventReceivers=[]}return t}(),gs.ObjectCodecContext=ObjectCodecContext,ObjectCodec=function(){function ObjectCodec(){}return ObjectCodec.onRestore=function(t,e){var i,r,o,s,n,a,h,l;i=e.decodedObjectStore,n=e.tempObjectStore;for(s in t)if(l=t[s],-1===n.indexOf(l)&&-1!==i.indexOf(l)&&null!=l)if(n.push(l),l instanceof Array)for(r=o=0,a=l.length;a>=0?a>o:o>a;r=a>=0?++o:--o)gs.ObjectCodec.onRestore(l[r],e),null!=(null!=(h=l[r])?h.onDataBundleRestore:void 0)&&-1===e.restoreEventReceivers.indexOf(l[r])&&(e.restoreEventReceivers.push(l[r]),l[r].onDataBundleRestore(null,e));else"object"==typeof l&&(gs.ObjectCodec.onRestore(l,e),l.onDataBundleRestore&&-1===e.restoreEventReceivers.indexOf(l)&&(e.restoreEventReceivers.push(l),"function"==typeof l.onDataBundleRestore&&l.onDataBundleRestore(null,e)));return null},ObjectCodec.decode=function(object,context){var a,decObjStore,decObject,i,id,j,objClass,objStore,ref;if(null==object)return object;if(objStore=context.encodedObjectStore,decObjStore=context.decodedObjectStore,decObject=null,"string"==typeof object&&-1!==object.indexOf("$$vnm_obj_ref")&&(id=parseInt(object.split(" ")[1]),object=objStore[id],decObject=decObjStore[id]),null!=object&&null==decObject)if(object instanceof Array)for(a=[],decObjStore[id]=a,decObject=a,i=j=0,ref=object.length;ref>=0?ref>j:j>ref;i=ref>=0?++j:--j)a[i]=gs.ObjectCodec.decode(object[i],context);else"object"==typeof object?"Function"===object.$class?object.$vnm_cb?(gs.ObjectCodec.decodeProperties(object,context),decObject=gs.CallBack(object.name,object.object,object.data),decObjStore[id]=decObject):(decObject=eval("("+object.source+")"),decObjStore[id]=decObject):(objClass=window[object.$ns||"gs"][object.$class]||window[object.$class]||Object,objClass.fromDataBundle?(decObject=objClass.fromDataBundle(object,context),decObjStore[id]=decObject):(decObject="function"==typeof objClass?new objClass:objClass,decObjStore[id]=decObject,object=gs.ObjectCodec.decodeProperties(object,context),delete object.$class,delete object.$ns,Object.mixin(decObject,object))):decObject=object;return decObject},ObjectCodec.decodeProperties=function(t,e){var i,r,o;r=t;for(i in t)o=t[i],null!=o&&("string"==typeof o?-1!==o.indexOf("$$vnm_obj_ref")?r[i]=gs.ObjectCodec.decode(o,e):"$$vnm_no_decode"!==o&&(r[i]=o):r[i]=o);return r},ObjectCodec.encode=function(t,e,i){var r,o,s,n,a,h,l,u,c;if(l=e.decodedObjectStore,o=e.encodedObjectStore,u=null,t instanceof Array||t instanceof Float32Array){for(l.push(t),r=[],s=a=0,c=t.length;c>=0?c>a:a>c;s=c>=0?++a:--a)r[s]=gs.ObjectCodec.encode(t[s],e,i);n=l.indexOf(t),o[n]=r,u="$$vnm_obj_ref "+n}else t instanceof Object?(l.push(t),h=null,"function"==typeof t?t.$vnm_cb?(h=gs.ObjectCodec.encodeProperties({name:t.funcName,object:t.object,data:t.data},e),h.$vnm_cb=!0,h.$class="Function"):(h={source:t.toString()},h.$class="Function",h.$ns=null):t.constructor.toDataBundle?(h=t.constructor.toDataBundle(t,e),h.$class=t.constructor.$name||t.constructor.name,h.$ns=t.constructor.$namespace):(h=gs.ObjectCodec.encodeProperties(t,e,t.constructor.objectCodecBlackList),h.$class=t.constructor.$name||t.constructor.name,h.$ns=t.constructor.$namespace),n=l.indexOf(t),u="$$vnm_obj_ref "+n,o[n]=h):u=t;return u},ObjectCodec.encodeProperties=function(t,e,i){var r,o,s,n,a,h;n=e.decodedObjectStore,r=e.encodedObjectStore,a={};for(s in t)!t.hasOwnProperty(s)||i&&-1!==i.indexOf(s)||(h=t[s],o=n.indexOf(h),a[s]=-1!==o?"$$vnm_obj_ref "+o:gs.ObjectCodec.encode(h,e,null));return a},ObjectCodec}(),gs.ObjectCodec=ObjectCodec}.call(this),function(){var t,e,i=function(t,e){function i(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=function(){function t(){}return t.initialize=function(){return this.WORKING_DIRECTORY=0,this.APP_DATA_DIRECTORY=1,this.INTERNAL_STORAGE=2},t}(),e.initialize(),gs.GameStorageLocations=e,t=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.initializationTimer=null}return i(e,t),e.prototype.clear=function(){return localStorage.clear()},e.prototype.initialize=function(){return gs.Platform.isAtsumaru?(this.atsumaruCloudStorage=RPGAtsumaru.storage.getItems(),this.atsumaruCloudStorage.isFulfilled()?this.emit("finishInitialize"):this.atsumaruCloudStorage.isRejected()?(this.atsumaruCloudStorage=null,this.emit("finishInitialize")):this.initializationTimer=setInterval(function(t){return function(){return t.atsumaruCloudStorage.isFulfilled()?(clearInterval(t.initializationTimer),t.atsumaruCloudStorage=t.atsumaruCloudStorage.value(),t.emit("finishInitialize")):t.atsumaruCloudStorage.isRejected()?(clearInterval(t.initializationTimer),t.atsumaruCloudStorage=null,t.emit("finishInitialize")):void 0}}(this),10)):this.emit("finishInitialize")},e.prototype.storagePath=function(){if(!$PARAMS.isOffline||$PARAMS.platform.isSteamOS||null==window.nw)return"";switch(RecordManager.system.gameDataPath){case gs.GameStorageLocations.APP_DATA_DIRECTORY:return nw.App.dataPath;case gs.GameStorageLocations.WORKING_DIRECTORY:return"./";case gs.GameStorageLocations.INTERNAL_STORAGE:return"";default:return"./"}},e.prototype.exists=function(t){return $PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").existsSync(this.storagePath()+"/"+t+".vndata"):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,this.atsumaruCloudStorage.filter(function(e){return e.key===t}).length>0):null!==localStorage.getItem($PARAMS.uid+"_"+t)},e.prototype.remove=function(t){var e;if($PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw){if(require("fs").existsSync(this.storagePath()+"/"+t+".vndata"))return require("fs").unlinkSync(this.storagePath()+"/"+t+".vndata")}else{if(!gs.Platform.isAtsumaru||!this.atsumaruCloudStorage)return localStorage.removeItem($PARAMS.uid+"_"+t);if(t=$PARAMS.uid+"_"+t,RPGAtsumaru.storage.removeItem(t),e=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0])return this.atsumaruCloudStorage.splice(this.atsumaruCloudStorage.indexOf(e),1)}},e.prototype.setData=function(t,e){var i;return $PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").writeFileSync(this.storagePath()+"/"+t+".vndata",e):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,i=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0],i||(i={key:t,value:null},this.atsumaruCloudStorage.push(i)),i.value=e,RPGAtsumaru.storage.setItems([{key:t,value:e}])):localStorage.setItem($PARAMS.uid+"_"+t,e)},e.prototype.getData=function(t){var e;return e=null,$PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?e=require("fs").readFileSync(this.storagePath()+"/"+t+".vndata","utf8"):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,e=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0],e=null!=e?e.value:void 0):e=localStorage.getItem($PARAMS.uid+"_"+t),e},e.prototype.setObject=function(t,e){var i;return $PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").writeFileSync(this.storagePath()+"/"+t+".vndata",JSON.stringify(e)):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,i=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0],i||(i={key:t,value:null},this.atsumaruCloudStorage.push(i)),i.value=JSON.stringify(e),RPGAtsumaru.storage.setItems([{key:t,value:i.value}])):localStorage.setItem($PARAMS.uid+"_"+t,JSON.stringify(e))},e.prototype.getObject=function(t){var e,i;return e=null,i=null,$PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").existsSync(this.storagePath()+"/"+t+".vndata")&&(e=require("fs").readFileSync(this.storagePath()+"/"+t+".vndata","utf8")):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,e=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0],e=null!=e?e.value:void 0):e=localStorage.getItem($PARAMS.uid+"_"+t),i=null,null!=e&&(i=JSON.parse(e)),i},e}(gs.EventEmitter),window.GameStorage=new t,gs.GameStorage=window.GameStorage}.call(this),function(){var t;t=function(){function t(){}return t.postSceneChange=function(t){return t=t.truncate(16),gs.Platform.isAtsumaru?RPGAtsumaru.comment.changeScene(t):void 0},t.postResetSceneChange=function(t){return t=t.truncate(16),gs.Platform.isAtsumaru?RPGAtsumaru.comment.resetAndChangeScene(t):void 0},t.postContextChange=function(t){return gs.Platform.isAtsumaru?RPGAtsumaru.comment.pushContextFactor(t):void 0},t.postMinorChange=function(){return gs.Platform.isAtsumaru?RPGAtsumaru.comment.pushMinorContext():void 0},t}(),gs.GameNotifier=t}.call(this),function(){var Data;Data=function(){function Data(){}return Data._loadTest=function(t,e){var i,r;return r=new XMLHttpRequest,r.open("GET","./data/"+t+".json",!0),r.responseType="arraybuffer",i=function(){return function(t){return console.log("ERROR"),console.log(t),"function"==typeof e?e(null,t):void 0}}(this),r.onload=function(){return function(){var o,s;return o=GS.DataPreparer.prepare(r.response),s=new FileReader,s.onload=function(i){var r;return r=JSON.parse(i.target.result),GS.dataCache[t]=r,"function"==typeof e?e(r,null):void 0},s.onerror=i,s.readAsText(new Blob([o]))}}(this),r.onerror=i,r.send()},Data._loadRelease=function(uid,callback){return gs.Application.loadData("data/"+uid+".json.js",function(_this){return function(data){var buffer,reader;return buffer=GS.DataPreparer.prepare(data),reader=new FileReader,reader.onload=function(e){var dataObject;return eval(e.target.result),dataObject=GS.dataCache[uid],"function"==typeof callback?callback(dataObject,null):void 0},reader.onerror=function(t){return console.log("ERROR"),console.log(t),"function"==typeof callback?callback(null,t):void 0},reader.readAsText(new Blob([buffer]))}}(this),function(){return function(t){return console.log("ERROR"),console.log(t),"function"==typeof callback?callback(null,t):void 0}}(this))},Data.load=function(t,e){return null!=$PARAMS.testOffline?this._loadTest(t,e):this._loadRelease(t,e)},Data.loadRaw=function(t,e){return gs.Application.loadData(t,function(){return function(t){var i,r;return i=GS.DataPreparer.prepare(t),r=new FileReader,r.onload=function(t){return"function"==typeof e?e(t.target.result,null):void 0},r.onerror=function(t){return console.log("ERROR"),console.log(t),"function"==typeof e?e(null,t):void 0},r.readAsText(new Blob([i]))}}(this),function(){return function(t){return console.log("ERROR"),console.log(t),"function"==typeof e?e(null,t):void 0}}(this))},Data}(),gs.Data=Data}.call(this),function(){var t,e,i,r=function(t,e){function i(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},o={}.hasOwnProperty;t=function(){function t(t){this.data=t}return t.prototype.readString=function(t,e,i){var r,o,s,n;for(n="",r=o=0,s=i;s>=0?s>o:o>s;r=s>=0?++o:--o)n+=String.fromCharCode(t[e+r]);return n},t.prototype.readNum32LE=function(t,e){return 16777216*t[e+3]+65536*t[e+2]+256*t[e+1]+t[e+0]},t.prototype.readNum32BE=function(t,e){return 16777216*t[e+0]+65536*t[e+1]+256*t[e+2]+t[e+3]},t}(),i=function(t){function e(t){e.__super__.constructor.call(this,t),this.loopStart=0,this.loopLength=0,this.sampleRate=0,this.parse(t)}return r(e,t),e.prototype.parse=function(t){var e,i,r,o,s,n,a,h,l,u,c;try{for(o=0;o<t.length&&"OggS"===this.readString(t,o,4);){for(o+=26,c=!1,a=t[o++],u=[],r=s=0,h=a;h>=0?h>s:s>h;r=h>=0?++s:--s)u.push(t[o++]);for(r=n=0,l=a;l>=0?l>n:n>l;r=l>=0?++n:--n)"vorb"===this.readString(t,o+1,4)&&(i=t[o],1===i?this.sampleRate=this.readNum32LE(t,o+12):3===i&&this.readLoopData(t,o,u[r]),c=!0),o+=u[r];if(!c)break}}catch(d){e=d,console.log("ERROR PARSING OGG META DATA"),console.log(e)}return null},e.prototype.readLoopData=function(t,e,i){var r,o,s,n,a,h;for(a=[],r=o=s=e,n=e+i-10;n>=s?n>o:o>n;r=n>=s?++o:--o)if("LOOP"===this.readString(t,r,4)){for(h="";t[r]>0;)h+=String.fromCharCode(t[r++]);h.match(/LOOPSTART=([0-9]+)/)&&(this.loopStart=parseInt(RegExp.$1)),a.push(h.match(/LOOPLENGTH=([0-9]+)/)?this.loopLength=parseInt(RegExp.$1):void 0)}else a.push(void 0);return a},e}(t),e=function(t){function e(t){e.__super__.constructor.call(this,t),this.loopStart=0,this.loopLength=0,this.sampleRate=0,this.parse(t)}return r(e,t),e.prototype.parse=function(t){var e,i,r,o,s;try{if("ftyp"===this.readString(t,4,4)){for(i=0,o=[];i<t.length;)if(s=this.readNum32BE(t,i),r=this.readString(t,i+4,4),"moov"===r)o.push(i+=8);else{if("mvhd"===r&&(this.sampleRate=this.readNum32BE(t,i+20)),("udta"===r||"meta"===r)&&this.readLoopData(t,i,s),i+=s,1>=s)break;o.push(void 0)}return o}}catch(n){return e=n,console.log("ERROR PARSING MP4/M4A META DATA"),console.log(e)}},e.prototype.readLoopData=function(t,e,i){var r,o,s,n,a,h,l;for(h=[],r=o=n=e,a=e+i-10;a>=n?a>o:o>a;r=a>=n?++o:--o)if("LOOP"===this.readString(t,r,4)){for(s="";t[r]>0;)s+=String.fromCharCode(t[r++]);if("LOOPSTART"===s||"LOOPLENGTH"===s){for(l="",r+=16;t[r]>0;)l+=String.fromCharCode(t[r++]);h.push("LOOPSTART"===s?this.loopStart=parseInt(l):this.loopLength=parseInt(l))}else h.push(void 0)}else h.push(void 0);return h},e}(t),gs.BinaryData=t,gs.OggData=i,gs.Mp4Data=e}.call(this),function(){var t,e;e=function(){function t(){this.LEFT=1,this.MIDDLE=2,this.RIGHT=3,this.BUTTON_LEFT=1,this.BUTTON_MIDDLE=2,this.BUTTON_RIGHT=3,this.DIRECTION_NONE=0,this.DIRECTION_HORIZONTAL=1,this.DIRECTION_VERTICAL=2,this.DIRECTION_BOTH=3,this.buttons=new Uint8Array(new ArrayBuffer(4)),this.wheel=0,this.x=0,this.y=0,this.initialized=!1,this.hammer=null,this.screen=null,this.mouseMoveOnTouchDevices=0,this.moved=!1,this.buttonDown=!1,this.buttonUp=!1,this.wheelChanged=!1,this.lx=0,this.ly=0}return t.prototype.initialize=function(){return Graphics.canvas.addEventListener("scroll",function(){return function(t){return t.preventDefault()}}(this)),window.addEventListener("scroll",function(){return function(t){return t.preventDefault()}}(this)),window.addEventListener("touchmove",function(){return function(t){return t.preventDefault()}}(this)),window.addEventListener("touchstart",function(){return function(t){return t.preventDefault()}}(this)),window.addEventListener("touchend",function(){return function(t){return t.preventDefault()}}(this)),window.document.addEventListener("touchmove",function(){return function(t){return t.preventDefault()}}(this)),window.document.addEventListener("touchstart",function(){return function(t){return t.preventDefault()}}(this)),window.document.addEventListener("touchend",function(){return function(t){return t.preventDefault()}}(this)),jQuery(Graphics.canvas).bind("touchmove",function(t){return function(e){var i,r,o,s;return e=e.originalEvent,e.preventDefault(),2===e.touches.length?(r=e.touches[0].clientY-t.ly,i=e.touches[0].clientX-t.lx,o=Math.max(0,e.touches[0].clientX-Graphics.x),s=Math.max(0,e.touches[0].clientY-Graphics.y),t.x=Math.round(o*Graphics.scaleFactorX),t.y=Math.round(s*Graphics.scaleFactorY),t.buttonDown=!1,t.buttons[1]=0,r>0&&(t.wheel=-1),0>r&&(t.wheel=1),t.wheelSpeed=r/.05,t.wheelChanged=!0):(o=Math.max(0,e.touches[0].clientX-Graphics.x),s=Math.max(0,e.touches[0].clientY-Graphics.y),t.x=Math.round(o*Graphics.scaleFactorX),t.y=Math.round(s*Graphics.scaleFactorY),t.buttons[1]=1,t.buttonDown=!0),t.ly=e.touches[0].clientY,t.lx=e.touches[0].clientX,!1}}(this)),jQuery(Graphics.canvas).bind("touchstart",function(t){return function(e){var i,r;return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),e=e.originalEvent,t.ly=e.touches[0].clientY,t.lx=e.touches[0].clientX,1===e.touches.length&&(i=Math.max(0,e.touches[0].clientX-Graphics.x),r=Math.max(0,e.touches[0].clientY-Graphics.y),t.x=Math.round(i*Graphics.scaleFactorX),t.y=Math.round(r*Graphics.scaleFactorY),t.buttons[1]=1,t.buttonDown=!0),2===e.touches.length&&(t.buttons[3]=1,t.buttonDown=!0),!1}}(this)),jQuery(Graphics.canvas).bind("touchend",function(t){return function(e){var i,r;return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),e=e.originalEvent,1===e.changedTouches.length&&(i=Math.max(0,e.changedTouches[0].clientX-Graphics.x),r=Math.max(0,e.changedTouches[0].clientY-Graphics.y),t.x=Math.round(i*Graphics.scaleFactorX),t.y=Math.round(r*Graphics.scaleFactorY),t.buttons[1]=2,t.buttonUp=!0),3===e.changedTouches.length&&(t.buttons[3]=2,t.buttonUp=!0),t.lx=0,t.ly=0,!1}}(this)),jQuery.browser.mobile||($PARAMS.platform.isSteamOS?this.screen=require("screen"):jQuery(Graphics.canvas).mousemove(function(t){return function(e){return t.x=e.offsetX,t.y=e.offsetY,t.moved=!0}}(this)),jQuery(document).bind("contextmenu",function(){return function(t){return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1}}(this)),Graphics.canvas.addEventListener("mousewheel",function(t){return function(e){return t.updateMouseWheel(e),!1}}(this)),jQuery(Graphics.canvas).mousedown(function(t){return function(e){return t.buttons[e.which]=1,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.buttonDown=!0,!1}}(this)),jQuery(Graphics.canvas).mouseup(function(t){return function(e){return t.buttons[e.which]=2,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.buttonUp=!0,!1}}(this))),this.initialized=!0},t.prototype.updateMouseWheel=function(t){return this.wheel=t.wheelDelta>=0?1:-1,this.wheelSpeed=t.wheelDelta,this.wheelChanged=!0},t.prototype.isButton=function(t){var e;switch(e=!0,t){case this.LEFT:e=!0;break;case this.MIDDLE:e=!0;break;case this.RIGHT:e=!0;break;default:e=!1}return e},t.prototype.press=function(t){return 1===this.buttons[t]},t.prototype.update=function(){var t,e,i,r,o;for(t=e=0,o=this.buttons.length;o>=0?o>e:e>o;t=o>=0?++e:--e)2===this.buttons[t]&&(this.buttons[t]=0);return this.wheel=0,this.wheelSpeed=0,this.wheelChanged=!1,this.buttonDown=!1,this.buttonUp=!1,this.moved=!1,this.screen&&(i=this.screen.getCursorScreenPoint(),r=Graphics.canvas.getClientRects()[0],this.x=Math.max(i.x-r.left,0),this.y=Math.max(i.y-r.top,0),this.x=Math.min(Math.round(this.x*Graphics.scaleFactorX),Graphics.width),this.y=Math.min(Math.round(this.y*Graphics.scaleFactorY),Graphics.height),(this.x!==this.lx||this.y!==this.ly)&&(this.lx=this.x,this.ly=this.y,this.moved=!0)),null},t.prototype.clear=function(){var t,e,i,r;for(r=[],t=e=0,i=this.buttons.length;i>=0?i>e:e>i;t=i>=0?++e:--e)r.push(this.buttons[t]=0);return r},t}(),t=function(){function t(){this.LEFT=37,this.UP=38,this.RIGHT=39,this.DOWN=40,this.A=16,this.B=88,this.C=13,this.X=65,this.Y=83,this.Z=68,this.L=81,this.R=87,this.START=this.C,this.SELECT=this.Z,this.KEY_CANCEL=3,this.KEY_HELP=6,this.KEY_BACK_SPACE=8,this.KEY_TAB=9,this.KEY_CLEAR=12,this.KEY_RETURN=13,this.KEY_ENTER=14,this.KEY_SHIFT=16,this.KEY_CONTROL=17,this.KEY_ALT=18,this.KEY_PAUSE=19,this.KEY_CAPS_LOCK=20,this.KEY_ESCAPE=27,this.KEY_SPACE=32,this.KEY_PAGE_UP=33,this.KEY_PAGE_DOWN=34,this.KEY_END=35,this.KEY_HOME=36,this.KEY_LEFT=37,this.KEY_UP=38,this.KEY_RIGHT=39,this.KEY_DOWN=40,this.KEY_PRINTSCREEN=44,this.KEY_INSERT=45,this.KEY_DELETE=46,this.KEY_0=48,this.KEY_1=49,this.KEY_2=50,this.KEY_3=51,this.KEY_4=52,this.KEY_5=53,this.KEY_6=54,this.KEY_7=55,this.KEY_8=56,this.KEY_9=57,this.KEY_SEMICOLON=59,this.KEY_EQUALS=61,this.KEY_A=65,this.KEY_B=66,this.KEY_C=67,this.KEY_D=68,this.KEY_E=69,this.KEY_F=70,this.KEY_G=71,this.KEY_H=72,this.KEY_I=73,this.KEY_J=74,this.KEY_K=75,this.KEY_L=76,this.KEY_M=77,this.KEY_N=78,this.KEY_O=79,this.KEY_P=80,this.KEY_Q=81,this.KEY_R=82,this.KEY_S=83,this.KEY_T=84,this.KEY_U=85,this.KEY_V=86,this.KEY_W=87,this.KEY_X=88,this.KEY_Y=89,this.KEY_Z=90,this.KEY_CONTEXT_MENU=93,this.KEY_NUMPAD0=96,this.KEY_NUMPAD1=97,this.KEY_NUMPAD2=98,this.KEY_NUMPAD3=99,this.KEY_NUMPAD4=100,this.KEY_NUMPAD5=101,this.KEY_NUMPAD6=102,this.KEY_NUMPAD7=103,this.KEY_NUMPAD8=104,this.KEY_NUMPAD9=105,this.KEY_MULTIPLY=106,this.KEY_ADD=107,this.KEY_SEPARATOR=108,this.KEY_SUBTRACT=109,this.KEY_DECIMAL=110,this.KEY_DIVIDE=111,this.KEY_F1=112,this.KEY_F2=113,this.KEY_F3=114,this.KEY_F4=115,this.KEY_F5=116,this.KEY_F6=117,this.KEY_F7=118,this.KEY_F8=119,this.KEY_F9=120,this.KEY_F10=121,this.KEY_F11=122,this.KEY_F12=123,this.KEY_F13=124,this.KEY_F14=125,this.KEY_F15=126,this.KEY_F16=127,this.KEY_F17=128,this.KEY_F18=129,this.KEY_F19=130,this.KEY_F20=131,this.KEY_F21=132,this.KEY_F22=133,this.KEY_F23=134,this.KEY_F24=135,this.KEY_NUM_LOCK=144,this.KEY_SCROLL_LOCK=145,this.KEY_COMMA=188,this.KEY_PERIOD=190,this.KEY_SLASH=191,this.KEY_BACK_QUOTE=192,this.KEY_OPEN_BRACKET=219,this.KEY_BACK_SLASH=220,this.KEY_CLOSE_BRACKET=221,this.KEY_QUOTE=222,this.KEY_META=224,this.keyDown=!1,this.keyUp=!1,this.keys=new Uint8Array(new ArrayBuffer(256)),this.repeatedKeys=new Uint8Array(new ArrayBuffer(256)),this.triggeredKeys=new Uint8Array(new ArrayBuffer(256)),this.pressTimes=new Uint32Array(new ArrayBuffer(1024)),this.gamepadButtons=[14,15,12,13,0,1,2,3,0],this.gamepadKeys=[this.LEFT,this.RIGHT,this.UP,this.DOWN,this.A,this.B,this.X,this.Y,this.C],this.gamepadKeyStates=[0,0,0,0,0,0,0,0,0],this.Mouse=new e,this.Gamepad=null}return Object.defineProperty(t.prototype,"touchButtonsEnabled",{get:function(){return this.touchButtonsEnabled_},set:function(t){return this.touchButtonsEnabled_=t,t?(jQuery(window).bind("touchstart",this._onTouchStart),jQuery(window).bind("touchend",this._onTouchEnd)):(jQuery(window).unbind("touchstart",this._onTouchStart),jQuery(window).unbind("touchend",this._onTouchEnd));
2 -
3 - }}),t.prototype._onTouchStart=function(t){var e,i,r;return t.preventDefault(),this.touchButtonsEnabled?(this.tsx=t.originalEvent.touches[0].clientX,this.tsy=t.originalEvent.touches[0].clientY,r=window.innerWidth/4,i=window.innerHeight/2,e=Math.round(i/3),this.tsx>3*r&&this.tsy>i?this.keys[this.B]=1:this.tsx>3*r&&this.tsy<i?this.keys[this.X]=1:this.tsx>2*r&&this.tsy>i?this.keys[this.A]=1:this.tsx>2*r&&this.tsy<i?this.keys[this.Y]=1:this.tsx<1*r&&this.tsy>i&&this.tsy<i+e?(this.keys[this.UP]=1,this.upFrameCount=Graphics.frameCount):this.tsx<1*r&&this.tsy>i+2*e?(this.keys[this.DOWN]=1,this.downFrameCount=Graphics.frameCount):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx<r/2?(this.keys[this.LEFT]=1,this.leftFrameCount=Graphics.frameCount):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx>r/2?(this.keys[this.RIGHT]=1,this.rightFrameCount=Graphics.frameCount):void 0):void 0},t.prototype._onTouchEnd=function(t){var e,i,r;return t.preventDefault(),this.touchButtonsEnabled?(r=window.innerWidth/4,i=window.innerHeight/2,e=Math.round(i/3),this.tsx>3*r&&this.tsy>i?(this.keys[this.B]=2,this.pressTimes[this.B]=0):this.tsx>3*r&&this.tsy<i?(this.keys[this.X]=2,this.pressTimes[this.X]=0):this.tsx>2*r&&this.tsy>i?(this.keys[this.A]=2,this.pressTimes[this.A]=0):this.tsx>2*r&&this.tsy<i?(this.keys[this.Y]=2,this.pressTimes[this.Y]=0):this.tsx<1*r&&this.tsy>i&&this.tsy<i+e?(this.keys[this.UP]=2,this.pressTimes[this.UP]=0):this.tsx<1*r&&this.tsy>i+2*e?(this.keys[this.DOWN]=2,this.pressTimes[this.DOWN]=0):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx<r/2?(this.keys[this.LEFT]=2,this.pressTimes[this.LEFT]=0):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx>r/2?(this.keys[this.RIGHT]=2,this.pressTimes[this.RIGHT]=0):void 0):void 0},t.prototype.initialize=function(){return jQuery.browser.mobile&&(this.C=this.A,this.touchButtonsEnabled=!1,this.isTouchDevice=!0),this.leftFrameCount=0,this.rightFrameCount=0,this.upFrameCount=0,this.downFrameCount=0,jQuery(document).keydown(function(t){return function(e){return Graphics.frozen?void 0:(t.keyDown=!0,t.keys[e.keyCode]=1,e.keyCode===t.LEFT&&(t.leftFrameCount=Graphics.frameCount),e.keyCode===t.RIGHT&&(t.rightFrameCount=Graphics.frameCount),e.keyCode===t.UP&&(t.upFrameCount=Graphics.frameCount),e.keyCode===t.DOWN?t.downFrameCount=Graphics.frameCount:void 0)}}(this)),jQuery(document).keyup(function(t){return function(e){return t.keyUp=!0,t.keys[e.keyCode]=2,t.pressTimes[e.keyCode]=0}}(this))},t.prototype.press=function(t){return 1===this.keys[t]},t.prototype.release=function(t){return 2===this.keys[t]},t.prototype.trigger=function(t){return 1===this.triggeredKeys[t]},t.prototype.repeat=function(t){return 1===this.repeatedKeys[t]},t.prototype.dir4=function(){return 1===this.keys[this.LEFT]&&(jQuery.browser.mobile||this.leftFrameCount>this.rightFrameCount&&this.leftFrameCount>this.upFrameCount&&this.leftFrameCount>this.downFrameCount)?4:1===this.keys[this.RIGHT]&&(jQuery.browser.mobile||this.rightFrameCount>this.leftFrameCount&&this.rightFrameCount>this.upFrameCount&&this.rightFrameCount>this.downFrameCount)?8:1===this.keys[this.UP]&&(jQuery.browser.mobile||this.upFrameCount>this.downFrameCount&&this.upFrameCount>this.leftFrameCount&&this.upFrameCount>this.rightFrameCount)?6:1===this.keys[this.DOWN]&&(jQuery.browser.mobile||this.downFrameCount>this.upFrameCount&&this.downFrameCount>this.leftFrameCount&&this.downFrameCount>this.rightFrameCount)?2:0},t.prototype.dir8=function(){return 1===this.keys[this.LEFT]&&1===this.keys[this.UP]?7:1===this.keys[this.RIGHT]&&1===this.keys[this.UP]?5:1===this.keys[this.RIGHT]&&1===this.keys[this.DOWN]?3:1===this.keys[this.LEFT]&&1===this.keys[this.DOWN]?1:this.dir4()},t.prototype.clear=function(){var t,e,i;for(t=e=0,i=this.keys.length;i>=0?i>e:e>i;t=i>=0?++e:--e)this.keys[t]=0,this.triggeredKeys[t]=0,this.pressTimes[t]=0;return this.Mouse.initialized?this.Mouse.clear():void 0},t.prototype.update=function(){var t,e,i,r,o,s,n;if(this.keyDown=!1,this.keyUp=!1,null!=this.Gamepad)for(this.Gamepad=navigator.getGamepads()[0],t=e=0,s=this.gamepadKeys.length;s>=0?s>e:e>s;t=s>=0?++e:--e){if(r=this.gamepadKeys[t],o=this.Gamepad.buttons[this.gamepadButtons[t]].pressed,!o)switch(t){case 0:o=Math.round(this.Gamepad.axes[0])<0;break;case 1:o=Math.round(this.Gamepad.axes[0])>0;break;case 2:o=Math.round(this.Gamepad.axes[1])<0;break;case 3:o=Math.round(this.Gamepad.axes[1])>0}1!==this.gamepadKeyStates[t]&&o?(this.keys[r]=1,this.gamepadKeyStates[t]=1,r===this.LEFT&&(this.leftFrameCount=Graphics.frameCount),r===this.RIGHT&&(this.rightFrameCount=Graphics.frameCount),r===this.UP&&(this.upFrameCount=Graphics.frameCount),r===this.DOWN&&(this.downFrameCount=Graphics.frameCount)):1!==this.gamepadKeyStates[t]||o||(this.gamepadKeyStates[t]=0,this.keys[r]=2,this.pressTimes[r]=0)}for(this.Mouse.initialized&&this.Mouse.update(),t=i=0,n=this.keys.length;n>=0?n>i:i>n;t=n>=0?++i:--i)this.repeatedKeys[t]=0,2===this.keys[t]&&(this.keys[t]=0),1===this.keys[t]&&this.pressTimes[t]++,this.triggeredKeys[t]=1===this.pressTimes[t]?1:0,this.repeatedKeys[t]=1===this.pressTimes[t]||this.pressTimes[t]>20&&0===(3&this.pressTimes[t])?1:0;return 0===this.keys[this.LEFT]&&(this.leftFrameCount=0),0===this.keys[this.RIGHT]&&(this.rightFrameCount=0),0===this.keys[this.UP]&&(this.upFrameCount=0),0===this.keys[this.DOWN]?this.downFrameCount=0:void 0},t}(),window.Input=new t,gs.Input=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t,e,r){i.__super__.constructor.apply(this,arguments),this.filePath=t,this.languageCode=r,this.context=GS.Audio.context,this.loaded=!1,this.playing=!1,this.source=null,this.encodedBuffer=null,this.decodedBuffer=null,this.playIfReady=!1,this.decoded=!1,this.fadeInTime=0,this.fadeOutTime=0,this.fadeInVolume=0,this.playTime=0,this.customData={},this.loop=!1,gs.Audio.addAudioBuffer(this),this.gainNode=null!=this.context.createGain?this.context.createGain():this.context.createGainNode(),t=gs.Application.getPlatformSpecificAudioFilePath(t,r),gs.Application.loadData(t,function(e){return function(i){var r;return e.encodedBuffer=GS.DataPreparer.prepare(i),r=null,t.toLowerCase().endsWith(".ogg")?r=new gs.OggData(new Uint8Array(i)):(t.toLowerCase().endsWith(".m4a")||t.toLowerCase().endsWith(".mp4"))&&(r=new gs.Mp4Data(new Uint8Array(i))),(null!=r?r.loopLength:void 0)>0&&(null!=r?r.sampleRate:void 0)>0&&(e.loopLength=r.loopLength/r.sampleRate,e.loopStart=r.loopStart/r.sampleRate),e.decode()}}(this),function(t){return function(e){return t.loaded=!0,t.error=!0,t.errorObject=e,console.log("AUDIO ERROR"),console.log(e)}}(this))}return e(i,t),i.fromDataBundle=function(t){var e;return e=null,t.filePath&&(e=ResourceManager.getAudioBuffer(t.filePath),e.volume=t.volume,e.playbackRate=t.playbackRate,e.currentTime=t.currentTime,t.isPlaying&&(e.playIfReady=!0)),e},i.toDataBundle=function(t){return{filePath:t.filePath,volume:t.volume,playbackRate:t.playbackRate,currentTime:t.currentTime,isPlaying:t.isPlaying}},Object.defineProperty(i.prototype,"volume",{set:function(t){return this.error?void 0:null!=this.context?this.gainNode.gain.value=t:this.source.volume=t},get:function(){var t,e;return this.error?0:null!=this.context?null!=(t=null!=(e=this.gainNode)?e.gain.value:void 0)?t:100:this.source.volume}}),Object.defineProperty(i.prototype,"isPlaying",{get:function(){return null!=this.context?this.playing:!this.source.paused}}),Object.defineProperty(i.prototype,"loop",{get:function(){return this.loop_},set:function(t){var e,i,r;return this.loop_!==t&&(this.loop_=t,null!=(e=this.source)&&(e.loop=this.loop),this.loopLength>0&&this.loop)?(null!=(i=this.source)&&(i.loopStart=this.loopStart),null!=(r=this.source)?r.loopEnd=this.loopStart+this.loopLength:void 0):void 0}}),Object.defineProperty(i.prototype,"currentTime",{get:function(){var t;return(null!=(t=this.source)?t.currentTime:void 0)||0},set:function(t){var e;return null!=(e=this.source)?e.currentTime=t:void 0}}),Object.defineProperty(i.prototype,"playbackRate",{set:function(t){return this.source?this.context?this.source.playbackRate.value=t:this.source.playbackRate=t:void 0},get:function(){var t,e;return this.source?this.context?null!=(t=null!=(e=this.source)?e.playbackRate.value:void 0)?t:100:this.source.playbackRate:100}}),i.prototype.bufferToBase64=function(t){var e,i,r,o,s,n;for(e="",i=new Uint8Array(t),s=i.byteLength,r=o=0,n=s;n>=0?n>o:o>n;r=n>=0?++o:--o)e+=String.fromCharCode(i[r]);return window.btoa(e)},i.prototype.dispose=function(){var t,e;return this.disposed?void 0:(this.stop(),this.disposed=!0,gs.Audio.removeAudioBuffer(this),(null!=(t=this.source)?t.numberOfOutputs:void 0)>0&&this.source.disconnect(),(null!=(e=this.gainNode)?e.numberOfOutputs:void 0)>0&&this.gainNode.disconnect(),this.gainNode=null,this.encodedBuffer=null,this.decodedBuffer=null,this.source=null,this.decoded=!1)},i.prototype.decode=function(){if(null==this.context)return this.decoded=!0,null!=this.onFinishDecode&&this.onFinishDecode(this),this.emit("finishDecode");if(this.decoded)return null!=this.onFinishDecode&&this.onFinishDecode(this),void this.emit("finishDecode");try{return this.context.decodeAudioData(this.encodedBuffer,function(t){return function(e){return t.decodedBuffer=e,t.loaded=!0,t.source=t.context.createBufferSource(),t.source.buffer=t.decodedBuffer,t.source.onended=function(){return t.playing=!1,null!=t.onEnd?t.onEnd(t):void 0},t.decoded=!0,null!=t.onFinishDecode&&t.onFinishDecode(t),t.emit("finishDecode")}}(this),function(t){return function(e){return t.loaded=!0,t.decoded=!0,t.error=!0,console.log("DECODE ERROR"),console.log(e)}}(this))}catch(t){return this.loaded=!0,this.decoded=!0}},i.prototype.update=function(){return this.playIfReady&&this.loaded&&(this.playIfReady=!1,this.play()),this.playTime>0&&this.playing&&(this.playTime--,this.playTime<=this.fadeOutTime&&(this.fadeInTime=this.playTime,this.playTime=0,this.fadeInVolume=-(this.volume/this.fadeInTime))),this.fadeInTime>0&&!this.error&&(this.fadeInTime--,this.volume=Math.max(Math.min(this.volume+this.fadeInVolume,1),0),this.fadeInTime<=0&&(this.fadeInVolume<0&&null!=this.onFadeOutEnd&&this.onFadeOutEnd(this),this.fadeInVolume>0&&null!=this.onFadeInEnd))?this.onFadeInEnd(this):void 0},i.prototype.play=function(t,e,i){var r,o,s;if(!this.error)return this.context?(this.playTime=e,this.fadeInTime=t||0,this.fadeOutTime=i||0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),this.playing=!0,r=null!=(o=null!=(s=this.source)?s.playbackRate.value:void 0)?o:1,this.source=this.context.createBufferSource(),this.source.buffer=this.decodedBuffer,this.source.loop=this.loop,this.loopLength>0&&this.loop&&(this.source.loopStart=this.loopStart,this.source.loopEnd=this.loopStart+this.loopLength),this.source.onended=function(t){return function(){return t.playing=!1,null!=t.onEnd&&t.onEnd(t),t.loop?t.play():void 0}}(this),this.source.connect(this.gainNode),this.gainNode.connect(this.context.destination),this.source.playbackRate.value=r,this.startTime=this.context.currentTime,null!=this.source.noteOn?this.source.noteOn(0):this.source.start(0)):this.source.play()},i.prototype.resume=function(t){var e;if(!this.error)return this.context?(this.fadeInTime=t||0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),e=this.playbackRate,this.playing=!0,this.source=this.context.createBufferSource(),this.source.loop=this.loop,this.loopLength>0&&this.loop&&(this.source.loopStart=this.loopStart,this.source.loopEnd=this.loopStart+this.loopLength),this.source.onended=function(t){return function(){return t.playing=!1,null!=t.onEnd?t.onEnd(t):void 0}}(this),this.source.buffer=this.decodedBuffer,this.source.connect(this.gainNode),this.playbackRate=e,null!=this.stopTime&&null!=this.startTime?this.source.start(0,this.stopTime-this.startTime):this.source.start(0)):this.source.paused=!1},i.prototype.stop=function(t){if(!this.error){if(this.fadeInTime=t||0,this.fadeInTime>0)return this.fadeInVolume=-(this.volume/this.fadeInTime),this.onFadeOutEnd=function(t){return function(){if(null!=t.source){if(null==t.context)return t.source.paused=!0;if(t.stopTime=t.context.currentTime,t.playing)return t.source.onended=null,null!=t.source.noteOff?t.source.noteOff(0):t.source.stop(0),t.source.numberOfOutputs>0&&t.source.disconnect(),t.playing=!1}}}(this);if(null!=this.source){if(null==this.context)return this.source.paused=!0;if(this.stopTime=this.context.currentTime,this.playing)return null!=this.source.noteOff?this.source.noteOff(0):this.source.stop(0),this.source.numberOfOutputs>0&&this.source.disconnect(),this.playing=!1}}},i.prototype.toDataURL=function(){return this.source.src||""},i}(gs.EventEmitter),window.GS.AudioBuffer=t,gs.AudioBuffer=t}.call(this),function(){var t;t=function(){function t(){var t;this.context=null,this.gainNode=null,this.audioBuffers=[];try{this.context=null!=window.webkitAudioContext?new webkitAudioContext:null!=window.mozAudioContext?new mozAudioContext:null!=window.oAudioContext?new oAudioContext:new AudioContext,this.gainNode=null!=this.context.createGain?this.context.createGain():this.context.createGainNode()}catch(e){t=e,this.context=null}}return t.prototype.addAudioBuffer=function(t){return this.audioBuffers.push(t)},t.prototype.removeAudioBuffer=function(t){return this.audioBuffers.remove(t)},t.prototype.pause=function(){var t,e,i,r,o,s;for(o=this.audioBuffers,s=[],i=0,r=o.length;r>i;i++)if(t=o[i],null!=t){t.customData.wasPlaying=t.isPlaying;try{s.push(t.isPlaying?t.stop(0):void 0)}catch(n){e=n,s.push(console.warn(e))}}else s.push(void 0);return s},t.prototype.resume=function(){var t,e,i,r,o;for(r=this.audioBuffers,o=[],e=0,i=r.length;i>e;e++)t=r[e],o.push(null!=t&&t.customData.wasPlaying?null!=t?t.resume(0):void 0:void 0);return o},t}(),window.GS.Audio=new t,gs.Audio=GS.Audio}.call(this),function(){var t;t=function(){function t(t,e){this.context=GS.Audio.context,this.audioBuffer=t,this.playing=!1,this.source=null,this.customData={},this.useAnalyser=null!=e?e:!1,this.startTime=0,this.stopTime=0,gs.Audio.addAudioBuffer(this),null!=this.audioBuffer&&this.initialize()}return t.fromDataBundle=function(t,e){var i;return i=null,t.audioBuffer&&(gs.ObjectCodec.decodeProperties(t,e),i=new gs.AudioBufferReference(null,t.useAnalyser),t.audioBuffer.decoded?(i.audioBuffer=t.audioBuffer,i.initialize(),i.volume=t.volume,i.playbackRate=t.playbackRate,t.isPlaying&&i.play()):t.audioBuffer.once("finishDecode",{audioBuffer:t.audioBuffer,reference:i},function(t){var e;return(null!=(e=t.data.audioBuffer)?e.decoded:void 0)&&(t.data.reference.audioBuffer=t.data.audioBuffer,t.data.reference.initialize(),t.data.reference.isPlaying)?t.data.reference.play():void 0}),i.customData=t.customData),i},t.toDataBundle=function(t,e){var i;return i={audioBuffer:t.audioBuffer,customData:t.customData,useAnalyzer:t.useAnalyzer,volume:t.volume,playbackRate:t.playbackRate,isPlaying:t.isPlaying},gs.ObjectCodec.encodeProperties(i,e,null)},Object.defineProperty(t.prototype,"volume",{set:function(t){return this.audioBuffer.error?void 0:null!=this.context?this.gainNode.gain.value=t:this.source.volume=t},get:function(){return this.audioBuffer.error?100:null!=this.context?this.gainNode.gain.value:this.source.volume}}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return this.audioBuffer.error?!1:null!=this.context?this.playing:!this.source.paused}}),Object.defineProperty(t.prototype,"playbackRate",{set:function(t){var e,i;if(!this.audioBuffer.error)return this.context?null!=(e=this.source)?e.playbackRate.value=t:void 0:null!=(i=this.source)?i.playbackRate=t:void 0},get:function(){var t;if(!this.audioBuffer.error)return this.context?(null!=(t=this.source)?t.playbackRate.value:void 0)||100:this.source.playbackRate}}),t.prototype._getAverageVolume=function(t){var e,i,r,o,s,n;for(n=0,e=0,o=t.length,i=r=0,s=o;s>=0?s>r:r>s;i=s>=0?++r:--r)n+=t[i];return e=n/o},t.prototype.initialize=function(){return this.audioBuffer.error?void 0:(this.useAnalyser&&(this.analyser=this.context.createAnalyser(),this.analyser.smoothingTimeConstant=.3,this.analyser.fftSize=1024,this.averageVolume=0,this.scriptProcessor=this.context.createScriptProcessor(2048,1,1),this.scriptProcessor.onaudioprocess=function(t){return function(){var e;return e=new Uint8Array(t.analyser.frequencyBinCount),t.analyser.getByteFrequencyData(e),t.averageVolume=t._getAverageVolume(e)}}(this),this.scriptProcessor.connect(this.context.destination),this.analyser.connect(this.scriptProcessor)),this.context?(this.gainNode=null!=this.context.createGain?this.context.createGain():this.context.createGainNode(),this.source=this.context.createBufferSource(),null!=this.analyser&&this.source.connect(this.analyser),this.source.buffer=this.audioBuffer.decodedBuffer,this.source.onended=function(t){return function(){return t.playing=!1,null!=t.onEnd?t.onEnd(t):void 0}}(this)):(this.source=new Audio,this.source.src=this.audioBuffer.toDataURL()))},t.prototype.dispose=function(){return gs.Audio.removeAudioBuffer(this),this.source=null},t.prototype.play=function(){var t,e;if(!this.audioBuffer.error)return this.context?(this.startTime=this.context.currentTime,this.playing=!0,e=this.source.playbackRate.value,t=this.source.buffer,this.source=this.context.createBufferSource(),null!=this.analyser&&this.source.connect(this.analyser),this.source.buffer=t,this.source.onended=function(t){return function(){return t.playing=!1,null!=t.onEnd?t.onEnd(t):void 0}}(this),this.source.connect(this.gainNode),this.gainNode.connect(this.context.destination),this.source.playbackRate.value=e,null!=this.source.noteOn?this.source.noteOn(0):this.source.start(0)):this.source.play()},t.prototype.resume=function(){var t,e;if(!this.audioBuffer.error)return this.context?(this.playing=!0,e=this.source.playbackRate.value,t=this.source.buffer,this.source=this.context.createBufferSource(),null!=this.analyser&&this.source.connect(this.analyser),this.source.buffer=t,this.source.onended=function(t){return function(){return t.playing=!1,null!=t.onEnd?t.onEnd(t):void 0}}(this),this.source.connect(this.gainNode),this.gainNode.connect(this.context.destination),this.source.playbackRate.value=e,null!=this.source.noteOn?this.source.noteOn(0,this.stopTime-this.startTime):this.source.start(0,this.stopTime-this.startTime)):this.source.paused=!1},t.prototype.stop=function(){if(!this.audioBuffer.error&&this.source){if(!this.context)return this.source.pause(),this.source.currentTime=0;if(this.playing)return this.stopTime=this.context.currentTime,null!=this.source.noteOff?this.source.noteOff(0):this.source.stop(0),this.source.numberOfOutputs>0&&this.source.disconnect(),this.playing=!1}},t}(),window.GS.AudioBufferReference=t,gs.AudioBufferReference=t}.call(this),function(){var t;t=function(){function t(t,e){var i;this.filePath=t,this.languageCode=e,this.context=GS.Audio.context,this.loaded=!1,this.playing=!1,this.source=null,this.encodedBuffer=null,this.decodedBuffer=null,this.decoded=!1,this.fadeInTime=0,this.fadeOutTime=0,this.fadeInVolume=0,this.playTime=0,this.customData={},this.loop=!1,this.audioStream=null,gs.Audio.addAudioBuffer(this),i=gs.Application.getPlatformSpecificAudioFilePath(t,e,!0),t=gs.Application.getPlatformSpecificAudioFilePath(t,e),this.audioStream=new Audio,this.audioStream.addEventListener("loadeddata",function(t){return function(){return t.loaded=!0}}(this)),this.audioStream.canplaythrough=function(t){return function(){return t.loaded=!0}}(this),this.audioStream.addEventListener("error",function(t){return function(){return t.loaded=!0,t.error=!0}}(this)),this.audioStream.addEventListener("ended",function(t){return function(){var e;return null!=t.onEnd&&t.onEnd(t),t.loop?(t.play(),t.audioStream.currentTime=null!=(e=t.loopStart)?e:0):void 0}}(this)),gs.Platform.isSafariMobile&&gs.Platform.isCordova?$PARAMS.needsPreparation?gs.Application.loadData(t,function(t){return function(e,i){var r;return e=GS.DataPreparer.prepare(e),r=new FileReader,r.onload=function(e){return t.audioStream.src=e.target.result,t.audioStream.load()},r.onerror=onerror,r.readAsDataURL(new Blob([e],{type:i}))}}(this),function(){return function(){return onerror()}}(this),0,"audio/"+i.substring(i.lastIndexOf(".")+1)):gs.Application.loadData(t,function(t){return function(e){return t.audioStream.src=e,t.audioStream.load()}}(this),function(t){return function(){return t.loaded=!0,t.error=!0}}(this),1):($PARAMS.needsPreparation,gs.Application.loadData(t,function(t){return function(e,i){var r;return e=GS.DataPreparer.prepare(e),r=new FileReader,r.onload=function(e){return t.audioStream.src=e.target.result,t.audioStream.load()},r.onerror=onerror,r.readAsDataURL(new Blob([e],{type:i}))}}(this),function(){return function(){return onerror()}}(this),0,"audio/"+i.substring(i.lastIndexOf(".")+1)))}return t.fromDataBundle=function(t){var e;return e=null,t.filePath&&(e=new gs.AudioBufferStream(t.filePath,!1,t.languageCode),e.volume=t.volume,e.playbackRate=t.playbackRate,e.currentTime=t.currentTime,t.isPlaying&&(e.play(),e.currentTime=t.currentTime)),e},t.toDataBundle=function(t){return{filePath:t.filePath,volume:t.volume,playbackRate:t.playbackRate,currentTime:t.currentTime,isPlaying:t.isPlaying}},Object.defineProperty(t.prototype,"volume",{set:function(t){return this.error?0:this.audioStream.volume=t},get:function(){return this.error?0:this.audioStream.volume}}),Object.defineProperty(t.prototype,"duration",{get:function(){return this.error?0:this.audioStream.duration}}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this.error?0:this.audioStream.currentTime},set:function(t){return this.audioStream.currentTime=t}}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!this.audioStream.paused}}),Object.defineProperty(t.prototype,"playbackRate",{set:function(t){return this.audioStream?this.audioStream.playbackRate=t:void 0},get:function(){return this.audioStream?this.audioStream.playbackRate:100}}),t.prototype.dispose=function(){var t,e;return this.disposed?void 0:(this.disposed=!0,gs.Audio.removeAudioBuffer(this),this.decodedBuffer=null,this.source=null,this.decoded=!1,null!=(t=this.audioStream)&&t.pause(),null!=(e=this.audioStream)&&(e.src=""),delete this.audioStream)},t.prototype.decode=function(){return this.decoded=!0,null!=this.onFinishDecode?this.onFinishDecode(this):void 0},t.prototype.update=function(){return this.playTime>0&&this.playing&&(this.playTime--,this.playTime<=this.fadeOutTime&&(this.fadeInTime=this.playTime,this.playTime=0,this.fadeInVolume=-(this.volume/this.fadeInTime))),this.fadeInTime>0&&!this.error&&(this.fadeInTime--,this.volume=Math.max(Math.min(this.volume+this.fadeInVolume,1),0),0===this.fadeInTime&&(this.fadeInVolume<0&&null!=this.onFadeOutEnd&&this.onFadeOutEnd(this),this.fadeInVolume>0&&null!=this.onFadeInEnd&&this.onFadeInEnd(this))),this.playing&&this.audioStream.currentTime>=this.loopStart+this.loopLength?this.audioStream.currentTime=this.loopStart:void 0},t.prototype.play=function(t,e,i){return this.error?void 0:(this.fadeInTime>0&&(this.volume=Math.max(Math.min(this.volume+this.fadeInTime*this.fadeInVolume,1),0)),this.playTime=e,this.fadeInTime=t||0,this.fadeOutTime=i||0,this.audioStream.currentTime=0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),this.playing=!0,this.audioStream.play())},t.prototype.resume=function(t){return this.error?void 0:(this.fadeInTime>0&&(this.volume=Math.max(Math.min(this.volume+this.fadeInTime*this.fadeInVolume,1),0)),this.fadeInTime=t||0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),this.playing=!0,this.audioStream.play())},t.prototype.stop=function(t){var e;if(!this.error&&this.isPlaying)return this.fadeInTime>0&&(this.volume=Math.max(Math.min(this.volume+this.fadeInTime*this.fadeInVolume,1),0)),this.fadeInTime=t||0,this.fadeInTime>0?(e=this.volume,this.fadeInVolume=-(this.volume/this.fadeInTime),this.onFadeOutEnd=function(t){return function(){return null!=t.audioStream&&t.audioStream.pause(),t.volume=e}}(this)):null!=this.audioStream?this.audioStream.pause():void 0},t.prototype.toDataURL=function(){return this.source.src||""},t}(),window.GS.AudioBufferStream=t,window.gs.AudioBufferStream=t}.call(this),function(){var t;t=function(){function t(){}return t.prepare=function(t){var e,i,r,o,s;if(!$PARAMS.needsPreparation)return t;for(i=GS.DataPreparer.generateKey(),e=new Uint8Array(t),r=o=0,s=e.length;s>=0?s>o:o>s;r=s>=0?++o:--o)e[r]=e[r]^i[r%i.length];return t},t.prepareFilePath=function(t){return t},t.generateKey=function(){var t,e,i,r,o,s,n;return null==window.$PARAMS||$PARAMS.needsPreparation?(r=new Int32Array([0,0,0,0,0]),s=new Int32Array([42,11,23,88,133]),o=Module._malloc(r.length*r.BYTES_PER_ELEMENT),n=Module._malloc(s.length*s.BYTES_PER_ELEMENT),e=new Uint8Array(Module.HEAPU8.buffer,o,r.length*r.BYTES_PER_ELEMENT),e.set(new Uint8Array(r.buffer)),i=new Uint8Array(Module.HEAPU8.buffer,n,s.length*s.BYTES_PER_ELEMENT),i.set(new Uint8Array(s.buffer)),Module.ccall("ac6d78ea1cf7fe1","void",["number","number","number","number"],[e.byteOffset,r.length,i.byteOffset,s.length]),t=new Int32Array(e.buffer,e.byteOffset,r.length),Module._free(e.byteOffset),Module._free(i.byteOffset),t):[0]},t}(),GS.DataPreparer=t,window.gs||(window.gs={}),window.gs.DataPreparer=t}.call(this),function(){var t;t=function(){function t(t,e,i,r){null==t?(this.red=255,this.green=255,this.blue=255,this.alpha=255):null==e?(this.red=t.red,this.green=t.green,this.blue=t.blue,this.alpha=t.alpha):(this.red=t,this.green=e,this.blue=i,this.alpha=null!=r?r:255)}return t.prototype.setFromArray=function(t){return this.red=t[0],this.green=t[1],this.blue=t[2],this.alpha=t[3]},t.prototype.setFromObject=function(t){return this.red=t.red,this.green=t.green,this.alpha=t.blue,this.blue=t.alpha},t.prototype.set=function(t,e,i,r){return null==t?(this.red=255,this.green=255,this.blue=255,this.alpha=255):null==e?(this.red=t.red,this.green=t.green,this.blue=t.blue,this.alpha=t.alpha):(this.red=t,this.green=e,this.blue=i,null!=r?this.alpha=r:void 0)},t.prototype.setFromObject=function(t){var e,i,r,o;return this.red=null!=(e=t.red)?e:this.red,this.green=null!=(i=t.green)?i:this.green,this.blue=null!=(r=t.blue)?r:this.blue,this.alpha=null!=(o=t.alpha)?o:this.alpha},t.prototype.toString=function(){return"rgba({0}, {1}, {2}, {3})".format(this.red,this.green,this.blue,this.alpha)},t.prototype.toFillStyle=function(){return"rgba({0}, {1}, {2}, {3})".format(this.red,this.green,this.blue,.00392156862745*this.alpha)},t.prototype.equals=function(t){return this.red===t.red&&this.green===t.green&&this.blue===t.blue&&this.alpha===t.alpha},t.compare=function(t,e){return t&&e&&t.red===e.red&&t.green===e.green&&t.blue===e.blue&&t.alpha===e.alpha},t.fromArray=function(e){return new t(e[0],e[1],e[2],e[3])},t.fromObject=function(e){return new t(e.red,e.green,e.blue,e.alpha)},t.rgbToHsl=function(t,e,i){var r,o,s,n,a,h;return t/=255,e/=255,i/=255,r=Math.max(t,e,i),o=Math.min(t,e,i),s=r-o,a=(r+o)/2,n=0,h=0,n=0===s?0:r===t?60*((e-i)/s%6):r===e?60*((i-t)/s+2):60*((t-e)/s+4),h=0===s?0:s/(1-Math.abs(2*a-1)),{h:n,s:h,l:a}},t.hslToRgb=function(t,e,i){var r,o,s,n,a,h;return o=(1-Math.abs(2*i-1))*e,h=o*(1-Math.abs(t/60%2-1)),n=i-o/2,a=0,s=0,r=0,60>t?(a=o,s=h,r=0):120>t?(a=h,s=o,r=0):180>t?(a=0,s=o,r=h):240>t?(a=0,s=h,r=o):300>t?(a=h,s=0,r=o):(a=o,s=0,r=h),a=Math.max(Math.floor(255*(a+n)),0),s=Math.max(Math.floor(255*(s+n)),0),r=Math.max(Math.floor(255*(r+n)),0),{r:a,g:s,b:r}},t}(),t.TRANSPARENT=new t(0,0,0,0),t.BLACK=new t(0,0,0,255),t.WHITE=new t(255,255,255,255),window.Color=t,gs.Color=t}.call(this),function(){var t;t=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.set=function(t,e){return this.x=t,this.y=e},t.prototype.setFromObject=function(t){return this.x=t.x,this.y=t.y},t}(),gs.Point=t}.call(this),function(){var t;t=function(){function t(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||1,this.height=r||1}return t.prototype.set=function(t,e,i,r){return null!=t.x?(this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height):(this.x=t,this.y=e,this.width=i,this.height=r)},t.prototype.setFromObject=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.expand=function(t,e,i,r){return-1===this.width?(this.x=t,this.y=e,this.width=i,this.height=r):(this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this.width=Math.max(this.x+this.width,t+i)-this.x,this.height=Math.max(this.y+this.height,e+r)-this.y)},t.prototype.floor=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.width=Math.round(this.width),this.height=Math.round(this.height)},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.width=Math.round(this.width),this.height=Math.round(this.height)},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.width=Math.ceil(this.width),this.height=Math.ceil(this.height)},t.prototype.shrink=function(t,e,i,r){var o,s;return s=this.x+this.width,o=this.y+this.height,this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this.width=Math.max(Math.min(i+t,s)-this.x,0),this.height=Math.max(Math.min(r+e,o)-this.y,0)},t.prototype.contains=function(e,i){return t.contains(this.x,this.y,this.width,this.height,e,i)},t.prototype.intersect=function(t,e,i,r){return!(t>this.x+this.width||t+i<this.x||e>this.y+this.height||e+r<this.y)},t.prototype.rotate=function(t){var e;return t=Math.degreesToRadians(t),e=new gs.Rect(0,0,1,1),e.x=this.x,e.y=this.y,e.width=this.width*Math.abs(Math.cos(t))+this.height*Math.abs(Math.sin(t)),e.height=this.width*Math.abs(Math.sin(t))+this.height*Math.abs(Math.cos(t)),e},t.contains=function(t,e,i,r,o,s){return null==s&&(o=e,s=i,e=t.y,i=t.width,r=t.height,t=t.x),o>=t&&t+i>o&&s>=e&&e+r>s},t.intersect=function(t,e,i,r,o,s,n,a){return!(t>o+n||o>t+i||e>s+a||s>e+r)},t.fromArray=function(e){return new t(e[0],e[1],e[2],e[3])},t.fromObject=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),window.Rect=t,gs.Rect=t}.call(this),function(){var t;t=function(){function t(t,e,i,r){null!=t?this.set(t,e,i,r):this.set(0,0,0,0)}return t.prototype.setFromObject=function(t){return this.red=t.red,this.green=t.green,this.alpha=t.blue,this.grey=t.grey},t.prototype.set=function(t,e,i,r){return null!=i?(this.red=t,this.green=e,this.blue=i,this.grey=r):null!=e?(this.red=t.red,this.green=t.green,this.blue=t.blue,this.grey=e):(this.red=t.red,this.green=t.green,this.blue=t.blue,this.grey=t.grey)},t.fromArray=function(t){return new gs.Tone(t[0],t[1],t[2],t[3])},t.fromObject=function(e){return new t(e.red,e.green,e.blue,e.grey)},t}(),t.NORMAL=new t(0,0,0,0),window.Tone=t,gs.Tone=t}.call(this),function(){var t,e;e=function(){function e(e,i,r,o){this.keys=Input.keys,this.element=$(document.createElement("div")),this.element.css("position","absolute"),this.element.css("background-color","rgba(255, 0, 0, 0.2)"),this.element.width(32),this.element.height(32),this.code=o,this.element.bind("touchstart",function(e){return function(){return e.keys[o]=1,o===Input.LEFT&&(Input.leftFrameCount=t.frameCount),o===Input.RIGHT&&(Input.rightFrameCount=t.frameCount),o===Input.UP&&(Input.upFrameCount=t.frameCount),o===Input.DOWN?Input.downFrameCount=t.frameCount:void 0}}(this)),this.element.bind("touchend",function(t){return function(){return t.keys[o]=2,Input.pressTimes[t.code]=0}}(this)),this.element.bind("mouseout",function(t){return function(){return t.keys[o]=2,Input.pressTimes[t.code]=0}}(this)),this.element.bind("touchmove",function(e){return function(){return e.keys[o]=1,o===Input.LEFT&&(Input.leftFrameCount=t.frameCount),o===Input.RIGHT&&(Input.rightFrameCount=t.frameCount),o===Input.UP&&(Input.upFrameCount=t.frameCount),o===Input.DOWN?Input.downFrameCount=t.frameCount:void 0}}(this))}return e.prototype.setPosition=function(t,e){
4 - return this.element.css("top",e),this.element.css("left",t)},e.prototype.width=function(){return this.element.width()},e.prototype.height=function(){return this.element.height()},e}(),t=function(){function t(){}return t.prototype.initialize=function(t,e,i,r){var o;return this.width=t,this.height=e,this.keepRatio=null!=r?r:!0,this.transitionData=null,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.canvas.style.position="absolute",$(this.canvas).css("-webkit-font-smoothing","none"),this.screenDiff=$(window).height()-this.height,this.screenDiffW=$(window).width()-this.width,this.parent=i,this.frameCount=0,$(window).resize(function(t){return function(){return t.onResize()}}(this)),this.onEachFrame=null!=window.requestAnimationFrame?function(){return function(t){var e;return(e=function(){return t(),requestAnimationFrame(e)})()}}(this):null!=window.webkitRequestAnimationFrame?function(){return function(t){var e;return(e=function(){return t(),webkitRequestAnimationFrame(e)})()}}(this):null!=window.mozRequestAnimationFrame?function(){return function(t){var e;return(e=function(){return t(),mozRequestAnimationFrame(e)})()}}(this):function(){return function(t){return setInterval(t,16.666667)}}(this),i.appendChild(this.canvas),o=this.canvas,$MOBILE?($(o).css("left",($(window).width()-o.width)/2),$(o).css("top",this.screenDiff/2)):($(this.canvas).css("left",0),$(this.canvas).css("top",0)),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.context.webkitImageSmoothingEnabled=!1,this.context.mozImageSmoothingEnabled=!1,this.renderer=new Renderer(this.context),this.viewport=new Viewport(0,0,t,e),$("body").css("background-color","black"),this.onResize()},t.prototype.createButtons=function(){return this.buttonA=new e("ButtonA.png",null,null,Input.A),this.buttonA.setPosition($(window).width()-this.buttonA.width()-10,$(window).height()-this.buttonA.height()-100),this.buttonB=new e("ButtonB.png",null,null,Input.B),this.buttonB.setPosition($(window).width()-this.buttonB.width()-47,$(window).height()-this.buttonB.height()-100),this.buttonX=new e("ButtonX.png",null,null,Input.X),this.buttonX.setPosition($(window).width()-this.buttonA.width()-10,$(window).height()-this.buttonA.height()-105-32),this.buttonY=new e("ButtonY.png",null,null,Input.Y),this.buttonY.setPosition($(window).width()-this.buttonB.width()-47,$(window).height()-this.buttonB.height()-105-32),this.buttonLeft=new e("ButtonLeft.png",94,94,Input.LEFT),this.buttonLeft.setPosition(5,$(window).height()-this.buttonLeft.height()-32-70),this.buttonUp=new e("ButtonUp.png",94,94,Input.UP),this.buttonUp.setPosition(7+this.buttonUp.width()/2,$(window).height()-this.buttonUp.height()-32-32-70-5),this.buttonRight=new e("ButtonRight.png",94,94,Input.RIGHT),this.buttonRight.setPosition(42,$(window).height()-this.buttonLeft.height()-32-70),this.buttonDown=new e("ButtonDown.png",94,94,Input.DOWN),this.buttonDown.setPosition(7+this.buttonUp.width()/2,$(window).height()-this.buttonUp.height()-70+5),this.buttonStart=new e("ButtonStart.png",183,70,Input.START),this.buttonStart.setPosition(($(window).width()-2*this.buttonStart.width())/2,$(window).height()-64),this.buttonSelect=new e("ButtonSelect.png",183,70,Input.SELECT),this.buttonSelect.setPosition(64+($(window).width()-2*this.buttonStart.width())/2,$(window).height()-64),$(this.parent).append(this.buttonA.element),$(this.parent).append(this.buttonB.element),$(this.parent).append(this.buttonX.element),$(this.parent).append(this.buttonY.element),$(this.parent).append(this.buttonLeft.element),$(this.parent).append(this.buttonUp.element),$(this.parent).append(this.buttonRight.element),$(this.parent).append(this.buttonDown.element),$(this.parent).append(this.buttonStart.element),$(this.parent).append(this.buttonSelect.element)},t.prototype.dispose=function(){},t.prototype.onResize=function(t,e){var i;return e=e||$(window).height(),t=t||$(window).width(),this.screenDiff=e-this.height,this.screenDiffW=t-this.width,i=1+this.screenDiff/this.height,this.keepRatio&&(i=Math.min(i,t/this.width)),$(this.canvas).css("-webkit-transform","none"),$(this.canvas).css("-ms-transform","none"),$(this.canvas).css("-moz-transform","none"),$(this.canvas).css("transform","none"),$(this.canvas).css("-webkit-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("-ms-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("-moz-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("left",(t-this.width)/2),$(this.canvas).css("top",(e-this.height)/2),this.scaleFactorX=this.width/this.canvas.width,this.scaleFactorY=this.height/this.canvas.height},t.prototype.update=function(){return this.context.fillRect(0,0,this.width,this.height),this.viewport.update(),null!=this.transitionData?this.updateTransition():this.viewport.draw()},t.prototype.addGraphicObject=function(t){return null!=this.viewport?this.viewport.addGraphicObject(t):void 0},t.prototype.removeGraphicObject=function(t){return null!=this.viewport?this.viewport.removeGraphicObject(t):void 0},t.prototype.snapshot=function(){return new Bitmap(this.canvas)},t.prototype.updateTransition=function(){return null!=this.transitionData.transitionData?this.updateBitmapTransition():this.updateDefaultTransition()},t.prototype.updateDefaultTransition=function(){return this.context.drawImage(this.transitionData.sourceBitmap.image,0,0),this.context.globalAlpha=this.transitionData.currentAlpha/255,this.context.drawImage(this.transitionData.targetBitmap.image,0,0),this.context.globalAlpha=1,this.transitionData.currentAlpha+=255/this.transitionData.duration,this.transitionData.currentAlpha>=255?(this.transitionData=null,this.frozenScreenBitmap=null,this.frozen=!1):void 0},t.prototype.updateBitmapTransition=function(){var t,e,i,r,o,s,n,a,h;for(s=this.transitionData.screenData,h=this.transitionData.transitionData,a=this.transitionData.targetData,n=this.transitionData.sourceData,i=r=0,o=s.length;o>r;i=r+=4)h[i]>=this.transitionData.currentAlpha?(e=h[i]-this.transitionData.currentAlpha,this.transitionData.vague>e?(t=e/this.transitionData.vague*255,s[i]=(n[i]*t+a[i]*(255-t))/255,s[i+1]=(n[i+1]*t+a[i+1]*(255-t))/255,s[i+2]=(n[i+2]*t+a[i+2]*(255-t))/255,s[i+3]=n[i+3]):(s[i]=n[i],s[i+1]=n[i+1],s[i+2]=n[i+2],s[i+3]=n[i+3])):(s[i]=a[i],s[i+1]=a[i+1],s[i+2]=a[i+2],s[i+3]=a[i+3]);return this.transitionData.currentAlpha+=255/this.transitionData.duration,this.context.putImageData(this.transitionData.screenImageData,0,0),this.transitionData.currentAlpha>=255?(this.transitionData=null,this.frozenScreenBitmap=null,this.frozen=!1):void 0},t.prototype.freeze=function(){return this.frozen=!0,this.frozenScreenBitmap=this.snapshot()},t.prototype.transition=function(t,e,i){return null!=this.frozenScreenBitmap?(this.context.fillStyle="#000000",this.context.fillRect(0,0,this.width,this.height),this.viewport.update(),this.viewport.draw(),this._transition(this.frozenScreenBitmap,this.snapshot(),t,e,i)):void 0},t.prototype._transition=function(t,e,i,r,o){return this.transitionData={sourceBitmap:t,targetBitmap:e,duration:i,transitionBitmap:r,vague:o},this.transitionData.currentAlpha=0,null!=this.transitionData.transitionBitmap?(this.transitionData.screenImageData=this.context.getImageData(0,0,this.width,this.height),this.transitionData.screenData=this.transitionData.screenImageData.data,this.transitionData.transitionData=r.getImageData(0,0,this.width,this.height).data,this.transitionData.targetData=e.getImageData(0,0,this.width,this.height).data,this.transitionData.sourceData=t.getImageData(0,0,this.width,this.height).data):void 0},t.prototype._transitionWithBitmap=function(){},t}(),window.Graphics_Canvas=t,window.Graphics=new t}.call(this),function(){var t,e;t=function(){function t(){this.globalAlpha=1,this.globalCompositeOperation=0}return t}(),e=function(){function e(e){this.context=e,this.canvas=e.canvas,this.contextInfo=new t,this.ox=0,this.oy=0,this.zoom={x:1,y:1},this.size={width:0,height:0},this.angle=0,this.mirror=!1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendType=0,this.preparationBitmap=new Bitmap(1024,1024),this.preparationContext=this.preparationBitmap.context,this.clip=new Rect(0,0,this.canvas.width,this.canvas.height)}return e.prototype.reset=function(){return this.blendType=0,this.opacity=255,0!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="source-over",this.contextInfo.globalCompositeOperation=0),1!==this.contextInfo.globalAlpha?(this.context.globalAlpha=1,this.contextInfo.globalAlpha=1):void 0},e.prototype.drawRect=function(t){return this.context.fillStyle=this.color.toFillStyle(),this.context.fillRect(t.x,t.y,t.width,t.height)},e.prototype.clipRect=function(t){return t.x!==this.clip.x||t.y!==this.clip.y||t.width!==this.clip.width||t.height!==this.clip.height?(this.context.restore(),this.context.save(),this.context.beginPath(),this.context.rect(t.x,t.y,t.width,t.height),this.context.clip(),this.clip=t):void 0},e.prototype._changeTone=function(t){var e,i,r,o,s,n,a,h,l,u,c,d,p,f,m;if(s=t.data,l=this.tone.red,n=this.tone.green,o=this.tone.blue,0!==this.tone.grey)if(a=.00392156862745*this.tone.grey,255===this.tone.grey)for(h=u=0,p=s.length-1;p>u;h=u+=4)r=.3*(s[h]+s[h+1]+s[h+2]),s[h]=r+l,s[h+1]=r+n,s[h+2]=r+o;else for(h=c=0,f=s.length-1;f>c;h=c+=4)r=.3*(s[h]+s[h+1]+s[h+2]),e=r*a,i=1-a,s[h]=e+s[h]*i+l,s[h+1]=e+s[h+1]*i+n,s[h+2]=e+s[h+2]*i+o;else for(h=d=0,m=s.length-1;m>d;h=d+=4)s[h]+=l,s[h+1]+=n,s[h+2]+=o;return null},e.prototype.changeTone=function(t){var e;return this.preparationContext.globalCompositeOperation="source-over",e=this.context.getImageData(t.x,t.y,t.width,t.height),this._changeTone(e),this.context.putImageData(e,t.x,t.y)},e.prototype.drawTiledBitmap=function(t,e,i,r,o,s,n,a,h){var l,u,c,d,p,f;for(l=Math.ceil(r/h),u=Math.ceil(o/a),c=p=0;l>=0?l>p:p>l;c=l>=0?++p:--p)for(d=f=0;u>=0?u>f:f>u;d=u>=0?++f:--f)this.context.drawImage(t.image,s,n,h,a,e+c*h,i+d*a,h,a);return null},e.prototype.drawBitmapSimple=function(t,e,i,r,o,s,n,a,h){return null!=this.context.bitmap&&this.context.bitmap.sequenceNumber++,this.context.drawImage(t.image,s,n,a,h,e-this.ox,i-this.oy,r,o)},e.prototype.drawBitmap=function(t,e,i,r,o,s){var n,a,h,l;if(t.loaded){switch(null!=this.context.bitmap&&this.context.bitmap.sequenceNumber++,o=o||0,s=s||0,e=e-this.ox-o*this.zoom.x,i=i-this.oy-s*this.zoom.y,r.width=Math.min(Math.floor(r.width),t.width),r.height=Math.min(Math.floor(r.height),t.height),l=this.size.width>0?this.size.width:r.width*this.zoom.x,a=this.size.height>0?this.size.height:r.height*this.zoom.y,h=null,(0!==this.tone.red||0!==this.tone.green||0!==this.tone.blue||0!==this.tone.grey)&&(h=t.context.getImageData(r.x,r.y,r.width,r.height),this._changeTone(h),this.preparationContext.globalCompositeOperation="source-over",this.preparationContext.putImageData(h,0,0)),0!==this.color.alpha&&(this.preparationContext.globalCompositeOperation="source-over",null==h&&(this.preparationContext.clearRect(0,0,r.width,r.height),this.preparationContext.drawImage(t.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height)),this.preparationContext.globalCompositeOperation="source-atop",this.preparationContext.fillStyle=this.color.toFillStyle(),this.preparationContext.fillRect(0,0,r.width,r.height)),255!==this.opacity?(n=.00392156862745*this.opacity,this.contextInfo.globalAlpha!==n&&(this.context.globalAlpha=n,this.contextInfo.globalAlpha=n)):1!==this.contextInfo.globalAlpha&&(this.context.globalAlpha=1,this.contextInfo.globalAlpha=1),this.blendType){case 0:0!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="source-over",this.contextInfo.globalCompositeOperation=0);break;case 1:1!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="lighter",this.contextInfo.globalCompositeOperation=1);break;case 2:2!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="darker",this.contextInfo.globalCompositeOperation=2)}return 0!==this.angle?(this.mirror&&(this.context.scale(-1,1),e=-1*(e+l)),this.context.translate(e,i),this.context.translate(.5*l,.5*a),this.context.rotate(this.angle),this.context.translate(-(.5*l),-(.5*a)),0===this.color.alpha&&null==h?this.context.drawImage(t.image,r.x,r.y,r.width,r.height,0,0,l,a):this.context.drawImage(this.preparationBitmap.image,0,0,r.width,r.height,0,0,l,a),this.context.setTransform(1,0,0,1,0,0)):(this.mirror&&(this.context.scale(-1,1),e=-1*(e+l)),0===this.color.alpha&&null==h?this.context.drawImage(t.image,r.x,r.y,r.width,r.height,e,i,l,a):this.context.drawImage(this.preparationBitmap.image,0,0,r.width,r.height,e,i,l,a),this.mirror?this.context.setTransform(1,0,0,1,0,0):void 0)}},e}(),window.Renderer_Canvas=e,window.Renderer=e}.call(this),function(){var t;window.$gl=null,t=function(){function t(){}return t.prototype.initialize=function(t,e,i,r){var o,s,n,a,h,l;if(i=i||document.body,this.canvas=document.createElement("canvas"),jQuery(this.canvas).css("background-color","#000"),this.canvas.width=t,this.canvas.height=e,this.keepRatio=null!=r?r:!0,this.width=this.canvas.width,this.height=this.canvas.height,this.context=this.canvas.getContext("webgl",{alpha:!0})||this.canvas.getContext("experimental-webgl",{alpha:!1,antialias:!1}),this.renderer=null,this.frameStartTime=0,this.frameTime=0,this.onFocusReceive=null,this.onFocusLost=null,this.frameRate=60,window.$gl=this.context,"undefined"==typeof $gl||null===$gl)throw"No WebGL Support or WebGL is disabled. Check your browser configuration.";return $gl.clearColor(0,0,0,1),$gl.viewport(0,0,this.width,this.height),$gl.disable($gl.DEPTH_TEST),$gl.enable($gl.BLEND),$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA),$gl.enable($gl.SCISSOR_TEST),$gl.scissor(0,0,this.width,this.height),this.graphics=[],this.viewport=new Viewport(0,0,t,e),this.renderer=new Renderer(this.context),this.screenTexture=new Texture2D(t,e,null,!0,!1),this.screenTexture.bind(),this.screenTexture.setFilter(0,!1),this.screenTexture.unbind(),this.offscreenTexture=new Texture2D(Math.nextPow2(t),Math.nextPow2(e),null,!1,!0),this.frameBuffer=new gs.FrameBuffer,this.screenProjectionMatrix=mat4.create(),mat4.identity(this.screenProjectionMatrix),mat4.ortho(this.screenProjectionMatrix,0,this.offscreenTexture.realWidth,this.offscreenTexture.realHeight,0,-1,1),this.canvas.style.position="absolute",jQuery(this.canvas).css("-webkit-font-smoothing","none"),this.screenDiff=jQuery(window).height()-this.height,this.screenDiffW=jQuery(window).width()-this.width,this.parent=i,this.frameCount=0,this.paused=!1,this.stopped=!1,this.screenRenderInfo={position:vec3.create([0,0,0]),size:vec3.create([this.canvas.width,this.canvas.height,1])},jQuery(window).resize(function(t){return function(){return t.onResize()}}(this)),window.nw&&nw.Window.get().on("resize",function(t){return function(){return t.onResize()}}(this)),n=60,h=0,l=Date.now(),a=1e3/n,s=0,$PARAMS.preview||gs.Platform.isAtsumaru||(window.addEventListener("focus",function(t){return function(){return t.paused=!1,gs.Audio.resume(),Input.clear(),"function"==typeof t.onFocusReceive?t.onFocusReceive():void 0}}(this)),window.addEventListener("blur",function(t){return function(){return t.paused=!0,gs.Audio.pause(),Input.clear(),"function"==typeof t.onFocusLost?t.onFocusLost():void 0}}(this)),window.addEventListener("keydown",function(){return function(t){return 9===t.keyCode?t.preventDefault():void 0}}(this))),this.onEachFrame=null!=window.requestAnimationFrame?function(t){return function(e){var i;return(i=function(r){return t.stopped?void 0:((!t.paused||$PARAMS.preview)&&e(r),requestAnimationFrame(i))})()}}(this):null!=window.webkitRequestAnimationFrame?function(){return function(t){var e;return(e=function(){return t(),webkitRequestAnimationFrame(e)})()}}(this):null!=window.mozRequestAnimationFrame?function(){return function(t){var e;return(e=function(){return t(),mozRequestAnimationFrame(e)})()}}(this):function(){return function(t){return setInterval(t,16.666667)}}(this),i.appendChild(this.canvas),jQuery(document).mousedown(function(t){return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}),jQuery(document).mouseup(function(t){return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}),o=this.canvas,$MOBILE?(jQuery(o).css("left",(jQuery(window).width()-o.width)/2),jQuery(o).css("top",this.screenDiff/2)):(jQuery(this.canvas).css("left",0),jQuery(this.canvas).css("top",0)),$MOBILE&&jQuery("canvas").css("-webkit-transform","scale("+(1+this.screenDiff/this.height)+")"),this.onResize()},t.prototype.dispose=function(){return null!=this.onDispose&&this.onDispose(),this.renderer.dispose(),this.screenTexture.dispose(),this.offscreenTexture.dispose(),this.frameBuffer.dispose()},t.prototype.onResize=function(t,e){var i,r;return e=e||jQuery(window).height(),t=t||jQuery(window).width(),this.screenRenderInfo||(this.screenRenderInfo={position:vec3.create([0,0,0]),size:vec3.create([this.canvas.width,this.canvas.height,1])}),this.screenRenderInfo.size[0]=this.canvas.width,this.screenRenderInfo.size[1]=this.canvas.height,this.screenDiff=e-this.height,this.screenDiffW=t-this.width,i=1+this.screenDiff/this.height,r=1+this.screenDiffW/this.width,this.keepRatio&&(i=Math.min(i,t/this.width),r=i),jQuery(this.canvas).css("-webkit-transform","none"),jQuery(this.canvas).css("-ms-transform","none"),jQuery(this.canvas).css("-moz-transform","none"),jQuery(this.canvas).css("transform","none"),jQuery(this.canvas).css("-webkit-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("-ms-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("-moz-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("left",(t-this.width)/2),jQuery(this.canvas).css("top",(e-this.height)/2),this.x=0,this.y=0,this.keepRatio&&(this.x=Math.floor((t-this.canvas.width*i)/2),this.y=Math.floor((e-this.canvas.height*i)/2)),this.scaleFactorX=this.width/(this.width*r),this.scaleFactorY=this.height/(this.height*i)},t.prototype.setCursorBitmap=function(t,e,i){var r;return t&&!t.image&&t.makeMutable(),(null!=t?t.image:void 0)?(r=t.image.toDataURL("image/png"),jQuery(document.body).css("cursor","url('"+r+"') "+(e||0)+" "+(i||0)+", default")):jQuery(document.body).css("cursor","default")},t.prototype.enterFullscreen=function(){var t,e,i,r;if(window.nw&&!$PARAMS.platform.isSteamOS){r=nw.Window.get(),r.setResizable(!0),r.enterFullscreen();try{if(e=require("fs"),e.existsSync("./package.json"))return i=JSON.parse(e.readFileSync("./package.json","utf8")),i.fullscreen=!0,e.writeFileSync("./package.json",JSON.stringify(i),"utf8")}catch(o){return t=o,console.log("ERROR: Cannot store display-settings in package.json. Do have write-access to the game's directory/folder?"),console.log(t)}}},t.prototype.leaveFullscreen=function(){var t,e,i,r;if(window.nw&&!$PARAMS.platform.isSteamOS){r=nw.Window.get(),r.leaveFullscreen();try{e=require("fs"),e.existsSync("./package.json")&&(i=JSON.parse(e.readFileSync("./package.json","utf8")),i.fullscreen=!1,e.writeFileSync("./package.json",JSON.stringify(i),"utf8"))}catch(o){t=o,console.log("ERROR: Cannot store display-settings in package.json. Do have write-access to the game's directory/folder?"),console.log(t)}return r.setResizable(!0),r.width=this.width,r.height=this.height,this.onResize(),setTimeout(function(t){return function(){return t.onResize()}}(this),1)}},t.prototype.isFullscreen=function(){return null!=window.nw?nw.Window.get().isFullscreen:!0},t.prototype.clear=function(){return $gl.clear($gl.COLOR_BUFFER_BIT|$gl.DEPTH_BUFFER_BIT)},t.prototype.update=function(){return this.frameBuffer.bind(),this.frameBuffer.setTexture(this.screenTexture),$gl.viewport(0,0,this.screenTexture.width,this.screenTexture.height),this.viewport.update(),null!=this.transitionData?this.updateTransition():this.frozen||(this.clear(),this.viewport.draw(),this.renderer.render()),this.renderer.clip.set(0,0,this.width,this.height),this.frameBuffer.unbind(),$gl.scissor(0,0,this.canvas.width,this.canvas.height),this.renderer.setTexture(this.screenTexture),mat2d.identity(this.renderer.transform_),this.renderer.transform=this.renderer.transform_,this.renderer.setSourceRectangle(0,0,Graphics.width,Graphics.height),mat2d.translate(this.renderer.transform,this.renderer.transform,[0,Graphics.height]),mat2d.scale(this.renderer.transform,this.renderer.transform,[Graphics.width,-Graphics.height]),this.renderer.drawTransform(),this.renderer.render()},t.prototype.addGraphicObject=function(t){return null!=this.viewport?this.viewport.addGraphicObject(t):void 0},t.prototype.removeGraphicObject=function(t){return null!=this.viewport?this.viewport.removeGraphicObject(t):void 0},t.prototype.snapshotToTexture=function(t){return this.frameBuffer.bind(),this.frameBuffer.setTexture(this.screenTexture),this.clear(),this.viewport.update(),this.viewport.draw(),this.renderer.render(),t.bind(),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height),t.unbind(),this.frameBuffer.unbind()},t.prototype.snapshotAsTexture=function(t){var e;return this.frameBuffer.bind(),this.frameBuffer.setTexture(this.screenTexture),this.clear(),this.viewport.update(),this.viewport.draw(),this.renderer.render(),e=new Uint8Array(this.width*this.height*4),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,!0),$gl.readPixels(0,0,this.width,this.height,$gl.RGBA,$gl.UNSIGNED_BYTE,e),this.frameBuffer.unbind(),t=new Texture2D(e,this.width,this.height,!1,!0),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,!1),t},t.prototype.snapshot=function(){var t,e,i,r;return this.frameBuffer.bind(),i=new Uint8Array(this.width*this.height*4),$gl.readPixels(0,0,this.width,this.height,$gl.RGBA,$gl.UNSIGNED_BYTE,i),this.frameBuffer.unbind(),t=document.createElement("canvas"),t.width=this.width,t.height=this.height,e=t.getContext("2d"),e.clearRect(0,0,this.width,this.height),r=e.createImageData(this.width,this.height),r.data.set(i),e.putImageData(r,0,0),new Bitmap(t,!0)},t.prototype.snapshotAsData=function(){var t;return this.viewport.update(),this.viewport.draw(),this.renderer.render(),t=new Uint8Array(this.width*this.height*4),$gl.readPixels(0,0,this.width,this.height,$gl.RGBA,$gl.UNSIGNED_BYTE,t),t},t.prototype.freeze=function(){return this.frozen?void 0:($gl.scissor(0,0,this.width,this.height),this.frozen=!0,this.frozenScreenTexture=new Texture2D(Graphics.width,Graphics.height,null,!0,!1),this.snapshotToTexture(this.frozenScreenTexture))},t.prototype.transition=function(t,e,i){return null!=this.frozenScreenTexture?($gl.scissor(0,0,this.width,this.height),this.transitionSnapshot=new Texture2D(Graphics.width,Graphics.height,null,!0,!1),this.snapshotToTexture(this.transitionSnapshot),this._transition(this.frozenScreenTexture,this.transitionSnapshot,t,e,i),this.update()):void 0},t.prototype._transition=function(t,e,i,r,o){return this.transitionData={sourceTexture:t,targetTexture:e,duration:i,transitionBitmap:r,vague:o,mask:{ox:0,oy:0,source:r,type:1,value:0,vague:o}},this.transitionData.currentAlpha=0},t.prototype.updateTransition=function(){var t;return $gl.scissor(0,0,this.width,this.height),(null!=(t=this.transitionData.transitionBitmap)?t.loaded:void 0)?this.updateBitmapTransition():this.updateDefaultTransition()},t.prototype.updateDefaultTransition=function(){return this.renderer.setTexture(this.transitionData.sourceTexture),this.renderer.setSourceRectangle(0,Graphics.height,Graphics.width,-Graphics.height),this.renderer.position[0]=0,this.renderer.position[1]=0,this.renderer.size[0]=this.width,this.renderer.size[1]=this.height,mat2d.identity(this.renderer.transform_),mat2d.scale(this.renderer.transform_,this.renderer.transform_,vec2.fromValues(this.width,this.height)),this.renderer.transform=this.renderer.transform_,this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),this.renderer.opacity=this.transitionData.currentAlpha,this.renderer.setTexture(this.transitionData.targetTexture),this.renderer.position[0]=0,this.renderer.position[1]=0,this.renderer.size[0]=this.width,this.renderer.size[1]=this.height,this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),this.renderer.opacity=255,this.transitionData.currentAlpha>=255?(this.transitionData.sourceTexture.dispose(),this.transitionData.targetTexture.dispose(),this.transitionData=null,this.frozenScreenTexture=null,this.frozen=!1):this.transitionData.currentAlpha+=255/this.transitionData.duration},t.prototype.updateBitmapTransition=function(){return this.transitionData.currentAlpha=Math.min(this.transitionData.currentAlpha+255/this.transitionData.duration,255),$gl.disable($gl.BLEND),mat2d.identity(this.renderer.transform_),mat2d.scale(this.renderer.transform_,this.renderer.transform_,vec2.fromValues(this.width,this.height)),this.renderer.transform=this.renderer.transform_,this.renderer.setSourceRectangle(0,Graphics.height,Graphics.width,-Graphics.height),this.renderer.setTexture(this.transitionData.targetTexture),this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),$gl.enable($gl.BLEND),this.renderer.mask=this.transitionData.mask,this.renderer.mask.value=this.transitionData.currentAlpha,this.renderer.setTexture(this.transitionData.sourceTexture),this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),this.renderer.mask=null,this.transitionData.currentAlpha>=255?(this.transitionData.sourceTexture.dispose(),this.transitionData.targetTexture.dispose(),this.transitionData=null,this.frozenScreenTexture=null,this.frozen=!1):void 0},t}(),window.Graphics_OpenGL=t,window.Graphics=(null!=window.$PARAMS,new Graphics_Canvas),gs.Graphics=Graphics}.call(this),function(){var t,e,i;i=function(){function t(){this.tilesetBitmap=null,this.dataBitmap=null,this.ox=0,this.oy=0,this.autotileOffset=0,this.autotileAreaStart=0,this.tileSize=32}return t}(),gs.TilemapRenderInfo=i,t=function(){function t(){this.clear=!1,this.texture=null,this.opacity=0,this.blendMode=0,this.clip=new Rect(0,0,Graphics.width,Graphics.height),this.l2dObject=null,this.tilemap=null,this.tiling=!1,this.effects=new gs.EffectCollection}return t}(),gs.RenderTask=t,e=function(){function t(t){Effect.initialize(),this.context=t,this.canvas=t.canvas,this.clear=!1,this.ox=0,this.oy=0,this.anchor={x:0,y:0},this.zoom={x:1,y:1},this.size={width:0,height:0},this.textureOffset={x:0,y:0},this.transform_=mat2d.create(),this.transformVector_=vec2.create(),this.effects=null,this.angle=0,this.mirror=!1,this.mirrorY=!1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendType=0,this.clip=new Rect(0,0,this.canvas.width,this.canvas.height),this.transform=mat2d.create(),this.texBuffers=[],this.defaultTone=this.tone,this.vertexBuffer=null,this.indexBuffer=null,this.maxRenderTasks=1e3,this.renderTasks=new Array(this.maxRenderTasks),this.renderTaskIndex=0,this.vertexSize=5,this.vertexColorData=null,this.vertexDataBuffer=null,this.renderTaskSize=16*this.vertexSize,this.createBufferObjects(),this.rotationCenter=vec3.create([0,0,0]),this.rotationCenterInverse=vec3.create([0,0,0]),this.identity=mat4.create(),mat4.identity(this.identity),this.width=this.canvas.width,this.height=this.canvas.height,this.textures=[null,null],this.sourceRectangle=[0,0,1,1],this.position=vec3.create([0,0,0]),this.position1=vec2.fromValues(0,0),this.position2=vec2.fromValues(1,0),this.position3=vec2.fromValues(0,1),this.position4=vec2.fromValues(1,1),this.size=vec3.create([1,1,1]),this.color=[1,1,1,1],this.colors=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],this.clipRectangle=[0,0,this.width,this.height],this.transform=mat4.create(),this.translation=mat4.create(),this.scale=mat4.create(),mat4.identity(this.translation),mat4.identity(this.scale),mat4.identity(this.transform),this.effect=Effect.get(1),this.projectionMatrix=mat4.create(),mat4.identity(this.projectionMatrix),mat4.ortho(this.projectionMatrix,0,this.width,this.height,0,-1,1)}return t.prototype.dispose=function(){var t,e,i,r;for(this.effect.dispose(),this.tintEffect.dispose(),this.colorEffect.dispose(),this.colorTintEffect.dispose(),this.colorRectEffect.dispose(),this.transitionEffect.dispose(),r=this.texBuffers,e=0,i=r.length;i>e;e++)t=r[e],t.dispose();return this.vertexShader.dispose(),this.fragmentShader.dispose(),this.toneShader.dispose(),this.colorShader.dispose(),this.colorToneShader.dispose(),this.colorRectShader.dispose(),this.transitionShader.dispose()},t.prototype.createBufferObjects=function(){var t,e,i,r;for(t=e=0,i=this.renderTasks.length;i>=0?i>e:e>i;t=i>=0?++e:--e)this.renderTasks[t]=new gs.RenderTask;for(this.vertexDataBuffer=new ArrayBuffer(4*this.maxRenderTasks*4*this.vertexSize),this.vertexData=new Float32Array(this.vertexDataBuffer),this.vertexColorData=new Uint32Array(this.vertexDataBuffer),this.indexData=new Uint16Array(6*this.maxRenderTasks),t=0,r=0;t<6*this.maxRenderTasks;)this.indexData[t+0]=r+0,this.indexData[t+1]=r+1,this.indexData[t+2]=r+3,this.indexData[t+3]=r+2,this.indexData[t+4]=r+0,this.indexData[t+5]=r+3,t+=6,r+=4;return this.vertexBuffer=new gs.Buffer($gl.ARRAY_BUFFER,this.vertexData,5,4*this.maxRenderTasks,$gl.DYNAMIC_DRAW),this.indexBuffer=new gs.Buffer($gl.ELEMENT_ARRAY_BUFFER,this.indexData,3,6*this.maxRenderTasks),this.vertexBuffer.bind(),this.indexBuffer.bind()},t.prototype.resize=function(){return this.width=this.canvas.width,this.height=this.canvas.height,this.projectionMatrix=mat4.create(),mat4.identity(this.projectionMatrix),mat4.ortho(this.projectionMatrix,0,this.width,this.height,0,-1,1)},t.prototype.reset=function(){return this.blendType=0,this.opacity=255,$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA)},t.prototype.drawRotatedQuad=function(t,e){return this.drawQuad(t,e)},t.prototype.drawBuffer=function(t){var e,i,r;return i=null,r=null!=this.tone&&(0!==this.tone.red||0!==this.tone.green||0!==this.tone.blue||0!==this.tone.grey),e=null!=this.color&&this.color.alpha>0,e&&r?(i=this.colorTintEffect,this.colorTintEffect.use(),this.colorTintEffect.setVector4Value("Tone",this.tone.red,this.tone.green,this.tone.blue,this.tone.grey),this.colorTintEffect.setVector4Value("Color",this.color.red,this.color.green,this.color.blue,this.color.alpha)):r?(i=this.tintEffect,this.tintEffect.use(),this.tintEffect.setVector4Value("Tone",this.tone.red,this.tone.green,this.tone.blue,this.tone.grey)):e?(i=this.colorEffect,this.colorEffect.use(),this.colorEffect.setFloatValue("Opacity",this.opacity),this.colorEffect.setVector4Value("Color",this.color.red,this.color.green,this.color.blue,this.color.alpha)):i=this.effect,this.currentEffect!==i,this.currentEffect=i,i.use(),i.setMatrixValue("pMatrix",this.projectionMatrix),i.setFloatValue("Opacity",this.opacity),this.effectUsed=!0,this.projectionMatrixOld=this.projectionMatrix,this.opacityOld=this.opacity,$gl.drawElements($gl.TRIANGLES,t.itemCount,$gl.UNSIGNED_SHORT,0)},t.prototype.drawTextureTransform=function(t){var e,i,r,o;return this.effects&&this.effects.wobble.enabled&&(r=4*this.renderTaskIndex*this.vertexSize,i=Graphics.frameCount*this.effects.wobble.speed,this.effects.wobble.horizontal&&(this.vertexData[r+2]+=Math.sin(i)*this.effects.wobble.power,this.vertexData[r+7]+=Math.sin(i+1)*this.effects.wobble.power,this.vertexData[r+12]+=Math.sin(i+2)*this.effects.wobble.power,this.vertexData[r+17]+=Math.sin(i+3)*this.effects.wobble.power),this.effects.wobble.vertical&&(this.vertexData[r+3]+=Math.cos(i)*this.effects.wobble.power,
5 - this.vertexData[r+8]+=Math.cos(i+1)*this.effects.wobble.power,this.vertexData[r+13]+=Math.cos(i+2)*this.effects.wobble.power,this.vertexData[r+18]+=Math.cos(i+3)*this.effects.wobble.power)),r=4*this.renderTaskIndex*this.vertexSize,e=this.opacity<<24|0|0|0,this.position1[0]=0,this.position1[1]=0,this.position2[0]=1,this.position2[1]=0,this.position3[0]=0,this.position3[1]=1,this.position4[0]=1,this.position4[1]=1,vec2.transformMat2d(this.position1,this.position1,this.transform),vec2.transformMat2d(this.position2,this.position2,this.transform),vec2.transformMat2d(this.position3,this.position3,this.transform),vec2.transformMat2d(this.position4,this.position4,this.transform),this.vertexData[r+2]=this.position1[0]/this.texture.realWidth,this.vertexData[r+3]=this.position1[1]/this.texture.realHeight,this.vertexData[r+7]=this.position2[0]/this.texture.realWidth,this.vertexData[r+8]=this.position2[1]/this.texture.realHeight,this.vertexData[r+12]=this.position3[0]/this.texture.realWidth,this.vertexData[r+13]=this.position3[1]/this.texture.realHeight,this.vertexData[r+17]=this.position4[0]/this.texture.realWidth,this.vertexData[r+18]=this.position4[1]/this.texture.realHeight,this.vertexData[r]=t.x,this.vertexData[r+1]=t.y,this.vertexColorData[r+4]=e,this.vertexData[r+5]=t.x+t.width,this.vertexData[r+6]=t.y,this.vertexColorData[r+9]=e,this.vertexData[r+10]=t.x,this.vertexData[r+11]=t.y+t.height,this.vertexColorData[r+14]=e,this.vertexData[r+15]=t.x+t.width,this.vertexData[r+16]=t.y+t.height,this.vertexColorData[r+19]=e,o=this.renderTasks[this.renderTaskIndex],o.l2dObject=null,o.tilemap=null,o.texture=this.texture,o.clip.set(this.clip.x,this.clip.y,this.clip.width,this.clip.height),o.tone=this.tone,o.color=this.color,o.mask=this.mask,o.opacity=this.opacity,o.blendMode=this.blendType,o.effect=this.visualEffect,o.effects=this.effects,o.clear=this.clear,o.tiling=!0,this.renderTaskIndex++,this.renderTaskIndex>=this.maxRenderTasks?this.render():void 0},t.prototype.drawQuad=function(){var t,e,i,r,o;return e=null,this.effects&&this.effects.wobble.enabled&&(r=4*this.renderTaskIndex*this.vertexSize,i=Graphics.frameCount*this.effects.wobble.speed,this.effects.wobble.horizontal&&(this.vertexData[r+2]+=Math.sin(i)*this.effects.wobble.power,this.vertexData[r+7]+=Math.sin(i+1)*this.effects.wobble.power,this.vertexData[r+12]+=Math.sin(i+2)*this.effects.wobble.power,this.vertexData[r+17]+=Math.sin(i+3)*this.effects.wobble.power),this.effects.wobble.vertical&&(this.vertexData[r+3]+=Math.cos(i)*this.effects.wobble.power,this.vertexData[r+8]+=Math.cos(i+1)*this.effects.wobble.power,this.vertexData[r+13]+=Math.cos(i+2)*this.effects.wobble.power,this.vertexData[r+18]+=Math.cos(i+3)*this.effects.wobble.power)),r=4*this.renderTaskIndex*this.vertexSize,t=this.opacity<<24|0|0|0,this.position1[0]=0,this.position1[1]=0,this.position2[0]=1,this.position2[1]=0,this.position3[0]=0,this.position3[1]=1,this.position4[0]=1,this.position4[1]=1,vec2.transformMat2d(this.position1,this.position1,this.transform),vec2.transformMat2d(this.position2,this.position2,this.transform),vec2.transformMat2d(this.position3,this.position3,this.transform),vec2.transformMat2d(this.position4,this.position4,this.transform),this.vertexData[r]=this.position1[0],this.vertexData[r+1]=this.position1[1],this.vertexColorData[r+4]=t,this.vertexData[r+5]=this.position2[0],this.vertexData[r+6]=this.position2[1],this.vertexColorData[r+9]=t,this.vertexData[r+10]=this.position3[0],this.vertexData[r+11]=this.position3[1],this.vertexColorData[r+14]=t,this.vertexData[r+15]=this.position4[0],this.vertexData[r+16]=this.position4[1],this.vertexColorData[r+19]=t,o=this.renderTasks[this.renderTaskIndex],o.l2dObject=null,o.texture=this.texture,o.tiling=!1,o.tilemap=null,o.clip.set(this.clip.x,this.clip.y,this.clip.width,this.clip.height),o.tone=this.tone,o.color=this.color,o.mask=this.mask,o.opacity=this.opacity,o.blendMode=this.blendType,o.effect=this.visualEffect,o.effects=this.effects,o.clear=this.clear,this.renderTaskIndex++,this.renderTaskIndex>=this.maxRenderTasks?this.render():void 0},t.prototype.render=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E,b,R,_,D,A;for(r=null,f=0,g=0,e=null,D=null,i=null,S=null,n=this.effect,m=0,d=!1,T=!1,E=0,t=-1,n.use(),o=this.vertexData.subarray(0,4*this.renderTaskIndex*this.vertexSize),this.vertexBuffer.setSubData(o,0);f<this.renderTaskIndex;){if(_=this.renderTasks[f],e=_.clip,A=_.tone!==D||_.color!==i,d=_.mask&&_.mask.source,c=null!==_.effects,m=e.x!==this.clip.x||e.y!==this.clip.y||e.width!==this.clip.width||e.height!==this.clip.height,_.effect||c||_.tilemap||_.tiling||m||_.blendMode!==t||_.texture!==r||A||T!==d){if(this.drawTasks(r,n,E,g-E,_.clear),E=g,r=_.texture,D=_.tone,i=_.color,T=d,S=_.mask,a=0,t!==_.blendMode)switch(t=_.blendMode){case 1:$gl.blendFunc($gl.SRC_ALPHA,$gl.ONE);break;case 2:$gl.blendFunc($gl.SRC_ALPHA_SATURATE,$gl.ONE_MINUS_SRC_COLOR);break;default:$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA)}if(m&&(this.clip.set(e.x,e.y,e.width,e.height),$gl.scissor(e.x,Graphics.height-e.y-e.height,e.width,e.height)),u=!1,c)for(b=_.effects.list,w=0,x=b.length;x>w;w++)s=b[w],s.enabled&&(a|=s.id,u=u||0===s.type);if(_.tilemap?a|=4:r?u||(a=1):a|=8,_.tiling&&(a|=r.isPowerOf2?1:2),A&&(p=D&&(0!==D.red||0!==D.green||0!==D.blue||0!==D.grey),l=i&&i.alpha>0,p&&(a|=16),l&&(a|=32)),d&&(0===S.type?a|=64:1===S.type&&(a|=128)),n=gs.Effect.get(a),n.use(),n.setMatrixValue("pMatrix",this.projectionMatrix),_.tilemap?(h=Texture2D.filter,Texture2D.filter=0,this.setBitmap(_.tilemap.dataBitmap,2),this.setBitmap(_.tilemap.tilesetBitmap,3),Texture2D.filter=h,n.setVector2Value("viewportSize",Graphics.width,Graphics.height),n.setVector2Value("viewportOrigin",_.tilemap.ox,_.tilemap.oy),n.setVector2Value("autotileSettings",_.tilemap.autotileAreaStart,_.tilemap.tileSize),n.setFloatValue("autotileOffset",_.tilemap.autotileOffset),n.setVector2Value("invTilesetTextureSize",1/_.tilemap.tilesetBitmap.texture.realWidth,1/_.tilemap.tilesetBitmap.texture.realHeight),n.setVector2Value("invDataTextureSize",1/_.tilemap.dataBitmap.texture.realWidth,1/_.tilemap.dataBitmap.texture.realHeight),n.setIntegerValue("DataTexture",2),n.setIntegerValue("TilesetTexture",3)):r||n.setVector4Value("Color",i.red,i.green,i.blue,i.alpha),_.tiling&&!r.isPowerOf2&&n.setVector2Value("TextureMax",r.width/r.realWidth,r.height/r.realHeight),p&&n.setVector4Value("Tone",D.red,D.green,D.blue,D.grey),l&&n.setVector4Value("Color",i.red,i.green,i.blue,i.alpha),d&&(this.setBitmap(S.source,1),0===S.type?(n.setVector2Value("MaskOffset",S.ox/S.source.width,S.oy/S.source.height),n.setIntegerValue("Texture1",1)):1===S.type&&(n.setFloatValue("CurrentValue",S.value/255),n.setFloatValue("Vague",S.vague/255),n.setIntegerValue("Texture1",1))),c)for(R=_.effects.list,y=0,v=R.length;v>y;y++)s=R[y],s.enabled&&s.setup(n,_,r)}f++,g++}return this.drawTasks(r,n,E,g-E,!1),this.renderTaskIndex=0},t.prototype.drawTasks=function(t,e,i,r,o){return i>=0?(this.setTexture(t),this.effectUsed=!0,this.projectionMatrixOld=this.projectionMatrix,this.opacityOld=this.opacity,o&&$gl.clear($gl.COLOR_BUFFER_BIT|$gl.DEPTH_BUFFER_BIT),$gl.drawElements($gl.TRIANGLES,6*r,$gl.UNSIGNED_SHORT,6*i*2)):void 0},t.prototype.drawRect=function(){this.setTexture(null),this.texture=null,this.drawQuad(this.position,this.size)},t.prototype.changeTone=function(t){return this.drawScreenRect(t)},t.prototype.prepareScreenRect=function(){return this.render(),Graphics.frameBuffer.bind(),Graphics.frameBuffer.setTexture(Graphics.offscreenTexture),this.setTexture(Graphics.screenTexture),this.transform=mat2d.create(),mat2d.scale(this.transform,this.transform,[Graphics.screenTexture.width,Graphics.screenTexture.height]),this.setSourceRectangle(0,0,Graphics.screenTexture.width,Graphics.screenTexture.height),this.drawTransform(),this.render(),Graphics.frameBuffer.setTexture(Graphics.screenTexture)},t.prototype.drawScreenRect=function(t,e,i){return Graphics.offscreenTexture.bind(),e&&$gl.generateMipmap($gl.TEXTURE_2D),null!==i&&Graphics.offscreenTexture.setFilter(i,e),Graphics.offscreenTexture.unbind(),mat2d.identity(this.transform_),this.transformVector_[0]=t.x,this.transformVector_[1]=t.y,mat2d.translate(this.transform_,this.transform_,this.transformVector_),this.transformVector_[0]=t.width,this.transformVector_[1]=t.height,mat2d.scale(this.transform_,this.transform_,this.transformVector_),this.transform=this.transform_,this.setTexture(Graphics.offscreenTexture),this.setSourceRectangle(t.x,t.y,t.width,t.height),$gl.disable($gl.BLEND),this.drawTransform(),this.render(),$gl.enable($gl.BLEND)},t.prototype.blur=function(t,e){return this.render(),mat2d.identity(this.transform_),this.transformVector_[0]=t.x,this.transformVector_[1]=t.y,mat2d.translate(this.transform_,this.transform_,this.transformVector_),this.transformVector_[0]=t.width,this.transformVector_[1]=t.height,mat2d.scale(this.transform_,this.transform_,this.transformVector_),this.transform=this.transform_,this.blurV(t,e),this.blurH(t,e)},t.prototype.blurV=function(t,e){var i,r,o;for(this.setTexture(Graphics.offscreenTexture),this.setSourceRectangle(t.x,t.y,t.width,t.height),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height),this.visualEffect=this.vBlurEffect,i=r=0,o=e;o>=0?o>=r:r>=o;i=o>=0?++r:--r)this.drawQuad(this.position,this.size),this.render(),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height);return this.visualEffect=null},t.prototype.blurH=function(t,e){var i,r,o;for(this.setTexture(Graphics.offscreenTexture),this.setSourceRectangle(t.x,t.y,t.width,t.height),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height),this.visualEffect=this.hBlurEffect,i=r=0,o=e;o>=0?o>=r:r>=o;i=o>=0?++r:--r)this.drawQuad(this.position,this.size),this.render(),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height);return this.visualEffect=null},t.prototype.drawTransition=function(t){var e,i;return null!=(i=this.texture)&&i.unbind(),this.texture=null,this.setBitmap(t.sourceBitmap,1),this.setBitmap(t.targetBitmap,2),this.setBitmap(t.transitionBitmap,3),this.setSourceRectangleForTexture(t.transitionBitmap.texture,0,0,t.transitionBitmap.width,t.transitionBitmap.height),this.vertexData[0]=0,this.vertexData[1]=0,this.vertexData[5]=0+Graphics.width,this.vertexData[6]=0,this.vertexData[10]=0,this.vertexData[11]=0+Graphics.height,this.vertexData[15]=0+Graphics.width,this.vertexData[16]=0+Graphics.height,this.vertexBuffer.setSubData(this.vertexData),this.currentEffect=null,e=this.transitionEffect,e.use(),e.setFloatValue("CurrentAlpha",t.currentAlpha/255),e.setFloatValue("Vague",t.vague/255),e.setIntegerValue("Texture0",1),e.setIntegerValue("Texture1",2),e.setIntegerValue("Texture2",3),e.setMatrixValue("pMatrix",this.projectionMatrix),$gl.drawElements($gl.TRIANGLES,6,$gl.UNSIGNED_SHORT,0)},t.prototype.drawTiles=function(t,e,i,r,o,s,n){var a,h,l,u;l=4*this.renderTaskIndex*this.vertexSize,a=this.opacity<<24|0|0|0,this.position1[0]=0,this.position1[1]=0,this.position2[0]=1,this.position2[1]=0,this.position3[0]=0,this.position3[1]=1,this.position4[0]=1,this.position4[1]=1,vec2.transformMat2d(this.position1,this.position1,this.transform),vec2.transformMat2d(this.position2,this.position2,this.transform),vec2.transformMat2d(this.position3,this.position3,this.transform),vec2.transformMat2d(this.position4,this.position4,this.transform),this.vertexData[l]=this.position1[0],this.vertexData[l+1]=this.position1[1],this.vertexColorData[l+4]=a,this.vertexData[l+5]=this.position2[0],this.vertexData[l+6]=this.position2[1],this.vertexColorData[l+9]=a,this.vertexData[l+10]=this.position3[0],this.vertexData[l+11]=this.position3[1],this.vertexColorData[l+14]=a,this.vertexData[l+15]=this.position4[0],this.vertexData[l+16]=this.position4[1],this.vertexColorData[l+19]=a,h=Texture2D.filter,Texture2D.filter=0,this.updateBitmap(i),Texture2D.filter=h,this.setSourceRectangleForTexture(i.texture,0,0,i.texture.realWidth,i.texture.realHeight),u=this.renderTasks[this.renderTaskIndex],u.l2dObject=null,u.texture=i.texture,u.tiling=!1,u.tilemap={tilesetBitmap:r,dataBitmap:i,ox:t,oy:e,autotileOffset:o,autotileAreaStart:n.specialTiles.x,tileSize:s},u.clip.set(this.clip.x,this.clip.y,this.clip.width,this.clip.height),u.tone=this.tone,u.color=this.color,u.mask=this.mask,u.opacity=this.opacity,u.blendMode=this.blendType,u.effect=this.visualEffect,u.clear=this.clear,this.renderTaskIndex++,this.render()},t.prototype.drawLive2D=function(t){return t.draw_()},t.prototype.drawTiledBitmap=function(t,e,i,r,o,s,n,a,h){var l,u,c,d,p,f,m,g,w;for(this.setBitmap(t),e=Math.floor(e),i=Math.floor(i),r=Math.floor(r),o=Math.floor(o),f=Math.ceil(r/a),m=Math.ceil(o/h),l=0,g=u=0,d=f;d>=0?d>u:u>d;g=d>=0?++u:--u)for(w=c=0,p=m;p>=0?p>c:c>p;w=p>=0?++c:--c)this.position[0]=e+g*a,this.position[1]=i+w*h,this.size[0]=(l=this.position[0]+a-(e+r))>0?a-l:a,this.size[1]=(l=this.position[1]+h-(i+o))>0?h-l:h,this.setSourceRectangle(s,n,this.size[0],this.size[1]),this.drawQuad(this.position,this.size);return null},t.prototype.drawBitmapSimple=function(t,e,i,r,o,s,n,a,h){return t.loaded?(this.setBitmap(t),this.setSourceRectangle(s,n,a,h),this.position[0]=e-this.ox,this.position[1]=i-this.oy,this.size[0]=r,this.size[1]=o,this.drawQuad(this.position,this.size)):void 0},t.prototype.drawTransform=function(){return this.drawQuad(this.position,this.size)},t.prototype.drawBitmap=function(t,e,i,r,o,s){if(t.loaded){switch(o=o||0,s=s||0,e=e-this.ox-o,i=i-this.oy-s,this.blendType){case 1:$gl.blendFunc($gl.SRC_ALPHA,$gl.ONE);break;case 2:$gl.blendFunc($gl.SRC_ALPHA_SATURATE,$gl.ONE_MINUS_SRC_COLOR);break;default:$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA)}return this.setBitmap(t),this.mirror?this.setSourceRectangle(r.x+r.width,r.y,-r.width,r.height):this.setSourceRectangle(r.x,r.y,r.width,r.height),this.position[0]=e,this.position[1]=i,this.size[0]=r.width*this.zoom.x,this.size[1]=r.height*this.zoom.y,this.angle>0?(this.rotationCenter[0]=.5*this.size[0],this.rotationCenter[1]=.5*this.size[1],this.rotationCenterInverse[0]=-this.rotationCenter[0],this.rotationCenterInverse[1]=-this.rotationCenter[1],this.drawRotatedQuad(this.position,this.size,Math.degreesToRadians(this.angle),this.rotationCenter,this.rotationCenterInverse)):this.drawQuad(this.position,this.size)}},t.prototype._clipRect=function(t){return this.clip.set(t.x,t.y,t.width,t.height),$gl.scissor(t.x,Graphics.height-t.height,t.width-t.x,Graphics.height-t.y-(Graphics.height-t.height))},t.prototype.clipRect=function(t){return this.clip.set(t.x,t.y,t.width,t.height),$gl.scissor(t.x,Graphics.height-t.y-t.height,t.width,t.height)},t.prototype.clipTo=function(t,e,i,r){return this.clip.set(t,e,i,r),$gl.scissor(t,Graphics.height-e-r,i,r)},t.prototype.updateBitmap=function(t){return null==t.texture?t.texture=new Texture2D(t.image,t._flipTextureY):t.sequenceNumber!==t.texture.sequenceNumber?(t.texture.setImageData(t),t.dirtyRect.set(-1,-1,-1,-1)):void 0},t.prototype.setBitmap=function(t,e){return t&&t.width?(null==t.texture?t.texture=new Texture2D(t.image,t._flipTextureY):t.sequenceNumber!==t.texture.sequenceNumber&&(t.texture.setImageData(t),t.dirtyRect.set(-1,-1,-1,-1)),t.texture.sequenceNumber=t.sequenceNumber,this.setTexture(t.texture,e)):void 0},t.prototype.setTexture=function(t,e){var i;if(null==e){if(this.texture===t)return;return this.texture=t,null!=(i=this.texture)?i.bind():void 0}return $gl.activeTexture($gl.TEXTURE0+e),null!=t&&t.bind(),$gl.activeTexture($gl.TEXTURE0)},t.prototype.setSourceRectangleForTexture=function(t,e,i,r,o){var s,n,a,h,l;return null!=t?(h=e/t.realWidth,l=i/t.realHeight,a=r/t.realWidth,n=o/t.realHeight,s=4*this.renderTaskIndex*this.vertexSize,this.vertexData[s+2]=h,this.vertexData[s+3]=l,this.vertexData[s+7]=h+a,this.vertexData[s+8]=l,this.vertexData[s+12]=h,this.vertexData[s+13]=l+n,this.vertexData[s+17]=h+a,this.vertexData[s+18]=l+n):void 0},t.prototype.setSourceRectangle=function(t,e,i,r){var o,s,n,a,h;return null!=this.texture?(this.mirrorY?(h=(e+r)/this.texture.realHeight,s=-r/this.texture.realHeight):(h=e/this.texture.realHeight,s=r/this.texture.realHeight),this.mirror?(a=(t+i)/this.texture.realWidth,n=-i/this.texture.realWidth):(a=t/this.texture.realWidth,n=i/this.texture.realWidth),o=4*this.renderTaskIndex*this.vertexSize,this.vertexData[o+2]=a,this.vertexData[o+3]=h,this.vertexData[o+7]=a+n,this.vertexData[o+8]=h,this.vertexData[o+12]=a,this.vertexData[o+13]=h+s,this.vertexData[o+17]=a+n,this.vertexData[o+18]=h+s):void 0},t}(),window.Renderer_OpenGL=e,window.Renderer=null!=window.$PARAMS?Renderer_Canvas:Renderer_Canvas,gs.Renderer=e}.call(this),function(){var t,e,i;i="precision mediump float;\n\nattribute vec3 vertexPosition;\nattribute vec2 vertexTexture;\nattribute vec4 vertexColor;\n\n{DEFINES}\n\n{UNIFORMS}\n{VARYING}\n\n#ifdef USE_POSITION\nvoid default_position()\n{\n vColor = vertexColor;\n gl_Position = pMatrix * vec4(vertexPosition, 1.0);\n textureCoord = vertexTexture.st;\n}\n#endif\n#ifdef USE_TILEMAP\nvoid tilemap()\n{\n pixelCoord = (vertexTexture * viewportSize) + viewportOrigin;\n dataTextureCoord = pixelCoord * invDataTextureSize / autotileSettings.y;\n textureCoord = vertexTexture;\n vColor[3] = 1.0;\n\n gl_Position = pMatrix * vec4(vertexPosition, 1.0);\n}\n#endif\n\n{FUNCTIONS}\n\nvoid main(void)\n{\n {FUNCTION_CALLS}\n}",e="precision mediump float;\n\n{DEFINES}\n\n{UNIFORMS}\n{VARYING}\n\n#ifdef USE_TEXTURE_COLOR\nvoid texture_color()\n{\n#ifdef USE_TEXTURE_TILING\n gl_FragColor = texture2D(Texture0, mod(textureCoord, TextureMax));\n#else\n gl_FragColor = texture2D(Texture0, textureCoord);\n#endif\n\n gl_FragColor[3] *= vColor[3];\n}\n#endif\n\n#ifdef USE_TEXTURE_COLOR_TILING\nvoid texture_color_tiling()\n{\n gl_FragColor = texture2D(Texture0, mod(textureCoord, TextureMax));\n gl_FragColor[3] *= vColor[3];\n}\n#endif\n\n#ifdef USE_TINTING\nvoid tinting()\n{\n vec4 c = gl_FragColor;\n float avg = (c[0] + c[1] + c[2]) / 3.0;\n float grey = Tone[3] / 255.0;\n c.xyz = (avg * grey + c.xyz * (1.0 - grey)) + Tone.xyz / 255.0;\n c[3] *= vColor[3];\n gl_FragColor = c;\n}\n#endif\n\n#ifdef USE_COLOR\nvoid color()\n{\n vec4 c = gl_FragColor;\n float a = Color[3] / 255.0;\n\n c.xyz = Color.xyz / 255.0 * a + c.xyz * (1.0 - a);\n c[3] *= vColor[3];\n\n gl_FragColor = c;\n}\n#endif\n#ifdef USE_DYNAMIC_MASK\nvoid dynamic_mask()\n{\n vec4 sc = gl_FragColor;\n vec4 tsc = texture2D(Texture1, textureCoord);\n vec4 c = vec4(0.0, 0.0, 0.0, 0.0);\n\n if(tsc[0] >= CurrentValue)\n {\n if(Vague > tsc[0] - CurrentValue)\n {\n float diff = tsc[0] - CurrentValue;\n float alpha = diff / Vague;\n\n c[0] = sc[0];\n c[1] = sc[1];\n c[2] = sc[2];\n c[3] = sc[3] * alpha * (vColor[3]);\n }\n else\n {\n c = sc;\n c[3] *= (vColor[3]);\n }\n }\n\n gl_FragColor = c;\n}\n#endif\n#ifdef USE_STATIC_MASK\nvoid static_mask()\n{\n vec4 sc = gl_FragColor;\n vec4 tsc = texture2D(Texture1, vec2(textureCoord.s + MaskOffset.x, textureCoord.t + MaskOffset.y));\n\n sc[3] *= tsc[0] * (vColor[3]);\n\n gl_FragColor = sc;\n}\n#endif\n#ifdef USE_COLOR_QUAD\nvoid color_quad()\n{\n gl_FragColor = Color / 255.0;\n}\n#endif\n#ifdef USE_TILEMAP\nvoid tilemap()\n{\n vec4 tile = texture2D(DataTexture, dataTextureCoord);\n if(tile.x == 1.0 && tile.y == 1.0) { discard; }\n\n vec2 tilesetOffset = floor(tile.xy * 256.0) * autotileSettings.y;\n vec2 tilesetCoord = mod(pixelCoord, autotileSettings.y);\n\n if(tilesetOffset.x >= autotileSettings.x) tilesetOffset.x = tilesetOffset.x + autotileOffset;\n\n gl_FragColor = texture2D(TilesetTexture, (tilesetOffset + tilesetCoord) * invTilesetTextureSize);\n}\n#endif\n#ifdef USE_LOD_BLUR\nvoid lod_blur()\n{\n float bias = (5.0 + 5.0 * sin(LodBlurPower));\n#ifdef USE_TEXTURE_TILING\n vec4 col = texture2D(Texture0, mod(textureCoord, TextureMax), bias );\n#else\n vec4 col = texture2D(Texture0, textureCoord , bias );\n#endif\n\n gl_FragColor = vec4( col.xyz, 1.0 );\n}\n#endif\n#ifdef USE_PIXELATE\nvoid pixelate()\n{\n vec2 pixelatedCoord = vec2(0.0, 0.0);\n pixelatedCoord.x = floor(textureCoord.x / PixelateSize.x) * PixelateSize.x;\n pixelatedCoord.y = floor(textureCoord.y / PixelateSize.y) * PixelateSize.y;\n\n#ifdef USE_TEXTURE_TILING\n gl_FragColor = texture2D(Texture0, mod(pixelatedCoord, TextureMax));\n#else\n gl_FragColor = texture2D(Texture0, pixelatedCoord);\n#endif\n}\n#endif\n\n{FUNCTIONS}\n\nvoid main(void)\n{\n {FUNCTION_CALLS}\n}",t=function(){function t(t,e){if(this.id=$gl.createShader(e),$gl.shaderSource(this.id,t),$gl.compileShader(this.id),!$gl.getShaderParameter(this.id,$gl.COMPILE_STATUS))throw'Error while compliling shader "'+name+'". '+$gl.getShaderInfoLog(this.id)}return t.defaultShaders={"fragment-shader-template":e,"vertex-shader-template":i},t.prototype.dispose=function(){return $gl.deleteShader(this.id),this.id=null},t}(),window.Shader=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t){var e;e=Shader.defaultShaders["vertex-shader-template"],e=e.replace(/\{DEFINES\}/gi,t.defines.join("\n")),e=e.replace(/\{UNIFORMS\}/gi,t.uniforms.join("\n")),e=e.replace(/\{VARYING\}/gi,t.varying.join("\n")),e=e.replace(/\{FUNCTIONS\}/gi,t.functions.join("\n")),e=e.replace(/\{FUNCTION_CALLS\}/gi,t.functionCalls.join("\n")),i.__super__.constructor.call(this,e,$gl.VERTEX_SHADER)}return e(i,t),i}(Shader),window.VertexShader=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t){var e;e=Shader.defaultShaders["fragment-shader-template"],e=e.replace(/\{DEFINES\}/gi,t.defines.join("\n")),e=e.replace(/\{UNIFORMS\}/gi,t.uniforms.join("\n")),e=e.replace(/\{VARYING\}/gi,t.varying.join("\n")),e=e.replace(/\{FUNCTIONS\}/gi,t.functions.join("\n")),e=e.replace(/\{FUNCTION_CALLS\}/gi,t.functionCalls.join("\n")),i.__super__.constructor.call(this,e,$gl.FRAGMENT_SHADER)}return e(i,t),i}(Shader),window.FragmentShader=t}.call(this),function(){var t,e,i;i=function(){function t(t){var e,i,r,o,s,n,a,h;this.id=null!=(e=null!=t?t.id:void 0)?e:0,this.type=null!=(i=null!=t?t.type:void 0)?i:gs.GraphicEffectType.ADDON,this.name=null!=(r=null!=t?t.name:void 0)?r:"unknown",this.uniforms=null!=(o=null!=t?t.uniforms:void 0)?o:[],this.varying=null!=(s=null!=t?t.varying:void 0)?s:[],this.defines=null!=(n=null!=t?t.defines:void 0)?n:[],this.functionCalls=null!=(a=null!=t?t.functionCalls:void 0)?a:[],this.functions=null!=(h=null!=t?t.functions:void 0)?h:[]}return t}(),gs.EffectInfo=i,e=function(){function e(){this.wobble=new gs.WobbleEffect,this.blur=new gs.BlurEffect,this.pixelate=new gs.PixelateEffect,this.initialize()}return e.prototype.initialize=function(){var e,i,r,o,s;for(this.list=Object.values(this).where(function(t){return t instanceof gs.GraphicEffect&&t.type!==gs.GraphicEffectType.INTERNAL}),s=this.list,i=r=0,o=s.length;o>r;i=++r)e=s[i],e.id=t.fragmentShaderInfos[e.name].id;return null},e}(),gs.EffectCollection=e,t=function(){function t(t){this.textured=null!=t?!1:!0,this.programId=$gl.createProgram(),this.locations={},this.pointerSet=!1}return t.nextEffectId=8,t.registerEffect=function(e){return t.fragmentShaderInfos[e.name]=e,t.fragmentShaderInfosByID[1<<t.nextEffectId]=e,t.vertexShaderInfosByID[1<<t.nextEffectId]=t.vertexShaderInfos.position,e.id=1<<t.nextEffectId,t.nextEffectId++},t.effects=new Array(513),t.vertexShaderInfos={tilemap:{defines:["#define USE_TILEMAP"],uniforms:["uniform mat4 pMatrix;","uniform vec2 viewportSize;","uniform vec2 viewportOrigin;","uniform vec2 invDataTextureSize;","uniform vec2 autotileSettings;"],varying:["varying vec2 dataTextureCoord;","varying vec2 pixelCoord;","varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["tilemap();"],functions:[]},position:{defines:["#define USE_POSITION"],uniforms:["uniform mat4 pMatrix;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["default_position();"],functions:[]}},t.fragmentShaderInfos={texture_color:{type:0,defines:["#define USE_TEXTURE_COLOR"],uniforms:["uniform sampler2D Texture0;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["texture_color();"],functions:[]},texture_color_tiling:{type:1,defines:["#define USE_TEXTURE_TILING"],uniforms:["uniform vec2 TextureMax;"],varying:[],functionCalls:[],functions:[]},tinting:{type:1,defines:["#define USE_TINTING"],uniforms:["uniform sampler2D Texture0;","uniform vec4 Tone;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["tinting();"],functions:[]},color:{type:1,defines:["#define USE_COLOR"],uniforms:["uniform sampler2D Texture0;","uniform vec4 Color;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["color();"],functions:[]},dynamic_mask:{type:1,defines:["#define USE_DYNAMIC_MASK"],uniforms:["uniform sampler2D Texture0;","uniform sampler2D Texture1;","uniform float Vague;","uniform float CurrentValue;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["dynamic_mask();"],functions:[]},static_mask:{type:1,defines:["#define USE_STATIC_MASK"],uniforms:["uniform sampler2D Texture0;","uniform sampler2D Texture1;","uniform vec2 MaskOffset;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["static_mask();"],functions:[]},tilemap:{type:0,defines:["#define USE_TILEMAP"],uniforms:["uniform sampler2D DataTexture;","uniform sampler2D TilesetTexture;","uniform vec2 invTilesetTextureSize;","uniform float autotileOffset;","uniform vec2 autotileSettings;"],varying:["varying vec2 dataTextureCoord;","varying vec2 pixelCoord;"],functionCalls:["tilemap();"],functions:[]},color_quad:{type:0,defines:["#define USE_COLOR_QUAD"],uniforms:["uniform vec4 Color;"],varying:[],functionCalls:["color_quad();"],functions:[]},lod_blur:{type:0,name:"lod_blur",defines:["#define USE_LOD_BLUR"],uniforms:["uniform sampler2D Texture0;","uniform float LodBlurPower;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["lod_blur();"],functions:[]},pixelate:{type:0,name:"pixelate",defines:["#define USE_PIXELATE"],uniforms:["uniform sampler2D Texture0;","uniform vec2 PixelateSize;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["pixelate();"],functions:[]}},t.fragmentShaderInfosByID=new Array(513),t.vertexShaderInfosByID=new Array(513),t.initialize=function(){return t.fragmentShaderInfosByID[1]=t.fragmentShaderInfos.texture_color,t.fragmentShaderInfosByID[2]=t.fragmentShaderInfos.texture_color_tiling,t.fragmentShaderInfosByID[4]=t.fragmentShaderInfos.tilemap,t.fragmentShaderInfosByID[8]=t.fragmentShaderInfos.color_quad,t.fragmentShaderInfosByID[16]=t.fragmentShaderInfos.tinting,t.fragmentShaderInfosByID[32]=t.fragmentShaderInfos.color,t.fragmentShaderInfosByID[64]=t.fragmentShaderInfos.static_mask,t.fragmentShaderInfosByID[128]=t.fragmentShaderInfos.dynamic_mask,t.vertexShaderInfosByID[1]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[2]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[4]=t.vertexShaderInfos.tilemap,t.vertexShaderInfosByID[8]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[16]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[32]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[64]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[128]=t.vertexShaderInfos.position},t.createFragmentInfo=function(e){var i,r,o,s,n,a,h;for(o=[],h=new gs.EffectInfo,i=s=0;10>=s;i=++s)if(e&1<<i){if(r=t.fragmentShaderInfosByID[1<<i],!r)break;o.push(r)}for(o.sort(function(t,e){return t.type>e.type}),n=0,a=o.length;a>n;n++)r=o[n],h.defines.pushArray(r.defines),h.uniforms.pushArray(r.uniforms),h.varying.pushArray(r.varying),h.functions.pushArray(r.functions),h.functionCalls.pushArray(r.functionCalls);return h.defines=h.defines.filter(function(t,e,i){return i.indexOf(t)===e}),h.uniforms=h.uniforms.filter(function(t,e,i){return i.indexOf(t)===e}),h.varying=h.varying.filter(function(t,e,i){return i.indexOf(t)===e}),h.functions=h.functions.filter(function(t,e,i){return i.indexOf(t)===e}),h.functionCalls=h.functionCalls.filter(function(t,e,i){return i.indexOf(t)===e}),h},t.createVertexInfo=function(e){var i,r;return r=new gs.EffectInfo,4&e?(i=t.vertexShaderInfosByID[4],r.defines.pushArray(i.defines),r.uniforms.pushArray(i.uniforms),r.varying.pushArray(i.varying),r.functions.pushArray(i.functions),r.functionCalls.pushArray(i.functionCalls)):(i=t.vertexShaderInfosByID[1],r.defines.pushArray(i.defines),r.uniforms.pushArray(i.uniforms),r.varying.pushArray(i.varying),r.functions.pushArray(i.functions),r.functionCalls.pushArray(i.functionCalls)),r},t.get=function(e){var i,r,o,s,n;return i=t.effects[e],i||(r=t.createFragmentInfo(e),s=t.createVertexInfo(e),i=new t,n=new VertexShader(s),o=new FragmentShader(r),i.setVertexShader(n),i.setFragmentShader(o),i.build(),i.prepare(),t.effects[e]=i),i},t.prototype.dispose=function(){return $gl.deleteProgram(this.programId)},t.prototype.prepare=function(){return this.vertexPositionAttribute=$gl.getAttribLocation(this.programId,"vertexPosition"),this.vertexTextureAttribute=$gl.getAttribLocation(this.programId,"vertexTexture"),this.vertexColorAttribute=$gl.getAttribLocation(this.programId,"vertexColor"),$gl.enableVertexAttribArray(this.vertexPositionAttribute),$gl.enableVertexAttribArray(this.vertexTextureAttribute),-1!==this.vertexColorAttribute?$gl.enableVertexAttribArray(this.vertexColorAttribute):void 0},t.prototype.build=function(){if($gl.linkProgram(this.programId),!$gl.getProgramParameter(this.programId,$gl.LINK_STATUS))throw"Error while linking program: "+$gl.getProgramInfoLog(this.programId)},t.prototype.use=function(){return $gl.useProgram(this.programId),$gl.vertexAttribPointer(this.vertexPositionAttribute,2,$gl.FLOAT,!1,20,0),$gl.vertexAttribPointer(this.vertexTextureAttribute,2,$gl.FLOAT,!1,20,8),-1!==this.vertexColorAttribute?$gl.vertexAttribPointer(this.vertexColorAttribute,4,$gl.UNSIGNED_BYTE,!0,20,16):void 0},t.prototype.setIntegerValue=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1i(this.locations[t],e)},t.prototype.setIntegerValues=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1iv(this.locations[t],e)},t.prototype.setFloatValue=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1f(this.locations[t],e)},t.prototype.setFloatValues=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1fv(this.locations[t],e)},t.prototype.setVector2Value=function(t,e,i){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform2f(this.locations[t],e,i)},t.prototype.setVector2Values=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform2fv(this.locations[t],e)},t.prototype.setVector3Value=function(t,e,i,r){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform3f(this.locations[t],e,i,r)},t.prototype.setVector3Values=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform3fv(this.locations[t],e)},t.prototype.setVector4Value=function(t,e,i,r,o){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),
6 - $gl.uniform4f(this.locations[t],e,i,r,o)},t.prototype.setVector4Values=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform2fv(this.locations[t],e)},t.prototype.setMatrixValue=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniformMatrix4fv(this.locations[t],!1,e)},t.prototype.setVertexShader=function(t){return null==t&&null!=this.vertexShader&&$gl.detachShader(this.programId,this.vertexShader.id),this.vertexShader=t,null!=this.vertexShader?$gl.attachShader(this.programId,this.vertexShader.id):void 0},t.prototype.setFragmentShader=function(t){return null==t&&null!=this.fragmentShader&&$gl.detachShader(this.programId,this.fragmentShader.id),this.fragmentShader=t,null!=this.fragmentShader?$gl.attachShader(this.programId,this.fragmentShader.id):void 0},t}(),window.Effect=t,gs.Effect=t}.call(this),function(){var t,e;e=function(){function t(){}return t.NEAREST=0,t.LINEAR=1,t}(),gs.TextureFilter=e,t=function(){function t(e,i,r,o,s){this.isPowerOf2=!0,this.filter=t.filter,this.mipmap=null!=s?s:!1,"string"==typeof e?this.createFromFile(e,i):"number"==typeof e?this.createTexture(e,i,r,o,s):e instanceof Uint8Array?this.createFromPixels(e,i,r,o,s):"object"==typeof e&&this.createFromImage(e,!1,i)}return t.filter=0,t.prototype.setFilter=function(t,e){if(t!==this.filter)switch(this.filter=t,this.filter){case 0:return $gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);case 1:return $gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}},t.prototype.bind=function(){return $gl.bindTexture($gl.TEXTURE_2D,this.id)},t.prototype.unbind=function(){return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.dispose=function(){return $gl.deleteTexture(this.id)},t.prototype.createTexture=function(t,e,i,r,o){if(this.id=$gl.createTexture(),this.width=t,this.height=e,this.realWidth=t,this.realHeight=e,this.isLoaded=!0,this.isPowerOf2=Math.nextPow2(this.width)===this.width&&Math.nextPow2(this.height)===this.height,$gl.bindTexture($gl.TEXTURE_2D,this.id),r){switch(this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),o?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,this.realWidth,this.realHeight,0,$gl.RGBA,$gl.UNSIGNED_BYTE,null),o&&$gl.generateMipmap($gl.TEXTURE_2D)}else switch($gl.texImage2D($gl.TEXTURE_2D,0,null!=i?i:$gl.RGBA,t,e,0,null!=i?i:$gl.RGBA,$gl.UNSIGNED_BYTE,null),o&&$gl.generateMipmap($gl.TEXTURE_2D),this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),o?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),o?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.setImageData=function(t){return null!=t?($gl.bindTexture($gl.TEXTURE_2D,this.id),$gl.texSubImage2D($gl.TEXTURE_2D,0,0,0,$gl.RGBA,$gl.UNSIGNED_BYTE,t.image),$gl.bindTexture($gl.TEXTURE_2D,null)):void 0},t.prototype.createFromPixels=function(t,e,i,r,o){var s;switch(this.id=$gl.createTexture(),this.width=e||1,this.height=i||1,r?(this.realHeight=Math.nextPow2(this.height),this.realWidth=Math.nextPow2(this.width)):(this.realWidth=this.width,this.realHeight=this.height),this.isLoaded=!0,s=Math.nextPow2(this.width)===this.width&&Math.nextPow2(this.height)===this.height,this.isPowerOf2=s,$gl.bindTexture($gl.TEXTURE_2D,this.id),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,o),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,e,i,0,$gl.RGBA,$gl.UNSIGNED_BYTE,t),r&&$gl.generateMipmap($gl.TEXTURE_2D),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,!1),this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),r?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),r?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR),s?($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.REPEAT),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.REPEAT)):($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE))}return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.createFromImage=function(t,e){var i,r,o,s;switch(this.id=$gl.createTexture(),this.width=t.width||1,this.height=t.height||1,e?(this.realHeight=Math.nextPow2(this.height),this.realWidth=Math.nextPow2(this.width)):(this.realWidth=this.width,this.realHeight=this.height),this.isLoaded=!0,s=Math.nextPow2(this.width)===this.width&&Math.nextPow2(this.height)===this.height,this.isPowerOf2=s,i=t,(e&&this.width!==this.realWidth||this.height!==this.realHeight)&&(i=document.createElement("canvas"),i.width=Math.max(1,this.realWidth),i.height=Math.max(1,this.realHeight),r=i.getContext("2d"),r.clearRect(0,0,this.realWidth,this.realHeight),t.width>0&&t.height>0&&r.drawImage(t,0,0),t=i),o=t instanceof Image?t:i.getContext("2d").getImageData(0,0,this.realWidth,this.realHeight),$gl.bindTexture($gl.TEXTURE_2D,this.id),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,o),e&&$gl.generateMipmap($gl.TEXTURE_2D),this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR),s?($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.REPEAT),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.REPEAT)):($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE))}return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.createFromFile=function(t){return this.filePath=t,this.isLoaded=!1,this.id=$gl.createTexture(),this.image=new Image,this.image.onload=function(t){return function(){var e,i;switch(t.width=t.image.width,t.height=t.image.height,t.realWidth=Math.nextPow2(t.width),t.realHeight=Math.nextPow2(t.height),t.isPowerOf2=Math.nextPow2(t.width)===t.width&&Math.nextPow2(t.height)===t.height,e=document.createElement("canvas"),e.width=t.realWidth,e.height=t.realHeight,i=e.getContext("2d"),i.drawImage(t.image,0,0),$gl.bindTexture($gl.TEXTURE_2D,t.id),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,e),t.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}return $gl.bindTexture($gl.TEXTURE_2D,null),t.isLoaded=!0}}(this),this.image.src=t},t}(),window.Texture2D=t}.call(this),function(){var t;t=function(){function t(t,e,i,r,o){this.id=$gl.createBuffer(),this.type=t,this.itemSize=i,this.itemCount=r,this.usage=null!=o?o:$gl.STATIC_DRAW,$gl.bindBuffer(t,this.id),$gl.bufferData(t,e,this.usage),this.id.itemSize=i,this.id.numItems=r,$gl.bindBuffer(t,null)}return t.prototype.dispose=function(){return null!=this.id?($gl.deleteBuffer(this.id),this.id=null):void 0},t.prototype.setData=function(t){return $gl.bufferData(this.type,new Float32Array(t),this.usage)},t.prototype.setSubData=function(t,e){return $gl.bufferSubData(this.type,e,t)},t.prototype.bind=function(){return $gl.bindBuffer(this.type,this.id)},t.prototype.unbind=function(){return $gl.bindBuffer(this.type,null)},t}(),null==window.gs&&(window.gs={}),window.gs.Buffer=t}.call(this),function(){var t;t=function(){function t(){this.id=$gl.createFramebuffer(),this.texture=null}return t.prototype.dispose=function(){return null!=this.id?($gl.deleteFramebuffer(this.id),this.id=null):void 0},t.prototype.setTexture=function(t){return null!=this.texture&&$gl.framebufferTexture2D($gl.FRAMEBUFFER,$gl.COLOR_ATTACHMENT0,$gl.TEXTURE_2D,null,0),this.texture=t,null!=this.texture?$gl.framebufferTexture2D($gl.FRAMEBUFFER,$gl.COLOR_ATTACHMENT0,$gl.TEXTURE_2D,this.texture.id,0):void 0},t.prototype.bind=function(){return $gl.bindFramebuffer($gl.FRAMEBUFFER,this.id)},t.prototype.unbind=function(){return $gl.bindFramebuffer($gl.FRAMEBUFFER,null)},t}(),null==window.gs&&(window.gs={}),window.gs.FrameBuffer=t}.call(this),function(){var t;t=function(){function t(e,i){var r,o,s,n;this.outlineBitmap_=null,this.shadowBitmap_=null,this.metrics=null,null==t.compositeBuffer&&(t.compositeBuffer=document.createElement("canvas"),t.compositeBuffer.width=128,t.compositeBuffer.height=128,t.compositeContext=t.compositeBuffer.getContext("2d"),t.compositeContext.imageSmoothingEnabled=!1,t.compositeContext.webkitImageSmoothingEnabled=!1,t.compositeContext.mozImageSmoothingEnabled=!1),null!=e&&null==i?(this.name_=e.name,this.size=e.size,this.bold=e.bold,this.italic=e.italic,this.underline=e.underline,this.strikeThrough=e.strikeThrough,this.smallCaps=e.smallCaps,this.color=Color.fromObject(e.color),this.border=e.border,this.borderColor_=e.borderColor,this.borderSize=e.borderSize,this.shadow=e.shadow,this.shadowColor_=e.shadowColor,this.shadowOffsetX=1,this.shadowOffsetY=1,this.measureBitmap=null):(this.name_=e,this.size=i,this.bold=!1,this.italic=!1,this.underline=!1,this.strikethrough=!1,this.smallCaps=!1,this.color=new Color(255,255,255,255),this.border=!1,this.borderColor_=new Color(0,0,0,255),this.borderSize=4,this.shadow=!1,this.shadowColor_=new Color(0,0,0,128),this.shadowOffsetX=1,this.shadowOffsetY=1,this.measureBitmap=null),this.bitmap=null,this.bitmaps=[],this.loaded=!0,GS.dataCache&&GS.dataCache.RESOURCES&&(s=null,n=GS.dataCache.RESOURCES.items.resources,o="Graphics/Fonts/"+this.name,null!=n[o+"_"+s]?(r=GS.dataCache.RESOURCES.items.resources[o+"_"+s]||".woff",o="resources/"+GS.DataPreparer.prepareFilePath(o+"_"+s+r)):(r=GS.dataCache.RESOURCES.items.resources[o]||".woff",o="resources/"+GS.DataPreparer.prepareFilePath(o+r)),".fnt"===r&&(null!=t.bitmapCache[this.name+this.size]?(this.bitmap=t.bitmapCache[this.name+this.size].bitmap,this.bitmapFontData=t.bitmapCache[this.name+this.size].bitmapFontData):(this.loaded=!1,this.loadBitmapFontData(o,s))))}return t.CONTROL_SEQUENCE_COLOR=1,t.CONTROL_SEQUENCE_STYLE=2,t.sequenceColors=[Color.BLACK,Color.WHITE],t.defaultName="Courier",t.defaultSize=18,t.defaultBold=!1,t.defaultItalic=!1,t.defaultUnderline=!1,t.defaultStrikeThrough=!1,t.defaultShadow=!1,t.defaultBorder=!1,t.defaultColor=new Color(255,255,255,255),t.defaultBorderColor=new Color(0,0,0,255),t.defaultShadowColor=new Color(0,0,0,128),t.cache={},t.bitmapCache={},Object.defineProperty(t.prototype,"borderColor",{set:function(t){var e;return t.equals(this.borderColor_)?void 0:(null!=(e=this.outlineBitmap)&&e.changeColor(this.borderColor_),this.borderColor_=t)},get:function(){return this.borderColor_}}),Object.defineProperty(t.prototype,"shadowColor",{set:function(t){var e;return t.equals(this.shadowColor_)?void 0:(null!=(e=this.shadowBitmap)&&e.changeColor(this.shadowColor_),this.shadowColor_=t)},get:function(){return this.shadowColor_}}),t.prototype.height=function(){},Object.defineProperty(t.prototype,"height",{get:function(){return null==this.metrics&&(this.metrics=this.fontMetrics_()),this.metrics.height}}),Object.defineProperty(t.prototype,"ascent",{get:function(){return null==this.metrics&&(this.metrics=this.fontMetrics_()),this.metrics.ascent}}),Object.defineProperty(t.prototype,"descent",{get:function(){return null==this.metrics&&(this.metrics=this.fontMetrics_()),this.metrics.descent}}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this.bitmaps.length>0?this.bitmapFontData.common.lineHeight:(null==this.metrics&&(this.metrics=this.fontMetrics_()),this.border?this.metrics.height+this.borderSize:this.metrics.height)}}),Object.defineProperty(t.prototype,"size",{set:function(t){return this.size_!==t?(this.metrics=null,this.size_=t):void 0},get:function(){return this.bitmaps.length>0?this.bitmapFontData.info.size:this.size_}}),Object.defineProperty(t.prototype,"name",{set:function(t){return this.name_!==t?(this.metrics=null,this.name_=t,this.update()):void 0},get:function(){return this.name_}}),Object.defineProperty(t.prototype,"bold",{set:function(t){return this.bold_!==t?(this.metrics=null,this.bold_=t):void 0},get:function(){return this.bold_}}),Object.defineProperty(t.prototype,"italic",{set:function(t){return this.italic_!==t?(this.metrics=null,this.italic_=t):void 0},get:function(){return this.italic_}}),Object.defineProperty(t.prototype,"smallCaps",{set:function(t){return this.smallCaps_!==t?(this.metrics=null,this.smallCaps_=t):void 0},get:function(){return this.smallCaps_}}),t.prototype.update=function(){var e,i,r,o,s,n;if(this.bitmapFontData=t.cache[this.name],this.bitmapFontData){for(s=this.bitmapFontData.pages,n=[],i=0,r=s.length;r>i;i++)o=s[i],e=t.bitmapCache[o.file],n.push(this.bitmaps[o.id]=e);return n}return this.bitmaps=[]},t.prototype.parseBitmapFontData=function(t){var e,i;return i={pages:[],charData:[],kerningData:[]},e=t.split("\n"),e=e.select(function(t){var e;return e={},t.startsWith("info")&&(t=t.replace(/["][^"]*["]/gm,"0")),t.split(" ").select(function(t){var r;if(0!==t.length)if(r=t.split("="),r[1]){if("char"===e.cid)return"id"===r[0]?e.id=parseInt(r[1]):(i.charData[e.id]||(i.charData[e.id]=e),i.charData[e.id][r[0]]=isNaN(r[1])?r[1]:parseInt(r[1]));if("kerning"!==e.cid)return"page"===e.cid?"id"===r[0]?e.id=parseInt(r[1]):(i.pages[e.id]||(i.pages[e.id]=e),i.pages[e.id][r[0]]=isNaN(r[1])?r[1].replace(/"/gm,""):parseInt(r[1])):e[r[0]]=isNaN(r[1])?r[1]:parseInt(r[1]);if("first"===r[0]&&(e.first=parseInt(r[1]),i.kerningData[e.first]||(i.kerningData[e.first]=[])),"second"===r[0]&&(e.second=parseInt(r[1])),"amount"===r[0])return e.amount=parseInt(r[1]),i.kerningData[e.first][e.second]=e.amount}else if(e.cid=r[0],"char"!==e.cid&&"page"!==e.cid)return i[e.cid]=e}),e}),i},t.prototype.loadBitmapFontPages=function(e){var i,r,o,s,n,a,h,l,u,c,d;for(l=e.pages,d=[],o=0,n=l.length;n>o;o++){if(h=l[o],r=t.bitmapCache[h.file]){for(this.loaded=!0,u=this.bitmaps,s=0,a=u.length;a>s;s++)if(i=u[s],!i.loaded){this.loaded=!1;break}}else c="Graphics/Fonts/"+h.file.substring(0,h.file.lastIndexOf(".")),GS.dataCache.RESOURCES.items.resources[c]||(GS.dataCache.RESOURCES.items.resources[c]=".png"),r=new Bitmap("Graphics/Fonts/"+h.file.substring(0,h.file.lastIndexOf("."))),r.immutable=!1,r.onload=function(t){return function(){var e,i,r,o,s;for(t.loaded=!0,o=t.bitmaps,s=[],i=0,r=o.length;r>i;i++){if(e=o[i],!e.loaded){t.loaded=!1;break}s.push(void 0)}return s}}(this);t.bitmapCache[h.file]=r,d.push(this.bitmaps[h.id]=r)}return d},t.prototype.loadBitmapFontData=function(e){var i;return this.bitmapFontData=t.cache[this.name],this.bitmapFontData?this.update():(i=new XMLHttpRequest,i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(e){return function(){var r,o;return r=GS.DataPreparer.prepare(i.response),o=new FileReader,o.onload=function(i){return e.bitmapFontData=e.parseBitmapFontData(i.target.result),t.cache[e.name]=e.bitmapFontData,e.loadBitmapFontPages(e.bitmapFontData)},o.onerror=onerror,o.readAsText(new Blob([r]))}}(this),i.onerror=onerror,i.send())},t.prototype._fontHeight=function(){return this.fontMetrics_()},t.prototype.fontMetrics_=function(){var t,e,i,r,o,s;if(this.bitmaps.length>0)return i=this.bitmapFontData.common,{descent:i.lineHeight-i.base,ascent:i.base,height:i.lineHeight};s=jQuery("<span>hg</span>").css({fontFamily:this.name,fontSize:this.size.toString()+"px",fontWeight:this.bold?"bold":"normal",fontStyle:this.italic?"italic":"normal",fontVariant:this.smallCaps?"small-caps":"normal"}),t=jQuery('<div style="display: inline-block; width: 1px; height: 0px;"></div>'),r=jQuery("<div></div>"),r.append(s,t),e=jQuery("body"),e.append(r);try{o={},t.css({verticalAlign:"baseline"}),o.ascent=t.offset().top-s.offset().top,t.css({verticalAlign:"bottom"}),o.height=t.offset().top-s.offset().top,o.descent=o.height-o.ascent}finally{r.remove()}return o},t.exists=function(){return!0},t.createDefault=function(){var e;return e=new t(this.defaultName,this.defaultSize),e.bold=this.defaultBold,e.italic=this.defaultItalic,e.underline=this.defaultUnderline,e.strikeThrough=this.defaultStrikeThrough,e.shadow=this.defaultShadow,e.border=this.defaultBorder,e.color=this.defaultColor,e.borderColor=this.defaultBorderColor,e.shadowColor=this.defaultShadowColor,e},t.loadCustomFonts=function(e){var i,r,o,s,n;n="",i=[],n="resources/fonts.css",s=GS.dataCache.RESOURCES.items.resources;for(o in s)o.startsWith("Graphics/Fonts/")&&(r=o.split("/"),".woff"===s[o]?i.push(r[r.length-1]):".fnt"===s[o]&&new t(o.split("/").last(),1));return i.length>0?WebFont.load({custom:{families:i,urls:[n]},active:function(){return function(){return"function"==typeof e?e(!1):void 0}}(this),inactive:function(){return function(){return"function"==typeof e?e(!0):void 0}}(this)}):"function"==typeof e?e(!1):void 0},t.prototype.toString=function(){return(this.italic?"italic":"")+" "+(this.bold?"bold":"")+" "+(this.smallCaps?"small-caps":"")+" "+this.size+"px "+this.name},t.prototype.set=function(t){return this.name=t.name,this.size=t.size,this.bold=t.bold,this.italic=t.italic,this.underline=t.underline,this.strikeThrough=t.strikeThrough,this.smallCaps=t.smallCaps,this.color.setFromObject(t.color),this.border=t.border,this.borderColor_=t.borderColor,this.borderSize=t.borderSize,this.shadow=t.shadow,this.shadowColor_=t.shadowColor,this.measureBitmap=null},t.prototype.toDataBundle=function(){return{name:this.name,size:this.size,bold:this.bold,italic:this.italic,underline:this.underline,strikeThrough:this.strikeThrough,smallCaps:this.smallCaps,color:this.color,border:this.border,borderColor:this.borderColor,borderSize:this.borderSize,shadow:this.shadow,shadowColor:this.shadowColor}},t.prototype.restore=function(t){return this.name=t.name,this.size=t.size,this.bold=t.bold,this.italic=t.italic,this.underline=t.underline,this.strikeThrough=t.strikeThrough,this.smallCaps=t.smallCaps,this.color.setFromObject(t.color),this.border=t.border,this.borderColor_.setFromObject(t.borderColor),this.borderSize=t.borderSize,this.shadow=t.shadow,this.shadowColor_.setFromObject(t.shadowColor),this.measureBitmap=null},t.prototype.measureBitmapChar=function(t){var e,i;return e=t.charCodeAt(0),i=this.bitmapFontData.charData[e],null!=i?{width:i.xadvance,height:this.bitmapFontData.common.lineHeight+1}:{width:0,height:0}},t.prototype.measureBitmapText=function(t){var e,i,r,o,s,n,a;for(a={width:0,height:0},i=0,r=o=0,n=t.length;n>=0?n>o:o>n;r=n>=0?++o:--o)e=t.charCodeAt(r),s=this.bitmapFontData.charData[e],null!=s&&(a.width=a.width+s.xadvance-s.xoffset,a.height=this.bitmapFontData.common.lineHeight+1);return a},t.prototype.measureChar=function(t){var e,i,r;return this.bitmaps.length>0?this.measureBitmapChar(t):(null==this.measureBitmap&&(this.measureBitmap=new Bitmap(1,1),this.measureBitmap.font=this,this.measureBitmap.context.font=this.toString()),r={width:0,height:0},e=t.charCodeAt(0),this.measureBitmap.context.font=this.toString(),i=this.measureBitmap.context.measureText(t.charAt(0)),i.height=this.lineHeight,r.width=i.width,r.height=i.height,this.border&&(r.width+=this.borderSize-1+this.borderSize-1),r)},t.prototype.compare=function(t){return t&&t.name===this.name&&t.size===this.size&&t.bold===this.bold&&t.italic===this.italic&&t.underline===this.underline&&t.strikeThrough===this.strikeThrough&&t.smallCaps===this.smallCaps&&t.border===this.border&&t.shadow===this.shadow&&t.borderSize===this.borderSize&&t.shadowOffsetX===this.shadowOffsetX&&t.shadowOffsetY===this.shadowOffsetY&&gs.Color.compare(this.color,t.color)&&gs.Color.compare(this.shadowColor,t.shadowColor)&&gs.Color.compare(this.borderColor,t.borderColor)},t.prototype.measureTextPlain=function(e){var i;return this.bitmaps.length>0?this.measureBitmapText(e):(null==this.measureBitmap&&(this.measureBitmap=new Bitmap(1,1),this.measureBitmap.font=new t(this),this.measureBitmap.context.font=this.toString()),this.measureBitmap.context.font=this.toString(),i=this.measureBitmap.context.measureText(e),{width:i.width,height:this.lineHeight})},t.prototype.measureText=function(e){var i,r;return this.bitmaps.length>0?this.measureBitmapText(e):(r={width:0,height:0},null==this.measureBitmap&&(this.measureBitmap=new Bitmap(1,1),this.measureBitmap.font=new t(this),this.measureBitmap.context.font=this.toString()),this.measureBitmap.context.font=this.toString(),this.shadow?(this.measureBitmap.context.shadowOffsetX=1,this.measureBitmap.context.shadowOffsetY=1,this.measureBitmap.context.shadowBlur=2):(this.measureBitmap.context.shadowOffsetX=0,this.measureBitmap.context.shadowOffsetY=0,this.measureBitmap.context.shadowBlur=0),i=this.measureBitmap.context.measureText(e),i.height=this.lineHeight,r.width+=i.width,r.height=i.height,r.width=Math.round(r.width),r.height=Math.round(r.height),r)},t}(),window.Font=t,gs.Font=t}.call(this),function(){var t,e,i;i=function(){function t(){}return t.LEFT=0,t.TOP=0,t.CENTER=1,t.RIGHT=2,t.BOTTOM=2,t}(),gs.TextAlignment=i,t=function(){function t(){}return t.LEFT=0,t.TOP=1,t.CENTER=2,t.RIGHT=3,t.BOTTOM=4,t}(),gs.Alignment=i,e=function(){function t(t,e,i){this.loaded=!1,this.font=null,this.immutable=!1,this.disposed=!1,this.imageData=null,this.bounds=new gs.Rect(0,0,1,1),this.sequenceNumber=1,this.dirtyRect=new Rect(-1,-1,-1,-1),null!=e&&"string"!=typeof e&&"boolean"!=typeof e?(this.createWithSize(t,e),this.loaded=!0):"string"==typeof t?(this.loaded=!1,this.createFromFile(t,e,i)):"object"==typeof t&&(this.loaded=!0,i?this.createWithImage(t):this.createFromImage(t,e))}return t.fromDataBundle=function(t,e){var i;return i=null,t.filePath&&(i=ResourceManager.getBitmap(t.filePath),i.font=gs.ObjectCodec.decode(t.font,e)),i},t.toDataBundle=function(t,e){var i;return i={filePath:t.filePath,languageCode:t.languageCode,font:gs.ObjectCodec.encode(t.font,e)}},t.prototype.makeImmutable=function(){return this.immutable||this.error?void 0:(this.immutable=!0,null==this.texture?this.texture=new Texture2D(this.image):(this.texture.setImageData(bitmap),this.dirtyRect.set(-1,-1,-1,-1)),this.image=null,this.context=null,this.texture.sequenceNumber=this.sequenceNumber)},t.prototype.makeMutable=function(){var t,e,i,r;if(this.immutable&&!this.error)return this.immutable=!1,i=$gl.createFramebuffer(),$gl.bindFramebuffer($gl.FRAMEBUFFER,i),$gl.framebufferTexture2D($gl.FRAMEBUFFER,$gl.COLOR_ATTACHMENT0,$gl.TEXTURE_2D,this.texture.id,0),e=new Uint8Array(this.texture.realWidth*this.texture.realHeight*4),$gl.readPixels(0,0,this.texture.realWidth,this.texture.realHeight,$gl.RGBA,$gl.UNSIGNED_BYTE,e),$gl.deleteFramebuffer(i),t=document.createElement("canvas"),t.width=this.texture.realWidth,t.height=this.texture.realHeight,this.context=t.getContext("2d"),r=this.context.createImageData(this.texture.realWidth,this.texture.realHeight),r.data.set(e),this.context.putImageData(r,0,0),this.image=t},t.prototype.createWithImage=function(t){return this.width=t.width,this.height=t.height,this.bounds.set(0,0,this.width,this.height),this.image=t,this.context=t.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.context.webkitImageSmoothingEnabled=!1,this.context.mozImageSmoothingEnabled=!1,this.context.bitmap=this},t.prototype.createFromImage=function(t,e){return this.createWithSize(t.width,t.height),e&&(this.context.translate(0,this.height),this.context.scale(1,-1)),this.context.drawImage(t,0,0),e?this.context.setTransform(1,0,0,1,0,0):void 0},t.prototype.createFromFile=function(t,e){var i,r,o;return this.immutable=!0,this.filePath=t,this.languageCode=e,this.font=Font.createDefault(),this.image=new Image,this.image.onload=function(t){return function(){var e;return t.immutable?(t.width=t.image.width,t.height=t.image.height,t.bounds.set(0,0,t.width,t.height)):(e=document.createElement("canvas"),e.width=t.image.width,e.height=t.image.height,t.context=e.getContext("2d"),t.context.imageSmoothingEnabled=!1,t.context.webkitImageSmoothingEnabled=!1,t.context.mozImageSmoothingEnabled=!1,t.context.bitmap=t,t.width=t.image.width,t.height=t.image.height,t.bounds.set(0,0,t.width,t.height),t.context.clearRect(0,0,t.width,t.height),t.context.drawImage(t.image,0,0),t.image=e),t.loaded=!0,t.immutable&&(t.texture=new Texture2D(t.image),t.texture.sequenceNumber=t.sequenceNumber,t.image=null,t.context=null),null!=t.onload?t.onload():void 0}}(this),i=function(e){return function(){var i;return console.log(t&&t.startsWith("data:")?"CANNOT LOAD IMAGE":"CANNOT LOAD IMAGE: "+t),i=document.createElement("canvas"),i.width=32,i.height=32,e.context=i.getContext("2d"),e.context.imageSmoothingEnabled=!1,e.context.webkitImageSmoothingEnabled=!1,e.context.mozImageSmoothingEnabled=!1,e.context.bitmap=e,e.width=32,e.height=32,e.error=!0,e.context.clearRect(0,0,e.width,e.height),e.image=i,e.loaded=!0,null!=e.onerror?e.onerror():void 0}}(this),this.image.onerror=i,o=t,o=t.startsWith("data:")?t:gs.Application.getPlatformSpecificGraphicsFilePath(t,e),gs.Platform.isSafariMobile&&gs.Platform.isCordova?$PARAMS.needsPreparation?gs.Application.loadData(o,function(t){return function(e){var r;return e=GS.DataPreparer.prepare(e),r=new FileReader,r.onload=function(e){return t.image.src=e.target.result},r.onerror=i,r.readAsDataURL(new Blob([e]))}}(this),function(){return function(){return i()}}(this)):gs.Application.loadData(o,function(t){return function(e){return t.image.src=e}}(this),function(){return function(){return i()}}(this),1):$PARAMS.needsPreparation&&!t.startsWith("data:")?(r=new XMLHttpRequest,r.open("GET",o,!0),r.responseType="arraybuffer",r.onload=function(t){return function(){var e,o;return e=GS.DataPreparer.prepare(r.response),o=new FileReader,o.onload=function(e){return t.image.src=e.target.result},o.onerror=i,o.readAsDataURL(new Blob([e]))}}(this),r.onerror=i,r.send()):this.image.src=o},t.prototype.createWithSize=function(t,e){return this.font=Font.createDefault(),this.context=null,this.image=document.createElement("canvas"),this.width=t,this.height=e,this.bounds.set(0,0,this.width,this.height),this.image.width=this.width,this.image.height=this.height,this.context=this.image.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.context.webkitImageSmoothingEnabled=!1,this.context.mozImageSmoothingEnabled=!1,this.context.bitmap=this,this.clear()},t.prototype.dispose=function(){return this.disposed=!0,null!=this.texture&&(this.texture.dispose(),this.texture=null),this.image=null,this.context=null},t.prototype.isPixelSet=function(t,e){return this.makeMutable(),this.imageData&&this.imageData.sequenceNumber===this.sequenceNumber||(this.imageData=this.context.getImageData(0,0,this.width,this.height),this.imageData.sequenceNumber=this.sequenceNumber),0!==this.imageData.data[4*(e*this.width+t)+3]},t.prototype.getPixel=function(t,e){return this.makeMutable(),this.imageData&&this.imageData.sequenceNumber===this.sequenceNumber||(this.imageData=this.context.getImageData(0,0,this.width,this.height),this.imageData.sequenceNumber=this.sequenceNumber),new gs.Color(this.imageData.data[4*(e*this.width+t)],this.imageData.data[4*(e*this.width+t)+1],this.imageData.data[4*(e*this.width+t)+2],this.imageData.data[4*(e*this.width+t)+3])},t.prototype.getImageData=function(t,e,i,r){return this.makeMutable(),this.context.getImageData(t,e,i,r)},t.prototype.setImageData=function(t,e,i){return this.makeMutable(),this.context.putImageData(t,e,i),this.dirtyRect.expand(0,0,this.width,this.height)},t.prototype.scale=function(t){var e,i;return i=document.createElement("canvas"),i.width=Math.floor(this.width*t),i.height=Math.floor(this.height*t),e=i.getContext("2d"),e.imageSmoothingEnabled=!1,e.webkitImageSmoothingEnabled=!1,e.mozImageSmoothingEnabled=!1,e.drawImage(this.image,0,0,this.width,this.height,0,0,i.width,i.height),this.image=i,this.width=i.width,this.height=i.height,this.context=e,this.sequenceNumber++},t.prototype.clear=function(){return this.clearRect(0,0,this.width,this.height),this.sequenceNumber++},t.prototype.clearRect=function(t,e,i,r){return this.makeMutable(),null!=e?(this.context.clearRect(t,e,i,r),this.dirtyRect.expand(t,e,i,r)):(this.context.clearRect(t.x,t.y,t.width,t.height),this.dirtyRect.expand(t.x,t.y,t.width,t.height)),this.sequenceNumber++},t.prototype.fillRect=function(t,e,i,r,o){return this.makeMutable(),null!=i?(this.context.fillStyle="rgba({0}, {1}, {2}, {3})".format(o.red,o.green,o.blue,o.alpha),this.context.fillRect(t,e,i,r),this.dirtyRect.expand(t,e,i,r)):(this.context.fillStyle="rgba({0}, {1}, {2}, {3})".format(e.red,e.green,e.blue,e.alpha),this.context.fillRect(t.x,t.y,t.width,t.height),this.dirtyRect.expand(t.x,t.y,t.width,t.height)),this.sequenceNumber++},t.prototype.gradientFillRect=function(t,e,i,r,o,s,n){var a;return this.makeMutable(),null!=o?(a=null!=n?this.context.createLinearGradient(t,e,t,e+r):this.context.createLinearGradient(t,0,t+i,r),a.addColorStop(0,o.toString()),a.addColorStop(1,s.toString()),this.context.fillStyle=a,this.context.fillRect(t,e,i,r),this.dirtyRect.expand(t,e,i,r)):(a=null!=r?this.context.createLinearGradient(0,this.width,0,this.height):this.context.createLinearGradient(0,this.height,this.width,0),a.addColorStop(0,e.toString()),a.addColorStop(1,i.toString()),this.context.fillStyle=a,this.context.fillRect(t.x,t.y,t.width,t.height),this.dirtyRect.expand(t.x,t.y,t.width,t.height)),this.sequenceNumber++},t.prototype.blt=function(t,e,i,r,o){return this.makeMutable(),i.makeMutable(),this.context.globalAlpha=null!=o?o/255:1,this.context.drawImage(i.image,r.x,r.y,Math.min(r.width,i.width),Math.min(r.height,i.height),t,e,r.width,r.height),this.sequenceNumber++,this.dirtyRect.expand(t,e,r.width,r.height)},t.prototype.stretchBlt=function(t,e,i,r){return this.makeMutable(),e.makeMutable(),this.context.globalAlpha=null!=r?r/255:1,this.context.drawImage(e.image,i.x,i.y,Math.min(i.width,e.width),Math.min(i.height,e.height),t.x,t.y,t.width,t.height),this.sequenceNumber++,this.dirtyRect.expand(t.x,t.y,t.width,t.height)},t.prototype.changeColor=function(t){return this.makeMutable(),this.context.globalCompositeOperation="source-atop",this.context.fillStyle=t.toString(),this.context.fillRect(0,0,this.width,this.height),this.context.globalCompositeOperation="source-over",this.dirtyRect.expand(0,0,this.width,this.height),this.sequenceNumber++},t.prototype.changeHue=function(t){
7 - var e,i,r,o,s,n,a;for(this.makeMutable(),o=this.context.getImageData(0,0,this.width,this.height),e=o.data,i=null,a=null,r=s=0,n=e.length;n>s;r=s+=4)i=Color.rgbToHsl(e[r],e[r+1],e[r+2]),i.h=i.h+t,i.h=i.h>359?i.h-360:i.h,a=Color.hslToRgb(i.h,i.s,i.l),e[r]=a.r,e[r+1]=a.g,e[r+2]=a.b;return this.sequenceNumber++,this.dirtyRect.expand(0,0,this.width,this.height),this.context.putImageData(o,0,0)},t.prototype.drawBitmapFontText=function(t,e,i,r,o,s){var n,a,h,l,u,c,d,p,f,m,g,w;switch(null==r&&(e=t.y,i=t.width,r=t.height,t=t.x),this.dirtyRect.expand(t,e,i,r),this.currentFont!==this.font&&(this.currentFont=this.font),w=this.font.measureText(o),a=this.font.color.toString(),m=null,f=0,h=Font.compositeContext,s){case 0:t=t;break;case 1:t=Math.floor(t+(i-w.width)/2);break;case 2:t=Math.floor(t+i-w.width)}for(l=this.font.bitmapFontData,e+=Math.floor((r-w.height)/2),this.context.globalAlpha=.00392156862745*this.font.color.alpha,c=d=0,g=o.length;g>=0?g>d:d>g;c=g>=0?++d:--d)n=o.charCodeAt(c),u=this.font.bitmapFontData.charData[n],u&&(m&&(p=l.kerningData[f],p&&p[n]&&(t+=p[n])),this.font.color.equals(Color.WHITE)?0===c?this.context.drawImage(this.font.bitmaps[u.page].image,u.x,u.y,u.width,u.height,t,e+u.yoffset,u.width,u.height):this.context.drawImage(this.font.bitmaps[u.page].image,u.x,u.y,u.width,u.height,t+u.xoffset,e+u.yoffset,u.width,u.height):(h.drawImage(this.font.bitmaps[u.page].image,u.x,u.y,u.width,u.height,0,0,u.width,u.height),h.globalCompositeOperation="source-atop",h.fillStyle=a,h.fillRect(0,0,u.width,u.height),h.globalCompositeOperation="source-over",this.context.drawImage(Font.compositeBuffer,0,0,u.width,u.height,t+u.xoffset,e+u.yoffset,u.width,u.height),h.clearRect(0,0,u.width,u.height)),m=u,f=n,t+=u.xadvance);return this.sequenceNumber++,null},t.prototype.drawTextF=function(t,e,i,r,o,s,n){var a,h,l,u,c;if(this.makeMutable(),this.font.bitmaps.length>0)return this.drawBitmapFontText(t,e,i,r,o,s,n);switch(s=null!=s?s:0,n=null!=n?n:1,null==r&&(e=t.y,i=t.width,r=t.height,t=t.x),this.dirtyRect.expand(t,e,i,r),this.context.font=this.font.toString(),this.context.textBaseline="top",this.currentFont=this.font,c=this.font.measureText(o),a=this.font.borderColor.toFillStyle(),u=this.font.shadowColor.toString(),h=this.font.color.toString(),s){case 0:t=t;break;case 1:t=Math.floor(t+(i-c.width)/2);break;case 2:t=Math.floor(t+i-c.width)}switch(n){case 0:e=e;break;case 1:e=Math.floor(e+(r-c.height)/2);break;case 2:e=Math.floor(e+r-c.height)}return l=this.font.size/10,this.font.shadow?(this.context.shadowColor=u,this.context.shadowOffsetX=this.font.shadowOffsetX,this.context.shadowOffsetY=this.font.shadowOffsetY,this.context.shadowBlur=2):(this.context.shadowColor="",this.context.shadowOffsetX=0,this.context.shadowOffsetY=0,this.context.shadowBlur=0),this.font.border?(this.context.strokeStyle=a,this.context.fillStyle=h,this.context.lineWidth=this.font.borderSize,this.context.lineJoin="round",this.context.lineCap="round",this.context.strokeText(o,t,e,i),this.context.fillText(o,t,e,i),this.font.underline&&(this.context.strokeRect(t+this.font.borderSize,e+c.height-this.font.descent,c.width-2*this.font.borderSize,l),this.context.fillRect(t+this.font.borderSize,e+c.height-this.font.descent,c.width-2*this.font.borderSize,l)),this.font.strikeThrough&&(this.context.strokeRect(t+this.font.borderSize,e+c.height/2,c.width-2*this.font.borderSize,l),this.context.fillRect(t+this.font.borderSize,e+c.height/2,c.width-2*this.font.borderSize,l)),this.context.lineWidth=1):(this.context.fillStyle=h,this.context.lineWidth=1,this.context.fillText(o,t,e,i),this.font.underline&&this.context.fillRect(t,e+c.height-l-1-this.font.descent,c.width,2),this.font.strikeThrough&&this.context.fillRect(t,e+c.height/2,c.width,2)),this.sequenceNumber++,null},t.prototype.drawText=function(t,e,i,r,o,s,n){return this.drawTextF(t,e,i,r,o,s,n)},t.prototype.textSize=function(t){var e;return e=this.font.measureText(t),this.font.border?(e.width+=0,e.height-=0):this.font.shadow&&(e.width+=0,e.height+=0),e},t.prototype._fontHeight=function(t){var e,i,r,o,s;s=$("<span>"+t+"</span>").css({fontFamily:this.font.name,fontSize:this.font.size.toString()+"pt",fontWeight:this.font.bold?"bold":"normal"}),e=$('<div style="display: inline-block; width: 1px; height: 0px;"></div>'),r=$("<div></div>"),r.append(s,e),i=$("body"),i.append(r);try{o={},e.css({verticalAlign:"baseline"}),o.ascent=e.offset().top-s.offset().top,e.css({verticalAlign:"bottom"}),o.height=e.offset().top-s.offset().top,o.descent=o.height-o.ascent}finally{r.remove()}return o},t}(),window.Bitmap=e,gs.Bitmap=e}.call(this),function(){var t;t=function(){function t(e,i){this.viewport_=e,this.managed=null!=i?i:!0,this.z=0,this.index=0,this.onIndexChange=null,this.ox=0,this.oy=0,this.transform=mat2d.create(),this.anchor=new gs.Point(0,0),this.positionAnchor=new gs.Point(0,0),this.visible=!0,this.disposed=!1,this.position=vec2.create(),this.effects=new gs.EffectCollection,this.id=t.instanceCount,t.instanceCount++,this.initialize()}return t.instanceCount=0,t.prototype.onDataBundleRestore=function(){},Object.defineProperty(t.prototype,"viewport",{set:function(t){return this.viewport_!==t?(this.managed&&(null!=this.viewport_?this.viewport_.removeGraphicObject(this):Graphics.removeGraphicObject(this)),this.viewport_=t,this.managed?null==this.viewport_?Graphics.addGraphicObject(this):this.viewport_.addGraphicObject(this):void 0):void 0},get:function(){return this.viewport_}}),Object.defineProperty(t.prototype,"z",{set:function(t){var e;return t!==this.z_?(this.z_=t,null!=(e=this.viewport)?e.needsSort=!0:void 0):void 0},get:function(){return this.z_}}),t.prototype.initialize=function(){return this.managed?null==this.viewport?(Graphics.addGraphicObject(this),this.viewport=Graphics.viewport):this.viewport.addGraphicObject(this):void 0},t.prototype.dispose=function(){return this.disposed=!0,this.managed?null!=this.viewport?this.viewport.removeGraphicObject(this):Graphics.removeGraphicObject(this):void 0},t.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-i*(this.zoomX-1)*this.anchor.x,this.position[1]=e-r*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=i*this.zoomX*this.anchor.x,this.position[1]=r*this.zoomY*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t-i*this.positionAnchor.x,this.position[1]=e-r*this.positionAnchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},t.prototype.update=function(){},t.prototype.draw=function(){},t}(),window.GraphicObject=t,gs.GraphicObject=t}.call(this),function(){var t;t=function(){function t(t,e){var i;this.languageCode=e,this.lastCurrentTime=-1,this.filePath=t,this.loaded=!1,this.disposed=!1,this.texture=null,this.width=0,this.height=0,this.sequenceNumber=0,this.onError=null,this.onEnded=null,this.onCanPlay=null,this.videoElement=document.createElement("video"),this.videoElement.autoplay=!1,this.videoElement.preload="auto",jQuery(this.videoElement).attr("playsinline",!0),gs.Platform.isSafariMobile&&!gs.Platform.isCordova&&jQuery(this.videoElement).attr("muted",!0),jQuery(this.videoElement).attr("webkit-playsinline",!0),this.videoElement.playsInline=!0,this.videoElement.oncanplaythrough=function(t){return function(){return t.loaded=!0,t.texture=new Texture2D(t.videoElement.videoWidth,t.videoElement.videoHeight,!1,!0),t.texture.sequenceNumber=0,t.width=t.videoElement.videoWidth,t.height=t.videoElement.videoHeight,t.sequenceNumber=0,"function"==typeof t.onCanPlay?t.onCanPlay():void 0}}(this),this.videoElement.onerror=function(t){return function(e){return t.loaded=!0,t.error=!0,console.log("ERROR: "),console.log(e),"function"==typeof t.onError?t.onError():void 0}}(this),this.videoElement.onended=function(t){return function(){return"function"==typeof t.onEnded?t.onEnded():void 0}}(this),t=gs.Application.getPlatformSpecificVideoFilePath(t,e),gs.Platform.isSafariMobile&&gs.Platform.isCordova?$PARAMS.needsPreparation?gs.Application.loadData(t,function(t){return function(e){var i;return e=GS.DataPreparer.prepare(e),i=new FileReader,i.onload=function(e){return t.videoElement.src=gs.Platform.isSafariMobile?e.target.result.replace("data:","data:video/webm"):e.target.result.replace("data:","data:video/mp4"),t.videoElement.load()},i.onerror=onerror,i.readAsDataURL(new Blob([e]))}}(this),function(t){return function(e){return t.videoElement.onerror(e)}}(this)):gs.Application.loadData(t,function(t){return function(e){return t.videoElement.src=e,t.videoElement.load()}}(this),function(t){return function(e){return t.videoElement.onerror(e)}}(this),1):$PARAMS.needsPreparation?(i=new XMLHttpRequest,i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(t){return function(){var e,r;return e=GS.DataPreparer.prepare(i.response),r=new FileReader,r.onload=function(e){return t.videoElement.src=gs.Platform.isSafari||gs.Platform.isEdge?e.target.result.replace("data:","data:video/mp4"):e.target.result.replace("data:","data:video/webm")},r.onerror=onerror,r.readAsDataURL(new Blob([e]))}}(this),i.onerror=function(t){return function(e){return console.log("ERROR: "),console.log(e),"function"==typeof t.onError?t.onError():void 0}}(this),i.send()):(this.videoElement.src=t,this.videoElement.load())}return t.fromDataBundle=function(t){var e;return e=null,t.filePath&&(e=new gs.Video(t.filePath,null),t.isPlaying&&(e.videoElement.currentTime=t.currentTime,e.volume=t.volume,e.playbackRate=t.playbackRate,e.loop=t.loop,e.play())),e},t.toDataBundle=function(t){var e,i;return e={filePath:t.filePath,loop:t.loop,isPlaying:t.isPlaying,currentTime:null!=(i=t.videoElement)?i.currentTime:void 0,volume:t.volume,playbackRate:t.playbackRate}},Object.defineProperty(t.prototype,"isPlaying",{get:function(){var t;return!(null!=(t=this.videoElement)?t.paused:void 0)}}),Object.defineProperty(t.prototype,"volume",{get:function(){var t;return null!=(t=this.videoElement)?t.volume:void 0},set:function(t){var e;return null!=(e=this.videoElement)?e.volume=t:void 0}}),Object.defineProperty(t.prototype,"playbackRate",{get:function(){var t;return null!=(t=this.videoElement)?t.playbackRate:void 0},set:function(t){var e;return null!=(e=this.videoElement)?e.playbackRate=t:void 0}}),Object.defineProperty(t.prototype,"loop",{get:function(){var t;return null!=(t=this.videoElement)?t.loop:void 0},set:function(t){var e;return null!=(e=this.videoElement)?e.loop=t:void 0}}),t.prototype.dispose=function(){var t;return this.disposed?void 0:(null!=(t=this.texture)&&t.dispose(),this.disposed=!0,this.videoElement.oncanplaythrough=null,this.videoElement.onerror=null,this.videoElement.onend=null,this.videoElement.pause(),this.videoElement.src="",delete this.videoElement)},t.prototype.play=function(){var t;return this.error?void 0:null!=(t=this.videoElement)?t.play():void 0},t.prototype.pause=function(){var t;return this.error?void 0:null!=(t=this.videoElement)?t.pause():void 0},t.prototype.stop=function(){var t;return this.error||null!=(t=this.videoElement)&&t.pause(),"function"==typeof this.onEnded?this.onEnded():void 0},t.prototype.update=function(){var t;return this.loaded&&!this.disposed&&this.videoElement.currentTime!==this.lastCurrentTime?(t=Graphics.renderer,t.setTexture(this.texture),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,this.videoElement),this.lastCurrentTime=this.videoElement.currentTime):void 0},t}(),gs.Video=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t,e,r,o,s){i.__super__.constructor.call(this,s),this.rect=null!=e?new Rect(t,e,r,o):null!=t?new Rect(t.x,t.y,t.width,t.height):new Rect(0,0,Graphics.width,Graphics.height),this.color=new Color(255,255,255,0),this.tone=new Tone(0,0,0,0),this.angle=0,this.zoomX=1,this.zoomY=1,this.objects=[],this.needsSort=!0,this.position=vec2.create()}return e(i,t),i.prototype.dispose=function(){var t,e;for(i.__super__.dispose.call(this),this.disposed=!0,t=0;t<this.objects.length;)e=this.objects[t],(null!=e?e.disposed:void 0)?t++:null!=e&&e.dispose();return null},i.prototype._sort=function(t,e){return t.z<e.z?-1:t.z>e.z?1:t.id>e.id?1:-1},i.prototype.addGraphicObject=function(t){return this!==Graphics.viewport?Graphics.addGraphicObject(t):this.needsSort=!0,-1===this.objects.indexOf(t)&&this.objects.push(t),t.viewport_=this},i.prototype.removeGraphicObject=function(t){return this!==Graphics.viewport&&Graphics.removeGraphicObject(t),Array.remove(this.objects,t)},i.prototype.updateTransform=function(){return mat2d.identity(this.transform),this.viewport&&mat2d.mul(this.transform,this.viewport.transform,this.transform),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=this.ox-this.rect.width*(this.zoomX-1)*(this.anchor.x-this.ox/this.rect.width),this.position[1]=this.oy-this.rect.height*(this.zoomY-1)*(this.anchor.y-this.oy/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=this.rect.width*this.zoomX*(this.anchor.x-this.ox/this.rect.width),this.position[1]=this.rect.height*this.zoomY*(this.anchor.y-this.oy/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=this.zoomX,this.position[1]=this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=this.ox,this.position[1]=this.oy,mat2d.translate(this.transform,this.transform,this.position))},i.prototype.updateGhostTransform=function(t){var e,i;return mat2d.identity(this.transform),e=t.x,i=t.y,this.viewport&&mat2d.mul(this.transform,this.viewport.transform,this.transform),0!==this.angle||1!==t.zoomX||1!==t.zoomY?(this.position[0]=e-this.rect.width*(t.zoomX-1)*(this.anchor.x-e/this.rect.width),this.position[1]=i-this.rect.height*(t.zoomY-1)*(this.anchor.y-i/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=this.rect.width*t.zoomX*(this.anchor.x-e/this.rect.width),this.position[1]=this.rect.height*t.zoomY*(this.anchor.y-i/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(t.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=t.zoomX,this.position[1]=t.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=e,this.position[1]=i,mat2d.translate(this.transform,this.transform,this.position))},i.prototype.updateMotionBlur=function(){var t,e,i;if(this.motionBlur.enabled){for((Graphics.frameCount+1)%this.motionBlur.delay===0&&(t={srcRect:new Rect(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),x:this.x,y:this.y,zoomX:this.zoomX,zoomY:this.zoomY,opacity:this.motionBlur.opacity,angle:this.angle},this.motionBlurGhosts.push(t)),e=0,i=[];e<this.motionBlurGhosts.length;)t=this.motionBlurGhosts[e],0===t.opacity?i.push(this.motionBlurGhosts.remove(t)):(t.opacity=Math.max(t.opacity-this.motionBlur.dissolveSpeed,0),i.push(e++));return i}},i.prototype.update=function(){return i.__super__.update.call(this),this.updateTransform()},i.prototype.draw=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m;if(f=Graphics.renderer,m=f.tone,r=f.effects,f.reset(),this.needsSort&&(this.objects.sort(this._sort),this.needsSort=!1),this===Graphics.viewport)for(d=this.objects,s=n=0,h=d.length;h>n;s=++n)c=d[s],c.index!==s&&(c.index=s,"function"==typeof c.onIndexChange&&c.onIndexChange()),c.visible&&c.draw();for(i=this.effects.wobble.enabled,u=!1,o=null,p=this.effects.list,a=0,l=p.length;l>a;a++)if(e=p[a],e.enabled){i=!0,u=e.mipmap,o=e.textureFilter;break}return(i||0!==this.tone.red||0!==this.tone.green||0!==this.tone.blue||0!==this.tone.grey)&&(f.prepareScreenRect(),f.effects=this.effects,f.tone=this.tone,f.drawScreenRect(this.rect,u,o),f.clear=!1,f.effects=r),0!==this.color.alpha&&(t=f.color,f.color=this.color,f.transform=f.transform_,mat2d.identity(f.transform_),this.position[0]=this.rect.x,this.position[1]=this.rect.y,mat2d.translate(f.transform_,f.transform_,this.position),this.position[0]=this.rect.width,this.position[1]=this.rect.height,mat2d.scale(f.transform_,f.transform_,this.position),f.drawRect(this.rect,0,0),f.color=t),f.tone=m},i}(GraphicObject),window.Viewport=t,gs.Viewport=t}.call(this),function(){var t,e,i,r,o,s,n,a,h,l,u,c,d=function(t,e){function i(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},p={}.hasOwnProperty;t=function(){function t(){}return t.NORMAL=0,t.ADDITIVE=1,t.SUBTRACTIVE=2,t}(),gs.BlendMode=t,r=function(){function t(){}return t.BASE=0,t.ADDON=1,t.INTERNAL=2,t}(),gs.GraphicEffectType=r,i=function(){function t(t){var e,i,r;this.type=null!=(e=null!=t?t.type:void 0)?e:gs.GraphicEffectType.ADDON,this.enabled=null!=(i=null!=t?t.enabled:void 0)?i:!1,this.id=null!=t?t.id:void 0,this.name=null!=(r=null!=t?t.name:void 0)?r:"unknown",this.mipmap=!1,this.textureFilter=null}return t.prototype.setup=function(){},t}(),gs.GraphicEffect=i,c=function(t){function e(t){var i,r,o,s;e.__super__.constructor.call(this,t),this.type=gs.GraphicEffectType.INTERNAL,this.name="wobble",this.power=null!=(i=null!=t?t.power:void 0)?i:.001,this.speed=null!=(r=null!=t?t.speed:void 0)?r:.1,this.vertical=null!=(o=null!=t?t.vertcial:void 0)?o:!0,this.horizontal=null!=(s=null!=t?t.horizontal:void 0)?s:!0}return d(e,t),e.fromObject=function(t){return new gs.WobbleEffect(t)},e}(gs.GraphicEffect),gs.WobbleEffect=c,e=function(t){function e(t){var i;e.__super__.constructor.call(this,t),this.type=gs.GraphicEffectType.BASE,this.name="lod_blur",this.mipmap=!0,this.textureFilter=gs.TextureFilter.LINEAR,this.power=null!=(i=null!=t?t.power:void 0)?i:0}return d(e,t),e.prototype.setup=function(t,e){return t.setFloatValue("LodBlurPower",e.effects.blur.power-1)},e.fromObject=function(t){return new gs.BlurEffect(t)},e}(gs.GraphicEffect),gs.BlurEffect=e,h=function(t){function e(t){var i,r;e.__super__.constructor.call(this,t),this.type=gs.GraphicEffectType.BASE,this.name="pixelate",this.textureFilter=gs.TextureFilter.NEAREST,this.width=null!=(i=null!=t?t.width:void 0)?i:0,this.height=null!=(r=null!=t?t.height:void 0)?r:0}return d(e,t),e.prototype.setup=function(t,e,i){return t.setVector2Value("PixelateSize",Math.max(e.effects.pixelate.width,1)/i.realWidth,Math.max(e.effects.pixelate.height,1)/i.realHeight)},e.fromObject=function(t){return new gs.PixelateEffect(t)},e}(gs.GraphicEffect),gs.PixelateEffect=h,s=function(){function t(){}return t.STATIC=0,t.DYNAMIC=1,t}(),gs.MaskingType=s,o=function(){function t(t){var e,i,r,o,s;this.ox=null!=(e=null!=t?t.ox:void 0)?e:0,this.oy=null!=(i=null!=t?t.oy:void 0)?i:0,this.source=null,this.type=null!=(r=null!=t?t.type:void 0)?r:0,this.value=null!=(o=null!=t?t.value:void 0)?o:0,this.vague=null!=(s=null!=t?t.vague:void 0)?s:0}return t.prototype.set=function(t){return t?(this.ox=t.ox,this.oy=t.oy,this.source=t.source,this.type=t.type,this.value=t.value,this.vague=t.vague):(this.ox=0,this.oy=0,this.source=null,this.type=0,this.value=0,this.vague=0)},t.prototype.toDataBundle=function(){var t;return{ox:this.ox,oy:this.oy,type:this.type,value:this.value,vague:this.vague,source:null!=(t=this.source)?t.filePath:void 0}},t.fromObject=function(t){return new gs.Mask(t)},t}(),gs.Mask=o,n=function(){function t(t){var e,i,r,o;this.enabled=null!=(e=null!=t?t.enabled:void 0)?e:!1,this.dissolveSpeed=null!=(i=null!=t?t.dissolveSpeed:void 0)?i:3,this.delay=null!=(r=null!=t?t.delay:void 0)?r:2,this.opacity=null!=(o=null!=t?t.opacity:void 0)?o:100,this.color=Color.TRANSPARENT}return t.prototype.set=function(t){var e,i,r,o;return this.enabled=null!=(e=null!=t?t.enabled:void 0)?e:!1,this.dissolveSpeed=null!=(i=null!=t?t.dissolveSpeed:void 0)?i:3,this.delay=null!=(r=null!=t?t.delay:void 0)?r:2,this.opacity=null!=(o=null!=t?t.opacity:void 0)?o:100,this.color=Color.TRANSPARENT},t.prototype.toDataBundle=function(){var t;return t={},Object.mixin(t,this),t},t.fromObject=function(t){return new gs.MotionBlur(t)},t}(),gs.MotionBlur=n,a=function(){function t(){}return t}(),u=function(t){function e(t,i){e.__super__.constructor.call(this,t,i),this.bitmap=null,this.video_=null,this.srcRect=null,this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.x=0,this.y=0,this.width=0,this.height=0,this.zoomX=1,this.zoomY=1,this.angle=0,this.mirror=!1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendingMode=0,this.motionBlur=new gs.MotionBlur,this.motionBlurGhosts=[],this.wobble=this.effects.wobble,this.clipRect=new Rect(0,0,Graphics.width,Graphics.height)}return d(e,t),e.objectCodecBlackList=["onIndexChange"],Object.defineProperty(e.prototype,"video",{set:function(t){return this.video_=t,this.bitmap=t},get:function(){return this.video_}}),e.prototype.updateGhostTransform=function(t){var e,i,r,o;return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),i=t.srcRect.width,e=t.srcRect.height,r=t.x-this.ox,o=t.y-this.oy,0!==t.angle||1!==t.zoomX||1!==t.zoomY?(this.position[0]=r-i*(t.zoomX-1)*this.anchor.x,this.position[1]=o-e*(t.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),0!==t.angle&&(this.position[0]=i*this.anchor.x,this.position[1]=e*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(t.angle)),this.position[0]=-(i*this.anchor.x),this.position[1]=-(e*this.anchor.y),mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=i*t.zoomX,this.position[1]=e*t.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=r,this.position[1]=o,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=e,mat2d.scale(this.transform,this.transform,this.position))},e.prototype.update=function(){var t,i,r;if(e.__super__.update.call(this),this.motionBlur.enabled){for((Graphics.frameCount+1)%this.motionBlur.delay===0&&(t={srcRect:new Rect(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),transform:mat2d.clone(this.transform),opacity:this.motionBlur.opacity},this.motionBlurGhosts.push(t)),i=0,r=[];i<this.motionBlurGhosts.length;)t=this.motionBlurGhosts[i],0===t.opacity?r.push(this.motionBlurGhosts.remove(t)):(t.opacity=Math.max(t.opacity-this.motionBlur.dissolveSpeed,0),r.push(i++));return r}},e.prototype.draw=function(){var t,e,i,r,o,s,n,a,h;if(null!=this.srcRect){if(a=Graphics.renderer,null!=this.video&&this.video.loaded&&(this.bitmap=this.video),e=a.color,h=a.tone,t=a.blendType,i=a.effects,this.updateTransform(~~(this.x-this.ox),~~(this.y-this.oy),this.width||this.srcRect.width,this.height||this.srcRect.height),a.transform=this.transform,a.mirror=this.mirror,a.color=this.color,a.opacity=this.opacity,a.tone=this.tone,a.blendType=this.blendingMode,a.mask=this.mask,a.wobble=this.wobble,a.effects=this.effects,a.clipRect(null!=this.clipRect?this.clipRect:Graphics.viewport.rect),null==this.bitmap||this.bitmap.disposed||(a.setBitmap(this.bitmap),a.setSourceRectangle(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),a.drawTransform()),this.motionBlur.enabled){for(o=s=0,n=this.motionBlurGhosts.length;n>=0?n>s:s>n;o=n>=0?++s:--s)r=this.motionBlurGhosts[o],a.mirror=this.mirror,a.color=this.motionBlur.color,a.opacity=r.opacity,a.tone=this.tone,a.blendType=this.blendingMode,null!=this.bitmap&&(a.transform=r.transform,a.setSourceRectangle(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),a.drawTransform());a.color=Color.TRANSPARENT,a.opacity=255}return a.opacity=255,a.tone=h,a.color=e,a.mask=null,a.blendType=t,a.effects=i,a.mirror=!1}},e}(GraphicObject),window.Sprite=u,gs.Sprite=u,l=function(t){function e(t){e.__super__.constructor.call(this,t),this.rect=new Rect(0,0,100,100),this.color=new Color(255,255,255,0),this.opacity=255,this.blendingMode=0,this.clipRect=null,this.zoomX=1,this.zoomY=1,this.angle=0}return d(e,t),e.objectCodecBlackList=["onIndexChange"],e.prototype.update=function(){return e.__super__.update.call(this),this.flashCounter>0?(this.flashCounter--,this.flashColor.alpha=this.flashCounter/this.flashDuration*255,this.color=this.flashColor):void 0},e.prototype.draw=function(){var t,e,i,r;return r=Graphics.renderer,r.clipRect(this.clipRect?this.clipRect:Graphics.viewport.rect),t=r.blendType,i=r.effects,r.blendType=this.blendingMode,r.mask=this.mask,r.wobble=this.wobble,r.effects=this.effects,0!==this.color.alpha&&(e=r.color,r.color=this.color,r.transform=this.transform,r.opacity=this.opacity,this.updateTransform(this.rect.x-this.ox,this.rect.y-this.oy,this.rect.width,this.rect.height),r.drawRect(this.rect,this.ox,this.oy),r.color=e,r.opacity=255),r.color=e,r.blendType=t,r.mask=null,r.effects=i,r.opacity=255},e}(GraphicObject),window.gs.Quad=l}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t,e){i.__super__.constructor.call(this,t,e),this.bitmap=null,this.video=null,this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendingMode=0,this.vertical=!0,this.horizontal=!0,this.effects=new gs.EffectCollection,this.motionBlur=new gs.MotionBlur,this.motionBlurGhosts=[],this.clipRect=new Rect(0,0,Graphics.width,Graphics.height),this.srcRect=null,this.x=0,this.y=0,this.zoomX=1,this.zoomY=1,this.angle=0}return e(i,t),i.objectCodecBlackList=["onIndexChange"],i.prototype.update=function(){return i.__super__.update.call(this)},i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle&&(this.position[0]=t+this.rect.width*this.anchor.x,this.position[1]=e+this.rect.height*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-this.rect.width*(this.zoomX-1)*this.anchor.x,this.position[1]=e-this.rect.height*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._drawTiles=function(t){var e,i,r,o;return i=Graphics.renderer,e=i.blendType,i.blendType=this.blendingMode,r=t.x-this.ox,o=t.y-this.oy,this.updateTransform(r,o,t.width,t.height),i.transform=this.transform,i.setBitmap(this.bitmap),i.setSourceRectangle(this.x,this.y,t.width,t.height),i.drawTransform(),i.blendType=e,null},i.prototype._draw=function(){return null!=this.bitmap?this._drawTiles(Graphics.viewport.rect):void 0},i.prototype.draw=function(){var t,e,i,r,o,s;if(null!=(r=this.bitmap)?r.loaded:void 0)return null==this.srcRect&&(this.srcRect=new Rect(0,0,this.bitmap.width,this.bitmap.height)),o=Graphics.renderer,null!=this.video&&this.video.loaded&&(this.bitmap=this.video),e=o.color,s=o.tone,t=o.blendType,i=o.effects,o.mirror=!1,o.color=this.color,o.opacity=this.opacity,o.tone=this.tone,o.blendType=this.blendingMode,o.mask=this.mask,o.wobble=this.wobble,o.effects=this.effects,o.clipRect(null!=this.clipRect?this.clipRect:Graphics.viewport.rect),this._draw(),o.opacity=255,o.tone=s,o.color=e,o.mask=null,o.blendType=t,o.effects=i},i}(GraphicObject),gs.TilingObject=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){i.__super__.constructor.apply(this,arguments),this.rect=new Rect(0,0,Graphics.width,Graphics.height)}return e(i,t),i.objectCodecBlackList=["onIndexChange"],i.prototype._draw=function(){return null!=this.bitmap?this._drawTiles(this.rect):void 0},i}(gs.TilingObject),gs.TilingSprite=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(){i.__super__.constructor.apply(this,arguments),this.rect=new Rect(0,0,Graphics.width,Graphics.height),this.x=0,this.y=0,this.viewportInverse_=mat2d.create()}return e(i,t),i.objectCodecBlackList=["onIndexChange"],i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.invert(this.viewportInverse_,this.viewport.transform),mat2d.mul(this.transform,this.transform,this.viewportInverse_),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-i*(this.zoomX-1)*this.anchor.x,this.position[1]=e-r*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=i*this.anchor.x,this.position[1]=r*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-(i*this.anchor.x),this.position[1]=-(r*this.anchor.y),mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._draw=function(){return null!=this.bitmap?this._drawTiles(this.rect):void 0},i.prototype._drawTiles=function(){var t,e,i;return i=Graphics.renderer,t=i.blendType,e=i.effects,i.blendType=this.blendingMode,this.updateTransform(~~-this.x,~~this.y,this.rect.width,this.rect.height),i.transform=this.transform,i.effects=this.effects,i.setBitmap(this.bitmap),i.drawTextureTransform(this.rect),i.blendType=t,i.effects=e,null},i}(gs.TilingObject),gs.TilingPlane=t}.call(this),function(){var t,e={}.hasOwnProperty,i=function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);return r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype,t};t=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.bitmap=null,this.zoomX=1,this.zoomY=1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendType=0,this.srcRect=null,this.loopVertical=!0,this.loopHorizontal=!0}return i(e,t),e.prototype.draw=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y;
8 -
9 - if(null!=this.bitmap&&this.bitmap.loaded){if(this.srcRect||(this.srcRect=new Rect(0,0,this.bitmap.width,this.bitmap.height)),r=Graphics.renderer,h=this.srcRect.width*this.zoomX,t=this.srcRect.height*this.zoomY,s=Graphics.width,o=Graphics.height,n=this.loopHorizontal?Math.ceil(s/h):1,a=this.loopVertical?Math.ceil(o/t):1,e=0,i=0,r.zoom.x=this.zoomX,r.zoom.y=this.zoomY,r.angle=0,r.mirror=!1,r.color=this.color,r.opacity=this.opacity,r.tone=this.tone,r.blendingMode=this.blendType,this.loopVertical&&this.loopHorizontal)for(l=c=-1,m=n+2;m>=-1?m>=c:c>=m;l=m>=-1?++c:--c)for(u=d=-1,g=a+2;g>=-1?g>=d:d>=g;u=g>=-1?++d:--d)e=l*h+-this.ox%h,i=u*t+-this.oy%t,e+h>0&&s>e&&i+t>0&&o>i&&r.drawBitmap(this.bitmap,e,i,this.srcRect);else if(this.loopVertical)for(u=p=-1,w=a+2;w>=-1?w>=p:p>=w;u=w>=-1?++p:--p)e=l,i=u*t+-this.oy%t,e+h>0&&s>e&&i+t>0&&o>i&&r.drawBitmap(this.bitmap,e,i,this.srcRect);else if(this.loopHorizontal)for(l=f=-1,y=n+2;y>=-1?y>=f:f>=y;l=y>=-1?++f:--f)e=l*h+-this.ox%h,i=u,e+h>0&&s>e&&i+t>0&&o>i&&r.drawBitmap(this.bitmap,e,i,this.srcRect);return null}},e}(GraphicObject),window.Plane=t}.call(this),function(){var t,e,i=function(t,e){function i(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(){function t(){}return t.prototype.jsonParseFromBytes=function(t){var e,i,r;return r=null,e=new Uint8Array(t,0,3),r=239===e[0]&&187===e[1]&&191===e[2]?String.fromCharCode.apply(null,new Uint8Array(t,3)):String.fromCharCode.apply(null,new Uint8Array(t)),i=JSON.parse(r)},t.prototype.log=function(t){return console.log(t)},t}(),window.L2DPlatformManager=t,e=function(t){function e(t,i,r){e.__super__.constructor.apply(this,arguments),this.filePath=t,this.live2DModel=null,this.params=[],r=null!=r?r:0,this.disposed=!1,this.initialized=!1,this.textures=[],this.motions={},this.motionsByGroup={},this.expressions=[],this.pose=null,"string"==typeof t?this.loadFromFile(t,i,r):this.loadFromBuffer(t,r)}return i(e,t),e.fromDataBundle=function(t){var e,i,r,o,s,n;if(n=null,t.filePath)if(n=ResourceManager.getLive2DModel(t.filePath),n.loaded)for(s=t.params,e=i=0,r=s.length;r>i;e=++i)o=s[e],n.live2DModel.setParamFloat(e,o);else n.once("modelDataLoaded",{params:t.params,model:n},function(t){var e,i,r,o,s,n;for(s=t.data.params,n=[],e=i=0,r=s.length;r>i;e=++i)o=s[e],n.push(t.data.model.live2DModel.setParamFloat(e,o));return n});return n},e.toDataBundle=function(t){var e,i,r,o,s,n;for(o=[],r=t.live2DModel._$5S._$_2,e=i=0,n=r.length;n>=0?n>=i:i>=n;e=n>=0?++i:--i)o[e]=r[e];return s={filePath:t.filePath,params:o}},Object.defineProperty(e.prototype,"loaded",{get:function(){var t,e,i,r,o;for(r=this.textures.length>0,i=this.textures,t=0,e=i.length;e>t;t++)if(o=i[t],!o||!o.loaded)return!1;return r}}),e.prototype.initialize=function(){var t,e,i,r,o;if(window.Live2DModelWebGL){for(i=this.textures,t=0,e=i.length;e>t;t++)r=i[t],o=$gl.createTexture(),$gl.pixelStorei($gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,1),$gl.activeTexture($gl.TEXTURE0),$gl.bindTexture($gl.TEXTURE_2D,o),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,r),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_NEAREST),$gl.generateMipmap($gl.TEXTURE_2D),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.pixelStorei($gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,0),r.textureId=o;return this.initialized=!0}},e.prototype.dispose=function(){var t,e,i,r,o,s;if(!this.disposed){for(this.disposed=!0,r=this.textures,o=[],t=e=0,i=r.length;i>e;t=++e)s=r[t],null!=s&&null!=s.textureId?($gl.deleteTexture(s.textureId),o.push(delete s.textureId)):o.push(void 0);return o}},e.prototype.reset=function(){var t,e,i,r,o,s;for(o=this.params,s=[],t=e=0,i=o.length;i>e;t=++e)r=o[t],s.push(this.live2DModel.setParamFloat(t,r));return s},e.prototype.loadFromBuffer=function(t,e){var i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E,b,R,_,D,A,C,M,I;if(!window.Live2DModelWebGL)return void(this.textures=[{loaded:!0}]);if(i=t,I=new JSZip(i),C=JSON.parse(I.file("settings.json").asText()),m=I.file("model.moc").asArrayBuffer(),this.live2DModel=Live2DModelWebGL.loadModel(m,null!=e?e:0),null!=C.motions)for(a in C.motions)for(this.motionsByGroup[a]=[],T=C.motions[a],n=0,l=T.length;l>n;n++)g=T[n],i=I.file(g.file).asArrayBuffer(),f=Live2DMotion.loadMotion(i),this.motions[g.file]=f,this.motionsByGroup[a].push(f);if(null!=C.expressions)for(E=C.expressions,h=0,u=E.length;u>h;h++)r=E[h],i=I.file(r.file).asArrayBuffer(),this.expressions[r.name]=L2DExpressionMotion.loadJson(i);if(null!=C.pose&&(i=I.file(C.pose).asArrayBuffer(),this.pose=L2DPose.load(i)),null!=C.physics&&(i=I.file(C.physics).asArrayBuffer(),this.physics=L2DPhysics.load(i)),null!=C.init_param)for(b=C.init_param,w=0,c=b.length;c>w;w++)x=b[w],this.live2DModel.setParamFloat(x.id,x.val);if(null!=C.init_parts_visible)for(R=C.init_parts_visible,y=0,d=R.length;d>y;y++)x=R[y],this.live2DModel.setPartsOpacity(x.id,x.val);for(v=this.live2DModel._$5S._$_2,s=S=0,_=v.length;_>=0?_>=S:S>=_;s=_>=0?++S:--S)this.params[s]=v[s];for(this.textures=new Array(C.textures.length),D=C.textures,s=A=0,p=D.length;p>A;s=++A)M=D[s],i=I.file(M).asArrayBuffer(),(o=function(t){return function(e,r){var o;return o=new FileReader,o.onload=function(e){var i;return i=new Image,t.textures[r]=i,i.onload=function(){return t.textures[r].loaded=!0},i.src=e.target.result.replace("data:","data:image/png")},o.onerror=function(t){return console.log(t)},o.readAsDataURL(new Blob([i]))}}(this))(M,s);return this.emit("modelDataLoaded")},e.prototype.loadFromFile=function(t,e,i){var r,o,s;return o=GS.dataCache.RESOURCES.items.resources,null!=o[t+"_"+e]?(r=o[t+"_"+e],s="resources/"+GS.DataPreparer.prepareFilePath(t+"_"+e+r)):(r=o[t]||".live2d",s="resources/"+GS.DataPreparer.prepareFilePath(t+r)),gs.Application.loadData(s,function(t){return function(e){return t.loadFromBuffer(GS.DataPreparer.prepare(e),null!=i?i:0)}}(this),function(){return function(t){return console.log(t)}}(this))},e.prototype.update=function(){return this.live2DModel.update()},e}(gs.EventEmitter),window.gs.Live2DModel=e}.call(this),function(){var t,e,i=function(t,e){function i(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=function(){function t(){}return t.ORDERED=0,t.RANDOM=1,t}(),window.gs.Live2DMotionPlayTypes=e,window.MotionQueueManager||(window.MotionQueueManager=Object,window.Live2D={isEnabled:!1,init:function(){return null},setGL:function(){return null},getGL:function(){return null}},window.Live2DFramework={setPlatformManager:function(){return null}}),t=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.motion=null,this.group=null,this.playType=0,this.currentMotion=null,this.loop=!0}return i(e,t),e.prototype.startMotionGroup=function(t,e){return this.group=t,this.playType=e,this.currentMotion=t[0],this.startNextMotion()},e.prototype.startNextMotion=function(){switch(this.playType){case 0:this.currentMotion=this.group[this.group.indexOf(this.currentMotion)+1%this.group.length];break;case 1:this.currentMotion=this.group[Math.round(Math.random()*this.group.length)]}return this.startMotion(this.currentMotion,!1)},e.prototype.updateParam=function(t){return e.__super__.updateParam.call(this,t),null!=this.group&&this.isFinished()&&this.loop?this.startNextMotion():void 0},e}(MotionQueueManager),window.gs.Live2DMotionManager=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;window.L2DEyeBlink&&(L2DEyeBlink.prototype.enabled=!0),t=function(t){function i(t){i.__super__.constructor.call(this,t),this.useRenderTexture=!0,this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.motionManager=new gs.Live2DMotionManager,this.expressionManager=new MotionQueueManager,this.eyeBlink=new L2DEyeBlink,this.model=null,this.currentMotion=null,this.loopMotion=!0,this.talking=!1,this.talkingVolume=0,this.lipSyncSensitivity=1,this.breathIntensity=1,this.idleIntensity=1,this.opacity=255,this.x=0,this.y=0,this.zoomX=1,this.zoomY=1,this.angle=0,this.blendingMode=0,this.transform4=mat4.create(),this.viewportTransform4=mat4.create(),this.position3=vec3.create(),this.proj=mat4.create()}return e(i,t),Object.defineProperty(i.prototype,"width",{get:function(){var t,e,i;return e=1,(null!=(t=this.model)?t.live2DModel:void 0)&&(i=Graphics.height/this.model.live2DModel.getCanvasHeight(),e=this.model.live2DModel.getCanvasWidth()*i*this.zoomX),e}}),Object.defineProperty(i.prototype,"height",{get:function(){var t,e,i;return e=1,(null!=(t=this.model)?t.live2DModel:void 0)&&(i=Graphics.height/this.model.live2DModel.getCanvasHeight(),e=this.model.live2DModel.getCanvasHeight()*i*this.zoomY),e}}),Object.defineProperty(i.prototype,"talking",{get:function(){return this.talking_},set:function(t){var e;return t!==this.talking_?(this.talking_=t,null!=(e=this.model)?e.live2DModel.setParamFloat("PARAM_MOUTH_OPEN_Y",0):void 0):void 0}}),i.fromDataBundle=function(t,e){var i;return i=null,gs.ObjectCodec.decodeProperties(t,e),i=new gs.Live2DObject,Object.mixin(i,t),i},i.toDataBundle=function(t,e){var i;return i=gs.ObjectCodec.encodeProperties(t,e,["motionManager","expressionManager"])},i.prototype.playMotionGroup=function(t,e){var i;return i=this.model.motionsByGroup[t],null!=i?this.motionManager.startMotionGroup(i,e||0):void 0},i.prototype.playMotion=function(t,e){var i,r;return i=null!=(r=this.model.motions[t])?r:this.model.motions[Object.keys(this.model.motions).first()],null!=i?(i.setFadeIn(e),this.motionManager.startMotionGroup([i],gs.Live2DMotionPlayTypes.ORDERED)):void 0},i.prototype.setPose=function(t){var e,i,r,o,s,n,a;for(this.model.pose.lastModel!==this.model.live2DModel&&(this.model.pose.initParam(this.model.live2DModel),this.model.pose.lastModel=this.model.live2DModel),n=this.model.pose.partsGroups,a=[],i=0,r=n.length;r>i;i++)s=n[i],a.push(function(){var i,r,n;for(n=[],e=i=0,r=s.length;r>i;e=++i)o=s[e],e===t?(this.model.live2DModel.setParamFloat(o.paramIndex,1),n.push(this.model.live2DModel.setPartsOpacity(o.partsIndex,1))):(this.model.live2DModel.setParamFloat(o.paramIndex,0),n.push(this.model.live2DModel.setPartsOpacity(o.partsIndex,0)));return n}.call(this));return a},i.prototype.setExpression=function(t,e){var i,r;return i=null!=(r=this.model.expressions[t])?r:this.model.expressions[Object.keys(this.model.expressions).first()],null!=i?(i.setFadeIn(null!=e?e:0),this.expressionManager.startMotion(i,!1)):void 0},i.prototype.setParameter=function(t,e){return this.model.live2DModel.setParamFloat(t,e)},i.prototype.getParameter=function(t){return this.model.live2DModel.getParamFloat(t)},i.prototype.update=function(){var t,e;if(null!=(t=this.model)?t.live2DModel:void 0)return this.motionManager.loop=this.loopMotion,this.motionManager.updateParam(this.model.live2DModel),this.expressionManager.isFinished()||this.expressionManager.updateParam(this.model.live2DModel),this.model.live2DModel.saveParam(),e=Date.now()/1e3*2*Math.PI,this.model.live2DModel.addToParamFloat("PARAM_ANGLE_X",Number(15*Math.sin(e/6.5345))*this.idleIntensity,.5),this.model.live2DModel.addToParamFloat("PARAM_ANGLE_Y",Number(8*Math.sin(e/3.5345))*this.idleIntensity,.5),this.model.live2DModel.addToParamFloat("PARAM_ANGLE_Z",Number(10*Math.sin(e/5.5345))*this.idleIntensity,.5),this.model.live2DModel.addToParamFloat("PARAM_BODY_ANGLE_X",Number(4*Math.sin(e/15.5345))*this.idleIntensity,.5),this.breathIntensity>0&&this.model.live2DModel.setParamFloat("PARAM_BREATH",Number(.5+.5*Math.sin(e/3.2345))*this.breathIntensity,1),this.talking&&this.model.live2DModel.setParamFloat("PARAM_MOUTH_OPEN_Y",this.talkingVolume*this.lipSyncSensitivity),null!=this.model.pose&&this.model.pose.updateParam(this.model.live2DModel),this.eyeBlink.enabled&&this.eyeBlink.updateParam(this.model.live2DModel),this.model.physics?this.model.physics.updateParam(this.model.live2DModel):void 0},i.prototype.draw_=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E;if(this.model&&this.model.live2DModel){for(this.update(),u=this.model.live2DModel,d=this.model.textures,s=n=0,a=d.length;a>n;s=++n)g=d[s],u.setTexture(s,g.textureId);return mat4.identity(this.transform4),m=Graphics.height/u.getCanvasHeight(),l=Graphics.width,h=Graphics.height,mat4.identity(this.proj),mat4.ortho(this.proj,0,l,h,0,-.5,.5),S=this.y,x=u.getCanvasWidth()*m,o=u.getCanvasHeight()*m,v=this.x,T=this.zoomX,E=this.zoomY,this.position3[0]=v-x*(T-1)*this.anchor.x,this.position3[1]=S-o*(E-1)*this.anchor.y,mat4.translate(this.transform4,this.transform4,this.position3),0!==this.angle&&(this.position3[0]=x*T*this.anchor.x,this.position3[1]=o*E*this.anchor.y,mat4.translate(this.transform4,this.transform4,this.position3),mat4.rotateZ(this.transform4,this.transform4,Math.degreesToRadians(this.angle)),this.position3[0]=-this.position3[0],this.position3[1]=-this.position3[1],mat4.translate(this.transform4,this.transform4,this.position3)),this.position3[0]=Graphics.height/u.getCanvasHeight()*T,this.position3[1]=Graphics.height/u.getCanvasHeight()*E,mat4.scale(this.transform4,this.transform4,this.position3),mat4.identity(this.viewportTransform4),this.useRenderTexture?(this.viewportTransform4[0]=this.viewport.transform[0],this.viewportTransform4[3]=this.viewport.transform[1],this.viewportTransform4[4]=this.viewport.transform[2],this.viewportTransform4[5]=-this.viewport.transform[3],this.viewportTransform4[12]=this.viewport.transform[4],this.viewportTransform4[13]=-this.viewport.transform[5]+o):(this.viewportTransform4[0]=this.viewport.transform[0],this.viewportTransform4[3]=this.viewport.transform[1],this.viewportTransform4[4]=this.viewport.transform[2],this.viewportTransform4[5]=this.viewport.transform[3],this.viewportTransform4[12]=this.viewport.transform[4],this.viewportTransform4[13]=this.viewport.transform[5]),mat4.multiply(this.transform4,this.viewportTransform4,this.transform4),mat4.multiply(this.transform4,this.proj,this.transform4),u.setMatrix(this.transform4),this.useRenderTexture?($gl.cullFace($gl.FRONT),Graphics.frameBuffer.setTexture(Graphics.offscreenTexture),$gl.viewport(0,0,Graphics.width,Graphics.height),$gl.scissor(0,0,Graphics.width,Graphics.height),c=Graphics.renderer.projectionMatrix,$gl.clearColor(0,0,0,0),$gl.clear($gl.COLOR_BUFFER_BIT|$gl.DEPTH_BUFFER_BIT),$gl.clearColor(0,0,0,1),u.update(),u.draw(),$gl.activeTexture($gl.TEXTURE0,0),v=0,S=0,y=Graphics.offscreenTexture.width,r=Graphics.offscreenTexture.height,Graphics.renderer.vertexBuffer.bind(),Graphics.renderer.indexBuffer.bind(),Graphics.renderer.currentEffect=null,null!=(p=Graphics.renderer.texture)&&p.unbind(),Graphics.renderer.texture=null,Graphics.frameBuffer.bind(),Graphics.frameBuffer.setTexture(Graphics.screenTexture),$gl.viewport(0,0,Graphics.width,Graphics.height),$gl.scissor(0,0,Graphics.width,Graphics.height),Graphics.renderer.projectionMatrix=c,Graphics.renderer.setTexture(Graphics.offscreenTexture),Graphics.renderer.setSourceRectangle(v,S,y,r),Graphics.renderer.transform=this.transform,mat2d.identity(this.transform),this.position[0]=0,this.position[1]=0,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=y,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position),Graphics.renderer.opacity=this.opacity,Graphics.renderer.blendType=0,e=Graphics.renderer.color,w=Graphics.renderer.tone,i=Graphics.renderer.effects,Graphics.renderer.color=this.color,Graphics.renderer.tone=this.tone,Graphics.renderer.mask=this.mask,Graphics.renderer.effects=this.effects,Graphics.renderer.projectionMatrix=c,$gl.blendFunc($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA),this.effects.pixelate.enabled&&null!==this.effects.pixelate.textureFilter&&Graphics.offscreenTexture.setFilter(this.effects.pixelate.textureFilter,this.effects.pixelate.mipmap),$gl.cullFace($gl.BACK),t=Graphics.renderer.blendType,Graphics.renderer.blendType=this.blendingMode,Graphics.renderer.drawTransform(),Graphics.renderer.render(),Graphics.renderer.setTexture(null),Graphics.renderer.blendType=t,Graphics.renderer.tone=w,Graphics.renderer.color=e,Graphics.renderer.mask=null,Graphics.renderer.effects=i,$gl.enable($gl.SCISSOR_TEST)):(u.update(),u.draw(),$gl.activeTexture($gl.TEXTURE0),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.activeTexture($gl.TEXTURE1),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.activeTexture($gl.TEXTURE2),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.activeTexture($gl.TEXTURE0)),Graphics.renderer.setTexture(null),Graphics.renderer.vertexBuffer.bind(),Graphics.renderer.indexBuffer.bind(),Graphics.renderer.currentEffect=null,null!=(f=Graphics.renderer.texture)&&f.unbind(),Graphics.renderer.texture=null,this.model.live2DModel.loadParam(),Graphics.frameBuffer.bind(),Graphics.frameBuffer.setTexture(Graphics.screenTexture),$gl.disable($gl.CULL_FACE),$gl.enable($gl.SCISSOR_TEST),$gl.scissor(0,0,Graphics.width,Graphics.height)}},i.prototype.draw=function(){return null!=this.model?Graphics.renderer.drawLive2D(this):void 0},i}(GraphicObject),window.gs.Live2DObject=t}.call(this),AutotileExpander.substitutableFrames=[34,36,38,40,16,20,24,28,46],AutotileExpander.tileSize=32,AutotileExpander.tilesetConfig=null,AutotileExpander.expand=function(t){var e=AutotileExpander.tileSize,i=AutotileExpander.tileSize;if(t.height>4*AutotileExpander.tileSize){if(t.width<=8*AutotileExpander.tileSize){for(var r=new Bitmap(8*i*4,8*e),o=0;4>o;o++)r.blt(8*i*o,0,t,new Rect(0,0,t.width,t.height));t=r}return t}var s=AutotileExpander.tilesetConfig.autoTiles,n=Math.floor(s.width/(8*i)),a=3*i,h={width:t.width,height:t.height},l=Math.floor(h.width>a?h.width/(3*i):h.width/(3*i)),u=new Bitmap(8*i*n,8*e),c=u.context,d=t;window.tw=i,window.th=e;for(var o=0;n>o;o++)GSAutotileExpanderDrawImage.originX=8*o*i,GSAutotileExpanderDrawImage.sourceOriginX=3*Math.min(o,l-1)*i,GSAutotileExpanderDrawImage.originY=0,GSAutotileExpanderDrawImage.sourceOriginY=0,GSAutotileExpanderDrawBackground(0,0,c,d),GSAutotileExpanderDrawBackground(1*i,0*e,c,d),GSAutotileExpanderDrawLeftTopCorner(1*i,0*e,c,d),GSAutotileExpanderDrawBackground(2*i,0*e,c,d),GSAutotileExpanderDrawRightTopCorner(2*i+Math.floor(i/2),0*e,c,d),GSAutotileExpanderDrawBackground(3*i,0*e,c,d),GSAutotileExpanderDrawLeftTopCorner(3*i,0*e,c,d),GSAutotileExpanderDrawRightTopCorner(3*i+Math.floor(i/2),0*e,c,d),GSAutotileExpanderDrawBackground(4*i,0*e,c,d),GSAutotileExpanderDrawRightBottomCorner(4*i+Math.floor(i/2),0*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(5*i,0*e,c,d),GSAutotileExpanderDrawLeftTopCorner(5*i,0*e,c,d),GSAutotileExpanderDrawRightBottomCorner(5*i+Math.floor(i/2),0*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(6*i,0*e,c,d),GSAutotileExpanderDrawRightTopCorner(6*i+Math.floor(i/2),0*e,c,d),GSAutotileExpanderDrawRightBottomCorner(6*i+Math.floor(i/2),0*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(7*i,0*e,c,d),GSAutotileExpanderDrawLeftTopCorner(7*i,0*e,c,d),GSAutotileExpanderDrawRightTopCorner(7*i+Math.floor(i/2),0*e,c,d),GSAutotileExpanderDrawRightBottomCorner(7*i+Math.floor(i/2),0*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(0*i,1*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(0*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(1*i,1*e,c,d),GSAutotileExpanderDrawLeftTopCorner(1*i,1*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(1*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(2*i,1*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(2*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightTopCorner(2*i+Math.floor(i/2),1*e,c,d),GSAutotileExpanderDrawBackground(3*i,1*e,c,d),GSAutotileExpanderDrawLeftTopCorner(3*i,1*e,c,d),GSAutotileExpanderDrawRightTopCorner(3*i+Math.floor(i/2),1*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(3*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(4*i,1*e,c,d),GSAutotileExpanderDrawRightBottomCorner(4*i+Math.floor(i/2),1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftBottomCorner(4*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(5*i,1*e,c,d),GSAutotileExpanderDrawLeftTopCorner(5*i,1*e,c,d),GSAutotileExpanderDrawRightBottomCorner(5*i+Math.floor(i/2),1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftBottomCorner(5*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawBackground(6*i,1*e,c,d),GSAutotileExpanderDrawRightTopCorner(6*i+Math.floor(i/2),1*e,c,d),GSAutotileExpanderDrawRightBottomCorner(6*i+Math.floor(i/2),1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftBottomCorner(6*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftTopCorner(7*i,1*e,c,d),GSAutotileExpanderDrawRightTopCorner(7*i+Math.floor(i/2),1*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(7*i,1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightBottomCorner(7*i+Math.floor(i/2),1*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftSide(0*i,2*e,c,d),GSAutotileExpanderDrawLeftSide(1*i,2*e,c,d),GSAutotileExpanderDrawRightTopCorner(1*i+Math.floor(i/2),2*e,c,d),GSAutotileExpanderDrawLeftSide(2*i,2*e,c,d),GSAutotileExpanderDrawRightBottomCorner(2*i+Math.floor(i/2),2*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftSide(3*i,2*e,c,d),GSAutotileExpanderDrawRightTopCorner(3*i+Math.floor(i/2),2*e,c,d),GSAutotileExpanderDrawRightBottomCorner(3*i+Math.floor(i/2),2*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawUpSide(4*i,2*e,c,d),GSAutotileExpanderDrawUpSide(5*i,2*e,c,d),GSAutotileExpanderDrawRightBottomCorner(5*i+Math.floor(i/2),2*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawUpSide(6*i,2*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(6*i,2*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawUpSide(7*i,2*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(7*i,2*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightBottomCorner(7*i+Math.floor(i/2),2*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightSide(0*i,3*e,c,d),GSAutotileExpanderDrawRightSide(1*i,3*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(1*i,3*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightSide(2*i,3*e,c,d),GSAutotileExpanderDrawLeftTopCorner(2*i,3*e,c,d),GSAutotileExpanderDrawRightSide(3*i,3*e,c,d),GSAutotileExpanderDrawLeftTopCorner(3*i,3*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(3*i,3*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawDownSide(4*i,3*e,c,d),GSAutotileExpanderDrawDownSide(5*i,3*e,c,d),GSAutotileExpanderDrawLeftTopCorner(5*i,3*e,c,d),GSAutotileExpanderDrawDownSide(6*i,3*e,c,d),GSAutotileExpanderDrawRightTopCorner(6*i+Math.floor(i/2),3*e,c,d),GSAutotileExpanderDrawDownSide(7*i,3*e,c,d),GSAutotileExpanderDrawLeftTopCorner(7*i,3*e,c,d),GSAutotileExpanderDrawRightTopCorner(7*i+Math.floor(i/2),3*e,c,d),GSAutotileExpanderDrawLeftSideSmall(0*i,4*e,c,d),GSAutotileExpanderDrawRightSideSmall(0*i+Math.floor(i/2),4*e,c,d),GSAutotileExpanderDrawUpSideSmall(1*i,4*e,c,d),GSAutotileExpanderDrawDownSideSmall(1*i,4*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftTop(2*i,4*e,c,d),GSAutotileExpanderDrawLeftTop(3*i,4*e,c,d),GSAutotileExpanderDrawRightBottomCorner(3*i+Math.floor(i/2),4*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightTop(4*i,4*e,c,d),GSAutotileExpanderDrawRightTop(5*i,4*e,c,d),GSAutotileExpanderDrawLeftBottomCorner(5*i,4*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightBottom(6*i,4*e,c,d),GSAutotileExpanderDrawRightBottom(7*i,4*e,c,d),GSAutotileExpanderDrawLeftTopCorner(7*i,4*e,c,d),GSAutotileExpanderDrawLeftBottom(0*i,5*e,c,d),GSAutotileExpanderDrawLeftBottom(1*i,5*e,c,d),GSAutotileExpanderDrawRightTopCorner(1*i+Math.floor(i/2),5*e,c,d),GSAutotileExpanderDrawLeftSideTop(2*i,5*e,c,d),GSAutotileExpanderDrawRightSideTop(2*i+Math.floor(i/2),5*e,c,d),GSAutotileExpanderDrawUpSideLeft(3*i,5*e,c,d),GSAutotileExpanderDrawDownSideLeft(3*i,5*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftSideBottom(4*i,5*e,c,d),GSAutotileExpanderDrawRightSideBottom(4*i+Math.floor(i/2),5*e,c,d),GSAutotileExpanderDrawUpSideRight(5*i,5*e,c,d),GSAutotileExpanderDrawDownSideRight(5*i,5*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftTopSmall(6*i,5*e,c,d),GSAutotileExpanderDrawLeftBottomSmall(6*i,5*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightTopSmall(6*i+Math.floor(i/2),5*e,c,d),GSAutotileExpanderDrawRightBottomSmall(6*i+Math.floor(i/2),5*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawLeftTopSmall(7*i,5*e,c,d),GSAutotileExpanderDrawLeftBottomSmall(7*i,5*e+Math.floor(e/2),c,d),GSAutotileExpanderDrawRightTopSmall(7*i+Math.floor(i/2),5*e,c,d),GSAutotileExpanderDrawRightBottomSmall(7*i+Math.floor(i/2),5*e+Math.floor(e/2),c,d);return u},gs.AutotileExpander=AutotileExpander,function(){var t,e,i,r,o,s=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;i=function(t){function e(t,i){e.__super__.constructor.call(this,t),this.bitmap=null,this.x=0,this.y=0,this.z=-50,this.srcRect=new Rect(0,0,0,0),this.visible=!1,this.tileSize=i,this.contextInfo=Graphics.renderer.contextInfo,this.context=Graphics.renderer.context}return s(e,t),e.prototype.draw=function(){return null!=this.bitmap?(null!=this.contextInfo&&0!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="source-over",this.contextInfo.globalCompositeOperation=0),null!=this.contextInfo&&1!==this.contextInfo.globalAlpha&&(this.context.globalAlpha=1,this.contextInfo.globalAlpha=1),Graphics.renderer.drawBitmapSimple(this.bitmap,this.x-this.ox,this.y-this.oy,this.tileSize,this.tileSize,this.srcRect.x,this.srcRect.y,this.tileSize,this.tileSize)):void 0},e}(GraphicObject),t=function(t){function e(t){e.__super__.constructor.call(this,t),this.autotiles=new Array(7),this.expandedAutotiles=new Array(7),this.tileset=null,this.priorities=null,this.passages=null,this.mapData=null,this.tileSize=32,this.sprites=[],this.autotileOffset=0,this.autotileOffset2=0,this.depth=3,this.cache=[]}return s(e,t),e.prototype.expandAutotiles=function(){var t,e,i,r;for(AutotileExpander.tileSize=this.tileSize,r=[],t=e=0,i=this.autotiles.length;i>=0?i>e:e>i;t=i>=0?++e:--e)r.push(this.autotiles[t]?this.expandedAutotiles[t]=AutotileExpander.expand(this.autotiles[t]):void 0);return r},e.prototype.clearCache=function(t){var e,i,r;for(e=i=0,r=t.length;r>=0?r>i:i>r;e=r>=0?++i:--i)this.cache[t[e]]=null;return null},e.prototype.draw=function(){},e.prototype.update=function(){var t,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E,b,R,_,D,A,C,M,I,P,G,$,O,B,z,k,F,L,N;if(e.__super__.update.call(this),this.visible&&null!=this.tileset&&this.tileset.loaded&&null!=this.mapData){for(D=Graphics.renderer,x=this.width*this.tileSize,y=this.height*this.tileSize,m=Math.floor(this.ox+this.viewport.ox),g=Math.floor(this.oy+this.viewport.oy),h=Math.ceil(this.tileset.width/this.tileSize),n=0,a=0,O=Math.floor(Graphics.width/this.tileSize)+2,B=Math.floor(Graphics.height/this.tileSize)+2,M=0,I=0,A=Math.floor(m/this.tileSize),C=Math.floor(g/this.tileSize),P=null,w=0,r=0,o=480===Graphics.height?256:128,G=0,z=0,k=0,0===Math.floor(Graphics.frameCount%16)&&(this.autotileOffset=(this.autotileOffset+1)%4,this.autotileOffset2=(this.autotileOffset2+1)%3),F=c=v=A,S=O+A;S>=v?S>c:c>S;F=S>=v?++c:--c)for(z=0>F?this.width+F:F>=this.width?F-this.width:F,L=d=T=C,E=B+C;E>=T?E>d:d>E;L=E>=T?++d:--d)for(k=0>L?this.height+L:L>=this.height?L-this.height:L,N=p=0,b=this.depth;b>=0?b>p:p>b;N=b>=0?++p:--p)if(u=k*this.width+z+this.width*this.height*N,s=this.cache[u],null!=s)s.visible&&(P=this.sprites[G],null==P&&(P=new i(this.viewport,this.tileSize),this.sprites[G]=P),G++,P.visible=!0,P.z=s.z,P.bitmap=s.bitmap,P.x=F*this.tileSize,P.y=L*this.tileSize,P.opacity=255,P.srcRect.x=s.frameX,P.srcRect.y=s.frameY,P.srcRect.width=this.tileSize,P.srcRect.height=this.tileSize,s.autotile&&null!=P.bitmap&&P.bitmap.width>o&&(r=P.bitmap.width>3*o?this.autotileOffset*o:this.autotileOffset2*o,P.srcRect.x+=r));else{if($=this.mapData[u],0>=$){this.cache[u]={visible:!1};continue}P=this.sprites[G],null==P&&(P=new i(this.viewport,this.tileSize),this.sprites[G]=P),G++,t=Math.floor($/64),P.visible=!0,w=this.priorities[$]||0,P.z=32+32*w+N,7>=t?($-=64*t,P.bitmap=this.expandedAutotiles[t],r=0,null!=P.bitmap&&P.bitmap.width>o&&(r=P.bitmap.width>3*o?this.autotileOffset*o:this.autotileOffset2*o),n=$%h*this.tileSize,a=Math.floor($/h)*this.tileSize):(P.bitmap=this.tileset,n=($-512)%h*this.tileSize,a=Math.floor(($-512)/h)*this.tileSize),P.x=F*this.tileSize,P.y=L*this.tileSize,P.srcRect.x=n,P.srcRect.y=a,P.srcRect.width=this.tileSize,P.srcRect.height=this.tileSize,this.cache[u]={x:P.x,y:P.y,frameX:n,frameY:a,bitmap:P.bitmap,z:P.z,visible:!0,autotile:7>=t}}for(l=f=R=G,_=this.sprites.length;_>=R?_>f:f>_;l=_>=R?++f:--f)this.sprites[l].visible=!1;return null}},e.prototype.dispose=function(){var t,i,r,o,s;for(e.__super__.dispose.apply(this,arguments),r=this.sprites,o=[],t=0,i=r.length;i>t;t++)s=r[t],o.push(s.dispose());return o},e.prototype.hide=function(t){var i,r,o,s;for(e.__super__.hide.call(this,t),s=[],i=r=0,o=this.sprites.length;o>=0?o>r:r>o;i=o>=0?++r:--r)s.push(this.sprites[i].visible=!1);return s},e.prototype.show=function(t){var e,i,r,o,s;if(t!==this.visible&&null==this.hideCounter){if(t){for(e=i=0,o=this.sprites.length;o>=0?o>i:i>o;e=o>=0?++i:--i)this.sprites[e].initialize();this.visible=!0}else{for(e=r=0,s=this.sprites.length;s>=0?s>r:r>s;e=s>=0?++r:--r)this.sprites[e].dispose();this.visible=!1}return null}},e}(GraphicObject),o=function(){function t(t){t=null!=t?t:32,this.useOriginalTileset=!0,this.invisibleTileId=32767,this.expandedSize={width:2048,height:2048},this.regularTiles=new gs.Rect(0,0,8*t,64*t),this.specialTiles=new gs.Rect(8*t,0,8*t*4,6*t*10),this.specialTileSize={width:8*t,height:6*t},this.animationFrames=4}return t}(),gs.TilesetConfiguration=o,r=function(t){function i(t){i.__super__.constructor.call(this,t),this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.autotiles=new Array(7),this.expandedAutotiles=new Array(7),this.tileset=null,this.tilesets=[],this.expandedTilesets=[],this.priorities=null,this.mapData=null,this.tileSize=32,this.autotileOffset=0,this.animationSpeed=16,this.width=50,this.height=50,this.depth=3,this.cache=[],this.layers=null,this.tilesetConfig=new gs.TilesetConfiguration(this.tileSize)}return s(i,t),i.prototype.dispose=function(){var t,e,i,r,o,s,n,a,h;for(this.tilesetConfig.useOriginalTileset||null!=(n=this.expandedTileset)&&n.dispose(),a=this.expandedAutotiles,e=0,o=a.length;o>e;e++)t=a[e],null!=t&&t.dispose();for(h=this.layers,i=0,s=h.length;s>i;i++)r=h[i],null!=r&&r.dispose();return null},i.prototype.setup=function(){return this.expandAutotiles()},i.prototype.expandAutotiles=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d;for(AutotileExpander.tileSize=this.tileSize,AutotileExpander.tilesetConfig=this.tilesetConfig,i=this.tilesetConfig.expandedSize.height,d=this.tilesetConfig.expandedSize.width,u=this.tilesetConfig.regularTiles,t=this.tilesetConfig.specialTiles,this.tileset?this.tilesets[0]=this.tileset:this.tileset=this.tilesets[0],this.expandedTilesets=new Array(this.tilesets.length),h=this.tilesets,r=s=0,a=h.length;a>s;r=++s)if(c=h[r],this.tilesetConfig.useOriginalTileset)this.expandedTilesets[r]=c;else for(this.expandedTilesets[r]=new Bitmap(d,i),this.expandedTilesets[r].blt(u.x,u.y,c,new Rect(0,0,c.width,c.height)),o=n=0,l=this.autotiles.length;l>=0?l>n:n>l;o=l>=0?++n:--n)null!=this.autotiles[o]&&(e=AutotileExpander.expand(this.autotiles[o]),this.expandedTilesets[r].blt(t.x,t.y+6*this.tileSize*o,e,new Rect(0,0,e.width,e.height)));return this.calculateMapData(),this.splitMapData()},i.prototype.calculateMapData=function(){},i.prototype.convertTileId=function(t){return t},i.prototype.splitMapData=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d;for(this.upperMapData=[],this.lowerMapData=[],t=8,e=r=0,n=this.depth;n>=0?n>r:r>n;e=n>=0?++r:--r)this.upperMapData[e]=[],
10 - this.lowerMapData[e]=[];for(h=[],u=o=0,a=this.width;a>=0?a>o:o>a;u=a>=0?++o:--o)h.push(function(){var e,r,o;for(o=[],c=e=0,r=this.height;r>=0?r>e:e>r;c=r>=0?++e:--e)o.push(function(){var e,r,o;for(o=[],d=e=0,r=this.depth;r>=0?r>e:e>r;d=r>=0?++e:--e)i=c*this.width+u+this.width*this.height*d,l=this.mapData[i],s=this.convertTileId(l,i,t,u,c,d),(this.priorities[l]||0)>0?(this.upperMapData[d][c*this.width+u]=s,o.push(this.lowerMapData[d][c*this.width+u]=this.tilesetConfig.invisibleTileId)):(this.upperMapData[d][c*this.width+u]=this.tilesetConfig.invisibleTileId,o.push(this.lowerMapData[d][c*this.width+u]=s));return o}.call(this));return o}.call(this));return h},i.prototype.shrinkLayers=function(t){var e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y;for(o=0,s=1,p=[];s<t.length;){for(a=!0,w=i=0,l=this.width;l>=0?l>i:i>l;w=l>=0?++i:--i)for(y=r=0,u=this.height;u>=0?u>r:r>u;y=u>=0?++r:--r)if(e=y*this.width+w,m=t[o][e],g=t[s][e],m!==this.tilesetConfig.invisibleTileId&&g!==this.tilesetConfig.invisibleTileId){a=!1;break}if(a){for(w=n=0,c=this.width;c>=0?c>n:n>c;w=c>=0?++n:--n)for(y=h=0,d=this.height;d>=0?d>h:h>d;y=d>=0?++h:--h)e=y*this.width+w,f=t[o][e],f===this.tilesetConfig.invisibleTileId&&(t[o][e]=t[s][e]);p.push(t.splice(s,1))}else o++,p.push(s++)}return p},i.prototype.clearCache=function(){},i.prototype.createLayers=function(){var t,i,r,o,s,n,a,h,l;for(this.layers=[],t=i=0,s=this.lowerMapData.length;s>=0?s>i:i>s;t=s>=0?++i:--i)o=new e(this.viewport,this,this.width,this.height,this.lowerMapData[t],this.tileSize,null!=(n=this.expandedTilesets[t])?n:this.expandedTilesets[0],this.animationSpeed),o.z=0+t,this.layers.push(o);for(l=[],t=r=0,a=this.upperMapData.length;a>=0?a>r:r>a;t=a>=0?++r:--r)o=new e(this.viewport,this,this.width,this.height,this.upperMapData[t],this.tileSize,null!=(h=this.expandedTilesets[t])?h:this.expandedTilesets[0],this.animationSpeed),o.z=64+t,l.push(this.layers.push(o));return l},i.prototype.draw=function(){},i.prototype.update=function(){var t,e,i,r;if(this.visible&&null!=this.tileset&&this.tileset.loaded&&null!=this.mapData){for(null==this.layers&&this.createLayers(),r=[],t=e=0,i=this.layers.length;i>=0?i>e:e>i;t=i>=0?++e:--e)this.layers[t].ox=this.ox,this.layers[t].oy=this.oy,this.layers[t].tone=this.tone,this.layers[t].color=this.color,r.push(this.layers[t].mask=this.mask);return r}},i.prototype.show=function(){},i.prototype.hide=function(){},i}(GraphicObject),e=function(t){function e(t,i,r,o,s,n,a){var h,l,u,c,d,p,f,m,g,w,y;for(e.__super__.constructor.call(this,t),this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.tilemap=i,this.angle=0,this.zoomX=1,this.zoomY=1,this.tileSize=n,this.tilesetBitmap=a,this.dataBitmap=new Bitmap(r,o),this.autotileOffset=0,this.animationSpeed=16,c=this.tilemap.tilesetConfig.invisibleTileId,u=this.dataBitmap.getImageData(0,0,r,o),h=u.data,l=Math.ceil(this.tilesetBitmap.width/this.tileSize),w=d=0,f=r;f>=0?f>d:d>f;w=f>=0?++d:--d)for(y=p=0,m=o;m>=0?m>p:p>m;y=m>=0?++p:--p)g=s[y*r+w],h[4*(y*r+w)]=g===c?255:g%l,h[4*(y*r+w)+1]=g===c?255:Math.floor(g/l),h[4*(y*r+w)+3]=255;this.dataBitmap.setImageData(u,0,0)}return s(e,t),e.objectCodecBlackList=["onIndexChange"],e.prototype.dispose=function(){var t;return null!=(t=this.dataBitmap)?t.dispose():void 0},e.prototype.draw=function(){var t,i,r,o;return e.__super__.draw.call(this),r=Graphics.renderer,i=r.color,o=r.tone,r.color=this.color,r.tone=this.tone,r.mask=this.mask,this.updateTransform(0,0,Graphics.width,Graphics.height),r.transform=this.transform,0===Math.floor(Graphics.frameCount%this.animationSpeed)&&(t=this.tilemap.tilesetConfig.animationFrames,this.autotileOffset=(this.autotileOffset+1)%t),r.drawTiles(this.ox+this.viewport.ox,this.oy+this.viewport.oy,this.dataBitmap,this.tilesetBitmap,this.autotileOffset*this.tilemap.tilesetConfig.specialTileSize.width,this.tileSize,this.tilemap.tilesetConfig),r.tone=o,r.color=i,r.mask=null},e.prototype.update=function(){},e}(GraphicObject),window.Tilemap=r,gs.Tilemap=r,gs.TilemapLayer=e}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t){i.__super__.constructor.call(this,t),this.srcRect=new Rect(0,0,64,64),this.firstPartSize=16,this.middlePartSize=1,this.lastPartSize=16,this.x=0,this.y=0,this.width=100,this.height=100,this.skin=null,this.opacity=255,this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.orientation=1,this.clipRect=null,this.zoomX=1,this.zoomY=1,this.angle=0}return e(i,t),i.objectCodecBlackList=["onIndexChange"],i.prototype.dispose=function(){return i.__super__.dispose.call(this)},i.prototype.update=function(){return i.__super__.update.call(this)},i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle&&(this.position[0]=this.x-this.ox+this.width*this.anchor.x,this.position[1]=this.y-this.oy+this.height*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,this.angle),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-this.width*(this.zoomX-1)*this.anchor.x,this.position[1]=e-this.height*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._drawParts=function(){var t,e,i,r,o,s,n,a,h;if(null!=this.skin&&this.skin.loaded)return this.width=Math.max(this.firstPartSize+this.middlePartSize+this.lastPartSize,this.width),this.height=Math.max(this.firstPartSize+this.middlePartSize+this.lastPartSize,this.height),a=~~(this.x-this.ox),h=~~(this.y-this.oy),o=Graphics.renderer,o.reset(),e=o.color,s=o.tone,t=o.blendType,i=o.effects,o.tone=this.tone,o.color=this.color,o.blendType=this.blendingMode,o.effects=this.effects,o.opacity=this.opacity,0===this.orientation?(n=this.width-this.firstPartSize-this.lastPartSize,this.updateTransform(a+this.firstPartSize,h,n,this.height),o.transform=this.transform,o.setBitmap(this.skin),o.setSourceRectangle(this.firstPartSize,0,this.middlePartSize,this.skin.height),o.drawTransform(),this.updateTransform(a,h,this.firstPartSize,this.height),o.setSourceRectangle(0,0,this.firstPartSize,this.skin.height),o.drawTransform(),this.updateTransform(a+this.firstPartSize+n,h,this.lastPartSize,this.height),o.setSourceRectangle(this.firstPartSize+this.middlePartSize,0,this.lastPartSize,this.skin.height),o.drawTransform()):(r=this.height-this.firstPartSize-this.lastPartSize,this.updateTransform(a,h+this.firstPartSize,this.width,r),o.transform=this.transform,o.setBitmap(this.skin),o.setSourceRectangle(0,this.firstPartSize,this.skin.width,this.middlePartSize),o.drawTransform(),this.updateTransform(a,h,this.width,this.firstPartSize),o.setSourceRectangle(0,0,this.skin.width,this.firstPartSize),o.drawTransform(),this.updateTransform(a,h+this.firstPartSize+r,this.width,this.lastPartSize),o.setSourceRectangle(0,this.firstPartSize+this.middlePartSize,this.skin.width,this.lastPartSize),o.drawTransform()),o.tone=s,o.color=e,o.blendType=t,o.effects=i,o.opacity=255,null},i.prototype.draw=function(){var t;return t=Graphics.renderer,t.blendType=0,t.reset(),t.clipRect(null!=this.clipRect?this.clipRect:Graphics.viewport.rect),this.opacity>0?this._drawParts():void 0},i}(GraphicObject),window.gs.ThreePartImage=t}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=function(t){function i(t){i.__super__.constructor.call(this,t),this.srcRect=new Rect(0,0,64,64),this.cornerSize=16,this.thickness=16,this.x=0,this.y=0,this.width=100,this.height=100,this.skin=null,this.opacity=255,this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.zoomX=1,this.zoomY=1,this.useTiling=!1,this.angle=0,this.tmpRect=new Rect(0,0,0,0),this.scale=vec2.create(),this.scaleTransform=mat2d.create()}return e(i,t),i.objectCodecBlackList=["onIndexChange"],i.prototype.dispose=function(){return i.__super__.dispose.call(this)},i.prototype.update=function(){return i.__super__.update.call(this)},i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle&&(this.position[0]=this.x-this.ox+this.width*this.anchor.x,this.position[1]=this.y-this.oy+this.height*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-this.width*(this.zoomX-1)*this.anchor.x,this.position[1]=e-this.height*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._drawFrame=function(){var t,e,i,r,o,s,n,a,h,l,u,c;if(null!=this.skin&&this.skin.loaded)return this.srcRect.width=this.skin.width,this.srcRect.height=this.skin.height,l=this.width*this.zoomX,n=this.height*this.zoomY,u=~~(this.x-this.ox),c=~~(this.y-this.oy),i=this.cornerSize*this.zoomX,r=this.cornerSize*this.zoomY,a=Graphics.renderer,e=a.color,h=a.tone,t=a.blendType,s=a.effects,a.reset(),a.tone=this.tone,a.color=this.color,a.blendType=this.blendingMode,a.effects=this.effects,a.opacity=this.opacity,a.clipRect(null!=this.clipRect?this.clipRect:Graphics.viewport.rect),o=2*this.cornerSize,this.updateTransform(u,c+r,this.thickness,this.height-o),a.transform=this.transform,a.setBitmap(this.skin),a.setSourceRectangle(this.srcRect.x,this.srcRect.y+this.cornerSize,this.thickness,this.srcRect.height-2*this.cornerSize),a.drawTransform(),this.updateTransform(u+i,c,this.width-o,this.thickness),a.setSourceRectangle(this.srcRect.x+this.cornerSize,this.srcRect.y,this.srcRect.width-2*this.cornerSize,this.thickness),a.drawTransform(),this.updateTransform(u+l-i,c+r,this.thickness,this.height-o),a.setSourceRectangle(this.srcRect.width-this.thickness,this.srcRect.y+this.cornerSize,this.thickness,this.srcRect.height-2*this.cornerSize),a.drawTransform(),this.updateTransform(u+i,c+n-r,this.width-o,this.thickness),a.setSourceRectangle(this.srcRect.x+this.cornerSize,this.srcRect.height-this.thickness,this.srcRect.width-2*this.cornerSize,this.thickness),a.drawTransform(),this.updateTransform(u,c,this.cornerSize,this.cornerSize),a.setSourceRectangle(this.srcRect.x,this.srcRect.y,this.cornerSize,this.cornerSize),a.drawTransform(),this.position[0]=(l-i)/i,this.position[1]=0,mat2d.translate(this.transform,this.transform,this.position),a.setSourceRectangle(this.srcRect.width-this.cornerSize,this.srcRect.y,this.cornerSize,this.cornerSize),a.drawTransform(),this.position[0]=0-this.position[0],this.position[1]=0+(n-r)/r-this.position[1],mat2d.translate(this.transform,this.transform,this.position),a.setSourceRectangle(this.srcRect.x,this.srcRect.height-this.cornerSize,this.cornerSize,this.cornerSize),a.drawTransform(),this.position[0]=0-this.position[0],this.position[1]=0+(n-r)/r-this.position[1],mat2d.translate(this.transform,this.transform,this.position),a.setSourceRectangle(this.srcRect.width-this.cornerSize,this.srcRect.height-this.cornerSize,this.cornerSize,this.cornerSize),a.drawTransform(),a.tone=h,a.color=e,a.blendType=t,a.effects=s,a.opacity=255,null},i.prototype.draw=function(){var t;return t=Graphics.renderer,t.blendType=0,t.reset(),this.opacity>0?this._drawFrame():void 0},i}(GraphicObject),window.gs.Frame=t}.call(this),function(){var t,e={}.hasOwnProperty,i=function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);return r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype,t};t=function(t){function e(t){e.__super__.constructor.call(this,t),this.x=0,this.y=0,this.cx=0,this.cy=0,this.width=100,this.height=100,this.windowSkin=null,this.contents=null,this.window=null,this.cursorRect=new Rect(0,0,0,0),this.active=!0,this.arrowsVisible=!0,this.pause=!1,this.padding=e.padding||12,this.opacity=255,this.backOpacity=192,this.contentsOpacity=255,this.openness=255,this.tone=new Tone(0,0,0,0),this.animationIncrement=.1,this.cursorOpacity=1,this.pauseArrowPattern=0,this.pauseAnimationCount=0,this.renderer=null,this.oldWindowSkin=null}return i(e,t),e.backRect=new Rect(0,0,64,64),e.backRect2=new Rect(0,64,64,64),e.frameRect=new Rect(64,0,64,64),e.frameThickness=16,e.framePadding=2,e.leftArrowRect=new Rect(e.frameRect.x+e.frameThickness,e.frameRect.y+24,16,16),e.topArrowRect=new Rect(e.frameRect.x+24,e.frameRect.y+e.frameThickness,16,16),e.rightArrowRect=new Rect(40+e.frameRect.x,e.frameRect.y+24,16,16),e.bottomArrowRect=new Rect(e.frameRect.x+24,40+e.frameRect.y,16,16),e.cornerSize=16,e.cursorRect=new Rect(64,64,32,32),e.cursorBorder=2,e.pauseRect=new Rect(96,64,32,32),e.padding=12,e.pauseIconSize=new Rect(0,0,16,16),e.textColorRect=new Rect(64,96,64,32),e.textColorSize=new Rect(0,0,8,8),e.prototype.dispose=function(){return e.__super__.dispose.call(this),null!=this.window&&this.window.dispose(),null!=this.contents?this.contents.dispose():void 0},e.prototype.update=function(){return e.__super__.update.call(this),this.active&&(this.cursorOpacity>=1&&(this.animationIncrement=-.025),this.cursorOpacity<=.5&&(this.animationIncrement=.025),this.cursorOpacity+=this.animationIncrement),this.pause&&(this.pauseAnimationCount++,this.pauseAnimationCount>15)?(this.pauseAnimationCount=0,this.pauseArrowPattern=(this.pauseArrowPattern+1)%4):void 0},e.prototype._createWindowBitmap=function(){},e.prototype._drawWindow=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g;if(null!=this.windowSkin&&this.windowSkin.loaded){for(this.oldWindowSkin=this.windowSkin,c=this.x,d=this.y,n=Graphics.renderer,r=n.ox,o=n.oy,n.ox=0,n.oy=0,n.reset(),h=new Rect(0,0,0,0),n.size.width=this.width-2*this.constructor.framePadding,n.size.height=this.height-2*this.constructor.framePadding,n.tone=this.tone,n.drawBitmapSimple(this.windowSkin,c+this.constructor.framePadding,d+this.constructor.framePadding,this.width-2*this.constructor.framePadding,this.height-2*this.constructor.framePadding,new Rect(this.constructor.backRect.x,this.constructor.backRect.y,this.constructor.backRect.width,this.constructor.backRect.height)),n.size.width=0,n.size.height=0,n.tone=Tone.NORMAL,n.clip=new Rect(c+this.constructor.framePadding,d+this.constructor.framePadding,this.width-2*this.constructor.framePadding,this.height-2*this.constructor.framePadding),n.drawTiledBitmap(this.windowSkin,c+this.constructor.framePadding,d+this.constructor.framePadding,n.clip.width,n.clip.height,this.constructor.backRect2.x,this.constructor.backRect2.y,this.constructor.backRect2.width,this.constructor.backRect2.height),n.clip=new Rect(0,0,Graphics.width,Graphics.height),n.opacity=this.opacity,n.context.globalAlpha=.00392156862745*this.opacity,e=this.height-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x,this.constructor.frameRect.y+this.constructor.cornerSize,this.constructor.frameThickness,this.constructor.frameRect.height-2*this.constructor.cornerSize),a=Math.ceil(e/h.height),i=p=0;a>=0?a>p:p>a;i=a>=0?++p:--p)i+1===a?(s=d+this.constructor.cornerSize+i*h.height,t=h.height-(s+h.height-(d+this.constructor.cornerSize+e)),n.drawBitmapSimple(this.windowSkin,c,s,h.width,t,h.x,h.y,h.width,t)):n.drawBitmapSimple(this.windowSkin,c,d+this.constructor.cornerSize+i*h.height,h.width,h.height,h.x,h.y,h.width,h.height);for(u=this.width-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x+this.constructor.cornerSize,this.constructor.frameRect.y,this.constructor.frameRect.width-2*this.constructor.cornerSize,this.constructor.frameThickness),a=Math.ceil(u/h.width),i=f=0;a>=0?a>f:f>a;i=a>=0?++f:--f)i+1===a?(s=c+this.constructor.cornerSize+i*h.width,l=h.width-(s+h.width-(c+this.constructor.cornerSize+u)),n.drawBitmapSimple(this.windowSkin,s,d,l,h.height,h.x,h.y,l,h.height)):n.drawBitmapSimple(this.windowSkin,c+this.constructor.cornerSize+i*h.width,d,h.width,h.height,h.x,h.y,h.width,h.height);for(e=this.height-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x+3*this.constructor.cornerSize,this.constructor.frameRect.y+this.constructor.cornerSize,this.constructor.frameThickness,this.constructor.frameRect.height-2*this.constructor.cornerSize),a=Math.ceil(e/h.height),i=m=0;a>=0?a>m:m>a;i=a>=0?++m:--m)i+1===a?(s=d+this.constructor.cornerSize+i*h.height,t=h.height-(s+h.height-(d+this.constructor.cornerSize+e)),n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,s,h.width,t,h.x,h.y,h.width,t)):n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,d+this.constructor.cornerSize+i*h.height,h.width,h.height,h.x,h.y,h.width,h.height);for(u=this.width-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x+this.constructor.cornerSize,this.constructor.frameRect.y+3*this.constructor.cornerSize,this.constructor.frameRect.width-2*this.constructor.cornerSize,this.constructor.frameThickness),a=Math.ceil(u/h.width),i=g=0;a>=0?a>g:g>a;i=a>=0?++g:--g)i+1===a?(s=c+this.constructor.cornerSize+i*h.width,l=h.width-(s+h.width-(c+this.constructor.cornerSize+u)),n.drawBitmapSimple(this.windowSkin,s,d+this.height-this.constructor.cornerSize,l,h.height,h.x,h.y,l,h.height)):n.drawBitmapSimple(this.windowSkin,c+this.constructor.cornerSize+i*h.width,d+this.height-this.constructor.cornerSize,h.width,h.height,h.x,h.y,h.width,h.height);return n.drawBitmapSimple(this.windowSkin,c,d,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x,this.constructor.frameRect.y,this.constructor.cornerSize,this.constructor.cornerSize),n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,d,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x+3*this.constructor.cornerSize,this.constructor.frameRect.y,this.constructor.cornerSize,this.constructor.cornerSize),n.drawBitmapSimple(this.windowSkin,c,d+this.height-this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x,this.constructor.frameRect.y+3*this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize),n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,d+this.height-this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x+3*this.constructor.cornerSize,this.constructor.frameRect.y+3*this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize),n.opacity=255,n.context.globalAlpha=1,n.ox=r,n.oy=o,null}},e.prototype.draw=function(){var t,e,i,r,o,s,n,a,h,l,u,c;if(l=Graphics.renderer,l.blendType=0,l.reset(),u=Math.floor(this.x)-this.ox,c=Math.floor(this.y)-this.oy,0===this.openness)return null;if(this.openness<255&&this.opacity>0)return n=.00392156862745*this.height*this.openness,this._drawWindow(),null;if(this.opacity>0&&this._drawWindow(),i=this.constructor.cursorBorder,r=2*i,o=this.constructor.cursorRect,u=u+this.padding-this.cx,c=c+this.padding-this.cy,this.cursorRect.width>0&&this.cursorRect.height>0&&(l.context.globalAlpha=this.cursorOpacity,l.opacity=255*this.cursorOpacity,l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x+i,c+this.cursorRect.y,this.cursorRect.width-r,i,o.x+i,o.y,o.width-r,i),l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x,c+this.cursorRect.y+i,i,this.cursorRect.height-r,o.x,o.y+i,i,o.height-r),l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x+i,c+this.cursorRect.y+this.cursorRect.height-i,this.cursorRect.width-r,i,o.x+i,o.y+o.height-i,o.width-r,i),l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x+this.cursorRect.width-i,c+this.cursorRect.y+i,i,this.cursorRect.height-r,o.x+o.width-i,o.y+i,i,o.height-r),l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x,c+this.cursorRect.y,i,i,o.x,o.y,i,i),l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x+this.cursorRect.width-i,c+this.cursorRect.y,i,i,o.x+o.width-i,o.y,i,i),l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x+this.cursorRect.width-i,c+this.cursorRect.y+this.cursorRect.height-i,i,i,o.x+o.width-i,o.y+o.height-i,i,i),l.drawBitmapSimple(this.windowSkin,u+this.cursorRect.x,c+this.cursorRect.y+this.cursorRect.height-i,i,i,o.x,o.y+o.height-i,i,i),l.opacity=255,l.context.globalAlpha=1),u=u-this.padding+this.cx,c=c-this.padding+this.cy,this.pause)switch(a=this.constructor.pauseIconSize,h=this.constructor.pauseRect,s=Math.floor,this.pauseArrowPattern){case 0:l.drawBitmapSimple(this.windowSkin,s(u+.5*this.width-8),s(c+this.height-a.height),a.width,a.height,h.x,h.y,a.width,a.height);break;case 1:l.drawBitmapSimple(this.windowSkin,s(u+.5*this.width-8),s(c+this.height-a.height),a.width,a.height,h.x+a.width,h.y,a.width,a.height);break;case 2:l.drawBitmapSimple(this.windowSkin,s(u+.5*this.width-8),s(c+this.height-a.height),a.width,a.height,h.x,h.y+a.height,a.width,a.height);break;case 3:l.drawBitmapSimple(this.windowSkin,s(u+.5*this.width-8),s(c+this.height-a.height),a.width,a.height,h.x+a.width,h.y+a.height,a.width,a.height)}return this.arrowsVisible&&null!=this.contents&&(this.cx>0&&l.drawBitmapSimple(this.windowSkin,u+4,c+.5*this.height-8,this.constructor.leftArrowRect.width,this.constructor.leftArrowRect.height,this.constructor.leftArrowRect.x,this.constructor.leftArrowRect.y,this.constructor.leftArrowRect.width,this.constructor.leftArrowRect.height),this.cy>0&&l.drawBitmapSimple(this.windowSkin,u+.5*this.width-8,c+4,this.constructor.topArrowRect.width,this.constructor.topArrowRect.height,this.constructor.topArrowRect.x,this.constructor.topArrowRect.y,this.constructor.topArrowRect.width,this.constructor.topArrowRect.height),this.contents.width-this.cx>this.width-this.padding&&l.drawBitmapSimple(this.windowSkin,u+this.width-11,c+.5*this.height-8,this.constructor.rightArrowRect.width,this.constructor.rightArrowRect.height,this.constructor.rightArrowRect.x,this.constructor.rightArrowRect.y,this.constructor.rightArrowRect.width,this.constructor.rightArrowRect.height),this.contents.height-this.cy>this.height-this.padding&&l.drawBitmapSimple(this.windowSkin,u+.5*this.width-8,c+this.height-11,this.constructor.bottomArrowRect.width,this.constructor.bottomArrowRect.height,this.constructor.bottomArrowRect.x,this.constructor.bottomArrowRect.y,this.constructor.bottomArrowRect.width,this.constructor.bottomArrowRect.height)),null!=this.contents?(l.context.globalAlpha=.00392156862745*this.contentsOpacity,e=this.contents.width-this.cx>this.width-2*this.padding?this.width-2*this.padding:this.contents.width-this.cx,t=this.contents.height-this.cy>this.height-2*this.padding?this.height-2*this.padding:this.contents.height-this.cy,e=Math.min(e,this.contents.image.width),t=Math.min(t,this.contents.image.height),l.drawBitmapSimple(this.contents,u+this.padding,c+this.padding,e,t,Math.max(this.cx,0),Math.max(this.cy,0),e,t)):void 0},e}(GraphicObject),window.Window=t}.call(this),Function.prototype.accessors=function(t,e){Object.defineProperty(this.prototype,t,e)},Object.mixin=function(t,e,i){for(k in e)!e.hasOwnProperty(k)||i&&-1!=i.indexOf(k)||(t[k]=e[k]);return t},Object.extend=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.base=e.prototype,t.basec=e.prototype.constructor},Object.getConstructorOf=function(t){return Object.getPrototypeOf(t.prototype).constructor},Object.getClassFromString=function(t){for(var e=t.split("."),i=globalScope,r=0;r<e.length;r++)i=i[e[r]];return i},Object.flatCopy=function(t){var e={};for(k in t)e[k]=t[k];return e},Object.copy=function(t){return JSON.parse(JSON.stringify(t))},owl=function(){function t(){}function e(e){return"object"==typeof e?(t.prototype=e,new t):e}function i(t){if("object"!=typeof t)return t;var i=t.valueOf();if(t!=i)return new t.constructor(i);if(t instanceof t.constructor&&t.constructor!==Object){var r=e(t.constructor.prototype);for(var o in t)t.hasOwnProperty(o)&&(r[o]=t[o])}else{var r={};for(var o in t)r[o]=t[o]}return r}function r(t){for(var e in t)this[e]=t[e]}function o(){this.copiedObjects=[],thisPass=this,this.recursiveDeepCopy=function(t){return thisPass.deepCopy(t)},this.depth=0}function s(t,e){var i=new o;return e&&(i.maxDepth=e),i.deepCopy(t)}function n(t){return window.Node?t instanceof Node:t===document?!0:"number"==typeof t.nodeType&&t.attributes&&t.childNodes&&t.cloneNode}var a=[];return r.prototype={constructor:r,canCopy:function(){return!1},create:function(){},populate:function(){}},o.prototype={constructor:o,maxDepth:256,cacheResult:function(t,e){this.copiedObjects.push([t,e])},getCachedResult:function(t){for(var e=this.copiedObjects,i=e.length,r=0;i>r;r++)if(e[r][0]===t)return e[r][1];return void 0},deepCopy:function(t){if(null===t)return null;if("object"!=typeof t)return t;var e=this.getCachedResult(t);if(e)return e;for(var i=0;i<a.length;i++){var r=a[i];if(r.canCopy(t))return this.applyDeepCopier(r,t)}throw new Error("no DeepCopier is able to copy "+t)},applyDeepCopier:function(t,e){var i=t.create(e);if(this.cacheResult(e,i),this.depth++,this.depth>this.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,i),this.depth--,i}},s.DeepCopier=r,s.deepCopiers=a,s.register=function(t){t instanceof r||(t=new r(t)),a.unshift(t)},s.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?e(t.constructor.prototype):{}},populate:function(t,e,i){for(var r in e)e.hasOwnProperty(r)&&(i[r]=t(e[r]));return i}}),s.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,i){for(var r=0;r<e.length;r++)i.push(t(e[r]));return i}}),s.register({canCopy:function(t){return t instanceof Date},create:function(t){return new Date(t)}}),s.register({canCopy:function(t){return n(t)},create:function(t){return t===document?document:t.cloneNode(!1)},populate:function(t,e,i){if(e===document)return document;if(e.childNodes&&e.childNodes.length)for(var r=0;r<e.childNodes.length;r++){var o=t(e.childNodes[r]);i.appendChild(o)}}}),{DeepCopyAlgorithm:o,copy:i,clone:e,deepCopy:s}}(),Object.values||(Object.values=function(t){var e=[];for(k in t)e.push(t[k]);return e}),Object.deepCopy=owl.deepCopy,gs.Utf8ArrayToStr=Utf8ArrayToStr,Math.degreesToRadians=function(t){return.017453292519943295*t},Math.nextPow2=function(t){return t--,t=t>>1|t,t=t>>2|t,t=t>>4|t,t=t>>8|t,t=t>>16|t,t++,t},Math.toRadians=function(t){return.01745329251994*t},Math.mod=function(t,e){return(t%e+e)%e},Math.linearTween=function(t,e,i,r){return i*t/r+e},Math.easeInQuad=function(t,e,i,r){return t/=r,i*t*t+e},Math.easeOutQuad=function(t,e,i,r){return t/=r,-i*t*(t-2)+e},Math.easeInOutQuad=function(t,e,i,r){return t/=r/2,1>t?i/2*t*t+e:(t--,-i/2*(t*(t-2)-1)+e)},Math.easeInCubic=function(t,e,i,r){return t/=r,i*t*t*t+e},Math.easeOutCubic=function(t,e,i,r){return t/=r,t--,i*(t*t*t+1)+e},Math.easeInOutCubic=function(t,e,i,r){return t/=r/2,1>t?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},Math.easeInQuart=function(t,e,i,r){return t/=r,i*t*t*t*t+e},Math.easeOutQuart=function(t,e,i,r){return t/=r,t--,-i*(t*t*t*t-1)+e},Math.easeInOutQuart=function(t,e,i,r){return t/=r/2,1>t?i/2*t*t*t*t+e:(t-=2,-i/2*(t*t*t*t-2)+e)},Math.easeInQuint=function(t,e,i,r){return t/=r,i*t*t*t*t*t+e},Math.easeOutQuint=function(t,e,i,r){return t/=r,t--,i*(t*t*t*t*t+1)+e},Math.easeInOutQuint=function(t,e,i,r){return t/=r/2,1>t?i/2*t*t*t*t*t+e:(t-=2,i/2*(t*t*t*t*t+2)+e)},Math.easeInSine=function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},Math.easeOutSine=function(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e},Math.easeInOutSine=function(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e},Math.easeInExpo=function(t,e,i,r){return i*Math.pow(2,10*(t/r-1))+e},Math.easeOutExpo=function(t,e,i,r){return i*(-Math.pow(2,-10*t/r)+1)+e},Math.easeInOutExpo=function(t,e,i,r){return t/=r/2,1>t?i/2*Math.pow(2,10*(t-1))+e:(t--,i/2*(-Math.pow(2,-10*t)+2)+e)},Math.easeInCirc=function(t,e,i,r){return t/=r,-i*(Math.sqrt(1-t*t)-1)+e},Math.easeOutCirc=function(t,e,i,r){return t/=r,t--,i*Math.sqrt(1-t*t)+e},Math.easeInOutCirc=function(t,e,i,r){return t/=r/2,1>t?-i/2*(Math.sqrt(1-t*t)-1)+e:(t-=2,i/2*(Math.sqrt(1-t*t)+1)+e)},String.prototype.replaceAt=function(t,e){return this.substr(0,t)+e+this.substr(t+e.length)},String.prototype.fill=function(t,e,i){var r=this,o=0,s="";if(this.length<e){o=e-this.length;for(var n=0;o>n;n++)s+=t;r=0==i?s+r:r+s}return r},String.prototype.lfill=function(t,e){return this.fill(t,e,0)},String.prototype.rfill=function(t,e){return this.fill(t,e,1)},String.prototype.ltrim=function(){return this.replace(/^\s+/,"")},String.prototype.rtrim=function(){return this.replace(/\s+$/,"")},String.prototype.trim=function(){return this.ltrim().rtrim()},String.prototype.format=function(){var t=arguments;return this.replace(/{(\d+)}/g,function(e,i){return"undefined"!=typeof t[i]?t[i]:e})},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.startsWith||(String.prototype.startsWith=function(t){return this.match("^"+t)==t}),String.prototype.endsWith||(String.prototype.endsWith=function(t){return this.match(t+"$")==t}),String.prototype.contains=function(t){return-1!=this.indexOf(t)},String.prototype.truncate=function(t){return this.length>t?this.substring(0,t):this},String.prototype.escapeHtml=function(){for(var t="",e=0;e<this.length;e++)t+="&"==this.charAt(e)?"&amp;":"<"==this.charAt(e)?"&lt;":">"==this.charAt(e)?"&gt;":this.charAt(e);return t},String.prototype.unescapeHtml=function(){var t=this.replace("&amp;","&");return t=this.replace("&gt;",">"),t=this.replace("&lt;","<")},String.prototype.withoutUnit=function(){var t=this,e=this.charAt(this.length-1);return(e>57||48>e)&&(t=this.substr(this.length-2,2)),t},Array.prototype.removeAll=function(t){for(var e=0,i=0;e<this.length;)t(this[e])&&(this.splice(e,1),e--,i++),e++;return i},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var i=-1;e=e||0;for(var r=e;r<this.length;r++)if(this[r]==t){i=r;break}return i}),Array.remove=function(t,e){var i=t.indexOf(e,0);-1!=i&&t.splice(i,1)},Array.prototype.remove=function(t){var e=Array.prototype.indexOf.call(this,t,0);-1!=e&&this.splice(e,1)},Array.prototype.toIndexArray=function(t){var e=[];t=t||0;for(var i=0;i<this.length;i++)e.push(t+i);return e},Array.prototype.toPropertyArray=function(t){for(var e=[],i=0;i<this.length;i++)e.push(this[i][t]);return e},Array.prototype.pushArray=function(t){for(var e=0;e<t.length;e++)this.push(t[e])},Array.prototype.fill=function(t,e,i){for(var e=e||0,i=i||this.length,r=e;i>r;r++)this[r]=t;return this};
1 + function AutotileExpander(){}function GSAutotileExpanderDrawImage(t,e,i,r,o,s,n,a,h,l){var u=GSAutotileExpanderDrawImage.sourceOriginX,c=GSAutotileExpanderDrawImage.sourceOriginY,d=GSAutotileExpanderDrawImage.originX,p=GSAutotileExpanderDrawImage.originY;t.drawImage(e.image,u+n,c+a,h-n,l-a,d+i,p+r,h-n,l-a)}function GSAutotileExpanderDrawLeftTopSmall(t,e,i,r){GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(Math.floor(tw/2)),e+Math.floor(th/2),0,th,Math.floor(tw/2),th+Math.floor(th/2))}function GSAutotileExpanderDrawRightTopSmall(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=th,n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftBottomSmall(t,e,i,r){var o=3*th+Math.floor(th/2),s=0+Math.floor(tw/2),n=o+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),0,o,s,n)}function GSAutotileExpanderDrawRightBottomSmall(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=3*th+Math.floor(th/2),n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftTopCorner(t,e,i,r){var o=2*tw,s=o+Math.floor(tw/2),n=0+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,0,s,n)}function GSAutotileExpanderDrawRightTopCorner(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=o+Math.floor(tw/2),n=0+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,0,s,n)}function GSAutotileExpanderDrawLeftBottomCorner(t,e,i,r){var o=2*tw,s=Math.floor(th/2),n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawRightBottomCorner(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=Math.floor(th/2),n=o+Math.floor(tw/2),a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftSideTop(t,e,i,r){var o=th,s=0+Math.floor(tw/2),n=o+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,0,o,s,n)}function GSAutotileExpanderDrawRightSideTop(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawLeftSideBottom(t,e,i,r){var o=3*th,s=0+Math.floor(tw/2),n=o+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,0,o,s,n)}function GSAutotileExpanderDrawRightSideBottom(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=3*th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawUpSideLeft(t,e,i,r){var o=th,s=0+tw,n=o+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),0,o,s,n)}function GSAutotileExpanderDrawUpSideRight(t,e,i,r){var o=2*tw,s=th,n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawDownSideLeft(t,e,i,r){var o=3*th+Math.floor(th/2),s=0+tw,n=o+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),0,o,s,n)}function GSAutotileExpanderDrawDownSideRight(t,e,i,r){var o=2*tw,s=3*th+Math.floor(th/2),n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftSideSmall(t,e,i,r){var o=2*th,s=0+Math.floor(tw/2),n=o+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,0,o,s,n)}function GSAutotileExpanderDrawRightSideSmall(t,e,i,r){var o=2*tw+Math.floor(tw/2),s=2*th,n=o+Math.floor(tw/2),a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+Math.floor(tw/2),e+th,o,s,n,a)}function GSAutotileExpanderDrawUpSideSmall(t,e,i,r){var o=tw,s=th,n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawDownSideSmall(t,e,i,r){var o=tw,s=3*th+Math.floor(th/2),n=o+tw,a=s+Math.floor(th/2);GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+Math.floor(th/2),o,s,n,a)}function GSAutotileExpanderDrawLeftSide(t,e,i,r){var o=2*th,s=0+tw,n=o+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,0,o,s,n)}function GSAutotileExpanderDrawRightSide(t,e,i,r){var o=2*tw,s=2*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawUpSide(t,e,i,r){var o=tw,s=th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawDownSide(t,e,i,r){var o=tw,s=3*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawLeftTop(t,e,i,r){var o=th,s=0+tw,n=o+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,0,o,s,n)}function GSAutotileExpanderDrawRightTop(t,e,i,r){var o=2*tw,s=th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawLeftBottom(t,e,i,r){var o=3*th,s=0+tw,n=o+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,0,o,s,n)}function GSAutotileExpanderDrawRightBottom(t,e,i,r){var o=2*tw,s=3*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function GSAutotileExpanderDrawBackground(t,e,i,r){var o=tw,s=2*th,n=o+tw,a=s+th;GSAutotileExpanderDrawImage(i,r,t,e,t+tw,e+th,o,s,n,a)}function Utf8ArrayToStr(t){var e,i,r,o,s,n;for(e="",r=t.length,i=0;i<r;)switch((o=t[i++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=String.fromCharCode(o);break;case 12:case 13:s=t[i++],e+=String.fromCharCode((31&o)<<6|63&s);break;case 14:s=t[i++],n=t[i++],e+=String.fromCharCode((15&o)<<12|(63&s)<<6|(63&n)<<0)}return e}function MAX(t,e){return Math.max(t,e)}function MIN(t,e){return Math.min(t,e)}(function(){var t;window.GS={dataCache:{}},window.gs={},window.$MOBILE=!1,t=function(){function t(){this.onExit=null,this.onReady=null}return t.prototype.initialize=function(){return gs.Platform={},void 0!==typeof window&&window.navigator&&(gs.Platform.isEdge=-1!==window.navigator.userAgent.indexOf("Edge"),gs.Platform.isChrome=!gs.Platform.isEdge&&-1!==window.navigator.userAgent.indexOf("Chrome"),gs.Platform.isSafari=!gs.Platform.isEdge&&!gs.Platform.isChrome&&-1!==window.navigator.userAgent.indexOf("Safari"),gs.Platform.isSafariMobile=!!window.navigator.userAgent.match(/iPad/i)||!!window.navigator.userAgent.match(/iPhone/i),gs.Platform.isCordova="undefined"!=typeof cordova,gs.Platform.isAndroid=gs.Platform.isCordova&&"android"===cordova.platformId,gs.Platform.isAtsumaru="undefined"!=typeof RPGAtsumaru,gs.Platform.isNWJS="undefined"!=typeof nw&&null!==nw.App,gs.Platform.isNode="undefined"!=typeof process&&null!==process.version,gs.Platform.isWeb=!(gs.Platform.isCordova||gs.Platform.isAndroid||gs.Platform.isNWJS||gs.Platform.isNode)),gs.Platform.isCordova?document.addEventListener("deviceready",function(t){return function(){return"function"==typeof t.onReady?t.onReady():void 0}}(this),!1):jQuery(document).ready(function(t){return function(){return"function"==typeof t.onReady?t.onReady():void 0}}(this))},t.prototype.exit=function(){return $PARAMS.platform.isSteamOS?window.close():$PARAMS.isOffline&&null!=window.require?require("nw.gui").App.quit():null!=this.onExit?this.onExit():void 0},t.prototype.getPlatformSpecificGraphicsFilePath=function(t,e){var i,r,o,s,n;return n=GS.dataCache.RESOURCES.items.resources,o=t+"_"+e,i=null,r=null,s=null,n[o]?(s=o,r=n[o]||".png"):(s=t,r=n[t]||".png"),i=r,i=".fnt"===i?".png":i,gs.Platform.isCordova&&gs.Platform.isAndroid&&$PARAMS.platform.usePlayStoreExpansionFile?"content://"+$PARAMS.platform.gameIdentifier+"/resources/"+GS.DataPreparer.prepareFilePath(s+i):"resources/"+GS.DataPreparer.prepareFilePath(s+i)},t.prototype.getPlatformSpecificVideoFilePath=function(t,e){var i,r,o,s,n;return n=GS.dataCache.RESOURCES.items.resources,o=t+"_"+e,i=null,r=null,s=null,n[o]?(s=o,r=n[o]||[".webm"]):(s=t,r=n[t]||[".webm"]),i=gs.Platform.isSafari||gs.Platform.isEdge||gs.Platform.isSafariMobile?(i=-1!==r.indexOf(".mp4")?".mp4":"")||r[0]:(i=-1!==r.indexOf(".webm")?".webm":"")?".webm":r[0]||".webm",gs.Platform.isCordova&&gs.Platform.isAndroid&&$PARAMS.platform.usePlayStoreExpansionFile?"content://"+$PARAMS.platform.gameIdentifier+"/resources/"+GS.DataPreparer.prepareFilePath(s+i):"resources/"+GS.DataPreparer.prepareFilePath(s+i)},t.prototype.getPlatformSpecificAudioFilePath=function(t,e,i){var r,o,s,n,a;return a=GS.dataCache.RESOURCES.items.resources,s=t+"_"+e,r=null,o=null,n=null,a[s]?(n=s,o=a[s]||[".wav"]):(n=t,o=a[t]||[".wav"]),r=gs.Platform.isSafari||gs.Platform.isEdge||gs.Platform.isSafariMobile?(r=(r=(r=(r=-1!==o.indexOf(".m4a")?".m4a":"")||-1===o.indexOf(".mp4")?r:".mp4")||-1===o.indexOf(".mp3")?r:".mp3")||-1===o.indexOf(".aac")?r:".aac")||o[0]:o[0],gs.Platform.isCordova&&gs.Platform.isAndroid&&$PARAMS.platform.usePlayStoreExpansionFile?"content://"+$PARAMS.platform.gameIdentifier+"/resources/"+GS.DataPreparer.prepareFilePath(n+r):"resources/"+GS.DataPreparer.prepareFilePath(n+r)},t.prototype.loadData=function(t,e,i,r,o){var s;return gs.Platform.isSafariMobile&&gs.Platform.isCordova?resolveLocalFileSystemURL(cordova.file.applicationDirectory+"/www/"+t,function(t){return t.file(function(t){var o;return o=new FileReader,o.onloadend=function(t){return e(this.result)},o.onerror=function(t){return i(t)},1===r?o.readAsDataURL(t):o.readAsArrayBuffer(t)})},function(t){return i(t)}):((s=new XMLHttpRequest).open("GET",t,!0),s.responseType="arraybuffer",s.onload=function(){return e(s.response,o)},s.onerror=function(t){return i(t)},s.send())},t}(),window.gs||(window.gs={}),window.Application=new t,gs.Application=window.Application,gs.CallBack=function(t,e,i){var r,o;return null!=i?(o=e[t],r=function(){var t,r,s,n;for(t=new Array(arguments.length+1),r=s=0,n=arguments.length;0<=n?s<n:s>n;r=0<=n?++s:--s)t[r]=arguments[r];return t[t.length-1]=i,o.apply(e,t)}):r=function(){return e[t].apply(e,arguments)},r.$vnm_cb=!0,r.funcName=t,r.object=e,r.data=i,r}}).call(this),function(){var t;t=function(){function t(){this.handlerList={}}return t.prototype.on=function(t,e,i){return this.handlerList[t]||(this.handlerList[t]=[]),this.handlerList[t].push({once:!1,data:e,callback:i})},t.prototype.once=function(t,e,i){return this.handlerList[t]||(this.handlerList[t]=[]),this.handlerList[t].push({once:!0,data:e,callback:i})},t.prototype.emit=function(t,e){var i,r,o,s,n,a,h;if(o=this.handlerList[t],i=[],o)for(s=0,a=o.length;s<a;s++)(r=o[s]).callback({sender:this,params:e,data:r.data}),r.once&&i.push(r);for(n=0,h=i.length;n<h;n++)r=i[n],o.remove(r);return null},t}(),gs.EventEmitter=t}.call(this),function(){var ObjectCodec,ObjectCodecContext;ObjectCodecContext=function(){return function(t,e,i){this.mode=0,this.decodedObjectStore=null!=t?t:[],this.encodedObjectStore=null!=e?e:[],this.tempObjectStore=null!=i?i:[],this.restoreEventReceivers=[]}}(),gs.ObjectCodecContext=ObjectCodecContext,ObjectCodec=function(){function ObjectCodec(){}return ObjectCodec.onRestore=function(t,e){var i,r,o,s,n,a,h,l;i=e.decodedObjectStore,n=e.tempObjectStore;for(s in t)if(l=t[s],-1===n.indexOf(l)&&-1!==i.indexOf(l)&&null!=l)if(n.push(l),l instanceof Array)for(r=o=0,a=l.length;0<=a?o<a:o>a;r=0<=a?++o:--o)gs.ObjectCodec.onRestore(l[r],e),null!=(null!=(h=l[r])?h.onDataBundleRestore:void 0)&&-1===e.restoreEventReceivers.indexOf(l[r])&&(e.restoreEventReceivers.push(l[r]),l[r].onDataBundleRestore(null,e));else"object"==typeof l&&(gs.ObjectCodec.onRestore(l,e),l.onDataBundleRestore&&-1===e.restoreEventReceivers.indexOf(l)&&(e.restoreEventReceivers.push(l),"function"==typeof l.onDataBundleRestore&&l.onDataBundleRestore(null,e)));return null},ObjectCodec.decode=function(object,context){var a,decObjStore,decObject,i,id,j,objClass,objStore,ref;if(null==object)return object;if(objStore=context.encodedObjectStore,decObjStore=context.decodedObjectStore,decObject=null,"string"==typeof object&&-1!==object.indexOf("$$vnm_obj_ref")&&(id=parseInt(object.split(" ")[1]),object=objStore[id],decObject=decObjStore[id]),null!=object&&null==decObject)if(object instanceof Array)for(a=[],decObjStore[id]=a,decObject=a,i=j=0,ref=object.length;0<=ref?j<ref:j>ref;i=0<=ref?++j:--j)a[i]=gs.ObjectCodec.decode(object[i],context);else"object"==typeof object?"Function"===object.$class?object.$vnm_cb?(gs.ObjectCodec.decodeProperties(object,context),decObject=gs.CallBack(object.name,object.object,object.data),decObjStore[id]=decObject):(decObject=eval("("+object.source+")"),decObjStore[id]=decObject):(objClass=window[object.$ns||"gs"][object.$class]||window[object.$class]||Object).fromDataBundle?(decObject=objClass.fromDataBundle(object,context),decObjStore[id]=decObject):(decObject="function"==typeof objClass?new objClass:objClass,decObjStore[id]=decObject,object=gs.ObjectCodec.decodeProperties(object,context),delete object.$class,delete object.$ns,Object.mixin(decObject,object)):decObject=object;return decObject},ObjectCodec.decodeProperties=function(t,e){var i,r,o;r=t;for(i in t)null!=(o=t[i])&&("string"==typeof o?-1!==o.indexOf("$$vnm_obj_ref")?r[i]=gs.ObjectCodec.decode(o,e):"$$vnm_no_decode"!==o&&(r[i]=o):r[i]=o);return r},ObjectCodec.encode=function(t,e,i){var r,o,s,n,a,h,l,u,c;if(l=e.decodedObjectStore,o=e.encodedObjectStore,u=null,t instanceof Array||t instanceof Float32Array){for(l.push(t),r=[],s=a=0,c=t.length;0<=c?a<c:a>c;s=0<=c?++a:--a)r[s]=gs.ObjectCodec.encode(t[s],e,i);o[n=l.indexOf(t)]=r,u="$$vnm_obj_ref "+n}else t instanceof Object?(l.push(t),h=null,"function"==typeof t?t.$vnm_cb?((h=gs.ObjectCodec.encodeProperties({name:t.funcName,object:t.object,data:t.data},e)).$vnm_cb=!0,h.$class="Function"):((h={source:t.toString()}).$class="Function",h.$ns=null):t.constructor.toDataBundle?((h=t.constructor.toDataBundle(t,e)).$class=t.constructor.$name||t.constructor.name,h.$ns=t.constructor.$namespace):((h=gs.ObjectCodec.encodeProperties(t,e,t.constructor.objectCodecBlackList)).$class=t.constructor.$name||t.constructor.name,h.$ns=t.constructor.$namespace),u="$$vnm_obj_ref "+(n=l.indexOf(t)),o[n]=h):u=t;return u},ObjectCodec.encodeProperties=function(t,e,i){var r,o,s,n,a;s=e.decodedObjectStore,e.encodedObjectStore,n={};for(o in t)!t.hasOwnProperty(o)||i&&-1!==i.indexOf(o)||(a=t[o],r=s.indexOf(a),n[o]=-1!==r?"$$vnm_obj_ref "+r:gs.ObjectCodec.encode(a,e,null));return n},ObjectCodec}(),gs.ObjectCodec=ObjectCodec}.call(this),function(){var t,e,i={}.hasOwnProperty;(e=function(){function t(){}return t.initialize=function(){return this.WORKING_DIRECTORY=0,this.APP_DATA_DIRECTORY=1,this.INTERNAL_STORAGE=2},t}()).initialize(),gs.GameStorageLocations=e,t=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.initializationTimer=null}return function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,gs.EventEmitter),e.prototype.clear=function(){return localStorage.clear()},e.prototype.initialize=function(){return gs.Platform.isAtsumaru?(this.atsumaruCloudStorage=RPGAtsumaru.storage.getItems(),this.atsumaruCloudStorage.isFulfilled()?this.emit("finishInitialize"):this.atsumaruCloudStorage.isRejected()?(this.atsumaruCloudStorage=null,this.emit("finishInitialize")):this.initializationTimer=setInterval(function(t){return function(){return t.atsumaruCloudStorage.isFulfilled()?(clearInterval(t.initializationTimer),t.atsumaruCloudStorage=t.atsumaruCloudStorage.value(),t.emit("finishInitialize")):t.atsumaruCloudStorage.isRejected()?(clearInterval(t.initializationTimer),t.atsumaruCloudStorage=null,t.emit("finishInitialize")):void 0}}(this),10)):this.emit("finishInitialize")},e.prototype.storagePath=function(){if(!$PARAMS.isOffline||$PARAMS.platform.isSteamOS||null==window.nw)return"";switch(RecordManager.system.gameDataPath){case gs.GameStorageLocations.APP_DATA_DIRECTORY:return nw.App.dataPath;case gs.GameStorageLocations.WORKING_DIRECTORY:return"./";case gs.GameStorageLocations.INTERNAL_STORAGE:return"";default:return"./"}},e.prototype.exists=function(t){return $PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").existsSync(this.storagePath()+"/"+t+".vndata"):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,this.atsumaruCloudStorage.filter(function(e){return e.key===t}).length>0):null!==localStorage.getItem($PARAMS.uid+"_"+t)},e.prototype.remove=function(t){var e;if($PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw){if(require("fs").existsSync(this.storagePath()+"/"+t+".vndata"))return require("fs").unlinkSync(this.storagePath()+"/"+t+".vndata")}else{if(!gs.Platform.isAtsumaru||!this.atsumaruCloudStorage)return localStorage.removeItem($PARAMS.uid+"_"+t);if(t=$PARAMS.uid+"_"+t,RPGAtsumaru.storage.removeItem(t),e=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0])return this.atsumaruCloudStorage.splice(this.atsumaruCloudStorage.indexOf(e),1)}},e.prototype.setData=function(t,e){var i;return $PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").writeFileSync(this.storagePath()+"/"+t+".vndata",e):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,(i=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0])||(i={key:t,value:null},this.atsumaruCloudStorage.push(i)),i.value=e,RPGAtsumaru.storage.setItems([{key:t,value:e}])):localStorage.setItem($PARAMS.uid+"_"+t,e)},e.prototype.getData=function(t){var e;return e=null,$PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?e=require("fs").readFileSync(this.storagePath()+"/"+t+".vndata","utf8"):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,e=null!=(e=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0])?e.value:void 0):e=localStorage.getItem($PARAMS.uid+"_"+t),e},e.prototype.setObject=function(t,e){var i;return $PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").writeFileSync(this.storagePath()+"/"+t+".vndata",JSON.stringify(e)):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,(i=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0])||(i={key:t,value:null},this.atsumaruCloudStorage.push(i)),i.value=JSON.stringify(e),RPGAtsumaru.storage.setItems([{key:t,value:i.value}])):localStorage.setItem($PARAMS.uid+"_"+t,JSON.stringify(e))},e.prototype.getObject=function(t){var e,i,r;if(i=null,r=null,$PARAMS.isOffline&&!$PARAMS.platform.isSteamOS&&null!=window.nw?require("fs").existsSync(this.storagePath()+"/"+t+".vndata")&&(i=require("fs").readFileSync(this.storagePath()+"/"+t+".vndata","utf8")):gs.Platform.isAtsumaru&&this.atsumaruCloudStorage?(t=$PARAMS.uid+"_"+t,i=null!=(i=this.atsumaruCloudStorage.filter(function(e){return e.key===t})[0])?i.value:void 0):i=localStorage.getItem($PARAMS.uid+"_"+t),r=null,null!=i)try{r=JSON.parse(i)}catch(i){e=i,console.warn(t+" corrupted."),console.warn(e),r=null}return r},e}(),window.GameStorage=new t,gs.GameStorage=window.GameStorage}.call(this),function(){var t;t=function(){function t(){}return t.postSceneChange=function(t){if(t=t.truncate(16),gs.Platform.isAtsumaru)return RPGAtsumaru.comment.changeScene(t)},t.postResetSceneChange=function(t){if(t=t.truncate(16),gs.Platform.isAtsumaru)return RPGAtsumaru.comment.resetAndChangeScene(t)},t.postContextChange=function(t){if(gs.Platform.isAtsumaru)return RPGAtsumaru.comment.pushContextFactor(t)},t.postMinorChange=function(t){if(gs.Platform.isAtsumaru)return RPGAtsumaru.comment.pushMinorContext()},t}(),gs.GameNotifier=t}.call(this),function(){var Data;Data=function(){function Data(){}return Data._loadTest=function(t,e){var i,r;return(r=new XMLHttpRequest).open("GET","./data/"+t+".json",!0),r.responseType="arraybuffer",i=function(t){return console.log("ERROR"),console.log(t),"function"==typeof e?e(null,t):void 0},r.onload=function(){var o,s;return o=GS.DataPreparer.prepare(r.response),s=new FileReader,s.onload=function(i){var r;return r=JSON.parse(i.target.result),GS.dataCache[t]=r,"function"==typeof e?e(r,null):void 0},s.onerror=i,s.readAsText(new Blob([o]))},r.onerror=i,r.send()},Data._loadRelease=function(uid,callback){return gs.Application.loadData("data/"+uid+".json.js",function(_this){return function(data){var buffer,reader;return buffer=GS.DataPreparer.prepare(data),reader=new FileReader,reader.onload=function(e){var dataObject;return eval(e.target.result),dataObject=GS.dataCache[uid],"function"==typeof callback?callback(dataObject,null):void 0},reader.onerror=function(t){return console.log("ERROR"),console.log(t),"function"==typeof callback?callback(null,t):void 0},reader.readAsText(new Blob([buffer]))}}(this),function(t){return console.log("ERROR"),console.log(t),"function"==typeof callback?callback(null,t):void 0})},Data.load=function(t,e){return null!=$PARAMS.testOffline?this._loadTest(t,e):this._loadRelease(t,e)},Data.loadRaw=function(t,e){return gs.Application.loadData(t,function(t){var i,r;return i=GS.DataPreparer.prepare(t),r=new FileReader,r.onload=function(t){return"function"==typeof e?e(t.target.result,null):void 0},r.onerror=function(t){return console.log("ERROR"),console.log(t),"function"==typeof e?e(null,t):void 0},r.readAsText(new Blob([i]))},function(t){return console.log("ERROR"),console.log(t),"function"==typeof e?e(null,t):void 0})},Data}(),gs.Data=Data}.call(this),function(){var t,e,i,r=function(t,e){function i(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},o={}.hasOwnProperty;t=function(){function t(t){this.data=t}return t.prototype.readString=function(t,e,i){var r,o,s,n;for(n="",r=o=0,s=i;0<=s?o<s:o>s;r=0<=s?++o:--o)n+=String.fromCharCode(t[e+r]);return n},t.prototype.readNum32LE=function(t,e){return 16777216*t[e+3]+65536*t[e+2]+256*t[e+1]+t[e+0]},t.prototype.readNum32BE=function(t,e){return 16777216*t[e+0]+65536*t[e+1]+256*t[e+2]+t[e+3]},t}(),i=function(e){function i(t){i.__super__.constructor.call(this,t),this.loopStart=0,this.loopLength=0,this.sampleRate=0,this.parse(t)}return r(i,t),i.prototype.parse=function(t){var e,i,r,o,s,n,a,h,l,u,c;try{for(o=0;o<t.length&&"OggS"===this.readString(t,o,4);){for(o+=26,c=!1,u=[],r=s=0,h=a=t[o++];0<=h?s<h:s>h;r=0<=h?++s:--s)u.push(t[o++]);for(r=n=0,l=a;0<=l?n<l:n>l;r=0<=l?++n:--n)"vorb"===this.readString(t,o+1,4)&&(1===(i=t[o])?this.sampleRate=this.readNum32LE(t,o+12):3===i&&this.readLoopData(t,o,u[r]),c=!0),o+=u[r];if(!c)break}}catch(t){e=t,console.log("ERROR PARSING OGG META DATA"),console.log(e)}return null},i.prototype.readLoopData=function(t,e,i){var r,o,s,n,a,h;for(a=[],r=o=s=e,n=e+i-10;s<=n?o<n:o>n;r=s<=n?++o:--o)if("LOOP"===this.readString(t,r,4)){for(h="";t[r]>0;)h+=String.fromCharCode(t[r++]);h.match(/LOOPSTART=([0-9]+)/)&&(this.loopStart=parseInt(RegExp.$1)),h.match(/LOOPLENGTH=([0-9]+)/)?a.push(this.loopLength=parseInt(RegExp.$1)):a.push(void 0)}else a.push(void 0);return a},i}(),e=function(e){function i(t){i.__super__.constructor.call(this,t),this.loopStart=0,this.loopLength=0,this.sampleRate=0,this.parse(t)}return r(i,t),i.prototype.parse=function(t){var e,i,r,o,s;try{if("ftyp"===this.readString(t,4,4)){for(i=0,o=[];i<t.length;)if(s=this.readNum32BE(t,i),"moov"===(r=this.readString(t,i+4,4)))o.push(i+=8);else{if("mvhd"===r&&(this.sampleRate=this.readNum32BE(t,i+20)),"udta"!==r&&"meta"!==r||this.readLoopData(t,i,s),i+=s,s<=1)break;o.push(void 0)}return o}}catch(t){return e=t,console.log("ERROR PARSING MP4/M4A META DATA"),console.log(e)}},i.prototype.readLoopData=function(t,e,i){var r,o,s,n,a,h,l;for(h=[],r=o=n=e,a=e+i-10;n<=a?o<a:o>a;r=n<=a?++o:--o)if("LOOP"===this.readString(t,r,4)){for(s="";t[r]>0;)s+=String.fromCharCode(t[r++]);if("LOOPSTART"===s||"LOOPLENGTH"===s){for(l="",r+=16;t[r]>0;)l+=String.fromCharCode(t[r++]);"LOOPSTART"===s?h.push(this.loopStart=parseInt(l)):h.push(this.loopLength=parseInt(l))}else h.push(void 0)}else h.push(void 0);return h},i}(),gs.BinaryData=t,gs.OggData=i,gs.Mp4Data=e}.call(this),function(){var t,e;e=function(){function t(){this.LEFT=1,this.MIDDLE=2,this.RIGHT=3,this.BUTTON_LEFT=1,this.BUTTON_MIDDLE=2,this.BUTTON_RIGHT=3,this.DIRECTION_NONE=0,this.DIRECTION_HORIZONTAL=1,this.DIRECTION_VERTICAL=2,this.DIRECTION_BOTH=3,this.buttons=new Uint8Array(new ArrayBuffer(4)),this.wheel=0,this.x=0,this.y=0,this.initialized=!1,this.hammer=null,this.screen=null,this.mouseMoveOnTouchDevices=0,this.moved=!1,this.buttonDown=!1,this.buttonUp=!1,this.wheelChanged=!1,this.lx=0,this.ly=0}return t.prototype.initialize=function(){return Graphics.canvas.addEventListener("scroll",function(t){return t.preventDefault()}),window.addEventListener("scroll",function(t){return t.preventDefault()}),window.addEventListener("touchmove",function(t){return t.preventDefault()}),window.addEventListener("touchstart",function(t){return t.preventDefault()}),window.addEventListener("touchend",function(t){return t.preventDefault()}),window.document.addEventListener("touchmove",function(t){return t.preventDefault()}),window.document.addEventListener("touchstart",function(t){return t.preventDefault()}),window.document.addEventListener("touchend",function(t){return t.preventDefault()}),jQuery(Graphics.canvas).bind("touchmove",function(t){return function(e){var i,r,o;return(e=e.originalEvent).preventDefault(),2===e.touches.length?(i=e.touches[0].clientY-t.ly,e.touches[0].clientX-t.lx,r=Math.max(0,e.touches[0].clientX-Graphics.x),o=Math.max(0,e.touches[0].clientY-Graphics.y),t.x=Math.round(r*Graphics.scaleFactorX),t.y=Math.round(o*Graphics.scaleFactorY),t.buttonDown=!1,t.buttons[1]=0,i>0&&(t.wheel=-1),i<0&&(t.wheel=1),t.wheelSpeed=i/.05,t.wheelChanged=!0):(r=Math.max(0,e.touches[0].clientX-Graphics.x),o=Math.max(0,e.touches[0].clientY-Graphics.y),t.x=Math.round(r*Graphics.scaleFactorX),t.y=Math.round(o*Graphics.scaleFactorY),t.buttons[1]=1,t.buttonDown=!0),t.ly=e.touches[0].clientY,t.lx=e.touches[0].clientX,!1}}(this)),jQuery(Graphics.canvas).bind("touchstart",function(t){return function(e){var i,r;return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),e=e.originalEvent,t.ly=e.touches[0].clientY,t.lx=e.touches[0].clientX,1===e.touches.length&&(i=Math.max(0,e.touches[0].clientX-Graphics.x),r=Math.max(0,e.touches[0].clientY-Graphics.y),t.x=Math.round(i*Graphics.scaleFactorX),t.y=Math.round(r*Graphics.scaleFactorY),t.buttons[1]=1,t.buttonDown=!0),2===e.touches.length&&(t.buttons[3]=1,t.buttonDown=!0),!1}}(this)),jQuery(Graphics.canvas).bind("touchend",function(t){return function(e){var i,r;return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),1===(e=e.originalEvent).changedTouches.length&&(i=Math.max(0,e.changedTouches[0].clientX-Graphics.x),r=Math.max(0,e.changedTouches[0].clientY-Graphics.y),t.x=Math.round(i*Graphics.scaleFactorX),t.y=Math.round(r*Graphics.scaleFactorY),t.buttons[1]=2,t.buttonUp=!0),3===e.changedTouches.length&&(t.buttons[3]=2,t.buttonUp=!0),t.lx=0,t.ly=0,!1}}(this)),jQuery.browser.mobile||($PARAMS.platform.isSteamOS?this.screen=require("screen"):jQuery(Graphics.canvas).mousemove(function(t){return function(e){return t.x=e.offsetX,t.y=e.offsetY,t.moved=!0}}(this)),jQuery(document).bind("contextmenu",function(t){return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1}),Graphics.canvas.addEventListener("mousewheel",function(t){return function(e){return t.updateMouseWheel(e),!1}}(this)),jQuery(Graphics.canvas).mousedown(function(t){return function(e){return t.buttons[e.which]=1,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.buttonDown=!0,!1}}(this)),jQuery(Graphics.canvas).mouseup(function(t){return function(e){return t.buttons[e.which]=2,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.buttonUp=!0,!1}}(this))),this.initialized=!0},t.prototype.updateMouseWheel=function(t){return this.wheel=t.wheelDelta>=0?1:-1,this.wheelSpeed=t.wheelDelta,this.wheelChanged=!0},t.prototype.isButton=function(t){var e;switch(e=!0,t){case this.LEFT:case this.MIDDLE:case this.RIGHT:e=!0;break;default:e=!1}return e},t.prototype.press=function(t){return 1===this.buttons[t]},t.prototype.update=function(){var t,e,i,r,o;for(t=e=0,o=this.buttons.length;0<=o?e<o:e>o;t=0<=o?++e:--e)2===this.buttons[t]&&(this.buttons[t]=0);return this.wheel=0,this.wheelSpeed=0,this.wheelChanged=!1,this.buttonDown=!1,this.buttonUp=!1,this.moved=!1,this.screen&&(i=this.screen.getCursorScreenPoint(),r=Graphics.canvas.getClientRects()[0],this.x=Math.max(i.x-r.left,0),this.y=Math.max(i.y-r.top,0),this.x=Math.min(Math.round(this.x*Graphics.scaleFactorX),Graphics.width),this.y=Math.min(Math.round(this.y*Graphics.scaleFactorY),Graphics.height),this.x===this.lx&&this.y===this.ly||(this.lx=this.x,this.ly=this.y,this.moved=!0)),null},t.prototype.clear=function(){var t,e,i,r;for(r=[],t=e=0,i=this.buttons.length;0<=i?e<i:e>i;t=0<=i?++e:--e)r.push(this.buttons[t]=0);return r},t}(),t=function(){function t(){this.LEFT=37,this.UP=38,this.RIGHT=39,this.DOWN=40,this.A=16,this.B=88,this.C=13,this.X=65,this.Y=83,this.Z=68,this.L=81,this.R=87,this.START=this.C,this.SELECT=this.Z,this.KEY_CANCEL=3,this.KEY_HELP=6,this.KEY_BACK_SPACE=8,this.KEY_TAB=9,this.KEY_CLEAR=12,this.KEY_RETURN=13,this.KEY_ENTER=14,this.KEY_SHIFT=16,this.KEY_CONTROL=17,this.KEY_ALT=18,this.KEY_PAUSE=19,this.KEY_CAPS_LOCK=20,this.KEY_ESCAPE=27,this.KEY_SPACE=32,this.KEY_PAGE_UP=33,this.KEY_PAGE_DOWN=34,this.KEY_END=35,this.KEY_HOME=36,this.KEY_LEFT=37,this.KEY_UP=38,this.KEY_RIGHT=39,this.KEY_DOWN=40,this.KEY_PRINTSCREEN=44,this.KEY_INSERT=45,this.KEY_DELETE=46,this.KEY_0=48,this.KEY_1=49,this.KEY_2=50,this.KEY_3=51,this.KEY_4=52,this.KEY_5=53,this.KEY_6=54,this.KEY_7=55,this.KEY_8=56,this.KEY_9=57,this.KEY_SEMICOLON=59,this.KEY_EQUALS=61,this.KEY_A=65,this.KEY_B=66,this.KEY_C=67,this.KEY_D=68,this.KEY_E=69,this.KEY_F=70,this.KEY_G=71,this.KEY_H=72,this.KEY_I=73,this.KEY_J=74,this.KEY_K=75,this.KEY_L=76,this.KEY_M=77,this.KEY_N=78,this.KEY_O=79,this.KEY_P=80,this.KEY_Q=81,this.KEY_R=82,this.KEY_S=83,this.KEY_T=84,this.KEY_U=85,this.KEY_V=86,this.KEY_W=87,this.KEY_X=88,this.KEY_Y=89,this.KEY_Z=90,this.KEY_CONTEXT_MENU=93,this.KEY_NUMPAD0=96,this.KEY_NUMPAD1=97,this.KEY_NUMPAD2=98,this.KEY_NUMPAD3=99,this.KEY_NUMPAD4=100,this.KEY_NUMPAD5=101,this.KEY_NUMPAD6=102,this.KEY_NUMPAD7=103,this.KEY_NUMPAD8=104,this.KEY_NUMPAD9=105,this.KEY_MULTIPLY=106,this.KEY_ADD=107,this.KEY_SEPARATOR=108,this.KEY_SUBTRACT=109,this.KEY_DECIMAL=110,this.KEY_DIVIDE=111,this.KEY_F1=112,this.KEY_F2=113,this.KEY_F3=114,this.KEY_F4=115,this.KEY_F5=116,this.KEY_F6=117,this.KEY_F7=118,this.KEY_F8=119,this.KEY_F9=120,this.KEY_F10=121,this.KEY_F11=122,this.KEY_F12=123,this.KEY_F13=124,this.KEY_F14=125,this.KEY_F15=126,this.KEY_F16=127,this.KEY_F17=128,this.KEY_F18=129,this.KEY_F19=130,this.KEY_F20=131,this.KEY_F21=132,this.KEY_F22=133,this.KEY_F23=134,this.KEY_F24=135,this.KEY_NUM_LOCK=144,this.KEY_SCROLL_LOCK=145,this.KEY_COMMA=188,this.KEY_PERIOD=190,this.KEY_SLASH=191,this.KEY_BACK_QUOTE=192,this.KEY_OPEN_BRACKET=219,this.KEY_BACK_SLASH=220,this.KEY_CLOSE_BRACKET=221,this.KEY_QUOTE=222,this.KEY_META=224,this.keyDown=!1,this.keyUp=!1,this.keys=new Uint8Array(new ArrayBuffer(256)),this.repeatedKeys=new Uint8Array(new ArrayBuffer(256)),this.triggeredKeys=new Uint8Array(new ArrayBuffer(256)),this.pressTimes=new Uint32Array(new ArrayBuffer(1024)),this.gamepadButtons=[14,15,12,13,0,1,2,3,0],this.gamepadKeys=[this.LEFT,this.RIGHT,this.UP,this.DOWN,this.A,this.B,this.X,this.Y,this.C],this.gamepadKeyStates=[0,0,0,0,0,0,0,0,0],this.Mouse=new e,this.Gamepad=null}return Object.defineProperty(t.prototype,"touchButtonsEnabled",{get:function(){return this.touchButtonsEnabled_},set:function(t){return this.touchButtonsEnabled_=t,t?(jQuery(window).bind("touchstart",this._onTouchStart),jQuery(window).bind("touchend",this._onTouchEnd)):(jQuery(window).unbind("touchstart",this._onTouchStart),jQuery(window).unbind("touchend",this._onTouchEnd))}}),t.prototype._onTouchStart=function(t){var e,i,r;if(t.preventDefault(),this.touchButtonsEnabled)return this.tsx=t.originalEvent.touches[0].clientX,this.tsy=t.originalEvent.touches[0].clientY,r=window.innerWidth/4,i=window.innerHeight/2,e=Math.round(i/3),this.tsx>3*r&&this.tsy>i?this.keys[this.B]=1:this.tsx>3*r&&this.tsy<i?this.keys[this.X]=1:this.tsx>2*r&&this.tsy>i?this.keys[this.A]=1:this.tsx>2*r&&this.tsy<i?this.keys[this.Y]=1:this.tsx<1*r&&this.tsy>i&&this.tsy<i+e?(this.keys[this.UP]=1,this.upFrameCount=Graphics.frameCount):this.tsx<1*r&&this.tsy>i+2*e?(this.keys[this.DOWN]=1,this.downFrameCount=Graphics.frameCount):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx<r/2?(this.keys[this.LEFT]=1,this.leftFrameCount=Graphics.frameCount):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx>r/2?(this.keys[this.RIGHT]=1,this.rightFrameCount=Graphics.frameCount):void 0},t.prototype._onTouchEnd=function(t){var e,i,r;if(t.preventDefault(),this.touchButtonsEnabled)return r=window.innerWidth/4,i=window.innerHeight/2,e=Math.round(i/3),this.tsx>3*r&&this.tsy>i?(this.keys[this.B]=2,this.pressTimes[this.B]=0):this.tsx>3*r&&this.tsy<i?(this.keys[this.X]=2,this.pressTimes[this.X]=0):this.tsx>2*r&&this.tsy>i?(this.keys[this.A]=2,this.pressTimes[this.A]=0):this.tsx>2*r&&this.tsy<i?(this.keys[this.Y]=2,this.pressTimes[this.Y]=0):this.tsx<1*r&&this.tsy>i&&this.tsy<i+e?(this.keys[this.UP]=2,this.pressTimes[this.UP]=0):this.tsx<1*r&&this.tsy>i+2*e?(this.keys[this.DOWN]=2,this.pressTimes[this.DOWN]=0):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx<r/2?(this.keys[this.LEFT]=2,this.pressTimes[this.LEFT]=0):this.tsx<1*r&&this.tsy>i+e&&this.tsy<i+2*e&&this.tsx>r/2?(this.keys[this.RIGHT]=2,this.pressTimes[this.RIGHT]=0):void 0},t.prototype.initialize=function(){return jQuery.browser.mobile&&(this.C=this.A,this.touchButtonsEnabled=!1,this.isTouchDevice=!0),this.leftFrameCount=0,this.rightFrameCount=0,this.upFrameCount=0,this.downFrameCount=0,jQuery(document).keydown(function(t){return function(e){if(!Graphics.frozen)return t.keyDown=!0,t.keys[e.keyCode]=1,e.keyCode===t.LEFT&&(t.leftFrameCount=Graphics.frameCount),e.keyCode===t.RIGHT&&(t.rightFrameCount=Graphics.frameCount),e.keyCode===t.UP&&(t.upFrameCount=Graphics.frameCount),e.keyCode===t.DOWN?t.downFrameCount=Graphics.frameCount:void 0}}(this)),jQuery(document).keyup(function(t){return function(e){return t.keyUp=!0,t.keys[e.keyCode]=2,t.pressTimes[e.keyCode]=0}}(this))},t.prototype.press=function(t){return 1===this.keys[t]},t.prototype.release=function(t){return 2===this.keys[t]},t.prototype.trigger=function(t){return 1===this.triggeredKeys[t]},t.prototype.repeat=function(t){return 1===this.repeatedKeys[t]},t.prototype.dir4=function(){return 1===this.keys[this.LEFT]&&(jQuery.browser.mobile||this.leftFrameCount>this.rightFrameCount&&this.leftFrameCount>this.upFrameCount&&this.leftFrameCount>this.downFrameCount)?4:1===this.keys[this.RIGHT]&&(jQuery.browser.mobile||this.rightFrameCount>this.leftFrameCount&&this.rightFrameCount>this.upFrameCount&&this.rightFrameCount>this.downFrameCount)?8:1===this.keys[this.UP]&&(jQuery.browser.mobile||this.upFrameCount>this.downFrameCount&&this.upFrameCount>this.leftFrameCount&&this.upFrameCount>this.rightFrameCount)?6:1===this.keys[this.DOWN]&&(jQuery.browser.mobile||this.downFrameCount>this.upFrameCount&&this.downFrameCount>this.leftFrameCount&&this.downFrameCount>this.rightFrameCount)?2:0},t.prototype.dir8=function(){return 1===this.keys[this.LEFT]&&1===this.keys[this.UP]?7:1===this.keys[this.RIGHT]&&1===this.keys[this.UP]?5:1===this.keys[this.RIGHT]&&1===this.keys[this.DOWN]?3:1===this.keys[this.LEFT]&&1===this.keys[this.DOWN]?1:this.dir4()},t.prototype.clear=function(){var t,e,i;for(t=e=0,i=this.keys.length;0<=i?e<i:e>i;t=0<=i?++e:--e)this.keys[t]=0,this.triggeredKeys[t]=0,this.pressTimes[t]=0;if(this.Mouse.initialized)return this.Mouse.clear()},t.prototype.update=function(){var t,e,i,r,o,s,n;if(this.keyDown=!1,this.keyUp=!1,null!=this.Gamepad)for(this.Gamepad=navigator.getGamepads()[0],t=e=0,s=this.gamepadKeys.length;0<=s?e<s:e>s;t=0<=s?++e:--e){if(r=this.gamepadKeys[t],!(o=this.Gamepad.buttons[this.gamepadButtons[t]].pressed))switch(t){case 0:o=Math.round(this.Gamepad.axes[0])<0;break;case 1:o=Math.round(this.Gamepad.axes[0])>0;break;case 2:o=Math.round(this.Gamepad.axes[1])<0;break;case 3:o=Math.round(this.Gamepad.axes[1])>0}1!==this.gamepadKeyStates[t]&&o?(this.keys[r]=1,this.gamepadKeyStates[t]=1,r===this.LEFT&&(this.leftFrameCount=Graphics.frameCount),r===this.RIGHT&&(this.rightFrameCount=Graphics.frameCount),r===this.UP&&(this.upFrameCount=Graphics.frameCount),r===this.DOWN&&(this.downFrameCount=Graphics.frameCount)):1!==this.gamepadKeyStates[t]||o||(this.gamepadKeyStates[t]=0,this.keys[r]=2,this.pressTimes[r]=0)}for(this.Mouse.initialized&&this.Mouse.update(),t=i=0,n=this.keys.length;0<=n?i<n:i>n;t=0<=n?++i:--i)this.repeatedKeys[t]=0,2===this.keys[t]&&(this.keys[t]=0),1===this.keys[t]&&this.pressTimes[t]++,1===this.pressTimes[t]?this.triggeredKeys[t]=1:this.triggeredKeys[t]=0,1===this.pressTimes[t]||this.pressTimes[t]>20&&0==(3&this.pressTimes[t])?this.repeatedKeys[t]=1:this.repeatedKeys[t]=0;if(0===this.keys[this.LEFT]&&(this.leftFrameCount=0),0===this.keys[this.RIGHT]&&(this.rightFrameCount=0),0===this.keys[this.UP]&&(this.upFrameCount=0),0===this.keys[this.DOWN])return this.downFrameCount=0},t}(),window.Input=new t,gs.Input=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t,e,r){i.__super__.constructor.apply(this,arguments),this.context_=null,this.filePath=t,this.languageCode=r,this.loaded=!1,this.playing=!1,this.source=null,this.encodedBuffer=null,this.decodedBuffer=null,this.playIfReadyData=null,this.decoded=!1,this.fadeInTime=0,this.fadeOutTime=0,this.fadeInVolume=0,this.playTime=0,this.customData={},this.loop=!1,gs.Audio.addAudioBuffer(this),this.gainNode=null!=this.context.createGain?this.context.createGain():this.context.createGainNode(),t=gs.Application.getPlatformSpecificAudioFilePath(t,r),gs.Application.loadData(t,function(e){return function(i){var r;return e.encodedBuffer=GS.DataPreparer.prepare(i),r=null,t.toLowerCase().endsWith(".ogg")?r=new gs.OggData(new Uint8Array(i)):(t.toLowerCase().endsWith(".m4a")||t.toLowerCase().endsWith(".mp4"))&&(r=new gs.Mp4Data(new Uint8Array(i))),(null!=r?r.loopLength:void 0)>0&&(null!=r?r.sampleRate:void 0)>0&&(e.loopLength=r.loopLength/r.sampleRate,e.loopStart=r.loopStart/r.sampleRate),e.decode()}}(this),function(t){return function(e){return t.loaded=!0,t.error=!0,t.errorObject=e,console.log("AUDIO ERROR"),console.log(e)}}(this))}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,gs.EventEmitter),i.audioBuffers=[],i.fromDataBundle=function(t,e){var i;return i=null,t.filePath&&((i=ResourceManager.getAudioBuffer(t.filePath)).volume=t.volume,i.playbackRate=t.playbackRate,i.currentTime=t.currentTime,i.loop=t.loop,t.isPlaying&&(i.playIfReadyData=t)),i},i.toDataBundle=function(t,e){return{filePath:t.filePath,loop:t.loop,volume:t.volume,playbackRate:t.playbackRate,currentTime:t.currentTime,isPlaying:t.isPlaying}},Object.defineProperty(i.prototype,"context",{get:function(){return this.context_!==GS.Audio.context&&(this.context_=GS.Audio.context,this.gainNode=null!=this.context_.createGain?this.context_.createGain():this.context_.createGainNode()),this.context_}}),Object.defineProperty(i.prototype,"volume",{set:function(t){if(!this.error)return null!=this.context?this.gainNode.gain.value=t:this.source.volume=t},get:function(){var t,e;return this.error?0:null!=this.context?null!=(t=null!=(e=this.gainNode)?e.gain.value:void 0)?t:100:this.source.volume}}),Object.defineProperty(i.prototype,"isPlaying",{get:function(){return null!=this.context?this.playing:!this.source.paused}}),Object.defineProperty(i.prototype,"duration",{get:function(){var t,e;return null!=this.context&&null!=(t=null!=(e=this.decodedBuffer)?e.duration:void 0)?t:0}}),Object.defineProperty(i.prototype,"loop",{get:function(){return this.loop_},set:function(t){var e,i,r;if(this.loop_!==t&&(this.loop_=t,null!=(e=this.source)&&(e.loop=this.loop),this.loopLength>0&&this.loop))return null!=(i=this.source)&&(i.loopStart=this.loopStart),null!=(r=this.source)?r.loopEnd=this.loopStart+this.loopLength:void 0}}),Object.defineProperty(i.prototype,"currentTime",{get:function(){return this.context.currentTime-this.startTime},set:function(t){var e;return null!=(e=this.source)?e.currentTime=t:void 0}}),Object.defineProperty(i.prototype,"playbackRate",{set:function(t){if(this.source)return this.context?this.source.playbackRate.value=t:this.source.playbackRate=t},get:function(){var t,e;return this.source?this.context?null!=(t=null!=(e=this.source)?e.playbackRate.value:void 0)?t:100:this.source.playbackRate:100}}),i.prototype.bufferToBase64=function(t){var e,i,r,o,s;for(e="",r=o=0,s=(i=new Uint8Array(t)).byteLength;0<=s?o<s:o>s;r=0<=s?++o:--o)e+=String.fromCharCode(i[r]);return window.btoa(e)},i.prototype.dispose=function(){var t,e;if(i.audioBuffers.remove(this),!this.disposed)return this.stop(),this.disposed=!0,gs.Audio.removeAudioBuffer(this),(null!=(t=this.source)?t.numberOfOutputs:void 0)>0&&this.source.disconnect(),(null!=(e=this.gainNode)?e.numberOfOutputs:void 0)>0&&this.gainNode.disconnect(),this.gainNode=null,this.encodedBuffer=null,this.decodedBuffer=null,this.source=null,this.decoded=!1},i.prototype.decode=function(){if(null==this.context)return this.decoded=!0,null!=this.onFinishDecode&&this.onFinishDecode(this),this.emit("finishDecode");if(this.decoded)return null!=this.onFinishDecode&&this.onFinishDecode(this),void this.emit("finishDecode");try{return this.context.decodeAudioData(this.encodedBuffer,function(t){return function(e){return t.decodedBuffer=e,t.loaded=!0,t.source=t.context.createBufferSource(),t.source.buffer=t.decodedBuffer,t.source.onended=function(){if(t.playing=!1,null!=t.onEnd)return t.onEnd(t)},t.decoded=!0,null!=t.onFinishDecode&&t.onFinishDecode(t),t.emit("finishDecode")}}(this),function(t){return function(e){return t.loaded=!0,t.decoded=!0,t.error=!0,console.log("DECODE ERROR"),console.log(e)}}(this))}catch(t){return this.loaded=!0,this.decoded=!0}},i.prototype.update=function(){if(this.playIfReadyData&&this.loaded&&(this.play(null,null,null,this.playIfReadyData.currentTime),this.volume=this.playIfReadyData.volume,this.playbackRate=this.playIfReadyData.playbackRate,this.loop=this.playIfReadyData.loop,this.playIfReadyData=null),this.playTime>0&&this.playing&&(this.playTime--,this.playTime<=this.fadeOutTime&&(this.fadeInTime=this.playTime,this.playTime=0,this.fadeInVolume=-this.volume/this.fadeInTime)),this.fadeInTime>0&&!this.error&&(this.fadeInTime--,this.volume=Math.max(Math.min(this.volume+this.fadeInVolume,1),0),this.fadeInTime<=0&&(this.fadeInVolume<0&&null!=this.onFadeOutEnd&&this.onFadeOutEnd(this),this.fadeInVolume>0&&null!=this.onFadeInEnd)))return this.onFadeInEnd(this)},i.prototype.play=function(t,e,i,r){var o,s,n,a,h;if(!this.error)return this.context?(this.playTime=e,this.fadeInTime=t||0,this.fadeOutTime=i||0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),this.playing=!0,o=null!=(s=null!=(n=this.source)?n.playbackRate.value:void 0)?s:1,(null!=(a=this.source)?a.numberOfOutputs:void 0)>0&&(this.source.buffer=null,this.source.disconnect()),(null!=(h=this.gainNode)?h.numberOfOutputs:void 0)>0&&this.gainNode.disconnect(),this.source=this.context.createBufferSource(),this.source.buffer=this.decodedBuffer,this.source.loop=this.loop,this.loopLength>0&&this.loop&&(this.source.loopStart=this.loopStart,this.source.loopEnd=this.loopStart+this.loopLength),this.source.onended=function(t){return function(){if(t.playing=!1,null!=t.onEnd&&t.onEnd(t),t.loop)return t.play()}}(this),this.source.connect(this.gainNode),this.gainNode.connect(this.context.destination),this.source.playbackRate.value=o,this.startTime=this.context.currentTime,null!=this.source.noteOn?this.source.noteOn(0,r||0):this.source.start(0,r||0)):this.source.play()},i.prototype.resume=function(t){var e;if(!this.error)return this.context?(this.fadeInTime=t||0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),e=this.playbackRate,this.playing=!0,this.source=this.context.createBufferSource(),this.source.loop=this.loop,this.loopLength>0&&this.loop&&(this.source.loopStart=this.loopStart,this.source.loopEnd=this.loopStart+this.loopLength),this.source.onended=function(t){return function(){if(t.playing=!1,null!=t.onEnd)return t.onEnd(t)}}(this),this.source.buffer=this.decodedBuffer,this.source.connect(this.gainNode),this.playbackRate=e,null!=this.stopTime&&null!=this.startTime?this.source.start(0,this.stopTime-this.startTime):this.source.start(0)):this.source.paused=!1},i.prototype.stop=function(t){if(!this.error){if(this.fadeInTime=t||0,this.fadeInTime>0)return this.fadeInVolume=-this.volume/this.fadeInTime,this.onFadeOutEnd=function(t){return function(){if(null!=t.source){if(null==t.context)return t.source.paused=!0;if(t.stopTime=t.context.currentTime,t.playing)return t.source.onended=null,null!=t.source.noteOff?t.source.noteOff(0):t.source.stop(0),t.source.numberOfOutputs>0&&t.source.disconnect(),t.playing=!1}}}(this);if(null!=this.source){if(null==this.context)return this.source.paused=!0;if(this.stopTime=this.context.currentTime,this.playing)return null!=this.source.noteOff?this.source.noteOff(0):this.source.stop(0),this.source.numberOfOutputs>0&&this.source.disconnect(),this.playing=!1}}},i.prototype.toDataURL=function(){return this.source.src||""},i}(),window.GS.AudioBuffer=t,gs.AudioBuffer=t}.call(this),function(){var t;t=function(){function t(){this.context=null,this.gainNode=null,this.audioBuffers=[];try{null!=window.webkitAudioContext?this.context=new webkitAudioContext:null!=window.mozAudioContext?this.context=new mozAudioContext:null!=window.oAudioContext?this.context=new oAudioContext:this.context=new AudioContext,this.gainNode=null!=this.context.createGain?this.context.createGain():this.context.createGainNode()}catch(t){t,this.context=null}}return t.prototype.reset=function(){return this.gainNode.numberOfOutputs>0&&this.gainNode.disconnect(),this.context.close(),null!=window.webkitAudioContext?this.context=new webkitAudioContext:null!=window.mozAudioContext?this.context=new mozAudioContext:null!=window.oAudioContext?this.context=new oAudioContext:this.context=new AudioContext,this.gainNode=null!=this.context.createGain?this.context.createGain():this.context.createGainNode()},t.prototype.addAudioBuffer=function(t){return this.audioBuffers.push(t)},t.prototype.removeAudioBuffer=function(t){return this.audioBuffers.remove(t)},t.prototype.pause=function(){var t,e,i,r,o,s;for(o=this.audioBuffers,s=[],i=0,r=o.length;i<r;i++)if(null!=(t=o[i])){t.customData.wasPlaying=t.isPlaying;try{t.isPlaying?s.push(t.stop(0)):s.push(void 0)}catch(t){e=t,s.push(console.warn(e))}}else s.push(void 0);return s},t.prototype.resume=function(){var t,e,i,r,o;for(o=[],e=0,i=(r=this.audioBuffers).length;e<i;e++)null!=(t=r[e])&&t.customData.wasPlaying?o.push(null!=t?t.resume(0):void 0):o.push(void 0);return o},t}(),window.GS.Audio=new t,gs.Audio=GS.Audio}.call(this),function(){var t;t=function(){function t(t,e){this.context_=null,this.audioBuffer=t,this.loop=!1,this.playing=!1,this.source=null,this.customData={},this.useAnalyser=null!=e&&e,this.startTime=0,this.stopTime=0,gs.Audio.addAudioBuffer(this),null!=this.audioBuffer&&this.initialize()}return t.audioBufferRefs=[],t.fromDataBundle=function(t,e){var i;return i=null,t.audioBuffer&&(gs.ObjectCodec.decodeProperties(t,e),i=new gs.AudioBufferReference(null,t.useAnalyser),t.audioBuffer.decoded?(i.audioBuffer=t.audioBuffer,i.initialize(),i.volume=t.volume,i.playbackRate=t.playbackRate,t.isPlaying&&i.play()):t.audioBuffer.once("finishDecode",{audioBuffer:t.audioBuffer,reference:i},function(t){var e;if((null!=(e=t.data.audioBuffer)?e.decoded:void 0)&&(t.data.reference.audioBuffer=t.data.audioBuffer,t.data.reference.initialize(),t.data.reference.isPlaying))return t.data.reference.play()}),i.customData=t.customData),i},t.toDataBundle=function(t,e){var i;return i={audioBuffer:t.audioBuffer,customData:t.customData,useAnalyzer:t.useAnalyzer,volume:t.volume,playbackRate:t.playbackRate,isPlaying:t.isPlaying},gs.ObjectCodec.encodeProperties(i,e,null)},Object.defineProperty(t.prototype,"context",{get:function(){return this.context_!==GS.Audio.context&&(this.context_=GS.Audio.context,this.gainNode=null!=this.context_.createGain?this.context_.createGain():this.context_.createGainNode(),this.useAnalyser&&this.createAnalyser()),this.context_}}),Object.defineProperty(t.prototype,"volume",{set:function(t){if(!this.audioBuffer.error)return null!=this.context?this.gainNode.gain.value=t:this.source.volume=t},get:function(){return this.audioBuffer.error?100:null!=this.context?this.gainNode.gain.value:this.source.volume}}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!this.audioBuffer.error&&(null!=this.context?this.playing:!this.source.paused)}}),Object.defineProperty(t.prototype,"duration",{get:function(){var t,e,i;return null!=this.context&&null!=(t=null!=(e=this.audioBuffer)&&null!=(i=e.decodedBuffer)?i.duration:void 0)?t:0}}),Object.defineProperty(t.prototype,"playbackRate",{set:function(t){var e,i;if(!this.audioBuffer.error)return this.context?null!=(e=this.source)?e.playbackRate.value=t:void 0:null!=(i=this.source)?i.playbackRate=t:void 0},get:function(){var t;if(!this.audioBuffer.error)return this.context?(null!=(t=this.source)?t.playbackRate.value:void 0)||100:this.source.playbackRate}}),t.prototype._getAverageVolume=function(t){var e,i,r,o,s;for(s=0,0,e=i=0,o=r=t.length;0<=o?i<o:i>o;e=0<=o?++i:--i)s+=t[e];return s/r},t.prototype.initialize=function(){if(!this.audioBuffer.error)return this.useAnalyser&&this.createAnalyser(),this.context?(this.gainNode=null!=this.context.createGain?this.context.createGain():this.context.createGainNode(),this.source=this.context.createBufferSource(),null!=this.analyser&&this.source.connect(this.analyser),this.source.buffer=this.audioBuffer.decodedBuffer,this.source.onended=function(t){return function(){if(t.playing=!1,null!=t.onEnd)return t.onEnd(t)}}(this)):(this.source=new Audio,this.source.src=this.audioBuffer.toDataURL())},t.prototype.createAnalyser=function(){return this.analyser=this.context.createAnalyser(),this.analyser.smoothingTimeConstant=.3,this.analyser.fftSize=1024,this.averageVolume=0,this.scriptProcessor=this.context.createScriptProcessor(2048,1,1),this.scriptProcessor.onaudioprocess=function(t){return function(){var e;return e=new Uint8Array(t.analyser.frequencyBinCount),t.analyser.getByteFrequencyData(e),t.averageVolume=t._getAverageVolume(e)}}(this),this.scriptProcessor.connect(this.context.destination),this.analyser.connect(this.scriptProcessor)},t.prototype.dispose=function(){return t.audioBufferRefs.remove(this),gs.Audio.removeAudioBuffer(this),this.source=null},t.prototype.play=function(){var t,e;if(!this.audioBuffer.error)return this.context?(this.startTime=this.context.currentTime,this.playing=!0,e=this.source.playbackRate.value,t=this.source.buffer,this.source=this.context.createBufferSource(),this.source.loop=this.loop,null!=this.analyser&&this.source.connect(this.analyser),this.source.buffer=t,this.source.onended=function(t){return function(){if(t.playing=!1,null!=t.onEnd)return t.onEnd(t)}}(this),this.source.connect(this.gainNode),this.gainNode.connect(this.context.destination),this.source.playbackRate.value=e,null!=this.source.noteOn?this.source.noteOn(0):this.source.start(0)):this.source.play()},t.prototype.resume=function(){var t,e;if(!this.audioBuffer.error)return this.context?(this.playing=!0,e=this.source.playbackRate.value,t=this.source.buffer,this.source=this.context.createBufferSource(),null!=this.analyser&&this.source.connect(this.analyser),this.source.buffer=t,this.source.onended=function(t){return function(){if(t.playing=!1,null!=t.onEnd)return t.onEnd(t)}}(this),this.source.connect(this.gainNode),this.gainNode.connect(this.context.destination),this.source.playbackRate.value=e,null!=this.source.noteOn?this.source.noteOn(0,this.stopTime-this.startTime):this.source.start(0,this.stopTime-this.startTime)):this.source.paused=!1},t.prototype.stop=function(){if(!this.audioBuffer.error&&this.source){if(!this.context)return this.source.pause(),this.source.currentTime=0;if(this.playing)return this.stopTime=this.context.currentTime,null!=this.source.noteOff?this.source.noteOff(0):this.source.stop(0),this.source.numberOfOutputs>0&&this.source.disconnect(),this.playing=!1}},t}(),window.GS.AudioBufferReference=t,gs.AudioBufferReference=t}.call(this),function(){var t;t=function(){function t(t,e){var i;this.filePath=t,this.languageCode=e,this.context=GS.Audio.context,this.loaded=!1,this.playing=!1,this.source=null,this.encodedBuffer=null,this.decodedBuffer=null,this.decoded=!1,this.fadeInTime=0,this.fadeOutTime=0,this.fadeInVolume=0,this.playTime=0,this.customData={},this.loop=!1,this.audioStream=null,gs.Audio.addAudioBuffer(this),i=gs.Application.getPlatformSpecificAudioFilePath(t,e,!0),t=gs.Application.getPlatformSpecificAudioFilePath(t,e),this.audioStream=new Audio,this.audioStream.addEventListener("loadeddata",function(t){return function(){return t.loaded=!0}}(this)),this.audioStream.canplaythrough=function(t){return function(){return t.loaded=!0}}(this),this.audioStream.addEventListener("error",function(t){return function(){return t.loaded=!0,t.error=!0}}(this)),this.audioStream.addEventListener("ended",function(t){return function(){var e;if(null!=t.onEnd&&t.onEnd(t),t.loop)return t.play(),t.audioStream.currentTime=null!=(e=t.loopStart)?e:0}}(this)),gs.Platform.isSafariMobile&&gs.Platform.isCordova?$PARAMS.needsPreparation?gs.Application.loadData(t,function(t){return function(e,i){var r;return e=GS.DataPreparer.prepare(e),r=new FileReader,r.onload=function(e){return t.audioStream.src=e.target.result,t.audioStream.load()},r.onerror=onerror,r.readAsDataURL(new Blob([e],{type:i}))}}(this),function(t){return onerror()},0,"audio/"+i.substring(i.lastIndexOf(".")+1)):gs.Application.loadData(t,function(t){return function(e){return t.audioStream.src=e,t.audioStream.load()}}(this),function(t){return function(e){return t.loaded=!0,t.error=!0}}(this),1):($PARAMS.needsPreparation,gs.Application.loadData(t,function(t){return function(e,i){var r;return e=GS.DataPreparer.prepare(e),r=new FileReader,r.onload=function(e){return t.audioStream.src=e.target.result,t.audioStream.load()},r.onerror=onerror,r.readAsDataURL(new Blob([e],{type:i}))}}(this),function(t){return onerror()},0,"audio/"+i.substring(i.lastIndexOf(".")+1)))}return t.fromDataBundle=function(t,e){var i;return i=null,t.filePath&&((i=new gs.AudioBufferStream(t.filePath,!1,t.languageCode)).volume=t.volume,i.playbackRate=t.playbackRate,i.currentTime=t.currentTime,t.isPlaying&&(i.play(),i.currentTime=t.currentTime)),i},t.toDataBundle=function(t,e){return{filePath:t.filePath,volume:t.volume,playbackRate:t.playbackRate,currentTime:t.currentTime,isPlaying:t.isPlaying}},Object.defineProperty(t.prototype,"volume",{set:function(t){return this.error?0:this.audioStream.volume=t},get:function(){return this.error?0:this.audioStream.volume}}),Object.defineProperty(t.prototype,"duration",{get:function(){return this.error?0:this.audioStream.duration}}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this.error?0:this.audioStream.currentTime},set:function(t){return this.audioStream.currentTime=t}}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!this.audioStream.paused}}),Object.defineProperty(t.prototype,"playbackRate",{set:function(t){if(this.audioStream)return this.audioStream.playbackRate=t},get:function(){return this.audioStream?this.audioStream.playbackRate:100}}),t.prototype.dispose=function(){var t,e;if(!this.disposed)return this.disposed=!0,gs.Audio.removeAudioBuffer(this),this.decodedBuffer=null,this.source=null,this.decoded=!1,null!=(t=this.audioStream)&&t.pause(),null!=(e=this.audioStream)&&(e.src=""),delete this.audioStream},t.prototype.decode=function(){if(this.decoded=!0,null!=this.onFinishDecode)return this.onFinishDecode(this)},t.prototype.update=function(){if(this.playTime>0&&this.playing&&(this.playTime--,this.playTime<=this.fadeOutTime&&(this.fadeInTime=this.playTime,this.playTime=0,this.fadeInVolume=-this.volume/this.fadeInTime)),this.fadeInTime>0&&!this.error&&(this.fadeInTime--,this.volume=Math.max(Math.min(this.volume+this.fadeInVolume,1),0),0===this.fadeInTime&&(this.fadeInVolume<0&&null!=this.onFadeOutEnd&&this.onFadeOutEnd(this),this.fadeInVolume>0&&null!=this.onFadeInEnd&&this.onFadeInEnd(this))),this.playing&&this.audioStream.currentTime>=this.loopStart+this.loopLength)return this.audioStream.currentTime=this.loopStart},t.prototype.play=function(t,e,i){if(!this.error)return this.fadeInTime>0&&(this.volume=Math.max(Math.min(this.volume+this.fadeInTime*this.fadeInVolume,1),0)),this.playTime=e,this.fadeInTime=t||0,this.fadeOutTime=i||0,this.audioStream.currentTime=0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),this.playing=!0,this.audioStream.play()},t.prototype.resume=function(t){if(!this.error)return this.fadeInTime>0&&(this.volume=Math.max(Math.min(this.volume+this.fadeInTime*this.fadeInVolume,1),0)),this.fadeInTime=t||0,this.fadeInTime>0&&(this.fadeInVolume=this.volume/this.fadeInTime,this.volume=0),this.playing=!0,this.audioStream.play()},t.prototype.stop=function(t){var e;if(!this.error&&this.isPlaying)return this.fadeInTime>0&&(this.volume=Math.max(Math.min(this.volume+this.fadeInTime*this.fadeInVolume,1),0)),this.fadeInTime=t||0,this.fadeInTime>0?(e=this.volume,this.fadeInVolume=-this.volume/this.fadeInTime,this.onFadeOutEnd=function(t){return function(){return null!=t.audioStream&&t.audioStream.pause(),t.volume=e}}(this)):null!=this.audioStream?this.audioStream.pause():void 0},t.prototype.toDataURL=function(){return this.source.src||""},t}(),window.GS.AudioBufferStream=t,window.gs.AudioBufferStream=t}.call(this),function(){var t;t=function(){function t(){}return t.prepare=function(t){var e,i,r,o,s;if(!$PARAMS.needsPreparation)return t;for(i=GS.DataPreparer.generateKey(),r=o=0,s=(e=new Uint8Array(t)).length;0<=s?o<s:o>s;r=0<=s?++o:--o)e[r]=e[r]^i[r%i.length];return t},t.prepareFilePath=function(t){return t},t.generateKey=function(){var t,e,i,r,o,s,n;return null==window.$PARAMS||$PARAMS.needsPreparation?(r=new Int32Array([0,0,0,0,0]),s=new Int32Array([42,11,23,88,133]),o=Module._malloc(r.length*r.BYTES_PER_ELEMENT),n=Module._malloc(s.length*s.BYTES_PER_ELEMENT),(e=new Uint8Array(Module.HEAPU8.buffer,o,r.length*r.BYTES_PER_ELEMENT)).set(new Uint8Array(r.buffer)),(i=new Uint8Array(Module.HEAPU8.buffer,n,s.length*s.BYTES_PER_ELEMENT)).set(new Uint8Array(s.buffer)),Module.ccall("ac6d78ea1cf7fe1","void",["number","number","number","number"],[e.byteOffset,r.length,i.byteOffset,s.length]),t=new Int32Array(e.buffer,e.byteOffset,r.length),Module._free(e.byteOffset),Module._free(i.byteOffset),t):[0]},t}(),GS.DataPreparer=t,window.gs||(window.gs={}),window.gs.DataPreparer=t}.call(this),function(){var t;(t=function(){function t(t,e,i,r){null==t?(this.red=255,this.green=255,this.blue=255,this.alpha=255):null==e?(this.red=t.red,this.green=t.green,this.blue=t.blue,this.alpha=t.alpha):(this.red=t,this.green=e,this.blue=i,this.alpha=null!=r?r:255)}return t.prototype.setFromArray=function(t){return this.red=t[0],this.green=t[1],this.blue=t[2],this.alpha=t[3]},t.prototype.setFromObject=function(t){return this.red=t.red,this.green=t.green,this.alpha=t.blue,this.blue=t.alpha},t.prototype.set=function(t,e,i,r){return null==t?(this.red=255,this.green=255,this.blue=255,this.alpha=255):null==e?(this.red=t.red,this.green=t.green,this.blue=t.blue,this.alpha=t.alpha):(this.red=t,this.green=e,this.blue=i,null!=r?this.alpha=r:void 0)},t.prototype.setFromObject=function(t){var e,i,r,o;return this.red=null!=(e=t.red)?e:this.red,this.green=null!=(i=t.green)?i:this.green,this.blue=null!=(r=t.blue)?r:this.blue,this.alpha=null!=(o=t.alpha)?o:this.alpha},t.prototype.toString=function(){return"rgba({0}, {1}, {2}, {3})".format(this.red,this.green,this.blue,this.alpha)},t.prototype.toFillStyle=function(){return"rgba({0}, {1}, {2}, {3})".format(this.red,this.green,this.blue,.00392156862745*this.alpha)},t.prototype.equals=function(t){return this.red===t.red&&this.green===t.green&&this.blue===t.blue&&this.alpha===t.alpha},t.compare=function(t,e){return t&&e&&t.red===e.red&&t.green===e.green&&t.blue===e.blue&&t.alpha===e.alpha},t.fromArray=function(e){return new t(e[0],e[1],e[2],e[3])},t.fromObject=function(e){return new t(e.red,e.green,e.blue,e.alpha)},t.rgbToHsl=function(t,e,i){var r,o,s,n,a,h;return t/=255,e/=255,i/=255,r=Math.max(t,e,i),o=Math.min(t,e,i),s=r-o,a=(r+o)/2,n=0,h=0,n=0===s?0:r===t?(e-i)/s%6*60:r===e?60*((i-t)/s+2):60*((t-e)/s+4),h=0===s?0:s/(1-Math.abs(2*a-1)),{h:n,s:h,l:a}},t.hslToRgb=function(t,e,i){var r,o,s,n,a,h;return o=(1-Math.abs(2*i-1))*e,h=o*(1-Math.abs(t/60%2-1)),n=i-o/2,a=0,s=0,r=0,t<60?(a=o,s=h,r=0):t<120?(a=h,s=o,r=0):t<180?(a=0,s=o,r=h):t<240?(a=0,s=h,r=o):t<300?(a=h,s=0,r=o):(a=o,s=0,r=h),a=Math.max(Math.floor(255*(a+n)),0),s=Math.max(Math.floor(255*(s+n)),0),r=Math.max(Math.floor(255*(r+n)),0),{r:a,g:s,b:r}},t}()).TRANSPARENT=new t(0,0,0,0),t.BLACK=new t(0,0,0,255),t.WHITE=new t(255,255,255,255),window.Color=t,gs.Color=t}.call(this),function(){var t;t=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.set=function(t,e){return this.x=t,this.y=e},t.prototype.setFromObject=function(t){return this.x=t.x,this.y=t.y},t}(),gs.Point=t}.call(this),function(){var t;t=function(){function t(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||1,this.height=r||1}return t.prototype.set=function(t,e,i,r){return null!=t.x?(this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height):(this.x=t,this.y=e,this.width=i,this.height=r)},t.prototype.setFromObject=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.expand=function(t,e,i,r){return-1===this.width?(this.x=t,this.y=e,this.width=i,this.height=r):(this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this.width=Math.max(this.x+this.width,t+i)-this.x,this.height=Math.max(this.y+this.height,e+r)-this.y)},t.prototype.floor=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.width=Math.round(this.width),this.height=Math.round(this.height)},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.width=Math.round(this.width),this.height=Math.round(this.height)},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.width=Math.ceil(this.width),this.height=Math.ceil(this.height)},t.prototype.shrink=function(t,e,i,r){var o,s;return s=this.x+this.width,o=this.y+this.height,this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this.width=Math.max(Math.min(i+t,s)-this.x,0),this.height=Math.max(Math.min(r+e,o)-this.y,0)},t.prototype.contains=function(e,i){return t.contains(this.x,this.y,this.width,this.height,e,i)},t.prototype.intersect=function(t,e,i,r){return!(t>this.x+this.width||t+i<this.x||e>this.y+this.height||e+r<this.y)},t.prototype.rotate=function(t){var e;return t=Math.degreesToRadians(t),e=new gs.Rect(0,0,1,1),e.x=this.x,e.y=this.y,e.width=this.width*Math.abs(Math.cos(t))+this.height*Math.abs(Math.sin(t)),e.height=this.width*Math.abs(Math.sin(t))+this.height*Math.abs(Math.cos(t)),e},t.contains=function(t,e,i,r,o,s){return null==s&&(o=e,s=i,e=t.y,i=t.width,r=t.height,t=t.x),o>=t&&o<t+i&&s>=e&&s<e+r},t.intersect=function(t,e,i,r,o,s,n,a){return!(t>o+n||t+i<o||e>s+a||e+r<s)},t.fromArray=function(e){return new t(e[0],e[1],e[2],e[3])},t.fromObject=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),window.Rect=t,gs.Rect=t}.call(this),function(){var t;(t=function(){function t(t,e,i,r){null!=t?this.set(t,e,i,r):this.set(0,0,0,0)}return t.prototype.setFromObject=function(t){return this.red=t.red,this.green=t.green,this.alpha=t.blue,this.grey=t.grey},t.prototype.set=function(t,e,i,r){return null!=i?(this.red=t,this.green=e,this.blue=i,this.grey=r):null!=e?(this.red=t.red,this.green=t.green,this.blue=t.blue,this.grey=e):(this.red=t.red,this.green=t.green,this.blue=t.blue,this.grey=t.grey)},t.fromArray=function(t){return new gs.Tone(t[0],t[1],t[2],t[3])},t.fromObject=function(e){return new t(e.red,e.green,e.blue,e.grey)},t}()).NORMAL=new t(0,0,0,0),window.Tone=t,gs.Tone=t}.call(this),function(){var t,e;e=function(){function e(e,i,r,o){this.keys=Input.keys,this.element=$(document.createElement("div")),this.element.css("position","absolute"),this.element.css("background-color","rgba(255, 0, 0, 0.2)"),this.element.width(32),this.element.height(32),this.code=o,this.element.bind("touchstart",function(e){return function(i){if(e.keys[o]=1,o===Input.LEFT&&(Input.leftFrameCount=t.frameCount),o===Input.RIGHT&&(Input.rightFrameCount=t.frameCount),o===Input.UP&&(Input.upFrameCount=t.frameCount),o===Input.DOWN)return Input.downFrameCount=t.frameCount}}(this)),this.element.bind("touchend",function(t){return function(e){return t.keys[o]=2,Input.pressTimes[t.code]=0}}(this)),this.element.bind("mouseout",function(t){return function(e){return t.keys[o]=2,Input.pressTimes[t.code]=0}}(this)),this.element.bind("touchmove",function(e){return function(i){if(e.keys[o]=1,o===Input.LEFT&&(Input.leftFrameCount=t.frameCount),o===Input.RIGHT&&(Input.rightFrameCount=t.frameCount),o===Input.UP&&(Input.upFrameCount=t.frameCount),o===Input.DOWN)return Input.downFrameCount=t.frameCount}}(this))}return e.prototype.setPosition=function(t,e){return this.element.css("top",e),this.element.css("left",t)},e.prototype.width=function(){return this.element.width()},e.prototype.height=function(){return this.element.height()},e}(),t=function(){function t(){}return t.prototype.initialize=function(t,e,i,r){var o;return this.width=t,this.height=e,this.keepRatio=null==r||r,this.transitionData=null,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.canvas.style.position="absolute",$(this.canvas).css("-webkit-font-smoothing","none"),this.screenDiff=$(window).height()-this.height,this.screenDiffW=$(window).width()-this.width,this.parent=i,this.frameCount=0,$(window).resize(function(t){return function(){return t.onResize()}}(this)),null!=window.requestAnimationFrame?this.onEachFrame=function(t){var e;return(e=function(){return t(),requestAnimationFrame(e)})()}:null!=window.webkitRequestAnimationFrame?this.onEachFrame=function(t){var e;return(e=function(){return t(),webkitRequestAnimationFrame(e)})()}:null!=window.mozRequestAnimationFrame?this.onEachFrame=function(t){var e;return(e=function(){return t(),mozRequestAnimationFrame(e)})()}:this.onEachFrame=function(t){return setInterval(t,16.666667)},i.appendChild(this.canvas),o=this.canvas,$MOBILE?($(o).css("left",($(window).width()-o.width)/2),$(o).css("top",this.screenDiff/2)):($(this.canvas).css("left",0),$(this.canvas).css("top",0)),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.context.webkitImageSmoothingEnabled=!1,this.context.mozImageSmoothingEnabled=!1,this.renderer=new Renderer(this.context),this.viewport=new Viewport(0,0,t,e),$("body").css("background-color","black"),this.onResize()},t.prototype.createButtons=function(){return this.buttonA=new e("ButtonA.png",null,null,Input.A),this.buttonA.setPosition($(window).width()-this.buttonA.width()-10,$(window).height()-this.buttonA.height()-100),this.buttonB=new e("ButtonB.png",null,null,Input.B),this.buttonB.setPosition($(window).width()-this.buttonB.width()-47,$(window).height()-this.buttonB.height()-100),this.buttonX=new e("ButtonX.png",null,null,Input.X),this.buttonX.setPosition($(window).width()-this.buttonA.width()-10,$(window).height()-this.buttonA.height()-105-32),this.buttonY=new e("ButtonY.png",null,null,Input.Y),this.buttonY.setPosition($(window).width()-this.buttonB.width()-47,$(window).height()-this.buttonB.height()-105-32),this.buttonLeft=new e("ButtonLeft.png",94,94,Input.LEFT),this.buttonLeft.setPosition(5,$(window).height()-this.buttonLeft.height()-32-70),this.buttonUp=new e("ButtonUp.png",94,94,Input.UP),this.buttonUp.setPosition(7+this.buttonUp.width()/2,$(window).height()-this.buttonUp.height()-32-32-70-5),this.buttonRight=new e("ButtonRight.png",94,94,Input.RIGHT),this.buttonRight.setPosition(42,$(window).height()-this.buttonLeft.height()-32-70),this.buttonDown=new e("ButtonDown.png",94,94,Input.DOWN),this.buttonDown.setPosition(7+this.buttonUp.width()/2,$(window).height()-this.buttonUp.height()-70+5),this.buttonStart=new e("ButtonStart.png",183,70,Input.START),this.buttonStart.setPosition(($(window).width()-2*this.buttonStart.width())/2,$(window).height()-64),this.buttonSelect=new e("ButtonSelect.png",183,70,Input.SELECT),this.buttonSelect.setPosition(64+($(window).width()-2*this.buttonStart.width())/2,$(window).height()-64),$(this.parent).append(this.buttonA.element),$(this.parent).append(this.buttonB.element),$(this.parent).append(this.buttonX.element),$(this.parent).append(this.buttonY.element),$(this.parent).append(this.buttonLeft.element),$(this.parent).append(this.buttonUp.element),$(this.parent).append(this.buttonRight.element),$(this.parent).append(this.buttonDown.element),$(this.parent).append(this.buttonStart.element),$(this.parent).append(this.buttonSelect.element)},t.prototype.dispose=function(){},t.prototype.onResize=function(t,e){var i;return e=e||$(window).height(),t=t||$(window).width(),this.screenDiff=e-this.height,this.screenDiffW=t-this.width,i=1+this.screenDiff/this.height,this.keepRatio&&(i=Math.min(i,t/this.width)),$(this.canvas).css("-webkit-transform","none"),$(this.canvas).css("-ms-transform","none"),$(this.canvas).css("-moz-transform","none"),$(this.canvas).css("transform","none"),$(this.canvas).css("-webkit-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("-ms-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("-moz-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),$(this.canvas).css("left",(t-this.width)/2),$(this.canvas).css("top",(e-this.height)/2),this.scaleFactorX=this.width/this.canvas.width,this.scaleFactorY=this.height/this.canvas.height},t.prototype.update=function(){return this.context.fillRect(0,0,this.width,this.height),this.viewport.update(),null!=this.transitionData?this.updateTransition():this.viewport.draw()},t.prototype.addGraphicObject=function(t){if(null!=this.viewport)return this.viewport.addGraphicObject(t)},t.prototype.removeGraphicObject=function(t){if(null!=this.viewport)return this.viewport.removeGraphicObject(t)},t.prototype.snapshot=function(){return new Bitmap(this.canvas)},t.prototype.updateTransition=function(){return null!=this.transitionData.transitionData?this.updateBitmapTransition():this.updateDefaultTransition()},t.prototype.updateDefaultTransition=function(){if(this.context.drawImage(this.transitionData.sourceBitmap.image,0,0),this.context.globalAlpha=this.transitionData.currentAlpha/255,this.context.drawImage(this.transitionData.targetBitmap.image,0,0),this.context.globalAlpha=1,this.transitionData.currentAlpha+=255/this.transitionData.duration,this.transitionData.currentAlpha>=255)return this.transitionData=null,this.frozenScreenBitmap=null,this.frozen=!1},t.prototype.updateBitmapTransition=function(){var t,e,i,r,o,s,n,a,h;for(s=this.transitionData.screenData,h=this.transitionData.transitionData,a=this.transitionData.targetData,n=this.transitionData.sourceData,i=r=0,o=s.length;r<o;i=r+=4)h[i]>=this.transitionData.currentAlpha?(e=h[i]-this.transitionData.currentAlpha,this.transitionData.vague>e?(t=e/this.transitionData.vague*255,s[i]=(n[i]*t+a[i]*(255-t))/255,s[i+1]=(n[i+1]*t+a[i+1]*(255-t))/255,s[i+2]=(n[i+2]*t+a[i+2]*(255-t))/255,s[i+3]=n[i+3]):(s[i]=n[i],s[i+1]=n[i+1],s[i+2]=n[i+2],s[i+3]=n[i+3])):(s[i]=a[i],s[i+1]=a[i+1],s[i+2]=a[i+2],s[i+3]=a[i+3]);if(this.transitionData.currentAlpha+=255/this.transitionData.duration,this.context.putImageData(this.transitionData.screenImageData,0,0),this.transitionData.currentAlpha>=255)return this.transitionData=null,this.frozenScreenBitmap=null,this.frozen=!1},t.prototype.freeze=function(){return this.frozen=!0,this.frozenScreenBitmap=this.snapshot()},t.prototype.transition=function(t,e,i){if(null!=this.frozenScreenBitmap)return this.context.fillStyle="#000000",this.context.fillRect(0,0,this.width,this.height),this.viewport.update(),this.viewport.draw(),this._transition(this.frozenScreenBitmap,this.snapshot(),t,e,i)},t.prototype._transition=function(t,e,i,r,o){if(this.transitionData={sourceBitmap:t,targetBitmap:e,duration:i,transitionBitmap:r,vague:o},this.transitionData.currentAlpha=0,null!=this.transitionData.transitionBitmap)return this.transitionData.screenImageData=this.context.getImageData(0,0,this.width,this.height),this.transitionData.screenData=this.transitionData.screenImageData.data,this.transitionData.transitionData=r.getImageData(0,0,this.width,this.height).data,this.transitionData.targetData=e.getImageData(0,0,this.width,this.height).data,this.transitionData.sourceData=t.getImageData(0,0,this.width,this.height).data},t.prototype._transitionWithBitmap=function(t,e,i,r,o){},t}(),window.Graphics_Canvas=t,window.Graphics=new t}.call(this),function(){var t,e;t=function(){return function(){this.globalAlpha=1,this.globalCompositeOperation=0}}(),e=function(){function e(e){this.context=e,this.canvas=e.canvas,this.contextInfo=new t,this.ox=0,this.oy=0,this.zoom={x:1,y:1},this.size={width:0,height:0},this.angle=0,this.mirror=!1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendType=0,this.preparationBitmap=new Bitmap(1024,1024),this.preparationContext=this.preparationBitmap.context,this.clip=new Rect(0,0,this.canvas.width,this.canvas.height)}return e.prototype.reset=function(){if(this.blendType=0,this.opacity=255,0!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="source-over",this.contextInfo.globalCompositeOperation=0),1!==this.contextInfo.globalAlpha)return this.context.globalAlpha=1,this.contextInfo.globalAlpha=1},e.prototype.drawRect=function(t){return this.context.fillStyle=this.color.toFillStyle(),this.context.fillRect(t.x,t.y,t.width,t.height)},e.prototype.clipRect=function(t){if(t.x!==this.clip.x||t.y!==this.clip.y||t.width!==this.clip.width||t.height!==this.clip.height)return this.context.restore(),this.context.save(),this.context.beginPath(),this.context.rect(t.x,t.y,t.width,t.height),this.context.clip(),this.clip=t},e.prototype._changeTone=function(t){var e,i,r,o,s,n,a,h,l,u,c,d,p,f,m;if(s=t.data,l=this.tone.red,n=this.tone.green,o=this.tone.blue,0!==this.tone.grey)if(a=.00392156862745*this.tone.grey,255===this.tone.grey)for(h=u=0,p=s.length-1;u<p;h=u+=4)r=.3*(s[h]+s[h+1]+s[h+2]),s[h]=r+l,s[h+1]=r+n,s[h+2]=r+o;else for(h=c=0,f=s.length-1;c<f;h=c+=4)e=(r=.3*(s[h]+s[h+1]+s[h+2]))*a,i=1-a,s[h]=e+s[h]*i+l,s[h+1]=e+s[h+1]*i+n,s[h+2]=e+s[h+2]*i+o;else for(h=d=0,m=s.length-1;d<m;h=d+=4)s[h]+=l,s[h+1]+=n,s[h+2]+=o;return null},e.prototype.changeTone=function(t){var e;return this.preparationContext.globalCompositeOperation="source-over",e=this.context.getImageData(t.x,t.y,t.width,t.height),this._changeTone(e),this.context.putImageData(e,t.x,t.y)},e.prototype.drawTiledBitmap=function(t,e,i,r,o,s,n,a,h){var l,u,c,d,p,f;for(l=Math.ceil(r/h),u=Math.ceil(o/a),c=p=0;0<=l?p<l:p>l;c=0<=l?++p:--p)for(d=f=0;0<=u?f<u:f>u;d=0<=u?++f:--f)this.context.drawImage(t.image,s,n,h,a,e+c*h,i+d*a,h,a);return null},e.prototype.drawBitmapSimple=function(t,e,i,r,o,s,n,a,h){return null!=this.context.bitmap&&this.context.bitmap.sequenceNumber++,this.context.drawImage(t.image,s,n,a,h,e-this.ox,i-this.oy,r,o)},e.prototype.drawBitmap=function(t,e,i,r,o,s){var n,a,h,l;if(t.loaded){switch(null!=this.context.bitmap&&this.context.bitmap.sequenceNumber++,o=o||0,s=s||0,e=e-this.ox-o*this.zoom.x,i=i-this.oy-s*this.zoom.y,r.width=Math.min(Math.floor(r.width),t.width),r.height=Math.min(Math.floor(r.height),t.height),l=this.size.width>0?this.size.width:r.width*this.zoom.x,a=this.size.height>0?this.size.height:r.height*this.zoom.y,h=null,0===this.tone.red&&0===this.tone.green&&0===this.tone.blue&&0===this.tone.grey||(h=t.context.getImageData(r.x,r.y,r.width,r.height),this._changeTone(h),this.preparationContext.globalCompositeOperation="source-over",this.preparationContext.putImageData(h,0,0)),0!==this.color.alpha&&(this.preparationContext.globalCompositeOperation="source-over",null==h&&(this.preparationContext.clearRect(0,0,r.width,r.height),this.preparationContext.drawImage(t.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height)),this.preparationContext.globalCompositeOperation="source-atop",this.preparationContext.fillStyle=this.color.toFillStyle(),this.preparationContext.fillRect(0,0,r.width,r.height)),255!==this.opacity?(n=.00392156862745*this.opacity,this.contextInfo.globalAlpha!==n&&(this.context.globalAlpha=n,this.contextInfo.globalAlpha=n)):1!==this.contextInfo.globalAlpha&&(this.context.globalAlpha=1,this.contextInfo.globalAlpha=1),this.blendType){case 0:0!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="source-over",this.contextInfo.globalCompositeOperation=0);break;case 1:1!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="lighter",this.contextInfo.globalCompositeOperation=1);break;case 2:2!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="darker",this.contextInfo.globalCompositeOperation=2)}return 0!==this.angle?(this.mirror&&(this.context.scale(-1,1),e=-1*(e+l)),this.context.translate(e,i),this.context.translate(.5*l,.5*a),this.context.rotate(this.angle),this.context.translate(-.5*l,-.5*a),0===this.color.alpha&&null==h?this.context.drawImage(t.image,r.x,r.y,r.width,r.height,0,0,l,a):this.context.drawImage(this.preparationBitmap.image,0,0,r.width,r.height,0,0,l,a),this.context.setTransform(1,0,0,1,0,0)):(this.mirror&&(this.context.scale(-1,1),e=-1*(e+l)),0===this.color.alpha&&null==h?this.context.drawImage(t.image,r.x,r.y,r.width,r.height,e,i,l,a):this.context.drawImage(this.preparationBitmap.image,0,0,r.width,r.height,e,i,l,a),this.mirror?this.context.setTransform(1,0,0,1,0,0):void 0)}},e}(),window.Renderer_Canvas=e,window.Renderer=e}.call(this),function(){var t;window.$gl=null,t=function(){function t(){}return t.prototype.initialize=function(t,e,i,r){var o;if(i=i||document.body,this.canvas=document.createElement("canvas"),jQuery(this.canvas).css("background-color","#000"),this.canvas.width=t,this.canvas.height=e,this.keepRatio=null==r||r,this.width=this.canvas.width,this.height=this.canvas.height,this.context=this.canvas.getContext("webgl",{alpha:!0})||this.canvas.getContext("experimental-webgl",{alpha:!1,antialias:!1}),this.renderer=null,this.frameStartTime=0,this.frameTime=0,this.onFocusReceive=null,this.onFocusLost=null,this.frameRate=60,window.$gl=this.context,"undefined"==typeof $gl||null===$gl)throw"No WebGL Support or WebGL is disabled. Check your browser configuration.";return $gl.clearColor(0,0,0,1),$gl.viewport(0,0,this.width,this.height),$gl.disable($gl.DEPTH_TEST),$gl.enable($gl.BLEND),$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA),$gl.enable($gl.SCISSOR_TEST),$gl.scissor(0,0,this.width,this.height),this.graphics=[],this.viewport=new Viewport(0,0,t,e),this.renderer=new Renderer(this.context),this.screenTexture=new Texture2D(t,e,null,!0,!1),this.screenTexture.bind(),this.screenTexture.setFilter(0,!1),this.screenTexture.unbind(),this.offscreenTexture=new Texture2D(Math.nextPow2(t),Math.nextPow2(e),null,!1,!0),this.frameBuffer=new gs.FrameBuffer,this.screenProjectionMatrix=mat4.create(),mat4.identity(this.screenProjectionMatrix),mat4.ortho(this.screenProjectionMatrix,0,this.offscreenTexture.realWidth,this.offscreenTexture.realHeight,0,-1,1),this.canvas.style.position="absolute",jQuery(this.canvas).css("-webkit-font-smoothing","none"),this.screenDiff=jQuery(window).height()-this.height,this.screenDiffW=jQuery(window).width()-this.width,this.parent=i,this.frameCount=0,this.paused=!1,this.stopped=!1,this.screenRenderInfo={position:vec3.create([0,0,0]),size:vec3.create([this.canvas.width,this.canvas.height,1])},jQuery(window).resize(function(t){return function(){return t.onResize()}}(this)),window.nw&&nw.Window.get().on("resize",function(t){return function(e,i){return t.onResize()}}(this)),60,0,Date.now(),1e3/60,0,$PARAMS.preview||gs.Platform.isAtsumaru||(window.addEventListener("focus",function(t){return function(e){return t.paused=!1,gs.Audio.resume(),Input.clear(),"function"==typeof t.onFocusReceive?t.onFocusReceive():void 0}}(this)),window.addEventListener("blur",function(t){return function(e){return t.paused=!0,gs.Audio.pause(),Input.clear(),"function"==typeof t.onFocusLost?t.onFocusLost():void 0}}(this)),window.addEventListener("keydown",function(t){if(9===t.keyCode)return t.preventDefault()})),null!=window.requestAnimationFrame?this.onEachFrame=function(t){return function(e){var i;return(i=function(r){if(!t.stopped)return t.paused&&!$PARAMS.preview||e(r),requestAnimationFrame(i)})()}}(this):null!=window.webkitRequestAnimationFrame?this.onEachFrame=function(t){var e;return(e=function(){return t(),webkitRequestAnimationFrame(e)})()}:null!=window.mozRequestAnimationFrame?this.onEachFrame=function(t){var e;return(e=function(){return t(),mozRequestAnimationFrame(e)})()}:this.onEachFrame=function(t){return setInterval(t,16.666667)},i.appendChild(this.canvas),jQuery(document).mousedown(function(t){return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}),jQuery(document).mouseup(function(t){return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}),o=this.canvas,$MOBILE?(jQuery(o).css("left",(jQuery(window).width()-o.width)/2),jQuery(o).css("top",this.screenDiff/2)):(jQuery(this.canvas).css("left",0),jQuery(this.canvas).css("top",0)),$MOBILE&&jQuery("canvas").css("-webkit-transform","scale("+(1+this.screenDiff/this.height)+")"),this.onResize()},t.prototype.dispose=function(){return null!=this.onDispose&&this.onDispose(),this.renderer.dispose(),this.screenTexture.dispose(),this.offscreenTexture.dispose(),this.frameBuffer.dispose()},t.prototype.onResize=function(t,e){var i,r;return e=e||jQuery(window).height(),t=t||jQuery(window).width(),this.screenRenderInfo||(this.screenRenderInfo={position:vec3.create([0,0,0]),size:vec3.create([this.canvas.width,this.canvas.height,1])}),this.screenRenderInfo.size[0]=this.canvas.width,this.screenRenderInfo.size[1]=this.canvas.height,this.screenDiff=e-this.height,this.screenDiffW=t-this.width,i=1+this.screenDiff/this.height,r=1+this.screenDiffW/this.width,this.keepRatio&&(r=i=Math.min(i,t/this.width)),jQuery(this.canvas).css("-webkit-transform","none"),jQuery(this.canvas).css("-ms-transform","none"),jQuery(this.canvas).css("-moz-transform","none"),jQuery(this.canvas).css("transform","none"),jQuery(this.canvas).css("-webkit-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("-ms-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("-moz-transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("transform","scale("+(this.keepRatio?"":1+this.screenDiffW/this.width+", ")+i+")"),jQuery(this.canvas).css("left",(t-this.width)/2),jQuery(this.canvas).css("top",(e-this.height)/2),this.x=0,this.y=0,this.keepRatio&&(this.x=Math.floor((t-this.canvas.width*i)/2),this.y=Math.floor((e-this.canvas.height*i)/2)),this.scaleFactorX=this.width/(this.width*r),this.scaleFactorY=this.height/(this.height*i)},t.prototype.setCursorBitmap=function(t,e,i){var r;return t&&!t.image&&t.makeMutable(),(null!=t?t.image:void 0)?(r=t.image.toDataURL("image/png"),jQuery(document.body).css("cursor","url('"+r+"') "+(e||0)+" "+(i||0)+", default")):jQuery(document.body).css("cursor","default")},t.prototype.enterFullscreen=function(){var t,e,i,r;if(window.nw&&!$PARAMS.platform.isSteamOS){(r=nw.Window.get()).setResizable(!0),r.enterFullscreen();try{if((e=require("fs")).existsSync("./package.json"))return i=JSON.parse(e.readFileSync("./package.json","utf8")),i.fullscreen=!0,e.writeFileSync("./package.json",JSON.stringify(i),"utf8")}catch(e){return t=e,console.log("ERROR: Cannot store display-settings in package.json. Do have write-access to the game's directory/folder?"),console.log(t)}}},t.prototype.leaveFullscreen=function(){var t,e,i,r;if(window.nw&&!$PARAMS.platform.isSteamOS){(r=nw.Window.get()).leaveFullscreen();try{(e=require("fs")).existsSync("./package.json")&&((i=JSON.parse(e.readFileSync("./package.json","utf8"))).fullscreen=!1,e.writeFileSync("./package.json",JSON.stringify(i),"utf8"))}catch(e){t=e,console.log("ERROR: Cannot store display-settings in package.json. Do have write-access to the game's directory/folder?"),console.log(t)}return r.setResizable(!0),r.width=this.width,r.height=this.height,this.onResize(),setTimeout(function(t){return function(){return t.onResize()}}(this),1)}},t.prototype.isFullscreen=function(){return null==window.nw||nw.Window.get().isFullscreen},t.prototype.clear=function(){return $gl.clear($gl.COLOR_BUFFER_BIT|$gl.DEPTH_BUFFER_BIT)},t.prototype.update=function(){return this.frameBuffer.bind(),this.frameBuffer.setTexture(this.screenTexture),$gl.viewport(0,0,this.screenTexture.width,this.screenTexture.height),this.viewport.update(),null!=this.transitionData?this.updateTransition():this.frozen||(this.clear(),this.viewport.draw(),this.renderer.render()),this.renderer.clip.set(0,0,this.width,this.height),this.frameBuffer.unbind(),$gl.scissor(0,0,this.canvas.width,this.canvas.height),this.renderer.setTexture(this.screenTexture),mat2d.identity(this.renderer.transform_),this.renderer.transform=this.renderer.transform_,this.renderer.setSourceRectangle(0,0,Graphics.width,Graphics.height),mat2d.translate(this.renderer.transform,this.renderer.transform,[0,Graphics.height]),mat2d.scale(this.renderer.transform,this.renderer.transform,[Graphics.width,-Graphics.height]),this.renderer.drawTransform(),this.renderer.render()},t.prototype.addGraphicObject=function(t){if(null!=this.viewport)return this.viewport.addGraphicObject(t)},t.prototype.removeGraphicObject=function(t){if(null!=this.viewport)return this.viewport.removeGraphicObject(t)},t.prototype.snapshotToTexture=function(t){return this.frameBuffer.bind(),this.frameBuffer.setTexture(this.screenTexture),this.clear(),this.viewport.update(),this.viewport.draw(),this.renderer.render(),t.bind(),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height),t.unbind(),this.frameBuffer.unbind()},t.prototype.snapshotAsTexture=function(t){var e;return this.frameBuffer.bind(),this.frameBuffer.setTexture(this.screenTexture),this.clear(),this.viewport.update(),this.viewport.draw(),this.renderer.render(),e=new Uint8Array(this.width*this.height*4),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,!0),$gl.readPixels(0,0,this.width,this.height,$gl.RGBA,$gl.UNSIGNED_BYTE,e),this.frameBuffer.unbind(),t=new Texture2D(e,this.width,this.height,!1,!0),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,!1),t},t.prototype.snapshot=function(){var t,e,i,r;return this.frameBuffer.bind(),i=new Uint8Array(this.width*this.height*4),$gl.readPixels(0,0,this.width,this.height,$gl.RGBA,$gl.UNSIGNED_BYTE,i),this.frameBuffer.unbind(),t=document.createElement("canvas"),t.width=this.width,t.height=this.height,(e=t.getContext("2d")).clearRect(0,0,this.width,this.height),(r=e.createImageData(this.width,this.height)).data.set(i),e.putImageData(r,0,0),new Bitmap(t,!0)},t.prototype.snapshotAsData=function(){var t;return this.viewport.update(),this.viewport.draw(),this.renderer.render(),t=new Uint8Array(this.width*this.height*4),$gl.readPixels(0,0,this.width,this.height,$gl.RGBA,$gl.UNSIGNED_BYTE,t),t},t.prototype.freeze=function(){if(!this.frozen)return $gl.scissor(0,0,this.width,this.height),this.frozen=!0,this.frozenScreenTexture=new Texture2D(Graphics.width,Graphics.height,null,!0,!1),this.snapshotToTexture(this.frozenScreenTexture)},t.prototype.transition=function(t,e,i){if(null!=this.frozenScreenTexture)return $gl.scissor(0,0,this.width,this.height),this.transitionSnapshot=new Texture2D(Graphics.width,Graphics.height,null,!0,!1),this.snapshotToTexture(this.transitionSnapshot),this._transition(this.frozenScreenTexture,this.transitionSnapshot,t,e,i),this.update()},t.prototype._transition=function(t,e,i,r,o){return this.transitionData={sourceTexture:t,targetTexture:e,duration:i,transitionBitmap:r,vague:o,mask:{ox:0,oy:0,source:r,type:1,value:0,vague:o}},this.transitionData.currentAlpha=0},t.prototype.updateTransition=function(){var t;return $gl.scissor(0,0,this.width,this.height),(null!=(t=this.transitionData.transitionBitmap)?t.loaded:void 0)?this.updateBitmapTransition():this.updateDefaultTransition()},t.prototype.updateDefaultTransition=function(){return this.renderer.setTexture(this.transitionData.sourceTexture),this.renderer.setSourceRectangle(0,Graphics.height,Graphics.width,-Graphics.height),this.renderer.position[0]=0,this.renderer.position[1]=0,this.renderer.size[0]=this.width,this.renderer.size[1]=this.height,mat2d.identity(this.renderer.transform_),mat2d.scale(this.renderer.transform_,this.renderer.transform_,vec2.fromValues(this.width,this.height)),this.renderer.transform=this.renderer.transform_,this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),this.renderer.opacity=this.transitionData.currentAlpha,this.renderer.setTexture(this.transitionData.targetTexture),this.renderer.position[0]=0,this.renderer.position[1]=0,this.renderer.size[0]=this.width,this.renderer.size[1]=this.height,this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),this.renderer.opacity=255,this.transitionData.currentAlpha>=255?(this.transitionData.sourceTexture.dispose(),this.transitionData.targetTexture.dispose(),this.transitionData=null,this.frozenScreenTexture=null,this.frozen=!1):this.transitionData.currentAlpha+=255/this.transitionData.duration},t.prototype.updateBitmapTransition=function(){if(this.transitionData.currentAlpha=Math.min(this.transitionData.currentAlpha+255/this.transitionData.duration,255),$gl.disable($gl.BLEND),mat2d.identity(this.renderer.transform_),mat2d.scale(this.renderer.transform_,this.renderer.transform_,vec2.fromValues(this.width,this.height)),this.renderer.transform=this.renderer.transform_,this.renderer.setSourceRectangle(0,Graphics.height,Graphics.width,-Graphics.height),this.renderer.setTexture(this.transitionData.targetTexture),this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),$gl.enable($gl.BLEND),this.renderer.mask=this.transitionData.mask,this.renderer.mask.value=this.transitionData.currentAlpha,this.renderer.setTexture(this.transitionData.sourceTexture),this.renderer.drawQuad(this.renderer.position,this.renderer.size),this.renderer.render(),this.renderer.mask=null,this.transitionData.currentAlpha>=255)return this.transitionData.sourceTexture.dispose(),this.transitionData.targetTexture.dispose(),this.transitionData=null,this.frozenScreenTexture=null,this.frozen=!1},t}(),window.Graphics_OpenGL=t,window.Graphics=(window.$PARAMS,new Graphics_Canvas),gs.Graphics=Graphics}.call(this),function(){var t,e,i;i=function(){return function(){this.tilesetBitmap=null,this.dataBitmap=null,this.ox=0,this.oy=0,this.autotileOffset=0,this.autotileAreaStart=0,this.tileSize=32}}(),gs.TilemapRenderInfo=i,t=function(){return function(){this.clear=!1,this.texture=null,this.opacity=0,this.blendMode=0,this.clip=new Rect(0,0,Graphics.width,Graphics.height),this.l2dObject=null,this.tilemap=null,this.tiling=!1,this.effects=new gs.EffectCollection}}(),gs.RenderTask=t,e=function(){function t(t){Effect.initialize(),this.context=t,this.canvas=t.canvas,this.clear=!1,this.ox=0,this.oy=0,this.anchor={x:0,y:0},this.zoom={x:1,y:1},this.size={width:0,height:0},this.textureOffset={x:0,y:0},this.transform_=mat2d.create(),this.transformVector_=vec2.create(),this.effects=null,this.angle=0,this.mirror=!1,this.mirrorY=!1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendType=0,this.clip=new Rect(0,0,this.canvas.width,this.canvas.height),this.transform=mat2d.create(),this.texBuffers=[],this.defaultTone=this.tone,this.vertexBuffer=null,this.indexBuffer=null,this.maxRenderTasks=1e3,this.renderTasks=new Array(this.maxRenderTasks),this.renderTaskIndex=0,this.vertexSize=5,this.vertexColorData=null,this.vertexDataBuffer=null,this.renderTaskSize=4*this.vertexSize*4,this.createBufferObjects(),this.rotationCenter=vec3.create([0,0,0]),this.rotationCenterInverse=vec3.create([0,0,0]),this.identity=mat4.create(),mat4.identity(this.identity),this.width=this.canvas.width,this.height=this.canvas.height,this.textures=[null,null],this.sourceRectangle=[0,0,1,1],this.position=vec3.create([0,0,0]),this.position1=vec2.fromValues(0,0),this.position2=vec2.fromValues(1,0),this.position3=vec2.fromValues(0,1),this.position4=vec2.fromValues(1,1),this.size=vec3.create([1,1,1]),this.color=[1,1,1,1],this.colors=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],this.clipRectangle=[0,0,this.width,this.height],this.transform=mat4.create(),this.translation=mat4.create(),this.scale=mat4.create(),mat4.identity(this.translation),mat4.identity(this.scale),mat4.identity(this.transform),this.effect=Effect.get(1),this.projectionMatrix=mat4.create(),mat4.identity(this.projectionMatrix),mat4.ortho(this.projectionMatrix,0,this.width,this.height,0,-1,1)}return t.prototype.dispose=function(){var t,e,i;for(this.effect.dispose(),this.tintEffect.dispose(),this.colorEffect.dispose(),this.colorTintEffect.dispose(),this.colorRectEffect.dispose(),this.transitionEffect.dispose(),t=0,e=(i=this.texBuffers).length;t<e;t++)i[t].dispose();return this.vertexShader.dispose(),this.fragmentShader.dispose(),this.toneShader.dispose(),this.colorShader.dispose(),this.colorToneShader.dispose(),this.colorRectShader.dispose(),this.transitionShader.dispose()},t.prototype.createBufferObjects=function(){var t,e,i,r;for(t=e=0,i=this.renderTasks.length;0<=i?e<i:e>i;t=0<=i?++e:--e)this.renderTasks[t]=new gs.RenderTask;for(this.vertexDataBuffer=new ArrayBuffer(4*this.maxRenderTasks*(4*this.vertexSize)),this.vertexData=new Float32Array(this.vertexDataBuffer),this.vertexColorData=new Uint32Array(this.vertexDataBuffer),this.indexData=new Uint16Array(6*this.maxRenderTasks),t=0,r=0;t<6*this.maxRenderTasks;)this.indexData[t+0]=r+0,this.indexData[t+1]=r+1,this.indexData[t+2]=r+3,this.indexData[t+3]=r+2,this.indexData[t+4]=r+0,this.indexData[t+5]=r+3,t+=6,r+=4;return this.vertexBuffer=new gs.Buffer($gl.ARRAY_BUFFER,this.vertexData,5,4*this.maxRenderTasks,$gl.DYNAMIC_DRAW),this.indexBuffer=new gs.Buffer($gl.ELEMENT_ARRAY_BUFFER,this.indexData,3,6*this.maxRenderTasks),this.vertexBuffer.bind(),this.indexBuffer.bind()},t.prototype.resize=function(){return this.width=this.canvas.width,this.height=this.canvas.height,this.projectionMatrix=mat4.create(),mat4.identity(this.projectionMatrix),mat4.ortho(this.projectionMatrix,0,this.width,this.height,0,-1,1)},t.prototype.reset=function(){return this.blendType=0,this.opacity=255,$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA)},t.prototype.drawRotatedQuad=function(t,e,i,r,o){return this.drawQuad(t,e)},t.prototype.drawBuffer=function(t){var e,i,r;return i=null,r=null!=this.tone&&(0!==this.tone.red||0!==this.tone.green||0!==this.tone.blue||0!==this.tone.grey),(e=null!=this.color&&this.color.alpha>0)&&r?(i=this.colorTintEffect,this.colorTintEffect.use(),this.colorTintEffect.setVector4Value("Tone",this.tone.red,this.tone.green,this.tone.blue,this.tone.grey),this.colorTintEffect.setVector4Value("Color",this.color.red,this.color.green,this.color.blue,this.color.alpha)):r?(i=this.tintEffect,this.tintEffect.use(),this.tintEffect.setVector4Value("Tone",this.tone.red,this.tone.green,this.tone.blue,this.tone.grey)):e?(i=this.colorEffect,this.colorEffect.use(),this.colorEffect.setFloatValue("Opacity",this.opacity),this.colorEffect.setVector4Value("Color",this.color.red,this.color.green,this.color.blue,this.color.alpha)):i=this.effect,this.currentEffect,this.currentEffect=i,i.use(),i.setMatrixValue("pMatrix",this.projectionMatrix),i.setFloatValue("Opacity",this.opacity),this.effectUsed=!0,this.projectionMatrixOld=this.projectionMatrix,this.opacityOld=this.opacity,$gl.drawElements($gl.TRIANGLES,t.itemCount,$gl.UNSIGNED_SHORT,0)},t.prototype.drawTextureTransform=function(t){var e,i,r,o;if(this.effects&&this.effects.wobble.enabled&&(r=this.renderTaskIndex*(4*this.vertexSize),i=Graphics.frameCount*this.effects.wobble.speed,this.effects.wobble.horizontal&&(this.vertexData[r+2]+=Math.sin(i)*this.effects.wobble.power,this.vertexData[r+7]+=Math.sin(i+1)*this.effects.wobble.power,this.vertexData[r+12]+=Math.sin(i+2)*this.effects.wobble.power,this.vertexData[r+17]+=Math.sin(i+3)*this.effects.wobble.power),this.effects.wobble.vertical&&(this.vertexData[r+3]+=Math.cos(i)*this.effects.wobble.power,this.vertexData[r+8]+=Math.cos(i+1)*this.effects.wobble.power,this.vertexData[r+13]+=Math.cos(i+2)*this.effects.wobble.power,this.vertexData[r+18]+=Math.cos(i+3)*this.effects.wobble.power)),r=this.renderTaskIndex*(4*this.vertexSize),e=0|this.opacity<<24,this.position1[0]=0,this.position1[1]=0,this.position2[0]=1,this.position2[1]=0,this.position3[0]=0,this.position3[1]=1,this.position4[0]=1,this.position4[1]=1,vec2.transformMat2d(this.position1,this.position1,this.transform),vec2.transformMat2d(this.position2,this.position2,this.transform),vec2.transformMat2d(this.position3,this.position3,this.transform),vec2.transformMat2d(this.position4,this.position4,this.transform),this.vertexData[r+2]=this.position1[0]/this.texture.realWidth,this.vertexData[r+3]=this.position1[1]/this.texture.realHeight,this.vertexData[r+7]=this.position2[0]/this.texture.realWidth,this.vertexData[r+8]=this.position2[1]/this.texture.realHeight,this.vertexData[r+12]=this.position3[0]/this.texture.realWidth,this.vertexData[r+13]=this.position3[1]/this.texture.realHeight,this.vertexData[r+17]=this.position4[0]/this.texture.realWidth,this.vertexData[r+18]=this.position4[1]/this.texture.realHeight,this.vertexData[r]=t.x,this.vertexData[r+1]=t.y,this.vertexColorData[r+4]=e,this.vertexData[r+5]=t.x+t.width,this.vertexData[r+6]=t.y,this.vertexColorData[r+9]=e,this.vertexData[r+10]=t.x,this.vertexData[r+11]=t.y+t.height,this.vertexColorData[r+14]=e,this.vertexData[r+15]=t.x+t.width,this.vertexData[r+16]=t.y+t.height,this.vertexColorData[r+19]=e,o=this.renderTasks[this.renderTaskIndex],o.l2dObject=null,o.tilemap=null,o.texture=this.texture,o.clip.set(this.clip.x,this.clip.y,this.clip.width,this.clip.height),o.tone=this.tone,o.color=this.color,o.mask=this.mask,o.opacity=this.opacity,o.blendMode=this.blendType,o.effect=this.visualEffect,o.effects=this.effects,o.clear=this.clear,o.tiling=!0,this.renderTaskIndex++,this.renderTaskIndex>=this.maxRenderTasks)return this.render()},t.prototype.drawQuad=function(t,e){var i,r,o,s;if(null,this.effects&&this.effects.wobble.enabled&&(o=this.renderTaskIndex*(4*this.vertexSize),r=Graphics.frameCount*this.effects.wobble.speed,this.effects.wobble.horizontal&&(this.vertexData[o+2]+=Math.sin(r)*this.effects.wobble.power,this.vertexData[o+7]+=Math.sin(r+1)*this.effects.wobble.power,this.vertexData[o+12]+=Math.sin(r+2)*this.effects.wobble.power,this.vertexData[o+17]+=Math.sin(r+3)*this.effects.wobble.power),this.effects.wobble.vertical&&(this.vertexData[o+3]+=Math.cos(r)*this.effects.wobble.power,this.vertexData[o+8]+=Math.cos(r+1)*this.effects.wobble.power,this.vertexData[o+13]+=Math.cos(r+2)*this.effects.wobble.power,this.vertexData[o+18]+=Math.cos(r+3)*this.effects.wobble.power)),o=this.renderTaskIndex*(4*this.vertexSize),i=0|this.opacity<<24,this.position1[0]=0,this.position1[1]=0,this.position2[0]=1,this.position2[1]=0,this.position3[0]=0,this.position3[1]=1,this.position4[0]=1,this.position4[1]=1,vec2.transformMat2d(this.position1,this.position1,this.transform),vec2.transformMat2d(this.position2,this.position2,this.transform),vec2.transformMat2d(this.position3,this.position3,this.transform),vec2.transformMat2d(this.position4,this.position4,this.transform),this.vertexData[o]=this.position1[0],this.vertexData[o+1]=this.position1[1],this.vertexColorData[o+4]=i,this.vertexData[o+5]=this.position2[0],this.vertexData[o+6]=this.position2[1],this.vertexColorData[o+9]=i,this.vertexData[o+10]=this.position3[0],this.vertexData[o+11]=this.position3[1],this.vertexColorData[o+14]=i,this.vertexData[o+15]=this.position4[0],this.vertexData[o+16]=this.position4[1],this.vertexColorData[o+19]=i,s=this.renderTasks[this.renderTaskIndex],s.l2dObject=null,s.texture=this.texture,s.tiling=!1,s.tilemap=null,s.clip.set(this.clip.x,this.clip.y,this.clip.width,this.clip.height),s.tone=this.tone,s.color=this.color,s.mask=this.mask,s.opacity=this.opacity,s.blendMode=this.blendType,s.effect=this.visualEffect,s.effects=this.effects,s.clear=this.clear,this.renderTaskIndex++,this.renderTaskIndex>=this.maxRenderTasks)return this.render()},t.prototype.render=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E,b,R,_,D,A;for(r=null,f=0,g=0,e=null,D=null,i=null,S=null,m=0,d=!1,T=!1,E=0,t=-1,(n=this.effect).use(),o=this.vertexData.subarray(0,this.renderTaskIndex*(4*this.vertexSize)),this.vertexBuffer.setSubData(o,0);f<this.renderTaskIndex;){if(_=this.renderTasks[f],e=_.clip,A=_.tone!==D||_.color!==i,d=_.mask&&_.mask.source,c=null!==_.effects,m=e.x!==this.clip.x||e.y!==this.clip.y||e.width!==this.clip.width||e.height!==this.clip.height,_.effect||c||_.tilemap||_.tiling||m||_.blendMode!==t||_.texture!==r||A||T!==d){if(this.drawTasks(r,n,E,g-E,_.clear),E=g,r=_.texture,D=_.tone,i=_.color,T=d,S=_.mask,a=0,t!==_.blendMode)switch(t=_.blendMode){case 1:$gl.blendFunc($gl.SRC_ALPHA,$gl.ONE);break;case 2:$gl.blendFunc($gl.SRC_ALPHA_SATURATE,$gl.ONE_MINUS_SRC_COLOR);break;default:$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA)}if(m&&(this.clip.set(e.x,e.y,e.width,e.height),$gl.scissor(e.x,Graphics.height-e.y-e.height,e.width,e.height)),u=!1,c)for(w=0,x=(b=_.effects.list).length;w<x;w++)(s=b[w]).enabled&&(a|=s.id,u=u||0===s.type);if(_.tilemap?a|=4:r?u||(a=1):a|=8,_.tiling&&(a|=r.isPowerOf2?1:2),A&&(p=D&&(0!==D.red||0!==D.green||0!==D.blue||0!==D.grey),l=i&&i.alpha>0,p&&(a|=16),l&&(a|=32)),d&&(0===S.type?a|=64:1===S.type&&(a|=128)),(n=gs.Effect.get(a)).use(),n.setMatrixValue("pMatrix",this.projectionMatrix),_.tilemap?(h=Texture2D.filter,Texture2D.filter=0,this.setBitmap(_.tilemap.dataBitmap,2),this.setBitmap(_.tilemap.tilesetBitmap,3),Texture2D.filter=h,n.setVector2Value("viewportSize",Graphics.width,Graphics.height),n.setVector2Value("viewportOrigin",_.tilemap.ox,_.tilemap.oy),n.setVector2Value("autotileSettings",_.tilemap.autotileAreaStart,_.tilemap.tileSize),n.setFloatValue("autotileOffset",_.tilemap.autotileOffset),n.setVector2Value("invTilesetTextureSize",1/_.tilemap.tilesetBitmap.texture.realWidth,1/_.tilemap.tilesetBitmap.texture.realHeight),n.setVector2Value("invDataTextureSize",1/_.tilemap.dataBitmap.texture.realWidth,1/_.tilemap.dataBitmap.texture.realHeight),n.setIntegerValue("DataTexture",2),n.setIntegerValue("TilesetTexture",3)):r||n.setVector4Value("Color",i.red,i.green,i.blue,i.alpha),_.tiling&&!r.isPowerOf2&&n.setVector2Value("TextureMax",r.width/r.realWidth,r.height/r.realHeight),p&&n.setVector4Value("Tone",D.red,D.green,D.blue,D.grey),l&&n.setVector4Value("Color",i.red,i.green,i.blue,i.alpha),d&&(this.setBitmap(S.source,1),0===S.type?(n.setVector2Value("MaskOffset",S.ox/S.source.width,S.oy/S.source.height),n.setIntegerValue("Texture1",1)):1===S.type&&(n.setFloatValue("CurrentValue",S.value/255),n.setFloatValue("Vague",S.vague/255),n.setIntegerValue("Texture1",1))),c)for(y=0,v=(R=_.effects.list).length;y<v;y++)(s=R[y]).enabled&&s.setup(n,_,r)}f++,g++}return this.drawTasks(r,n,E,g-E,!1),this.renderTaskIndex=0},t.prototype.drawTasks=function(t,e,i,r,o){if(i>=0)return this.setTexture(t),this.effectUsed=!0,this.projectionMatrixOld=this.projectionMatrix,this.opacityOld=this.opacity,o&&$gl.clear($gl.COLOR_BUFFER_BIT|$gl.DEPTH_BUFFER_BIT),$gl.drawElements($gl.TRIANGLES,6*r,$gl.UNSIGNED_SHORT,6*i*2)},t.prototype.drawRect=function(t,e,i){this.setTexture(null),this.texture=null,this.drawQuad(this.position,this.size)},t.prototype.changeTone=function(t){return this.drawScreenRect(t)},t.prototype.prepareScreenRect=function(){return this.render(),Graphics.frameBuffer.bind(),Graphics.frameBuffer.setTexture(Graphics.offscreenTexture),this.setTexture(Graphics.screenTexture),this.transform=mat2d.create(),mat2d.scale(this.transform,this.transform,[Graphics.screenTexture.width,Graphics.screenTexture.height]),this.setSourceRectangle(0,0,Graphics.screenTexture.width,Graphics.screenTexture.height),this.drawTransform(),this.render(),Graphics.frameBuffer.setTexture(Graphics.screenTexture)},t.prototype.drawScreenRect=function(t,e,i){return Graphics.offscreenTexture.bind(),e&&$gl.generateMipmap($gl.TEXTURE_2D),null!==i&&Graphics.offscreenTexture.setFilter(i,e),Graphics.offscreenTexture.unbind(),mat2d.identity(this.transform_),this.transformVector_[0]=t.x,this.transformVector_[1]=t.y,mat2d.translate(this.transform_,this.transform_,this.transformVector_),this.transformVector_[0]=t.width,this.transformVector_[1]=t.height,mat2d.scale(this.transform_,this.transform_,this.transformVector_),this.transform=this.transform_,this.setTexture(Graphics.offscreenTexture),this.setSourceRectangle(t.x,t.y,t.width,t.height),$gl.disable($gl.BLEND),this.drawTransform(),this.render(),$gl.enable($gl.BLEND)},t.prototype.blur=function(t,e){return this.render(),mat2d.identity(this.transform_),this.transformVector_[0]=t.x,this.transformVector_[1]=t.y,mat2d.translate(this.transform_,this.transform_,this.transformVector_),this.transformVector_[0]=t.width,this.transformVector_[1]=t.height,mat2d.scale(this.transform_,this.transform_,this.transformVector_),this.transform=this.transform_,this.blurV(t,e),this.blurH(t,e)},t.prototype.blurV=function(t,e){var i,r;for(this.setTexture(Graphics.offscreenTexture),this.setSourceRectangle(t.x,t.y,t.width,t.height),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height),this.visualEffect=this.vBlurEffect,i=0,r=e;0<=r?i<=r:i>=r;0<=r?++i:--i)this.drawQuad(this.position,this.size),this.render(),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height);return this.visualEffect=null},t.prototype.blurH=function(t,e){var i,r;for(this.setTexture(Graphics.offscreenTexture),this.setSourceRectangle(t.x,t.y,t.width,t.height),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height),this.visualEffect=this.hBlurEffect,i=0,r=e;0<=r?i<=r:i>=r;0<=r?++i:--i)this.drawQuad(this.position,this.size),this.render(),$gl.copyTexSubImage2D($gl.TEXTURE_2D,0,0,0,0,0,Graphics.width,Graphics.height);return this.visualEffect=null},t.prototype.drawTransition=function(t){var e,i;return null!=(i=this.texture)&&i.unbind(),this.texture=null,this.setBitmap(t.sourceBitmap,1),this.setBitmap(t.targetBitmap,2),this.setBitmap(t.transitionBitmap,3),this.setSourceRectangleForTexture(t.transitionBitmap.texture,0,0,t.transitionBitmap.width,t.transitionBitmap.height),this.vertexData[0]=0,this.vertexData[1]=0,this.vertexData[5]=0+Graphics.width,this.vertexData[6]=0,this.vertexData[10]=0,this.vertexData[11]=0+Graphics.height,this.vertexData[15]=0+Graphics.width,this.vertexData[16]=0+Graphics.height,this.vertexBuffer.setSubData(this.vertexData),this.currentEffect=null,(e=this.transitionEffect).use(),e.setFloatValue("CurrentAlpha",t.currentAlpha/255),e.setFloatValue("Vague",t.vague/255),e.setIntegerValue("Texture0",1),e.setIntegerValue("Texture1",2),e.setIntegerValue("Texture2",3),e.setMatrixValue("pMatrix",this.projectionMatrix),$gl.drawElements($gl.TRIANGLES,6,$gl.UNSIGNED_SHORT,0)},t.prototype.drawTiles=function(t,e,i,r,o,s,n){var a,h,l,u;l=this.renderTaskIndex*(4*this.vertexSize),a=0|this.opacity<<24,this.position1[0]=0,this.position1[1]=0,this.position2[0]=1,this.position2[1]=0,this.position3[0]=0,this.position3[1]=1,this.position4[0]=1,this.position4[1]=1,vec2.transformMat2d(this.position1,this.position1,this.transform),vec2.transformMat2d(this.position2,this.position2,this.transform),vec2.transformMat2d(this.position3,this.position3,this.transform),vec2.transformMat2d(this.position4,this.position4,this.transform),this.vertexData[l]=this.position1[0],this.vertexData[l+1]=this.position1[1],this.vertexColorData[l+4]=a,this.vertexData[l+5]=this.position2[0],this.vertexData[l+6]=this.position2[1],this.vertexColorData[l+9]=a,this.vertexData[l+10]=this.position3[0],this.vertexData[l+11]=this.position3[1],this.vertexColorData[l+14]=a,this.vertexData[l+15]=this.position4[0],this.vertexData[l+16]=this.position4[1],this.vertexColorData[l+19]=a,h=Texture2D.filter,Texture2D.filter=0,this.updateBitmap(i),Texture2D.filter=h,this.setSourceRectangleForTexture(i.texture,0,0,i.texture.realWidth,i.texture.realHeight),(u=this.renderTasks[this.renderTaskIndex]).l2dObject=null,u.texture=i.texture,u.tiling=!1,u.tilemap={tilesetBitmap:r,dataBitmap:i,ox:t,oy:e,autotileOffset:o,autotileAreaStart:n.specialTiles.x,tileSize:s},u.clip.set(this.clip.x,this.clip.y,this.clip.width,this.clip.height),u.tone=this.tone,u.color=this.color,u.mask=this.mask,u.opacity=this.opacity,u.blendMode=this.blendType,u.effect=this.visualEffect,u.clear=this.clear,this.renderTaskIndex++,this.render()},t.prototype.drawLive2D=function(t){return t.draw_()},t.prototype.drawTiledBitmap=function(t,e,i,r,o,s,n,a,h){var l,u,c,d,p,f,m,g,w;for(this.setBitmap(t),e=Math.floor(e),i=Math.floor(i),r=Math.floor(r),o=Math.floor(o),f=Math.ceil(r/a),m=Math.ceil(o/h),l=0,g=u=0,d=f;0<=d?u<d:u>d;g=0<=d?++u:--u)for(w=c=0,p=m;0<=p?c<p:c>p;w=0<=p?++c:--c)this.position[0]=e+g*a,this.position[1]=i+w*h,this.size[0]=(l=this.position[0]+a-(e+r))>0?a-l:a,this.size[1]=(l=this.position[1]+h-(i+o))>0?h-l:h,this.setSourceRectangle(s,n,this.size[0],this.size[1]),this.drawQuad(this.position,this.size);return null},t.prototype.drawBitmapSimple=function(t,e,i,r,o,s,n,a,h){if(t.loaded)return this.setBitmap(t),this.setSourceRectangle(s,n,a,h),this.position[0]=e-this.ox,this.position[1]=i-this.oy,this.size[0]=r,this.size[1]=o,this.drawQuad(this.position,this.size)},t.prototype.drawTransform=function(){return this.drawQuad(this.position,this.size)},t.prototype.drawBitmap=function(t,e,i,r,o,s){if(t.loaded){switch(o=o||0,s=s||0,e=e-this.ox-o,i=i-this.oy-s,this.blendType){case 1:$gl.blendFunc($gl.SRC_ALPHA,$gl.ONE);break;case 2:$gl.blendFunc($gl.SRC_ALPHA_SATURATE,$gl.ONE_MINUS_SRC_COLOR);break;default:$gl.blendFuncSeparate($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA,$gl.ONE,$gl.ONE_MINUS_SRC_ALPHA)}return this.setBitmap(t),this.mirror?this.setSourceRectangle(r.x+r.width,r.y,-r.width,r.height):this.setSourceRectangle(r.x,r.y,r.width,r.height),this.position[0]=e,this.position[1]=i,this.size[0]=r.width*this.zoom.x,this.size[1]=r.height*this.zoom.y,this.angle>0?(this.rotationCenter[0]=.5*this.size[0],this.rotationCenter[1]=.5*this.size[1],this.rotationCenterInverse[0]=-this.rotationCenter[0],this.rotationCenterInverse[1]=-this.rotationCenter[1],this.drawRotatedQuad(this.position,this.size,Math.degreesToRadians(this.angle),this.rotationCenter,this.rotationCenterInverse)):this.drawQuad(this.position,this.size)}},t.prototype._clipRect=function(t){return this.clip.set(t.x,t.y,t.width,t.height),$gl.scissor(t.x,Graphics.height-t.height,t.width-t.x,Graphics.height-t.y-(Graphics.height-t.height))},t.prototype.clipRect=function(t){return this.clip.set(t.x,t.y,t.width,t.height),$gl.scissor(t.x,Graphics.height-t.y-t.height,t.width,t.height)},t.prototype.clipTo=function(t,e,i,r){return this.clip.set(t,e,i,r),$gl.scissor(t,Graphics.height-e-r,i,r)},t.prototype.updateBitmap=function(t){return null==t.texture?t.texture=new Texture2D(t.image,t._flipTextureY):t.sequenceNumber!==t.texture.sequenceNumber?(t.texture.setImageData(t),t.dirtyRect.set(-1,-1,-1,-1)):void 0},t.prototype.setBitmap=function(t,e){if(t&&t.width)return null==t.texture?t.texture=new Texture2D(t.image,t._flipTextureY):t.sequenceNumber!==t.texture.sequenceNumber&&(t.texture.setImageData(t),t.dirtyRect.set(-1,-1,-1,-1)),t.texture.sequenceNumber=t.sequenceNumber,this.setTexture(t.texture,e)},t.prototype.setTexture=function(t,e){var i;if(null==e){if(this.texture===t)return;return this.texture=t,null!=(i=this.texture)?i.bind():void 0}return $gl.activeTexture($gl.TEXTURE0+e),null!=t&&t.bind(),$gl.activeTexture($gl.TEXTURE0)},t.prototype.setSourceRectangleForTexture=function(t,e,i,r,o){var s,n,a,h,l;if(null!=t)return h=e/t.realWidth,l=i/t.realHeight,a=r/t.realWidth,n=o/t.realHeight,s=this.renderTaskIndex*(4*this.vertexSize),this.vertexData[s+2]=h,this.vertexData[s+3]=l,this.vertexData[s+7]=h+a,this.vertexData[s+8]=l,this.vertexData[s+12]=h,this.vertexData[s+13]=l+n,this.vertexData[s+17]=h+a,this.vertexData[s+18]=l+n},t.prototype.setSourceRectangle=function(t,e,i,r){var o,s,n,a,h;if(null!=this.texture)return this.mirrorY?(h=(e+r)/this.texture.realHeight,s=-r/this.texture.realHeight):(h=e/this.texture.realHeight,s=r/this.texture.realHeight),this.mirror?(a=(t+i)/this.texture.realWidth,n=-i/this.texture.realWidth):(a=t/this.texture.realWidth,n=i/this.texture.realWidth),o=this.renderTaskIndex*(4*this.vertexSize),this.vertexData[o+2]=a,this.vertexData[o+3]=h,this.vertexData[o+7]=a+n,this.vertexData[o+8]=h,this.vertexData[o+12]=a,this.vertexData[o+13]=h+s,this.vertexData[o+17]=a+n,this.vertexData[o+18]=h+s},t}(),window.Renderer_OpenGL=e,window.Renderer=(window.$PARAMS,Renderer_Canvas),gs.Renderer=e}.call(this),function(){var t,e,i;i="precision mediump float;\n\nattribute vec3 vertexPosition;\nattribute vec2 vertexTexture;\nattribute vec4 vertexColor;\n\n{DEFINES}\n\n{UNIFORMS}\n{VARYING}\n\n#ifdef USE_POSITION\nvoid default_position()\n{\n vColor = vertexColor;\n gl_Position = pMatrix * vec4(vertexPosition, 1.0);\n textureCoord = vertexTexture.st;\n}\n#endif\n#ifdef USE_TILEMAP\nvoid tilemap()\n{\n pixelCoord = (vertexTexture * viewportSize) + viewportOrigin;\n dataTextureCoord = pixelCoord * invDataTextureSize / autotileSettings.y;\n textureCoord = vertexTexture;\n vColor[3] = 1.0;\n\n gl_Position = pMatrix * vec4(vertexPosition, 1.0);\n}\n#endif\n\n{FUNCTIONS}\n\nvoid main(void)\n{\n {FUNCTION_CALLS}\n}",e="precision mediump float;\n\n{DEFINES}\n\n{UNIFORMS}\n{VARYING}\n\n#ifdef USE_TEXTURE_COLOR\nvoid texture_color()\n{\n#ifdef USE_TEXTURE_TILING\n gl_FragColor = texture2D(Texture0, mod(textureCoord, TextureMax));\n#else\n gl_FragColor = texture2D(Texture0, textureCoord);\n#endif\n\n gl_FragColor[3] *= vColor[3];\n}\n#endif\n\n#ifdef USE_TEXTURE_COLOR_TILING\nvoid texture_color_tiling()\n{\n gl_FragColor = texture2D(Texture0, mod(textureCoord, TextureMax));\n gl_FragColor[3] *= vColor[3];\n}\n#endif\n\n#ifdef USE_TINTING\nvoid tinting()\n{\n vec4 c = gl_FragColor;\n float avg = (c[0] + c[1] + c[2]) / 3.0;\n float grey = Tone[3] / 255.0;\n c.xyz = (avg * grey + c.xyz * (1.0 - grey)) + Tone.xyz / 255.0;\n c[3] *= vColor[3];\n gl_FragColor = c;\n}\n#endif\n\n#ifdef USE_COLOR\nvoid color()\n{\n vec4 c = gl_FragColor;\n float a = Color[3] / 255.0;\n\n c.xyz = Color.xyz / 255.0 * a + c.xyz * (1.0 - a);\n c[3] *= vColor[3];\n\n gl_FragColor = c;\n}\n#endif\n#ifdef USE_DYNAMIC_MASK\nvoid dynamic_mask()\n{\n vec4 sc = gl_FragColor;\n vec4 tsc = texture2D(Texture1, textureCoord);\n vec4 c = vec4(0.0, 0.0, 0.0, 0.0);\n\n if(tsc[0] >= CurrentValue)\n {\n if(Vague > tsc[0] - CurrentValue)\n {\n float diff = tsc[0] - CurrentValue;\n float alpha = diff / Vague;\n\n c[0] = sc[0];\n c[1] = sc[1];\n c[2] = sc[2];\n c[3] = sc[3] * alpha * (vColor[3]);\n }\n else\n {\n c = sc;\n c[3] *= (vColor[3]);\n }\n }\n\n gl_FragColor = c;\n}\n#endif\n#ifdef USE_STATIC_MASK\nvoid static_mask()\n{\n vec4 sc = gl_FragColor;\n vec4 tsc = texture2D(Texture1, vec2(textureCoord.s + MaskOffset.x, textureCoord.t + MaskOffset.y));\n\n sc[3] *= tsc[0] * (vColor[3]);\n\n gl_FragColor = sc;\n}\n#endif\n#ifdef USE_COLOR_QUAD\nvoid color_quad()\n{\n gl_FragColor = Color / 255.0;\n}\n#endif\n#ifdef USE_TILEMAP\nvoid tilemap()\n{\n vec4 tile = texture2D(DataTexture, dataTextureCoord);\n if(tile.x == 1.0 && tile.y == 1.0) { discard; }\n\n vec2 tilesetOffset = floor(tile.xy * 256.0) * autotileSettings.y;\n vec2 tilesetCoord = mod(pixelCoord, autotileSettings.y);\n\n if(tilesetOffset.x >= autotileSettings.x) tilesetOffset.x = tilesetOffset.x + autotileOffset;\n\n gl_FragColor = texture2D(TilesetTexture, (tilesetOffset + tilesetCoord) * invTilesetTextureSize);\n}\n#endif\n#ifdef USE_LOD_BLUR\nvoid lod_blur()\n{\n\t float bias = (5.0 + 5.0 * sin(LodBlurPower));\n#ifdef USE_TEXTURE_TILING\n vec4 col = texture2D(Texture0, mod(textureCoord, TextureMax), bias );\n#else\n\t vec4 col = texture2D(Texture0, textureCoord , bias );\n#endif\n\n\t gl_FragColor = vec4( col.xyz, 1.0 );\n}\n#endif\n#ifdef USE_PIXELATE\nvoid pixelate()\n{\n vec2 pixelatedCoord = vec2(0.0, 0.0);\n pixelatedCoord.x = floor(textureCoord.x / PixelateSize.x) * PixelateSize.x;\n pixelatedCoord.y = floor(textureCoord.y / PixelateSize.y) * PixelateSize.y;\n\n#ifdef USE_TEXTURE_TILING\n gl_FragColor = texture2D(Texture0, mod(pixelatedCoord, TextureMax));\n#else\n gl_FragColor = texture2D(Texture0, pixelatedCoord);\n#endif\n}\n#endif\n\n{FUNCTIONS}\n\nvoid main(void)\n{\n {FUNCTION_CALLS}\n}",t=function(){function t(t,e){if(this.id=$gl.createShader(e),$gl.shaderSource(this.id,t),$gl.compileShader(this.id),!$gl.getShaderParameter(this.id,$gl.COMPILE_STATUS))throw'Error while compliling shader "'+name+'". '+$gl.getShaderInfoLog(this.id)}return t.defaultShaders={"fragment-shader-template":e,"vertex-shader-template":i},t.prototype.dispose=function(){return $gl.deleteShader(this.id),this.id=null},t}(),window.Shader=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t){var e;e=(e=(e=(e=(e=(e=Shader.defaultShaders["vertex-shader-template"]).replace(/\{DEFINES\}/gi,t.defines.join("\n"))).replace(/\{UNIFORMS\}/gi,t.uniforms.join("\n"))).replace(/\{VARYING\}/gi,t.varying.join("\n"))).replace(/\{FUNCTIONS\}/gi,t.functions.join("\n"))).replace(/\{FUNCTION_CALLS\}/gi,t.functionCalls.join("\n")),i.__super__.constructor.call(this,e,$gl.VERTEX_SHADER)}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,Shader),i}(),window.VertexShader=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t){var e;e=(e=(e=(e=(e=(e=Shader.defaultShaders["fragment-shader-template"]).replace(/\{DEFINES\}/gi,t.defines.join("\n"))).replace(/\{UNIFORMS\}/gi,t.uniforms.join("\n"))).replace(/\{VARYING\}/gi,t.varying.join("\n"))).replace(/\{FUNCTIONS\}/gi,t.functions.join("\n"))).replace(/\{FUNCTION_CALLS\}/gi,t.functionCalls.join("\n")),i.__super__.constructor.call(this,e,$gl.FRAGMENT_SHADER)}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,Shader),i}(),window.FragmentShader=t}.call(this),function(){var t,e,i;i=function(){return function(t){var e,i,r,o,s,n,a,h;this.id=null!=(e=null!=t?t.id:void 0)?e:0,this.type=null!=(i=null!=t?t.type:void 0)?i:gs.GraphicEffectType.ADDON,this.name=null!=(r=null!=t?t.name:void 0)?r:"unknown",this.uniforms=null!=(o=null!=t?t.uniforms:void 0)?o:[],this.varying=null!=(s=null!=t?t.varying:void 0)?s:[],this.defines=null!=(n=null!=t?t.defines:void 0)?n:[],this.functionCalls=null!=(a=null!=t?t.functionCalls:void 0)?a:[],this.functions=null!=(h=null!=t?t.functions:void 0)?h:[]}}(),gs.EffectInfo=i,e=function(){function e(){this.wobble=new gs.WobbleEffect,this.blur=new gs.BlurEffect,this.pixelate=new gs.PixelateEffect,this.initialize()}return e.prototype.initialize=function(){var e,i,r,o,s;for(this.list=Object.values(this).where(function(t){return t instanceof gs.GraphicEffect&&t.type!==gs.GraphicEffectType.INTERNAL}),i=r=0,o=(s=this.list).length;r<o;i=++r)(e=s[i]).id=t.fragmentShaderInfos[e.name].id;return null},e}(),gs.EffectCollection=e,t=function(){function t(t){this.textured=null==t,this.programId=$gl.createProgram(),this.locations={},this.pointerSet=!1}return t.nextEffectId=8,t.registerEffect=function(e){return t.fragmentShaderInfos[e.name]=e,t.fragmentShaderInfosByID[1<<t.nextEffectId]=e,t.vertexShaderInfosByID[1<<t.nextEffectId]=t.vertexShaderInfos.position,e.id=1<<t.nextEffectId,t.nextEffectId++},t.effects=new Array(513),t.vertexShaderInfos={tilemap:{defines:["#define USE_TILEMAP"],uniforms:["uniform mat4 pMatrix;","uniform vec2 viewportSize;","uniform vec2 viewportOrigin;","uniform vec2 invDataTextureSize;","uniform vec2 autotileSettings;"],varying:["varying vec2 dataTextureCoord;","varying vec2 pixelCoord;","varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["tilemap();"],functions:[]},position:{defines:["#define USE_POSITION"],uniforms:["uniform mat4 pMatrix;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["default_position();"],functions:[]}},t.fragmentShaderInfos={texture_color:{type:0,defines:["#define USE_TEXTURE_COLOR"],uniforms:["uniform sampler2D Texture0;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["texture_color();"],functions:[]},texture_color_tiling:{type:1,defines:["#define USE_TEXTURE_TILING"],uniforms:["uniform vec2 TextureMax;"],varying:[],functionCalls:[],functions:[]},tinting:{type:1,defines:["#define USE_TINTING"],uniforms:["uniform sampler2D Texture0;","uniform vec4 Tone;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["tinting();"],functions:[]},color:{type:1,defines:["#define USE_COLOR"],uniforms:["uniform sampler2D Texture0;","uniform vec4 Color;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["color();"],functions:[]},dynamic_mask:{type:1,defines:["#define USE_DYNAMIC_MASK"],uniforms:["uniform sampler2D Texture0;","uniform sampler2D Texture1;","uniform float Vague;","uniform float CurrentValue;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["dynamic_mask();"],functions:[]},static_mask:{type:1,defines:["#define USE_STATIC_MASK"],uniforms:["uniform sampler2D Texture0;","uniform sampler2D Texture1;","uniform vec2 MaskOffset;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["static_mask();"],functions:[]},tilemap:{type:0,defines:["#define USE_TILEMAP"],uniforms:["uniform sampler2D DataTexture;","uniform sampler2D TilesetTexture;","uniform vec2 invTilesetTextureSize;","uniform float autotileOffset;","uniform vec2 autotileSettings;"],varying:["varying vec2 dataTextureCoord;","varying vec2 pixelCoord;"],functionCalls:["tilemap();"],functions:[]},color_quad:{type:0,defines:["#define USE_COLOR_QUAD"],uniforms:["uniform vec4 Color;"],varying:[],functionCalls:["color_quad();"],functions:[]},lod_blur:{type:0,name:"lod_blur",defines:["#define USE_LOD_BLUR"],uniforms:["uniform sampler2D Texture0;","uniform float LodBlurPower;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["lod_blur();"],functions:[]},pixelate:{type:0,name:"pixelate",defines:["#define USE_PIXELATE"],uniforms:["uniform sampler2D Texture0;","uniform vec2 PixelateSize;"],varying:["varying vec2 textureCoord;","varying vec4 vColor;"],functionCalls:["pixelate();"],functions:[]}},t.fragmentShaderInfosByID=new Array(513),t.vertexShaderInfosByID=new Array(513),t.initialize=function(){return t.fragmentShaderInfosByID[1]=t.fragmentShaderInfos.texture_color,t.fragmentShaderInfosByID[2]=t.fragmentShaderInfos.texture_color_tiling,t.fragmentShaderInfosByID[4]=t.fragmentShaderInfos.tilemap,t.fragmentShaderInfosByID[8]=t.fragmentShaderInfos.color_quad,t.fragmentShaderInfosByID[16]=t.fragmentShaderInfos.tinting,t.fragmentShaderInfosByID[32]=t.fragmentShaderInfos.color,t.fragmentShaderInfosByID[64]=t.fragmentShaderInfos.static_mask,t.fragmentShaderInfosByID[128]=t.fragmentShaderInfos.dynamic_mask,t.vertexShaderInfosByID[1]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[2]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[4]=t.vertexShaderInfos.tilemap,t.vertexShaderInfosByID[8]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[16]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[32]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[64]=t.vertexShaderInfos.position,t.vertexShaderInfosByID[128]=t.vertexShaderInfos.position},t.createFragmentInfo=function(e){var i,r,o,s,n,a,h;for(o=[],h=new gs.EffectInfo,i=s=0;s<=10;i=++s)if(e&1<<i){if(!(r=t.fragmentShaderInfosByID[1<<i]))break;o.push(r)}for(o.sort(function(t,e){return t.type>e.type}),n=0,a=o.length;n<a;n++)r=o[n],h.defines.pushArray(r.defines),h.uniforms.pushArray(r.uniforms),h.varying.pushArray(r.varying),h.functions.pushArray(r.functions),h.functionCalls.pushArray(r.functionCalls);return h.defines=h.defines.filter(function(t,e,i){return i.indexOf(t)===e}),h.uniforms=h.uniforms.filter(function(t,e,i){return i.indexOf(t)===e}),h.varying=h.varying.filter(function(t,e,i){return i.indexOf(t)===e}),h.functions=h.functions.filter(function(t,e,i){return i.indexOf(t)===e}),h.functionCalls=h.functionCalls.filter(function(t,e,i){return i.indexOf(t)===e}),h},t.createVertexInfo=function(e){var i,r;return r=new gs.EffectInfo,4&e?(i=t.vertexShaderInfosByID[4],r.defines.pushArray(i.defines),r.uniforms.pushArray(i.uniforms),r.varying.pushArray(i.varying),r.functions.pushArray(i.functions),r.functionCalls.pushArray(i.functionCalls)):(i=t.vertexShaderInfosByID[1],r.defines.pushArray(i.defines),r.uniforms.pushArray(i.uniforms),r.varying.pushArray(i.varying),r.functions.pushArray(i.functions),r.functionCalls.pushArray(i.functionCalls)),r},t.get=function(e){var i,r,o,s,n;return(i=t.effects[e])||(r=t.createFragmentInfo(e),s=t.createVertexInfo(e),i=new t,n=new VertexShader(s),o=new FragmentShader(r),i.setVertexShader(n),i.setFragmentShader(o),i.build(),i.prepare(),t.effects[e]=i),i},t.prototype.dispose=function(){return $gl.deleteProgram(this.programId)},t.prototype.prepare=function(){if(this.vertexPositionAttribute=$gl.getAttribLocation(this.programId,"vertexPosition"),this.vertexTextureAttribute=$gl.getAttribLocation(this.programId,"vertexTexture"),this.vertexColorAttribute=$gl.getAttribLocation(this.programId,"vertexColor"),$gl.enableVertexAttribArray(this.vertexPositionAttribute),$gl.enableVertexAttribArray(this.vertexTextureAttribute),-1!==this.vertexColorAttribute)return $gl.enableVertexAttribArray(this.vertexColorAttribute)},t.prototype.build=function(){if($gl.linkProgram(this.programId),!$gl.getProgramParameter(this.programId,$gl.LINK_STATUS))throw"Error while linking program: "+$gl.getProgramInfoLog(this.programId)},t.prototype.use=function(){if($gl.useProgram(this.programId),$gl.vertexAttribPointer(this.vertexPositionAttribute,2,$gl.FLOAT,!1,20,0),$gl.vertexAttribPointer(this.vertexTextureAttribute,2,$gl.FLOAT,!1,20,8),-1!==this.vertexColorAttribute)return $gl.vertexAttribPointer(this.vertexColorAttribute,4,$gl.UNSIGNED_BYTE,!0,20,16)},t.prototype.setIntegerValue=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1i(this.locations[t],e)},t.prototype.setIntegerValues=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1iv(this.locations[t],e)},t.prototype.setFloatValue=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1f(this.locations[t],e)},t.prototype.setFloatValues=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform1fv(this.locations[t],e)},t.prototype.setVector2Value=function(t,e,i){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform2f(this.locations[t],e,i)},t.prototype.setVector2Values=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform2fv(this.locations[t],e)},t.prototype.setVector3Value=function(t,e,i,r){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform3f(this.locations[t],e,i,r)},t.prototype.setVector3Values=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform3fv(this.locations[t],e)},t.prototype.setVector4Value=function(t,e,i,r,o){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform4f(this.locations[t],e,i,r,o)},t.prototype.setVector4Values=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniform2fv(this.locations[t],e)},t.prototype.setMatrixValue=function(t,e){return null==this.locations[t]&&(this.locations[t]=$gl.getUniformLocation(this.programId,t)),$gl.uniformMatrix4fv(this.locations[t],!1,e)},t.prototype.setVertexShader=function(t){if(null==t&&null!=this.vertexShader&&$gl.detachShader(this.programId,this.vertexShader.id),this.vertexShader=t,null!=this.vertexShader)return $gl.attachShader(this.programId,this.vertexShader.id)},t.prototype.setFragmentShader=function(t){if(null==t&&null!=this.fragmentShader&&$gl.detachShader(this.programId,this.fragmentShader.id),this.fragmentShader=t,null!=this.fragmentShader)return $gl.attachShader(this.programId,this.fragmentShader.id)},t}(),window.Effect=t,gs.Effect=t}.call(this),function(){var t,e;e=function(){function t(){}return t.NEAREST=0,t.LINEAR=1,t}(),gs.TextureFilter=e,t=function(){function t(e,i,r,o,s){this.isPowerOf2=!0,this.filter=t.filter,this.mipmap=null!=s&&s,"string"==typeof e?this.createFromFile(e,i):"number"==typeof e?this.createTexture(e,i,r,o,s):e instanceof Uint8Array?this.createFromPixels(e,i,r,o,s):"object"==typeof e&&this.createFromImage(e,!1,i)}return t.filter=0,t.textures=[],t.prototype.setFilter=function(t,e){if(t!==this.filter)switch(this.filter=t,this.filter){case 0:return $gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);case 1:return $gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}},t.prototype.bind=function(){return $gl.bindTexture($gl.TEXTURE_2D,this.id)},t.prototype.unbind=function(){return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.dispose=function(){return t.textures.remove(this),$gl.deleteTexture(this.id)},t.prototype.createTexture=function(t,e,i,r,o){if(this.id=$gl.createTexture(),this.width=t,this.height=e,this.realWidth=t,this.realHeight=e,this.isLoaded=!0,this.isPowerOf2=Math.nextPow2(this.width)===this.width&&Math.nextPow2(this.height)===this.height,$gl.bindTexture($gl.TEXTURE_2D,this.id),r){switch(this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),o?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,this.realWidth,this.realHeight,0,$gl.RGBA,$gl.UNSIGNED_BYTE,null),o&&$gl.generateMipmap($gl.TEXTURE_2D)}else switch($gl.texImage2D($gl.TEXTURE_2D,0,null!=i?i:$gl.RGBA,t,e,0,null!=i?i:$gl.RGBA,$gl.UNSIGNED_BYTE,null),o&&$gl.generateMipmap($gl.TEXTURE_2D),this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),o?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),o?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.setImageData=function(t){if(null!=t)return $gl.bindTexture($gl.TEXTURE_2D,this.id),$gl.texSubImage2D($gl.TEXTURE_2D,0,0,0,$gl.RGBA,$gl.UNSIGNED_BYTE,t.image),$gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.createFromPixels=function(t,e,i,r,o){var s;switch(this.id=$gl.createTexture(),this.width=e||1,this.height=i||1,r?(this.realHeight=Math.nextPow2(this.height),this.realWidth=Math.nextPow2(this.width)):(this.realWidth=this.width,this.realHeight=this.height),this.isLoaded=!0,s=Math.nextPow2(this.width)===this.width&&Math.nextPow2(this.height)===this.height,this.isPowerOf2=s,$gl.bindTexture($gl.TEXTURE_2D,this.id),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,o),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,e,i,0,$gl.RGBA,$gl.UNSIGNED_BYTE,t),r&&$gl.generateMipmap($gl.TEXTURE_2D),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,!1),this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),r?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),r?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR),s?($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.REPEAT),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.REPEAT)):($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE))}return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.createFromImage=function(t,e,i){var r,o,s,n;switch(this.id=$gl.createTexture(),this.width=t.width||1,this.height=t.height||1,e?(this.realHeight=Math.nextPow2(this.height),this.realWidth=Math.nextPow2(this.width)):(this.realWidth=this.width,this.realHeight=this.height),this.isLoaded=!0,n=Math.nextPow2(this.width)===this.width&&Math.nextPow2(this.height)===this.height,this.isPowerOf2=n,r=t,(e&&this.width!==this.realWidth||this.height!==this.realHeight)&&((r=document.createElement("canvas")).width=Math.max(1,this.realWidth),r.height=Math.max(1,this.realHeight),(o=r.getContext("2d")).clearRect(0,0,this.realWidth,this.realHeight),t.width>0&&t.height>0&&o.drawImage(t,0,0),t=r),s=t instanceof Image?t:r.getContext("2d").getImageData(0,0,this.realWidth,this.realHeight),$gl.bindTexture($gl.TEXTURE_2D,this.id),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,s),e&&$gl.generateMipmap($gl.TEXTURE_2D),this.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST_MIPMAP_NEAREST):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),e?$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_LINEAR):$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR),n?($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.REPEAT),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.REPEAT)):($gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_T,$gl.CLAMP_TO_EDGE),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_WRAP_S,$gl.CLAMP_TO_EDGE))}return $gl.bindTexture($gl.TEXTURE_2D,null)},t.prototype.createFromFile=function(t){return this.filePath=t,this.isLoaded=!1,this.id=$gl.createTexture(),this.image=new Image,this.image.onload=function(t){return function(){var e;switch(t.width=t.image.width,t.height=t.image.height,t.realWidth=Math.nextPow2(t.width),t.realHeight=Math.nextPow2(t.height),t.isPowerOf2=Math.nextPow2(t.width)===t.width&&Math.nextPow2(t.height)===t.height,e=document.createElement("canvas"),e.width=t.realWidth,e.height=t.realHeight,e.getContext("2d").drawImage(t.image,0,0),$gl.bindTexture($gl.TEXTURE_2D,t.id),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,e),t.filter){case 0:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.NEAREST),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.NEAREST);break;case 1:$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR)}return $gl.bindTexture($gl.TEXTURE_2D,null),t.isLoaded=!0}}(this),this.image.src=t},t}(),window.Texture2D=t}.call(this),function(){var t;t=function(){function t(t,e,i,r,o){this.id=$gl.createBuffer(),this.type=t,this.itemSize=i,this.itemCount=r,this.usage=null!=o?o:$gl.STATIC_DRAW,$gl.bindBuffer(t,this.id),$gl.bufferData(t,e,this.usage),this.id.itemSize=i,this.id.numItems=r,$gl.bindBuffer(t,null)}return t.prototype.dispose=function(){if(null!=this.id)return $gl.deleteBuffer(this.id),this.id=null},t.prototype.setData=function(t){return $gl.bufferData(this.type,new Float32Array(t),this.usage)},t.prototype.setSubData=function(t,e){return $gl.bufferSubData(this.type,e,t)},t.prototype.bind=function(){return $gl.bindBuffer(this.type,this.id)},t.prototype.unbind=function(){return $gl.bindBuffer(this.type,null)},t}(),null==window.gs&&(window.gs={}),window.gs.Buffer=t}.call(this),function(){var t;t=function(){function t(){this.id=$gl.createFramebuffer(),this.texture=null}return t.prototype.dispose=function(){if(null!=this.id)return $gl.deleteFramebuffer(this.id),this.id=null},t.prototype.setTexture=function(t){if(null!=this.texture&&$gl.framebufferTexture2D($gl.FRAMEBUFFER,$gl.COLOR_ATTACHMENT0,$gl.TEXTURE_2D,null,0),this.texture=t,null!=this.texture)return $gl.framebufferTexture2D($gl.FRAMEBUFFER,$gl.COLOR_ATTACHMENT0,$gl.TEXTURE_2D,this.texture.id,0)},t.prototype.bind=function(){return $gl.bindFramebuffer($gl.FRAMEBUFFER,this.id)},t.prototype.unbind=function(){return $gl.bindFramebuffer($gl.FRAMEBUFFER,null)},t}(),null==window.gs&&(window.gs={}),window.gs.FrameBuffer=t}.call(this),function(){var t;t=function(){function t(e,i){var r,o,s;this.outlineBitmap_=null,this.shadowBitmap_=null,this.metrics=null,null==t.compositeBuffer&&((t.compositeBuffer=document.createElement("canvas")).width=128,t.compositeBuffer.height=128,(t.compositeContext=t.compositeBuffer.getContext("2d")).imageSmoothingEnabled=!1,t.compositeContext.webkitImageSmoothingEnabled=!1,t.compositeContext.mozImageSmoothingEnabled=!1),null!=e&&null==i?(this.name_=e.name,this.size=e.size,this.bold=e.bold,this.italic=e.italic,this.underline=e.underline,this.strikeThrough=e.strikeThrough,this.smallCaps=e.smallCaps,this.color=Color.fromObject(e.color),this.border=e.border,this.borderColor_=e.borderColor,this.borderSize=e.borderSize,this.shadow=e.shadow,this.shadowColor_=e.shadowColor,this.shadowOffsetX=1,this.shadowOffsetY=1,this.measureBitmap=null):(this.name_=e,this.size=i,this.bold=!1,this.italic=!1,this.underline=!1,this.strikethrough=!1,this.smallCaps=!1,this.color=new Color(255,255,255,255),this.border=!1,this.borderColor_=new Color(0,0,0,255),this.borderSize=4,this.shadow=!1,this.shadowColor_=new Color(0,0,0,128),this.shadowOffsetX=1,this.shadowOffsetY=1,this.measureBitmap=null),this.bitmap=null,this.bitmaps=[],this.loaded=!0,GS.dataCache&&GS.dataCache.RESOURCES&&(s=null,null!=GS.dataCache.RESOURCES.items.resources[(o="Graphics/Fonts/"+this.name)+"_"+s]?(r=GS.dataCache.RESOURCES.items.resources[o+"_"+s]||".woff",o="resources/"+GS.DataPreparer.prepareFilePath(o+"_"+s+r)):(r=GS.dataCache.RESOURCES.items.resources[o]||".woff",o="resources/"+GS.DataPreparer.prepareFilePath(o+r)),".fnt"===r&&(null!=t.bitmapCache[this.name+this.size]?(this.bitmap=t.bitmapCache[this.name+this.size].bitmap,this.bitmapFontData=t.bitmapCache[this.name+this.size].bitmapFontData):(this.loaded=!1,this.loadBitmapFontData(o,s))))}return t.CONTROL_SEQUENCE_COLOR=1,t.CONTROL_SEQUENCE_STYLE=2,t.sequenceColors=[Color.BLACK,Color.WHITE],t.defaultName="Courier",t.defaultSize=18,t.defaultBold=!1,t.defaultItalic=!1,t.defaultUnderline=!1,t.defaultStrikeThrough=!1,t.defaultShadow=!1,t.defaultBorder=!1,t.defaultColor=new Color(255,255,255,255),t.defaultBorderColor=new Color(0,0,0,255),t.defaultShadowColor=new Color(0,0,0,128),t.cache={},t.bitmapCache={},Object.defineProperty(t.prototype,"borderColor",{set:function(t){var e;if(!t.equals(this.borderColor_))return null!=(e=this.outlineBitmap)&&e.changeColor(this.borderColor_),this.borderColor_=t},get:function(){return this.borderColor_}}),Object.defineProperty(t.prototype,"shadowColor",{set:function(t){var e;if(!t.equals(this.shadowColor_))return null!=(e=this.shadowBitmap)&&e.changeColor(this.shadowColor_),this.shadowColor_=t},get:function(){return this.shadowColor_}}),t.prototype.height=function(){},Object.defineProperty(t.prototype,"height",{get:function(){return null==this.metrics&&(this.metrics=this.fontMetrics_()),this.metrics.height}}),Object.defineProperty(t.prototype,"ascent",{get:function(){return null==this.metrics&&(this.metrics=this.fontMetrics_()),this.metrics.ascent}}),Object.defineProperty(t.prototype,"descent",{get:function(){return null==this.metrics&&(this.metrics=this.fontMetrics_()),this.metrics.descent}}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this.bitmaps.length>0?this.bitmapFontData.common.lineHeight:(null==this.metrics&&(this.metrics=this.fontMetrics_()),this.border?this.metrics.height+this.borderSize:this.metrics.height)}}),Object.defineProperty(t.prototype,"size",{set:function(t){if(this.size_!==t)return this.metrics=null,this.size_=t},get:function(){return this.bitmaps.length>0?this.bitmapFontData.info.size:this.size_}}),Object.defineProperty(t.prototype,"name",{set:function(t){if(this.name_!==t)return this.metrics=null,this.name_=t,this.update()},get:function(){return this.name_}}),Object.defineProperty(t.prototype,"bold",{set:function(t){if(this.bold_!==t)return this.metrics=null,this.bold_=t},get:function(){return this.bold_}}),Object.defineProperty(t.prototype,"italic",{set:function(t){if(this.italic_!==t)return this.metrics=null,this.italic_=t},get:function(){return this.italic_}}),Object.defineProperty(t.prototype,"smallCaps",{set:function(t){if(this.smallCaps_!==t)return this.metrics=null,this.smallCaps_=t},get:function(){return this.smallCaps_}}),t.prototype.update=function(){var e,i,r,o,s,n;if(this.bitmapFontData=t.cache[this.name],this.bitmapFontData){for(n=[],i=0,r=(s=this.bitmapFontData.pages).length;i<r;i++)o=s[i],e=t.bitmapCache[o.file],n.push(this.bitmaps[o.id]=e);return n}return this.bitmaps=[]},t.prototype.parseBitmapFontData=function(t){var e,i;return i={pages:[],charData:[],kerningData:[]},e=t.split("\n"),e=e.select(function(t){var e;return e={},t.startsWith("info")&&(t=t.replace(/["][^"]*["]/gm,"0")),t.split(" ").select(function(t){var r;if(0!==t.length)if((r=t.split("="))[1]){if("char"===e.cid)return"id"===r[0]?e.id=parseInt(r[1]):(i.charData[e.id]||(i.charData[e.id]=e),i.charData[e.id][r[0]]=isNaN(r[1])?r[1]:parseInt(r[1]));if("kerning"!==e.cid)return"page"===e.cid?"id"===r[0]?e.id=parseInt(r[1]):(i.pages[e.id]||(i.pages[e.id]=e),i.pages[e.id][r[0]]=isNaN(r[1])?r[1].replace(/"/gm,""):parseInt(r[1])):e[r[0]]=isNaN(r[1])?r[1]:parseInt(r[1]);if("first"===r[0]&&(e.first=parseInt(r[1]),i.kerningData[e.first]||(i.kerningData[e.first]=[])),"second"===r[0]&&(e.second=parseInt(r[1])),"amount"===r[0])return e.amount=parseInt(r[1]),i.kerningData[e.first][e.second]=e.amount}else if(e.cid=r[0],"char"!==e.cid&&"page"!==e.cid)return i[e.cid]=e}),e}),i},t.prototype.loadBitmapFontPages=function(e){var i,r,o,s,n,a,h,l,u,c;for(c=[],r=0,s=(h=e.pages).length;r<s;r++){if(a=h[r],i=t.bitmapCache[a.file]){for(this.loaded=!0,o=0,n=(l=this.bitmaps).length;o<n;o++)if(!l[o].loaded){this.loaded=!1;break}}else u="Graphics/Fonts/"+a.file.substring(0,a.file.lastIndexOf(".")),GS.dataCache.RESOURCES.items.resources[u]||(GS.dataCache.RESOURCES.items.resources[u]=".png"),(i=new Bitmap("Graphics/Fonts/"+a.file.substring(0,a.file.lastIndexOf(".")))).immutable=!1,i.onload=function(t){return function(){var e,i,r,o;for(t.loaded=!0,o=[],e=0,i=(r=t.bitmaps).length;e<i;e++){if(!r[e].loaded){t.loaded=!1;break}o.push(void 0)}return o}}(this);t.bitmapCache[a.file]=i,c.push(this.bitmaps[a.id]=i)}return c},t.prototype.loadBitmapFontData=function(e,i){var r;return this.bitmapFontData=t.cache[this.name],this.bitmapFontData?this.update():((r=new XMLHttpRequest).open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(e){return function(){var i,o;return i=GS.DataPreparer.prepare(r.response),o=new FileReader,o.onload=function(i){return e.bitmapFontData=e.parseBitmapFontData(i.target.result),t.cache[e.name]=e.bitmapFontData,e.loadBitmapFontPages(e.bitmapFontData)},o.onerror=onerror,o.readAsText(new Blob([i]))}}(this),r.onerror=onerror,r.send())},t.prototype._fontHeight=function(){return this.fontMetrics_()},t.prototype.fontMetrics_=function(){var t,e,i,r,o;if(this.bitmaps.length>0)return e=this.bitmapFontData.common,{descent:e.lineHeight-e.base,ascent:e.base,height:e.lineHeight};o=jQuery("<span>hg</span>").css({fontFamily:this.name,fontSize:this.size.toString()+"px",fontWeight:this.bold?"bold":"normal",fontStyle:this.italic?"italic":"normal",fontVariant:this.smallCaps?"small-caps":"normal"}),t=jQuery('<div style="display: inline-block; width: 1px; height: 0px;"></div>'),(i=jQuery("<div></div>")).append(o,t),jQuery("body").append(i);try{r={},t.css({verticalAlign:"baseline"}),r.ascent=t.offset().top-o.offset().top,t.css({verticalAlign:"bottom"}),r.height=t.offset().top-o.offset().top,r.descent=r.height-r.ascent}finally{i.remove()}return r},t.exists=function(){return!0},t.createDefault=function(){var e;return e=new t(this.defaultName,this.defaultSize),e.bold=this.defaultBold,e.italic=this.defaultItalic,e.underline=this.defaultUnderline,e.strikeThrough=this.defaultStrikeThrough,e.shadow=this.defaultShadow,e.border=this.defaultBorder,e.color=this.defaultColor,e.borderColor=this.defaultBorderColor,e.shadowColor=this.defaultShadowColor,e},t.loadCustomFonts=function(e){var i,r,o,s,n;n="",i=[],n="resources/fonts.css",s=GS.dataCache.RESOURCES.items.resources;for(o in s)o.startsWith("Graphics/Fonts/")&&(r=o.split("/"),".woff"===s[o]?i.push(r[r.length-1]):".fnt"===s[o]&&new t(o.split("/").last(),1));return i.length>0?WebFont.load({custom:{families:i,urls:[n]},active:function(){return"function"==typeof e?e(!1):void 0},inactive:function(){return"function"==typeof e?e(!0):void 0}}):"function"==typeof e?e(!1):void 0},t.prototype.toString=function(){return(this.italic?"italic":"")+" "+(this.bold?"bold":"")+" "+(this.smallCaps?"small-caps":"")+" "+this.size+"px "+this.name},t.prototype.set=function(t){return this.name=t.name,this.size=t.size,this.bold=t.bold,this.italic=t.italic,this.underline=t.underline,this.strikeThrough=t.strikeThrough,this.smallCaps=t.smallCaps,this.color.setFromObject(t.color),this.border=t.border,this.borderColor_=t.borderColor,this.borderSize=t.borderSize,this.shadow=t.shadow,this.shadowColor_=t.shadowColor,this.measureBitmap=null},t.prototype.toDataBundle=function(){return{name:this.name,size:this.size,bold:this.bold,italic:this.italic,underline:this.underline,strikeThrough:this.strikeThrough,smallCaps:this.smallCaps,color:this.color,border:this.border,borderColor:this.borderColor,borderSize:this.borderSize,shadow:this.shadow,shadowColor:this.shadowColor}},t.prototype.restore=function(t){return this.name=t.name,this.size=t.size,this.bold=t.bold,this.italic=t.italic,this.underline=t.underline,this.strikeThrough=t.strikeThrough,this.smallCaps=t.smallCaps,this.color.setFromObject(t.color),this.border=t.border,this.borderColor_.setFromObject(t.borderColor),this.borderSize=t.borderSize,this.shadow=t.shadow,this.shadowColor_.setFromObject(t.shadowColor),this.measureBitmap=null},t.prototype.measureBitmapChar=function(t){var e,i;return e=t.charCodeAt(0),null!=(i=this.bitmapFontData.charData[e])?{width:i.xadvance,height:this.bitmapFontData.common.lineHeight+1}:{width:0,height:0}},t.prototype.measureBitmapText=function(t){var e,i,r,o,s,n;for(n={width:0,height:0},0,i=r=0,s=t.length;0<=s?r<s:r>s;i=0<=s?++r:--r)e=t.charCodeAt(i),null!=(o=this.bitmapFontData.charData[e])&&(n.width=n.width+o.xadvance-o.xoffset,n.height=this.bitmapFontData.common.lineHeight+1);return n},t.prototype.measureChar=function(t){var e,i;return this.bitmaps.length>0?this.measureBitmapChar(t):(null==gs.Font.measureBitmap&&(gs.Font.measureBitmap=new Bitmap(1,1),gs.Font.measureBitmap.font=this,gs.Font.measureBitmap.context.font=this.toString()),i={width:0,height:0},t.charCodeAt(0),gs.Font.measureBitmap.context.font=this.toString(),e=gs.Font.measureBitmap.context.measureText(t.charAt(0)),e.height=this.lineHeight,i.width=e.width,i.height=e.height,this.border&&(i.width+=this.borderSize-1+this.borderSize-1),i)},t.prototype.compare=function(t){return t&&t.name===this.name&&t.size===this.size&&t.bold===this.bold&&t.italic===this.italic&&t.underline===this.underline&&t.strikeThrough===this.strikeThrough&&t.smallCaps===this.smallCaps&&t.border===this.border&&t.shadow===this.shadow&&t.borderSize===this.borderSize&&t.shadowOffsetX===this.shadowOffsetX&&t.shadowOffsetY===this.shadowOffsetY&&gs.Color.compare(this.color,t.color)&&gs.Color.compare(this.shadowColor,t.shadowColor)&&gs.Color.compare(this.borderColor,t.borderColor)},t.prototype.measureTextPlain=function(e){var i;return this.bitmaps.length>0?this.measureBitmapText(e):(null==gs.Font.measureBitmap&&(gs.Font.measureBitmap=new Bitmap(1,1),gs.Font.measureBitmap.font=new t(this),gs.Font.measureBitmap.context.font=this.toString()),gs.Font.measureBitmap.context.font=this.toString(),i=gs.Font.measureBitmap.context.measureText(e),{width:i.width,height:this.lineHeight})},t.prototype.measureText=function(e){var i,r;return this.bitmaps.length>0?this.measureBitmapText(e):(r={width:0,height:0},null==gs.Font.measureBitmap&&(gs.Font.measureBitmap=new Bitmap(1,1),gs.Font.measureBitmap.font=new t(this),gs.Font.measureBitmap.context.font=this.toString()),gs.Font.measureBitmap.context.font=this.toString(),this.shadow?(gs.Font.measureBitmap.context.shadowOffsetX=1,gs.Font.measureBitmap.context.shadowOffsetY=1,gs.Font.measureBitmap.context.shadowBlur=2):(gs.Font.measureBitmap.context.shadowOffsetX=0,gs.Font.measureBitmap.context.shadowOffsetY=0,gs.Font.measureBitmap.context.shadowBlur=0),i=gs.Font.measureBitmap.context.measureText(e),i.height=this.lineHeight,r.width+=i.width,r.height=i.height,r.width=Math.round(r.width),r.height=Math.round(r.height),r)},t}(),window.Font=t,gs.Font=t}.call(this),function(){var t,e;e=function(){function t(){}return t.LEFT=0,t.TOP=0,t.CENTER=1,t.RIGHT=2,t.BOTTOM=2,t}(),gs.TextAlignment=e,function(){function t(){}t.LEFT=0,t.TOP=1,t.CENTER=2,t.RIGHT=3,t.BOTTOM=4}(),gs.Alignment=e,t=function(){function t(t,e,i){this.loaded=!1,this.font=null,this.immutable=!1,this.disposed=!1,this.imageData=null,this.bounds=new gs.Rect(0,0,1,1),this.sequenceNumber=1,this.dirtyRect=new Rect(-1,-1,-1,-1),null!=e&&"string"!=typeof e&&"boolean"!=typeof e?(this.createWithSize(t,e),this.loaded=!0):"string"==typeof t?(this.loaded=!1,this.createFromFile(t,e,i)):"object"==typeof t&&(this.loaded=!0,i?this.createWithImage(t):this.createFromImage(t,e))}return t.bitmaps=[],t.fromDataBundle=function(t,e){var i;return i=null,t.filePath&&((i=ResourceManager.getBitmap(t.filePath)).font=gs.ObjectCodec.decode(t.font,e)),i},t.toDataBundle=function(t,e){return{filePath:t.filePath,languageCode:t.languageCode,font:gs.ObjectCodec.encode(t.font,e)}},t.prototype.makeImmutable=function(){if(!this.immutable&&!this.error)return this.immutable=!0,null==this.texture?this.texture=new Texture2D(this.image):(this.texture.setImageData(bitmap),this.dirtyRect.set(-1,-1,-1,-1)),this.image=null,this.context=null,this.texture.sequenceNumber=this.sequenceNumber},t.prototype.makeMutable=function(){var t,e,i,r;if(this.immutable&&!this.error)return this.immutable=!1,i=$gl.createFramebuffer(),$gl.bindFramebuffer($gl.FRAMEBUFFER,i),$gl.framebufferTexture2D($gl.FRAMEBUFFER,$gl.COLOR_ATTACHMENT0,$gl.TEXTURE_2D,this.texture.id,0),e=new Uint8Array(this.texture.realWidth*this.texture.realHeight*4),$gl.readPixels(0,0,this.texture.realWidth,this.texture.realHeight,$gl.RGBA,$gl.UNSIGNED_BYTE,e),$gl.deleteFramebuffer(i),t=document.createElement("canvas"),t.width=this.texture.realWidth,t.height=this.texture.realHeight,this.context=t.getContext("2d"),(r=this.context.createImageData(this.texture.realWidth,this.texture.realHeight)).data.set(e),this.context.putImageData(r,0,0),this.image=t},t.prototype.createWithImage=function(t){return this.width=t.width,this.height=t.height,this.bounds.set(0,0,this.width,this.height),this.image=t,this.context=t.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.context.webkitImageSmoothingEnabled=!1,this.context.mozImageSmoothingEnabled=!1,this.context.bitmap=this},t.prototype.createFromImage=function(t,e){if(this.createWithSize(t.width,t.height),e&&(this.context.translate(0,this.height),this.context.scale(1,-1)),this.context.drawImage(t,0,0),e)return this.context.setTransform(1,0,0,1,0,0)},t.prototype.createFromFile=function(t,e){var i,r,o;return this.immutable=!0,this.filePath=t,this.languageCode=e,this.font=Font.createDefault(),this.image=new Image,this.image.onload=function(t){return function(){var e;if(t.immutable?(t.width=t.image.width,t.height=t.image.height,t.bounds.set(0,0,t.width,t.height)):((e=document.createElement("canvas")).width=t.image.width,e.height=t.image.height,t.context=e.getContext("2d"),t.context.imageSmoothingEnabled=!1,t.context.webkitImageSmoothingEnabled=!1,t.context.mozImageSmoothingEnabled=!1,t.context.bitmap=t,t.width=t.image.width,t.height=t.image.height,t.bounds.set(0,0,t.width,t.height),t.context.clearRect(0,0,t.width,t.height),t.context.drawImage(t.image,0,0),t.image=e),t.loaded=!0,t.immutable&&(t.texture=new Texture2D(t.image),t.texture.sequenceNumber=t.sequenceNumber,t.image=null,t.context=null),null!=t.onload)return t.onload()}}(this),i=function(e){return function(){var i;if(t&&t.startsWith("data:")?console.log("CANNOT LOAD IMAGE"):console.log("CANNOT LOAD IMAGE: "+t),i=document.createElement("canvas"),i.width=32,i.height=32,e.context=i.getContext("2d"),e.context.imageSmoothingEnabled=!1,e.context.webkitImageSmoothingEnabled=!1,e.context.mozImageSmoothingEnabled=!1,e.context.bitmap=e,e.width=32,e.height=32,e.error=!0,e.context.clearRect(0,0,e.width,e.height),e.image=i,e.loaded=!0,null!=e.onerror)return e.onerror()}}(this),this.image.onerror=i,o=t,o=t.startsWith("data:")?t:gs.Application.getPlatformSpecificGraphicsFilePath(t,e),gs.Platform.isSafariMobile&&gs.Platform.isCordova?$PARAMS.needsPreparation?gs.Application.loadData(o,function(t){return function(e){var r;return e=GS.DataPreparer.prepare(e),r=new FileReader,r.onload=function(e){return t.image.src=e.target.result},r.onerror=i,r.readAsDataURL(new Blob([e]))}}(this),function(t){return i()}):gs.Application.loadData(o,function(t){return function(e){return t.image.src=e}}(this),function(t){return i()},1):$PARAMS.needsPreparation&&!t.startsWith("data:")?((r=new XMLHttpRequest).open("GET",o,!0),r.responseType="arraybuffer",r.onload=function(t){return function(){var e,o;return e=GS.DataPreparer.prepare(r.response),o=new FileReader,o.onload=function(e){return t.image.src=e.target.result},o.onerror=i,o.readAsDataURL(new Blob([e]))}}(this),r.onerror=i,r.send()):this.image.src=o},t.prototype.createWithSize=function(t,e){return this.font=Font.createDefault(),this.context=null,this.image=document.createElement("canvas"),this.width=t,this.height=e,this.bounds.set(0,0,this.width,this.height),this.image.width=this.width,this.image.height=this.height,this.context=this.image.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.context.webkitImageSmoothingEnabled=!1,this.context.mozImageSmoothingEnabled=!1,this.context.bitmap=this,this.clear()},t.prototype.dispose=function(){return t.bitmaps.removeAll(function(t){return t.bitmap===this}),this.disposed=!0,null!=this.texture&&(this.texture.dispose(),this.texture=null),this.image=null,this.context=null},t.prototype.isPixelSet=function(t,e){return this.makeMutable(),this.imageData&&this.imageData.sequenceNumber===this.sequenceNumber||(this.imageData=this.context.getImageData(0,0,this.width,this.height),this.imageData.sequenceNumber=this.sequenceNumber),0!==this.imageData.data[4*(e*this.width+t)+3]},t.prototype.getPixel=function(t,e){return this.makeMutable(),this.imageData&&this.imageData.sequenceNumber===this.sequenceNumber||(this.imageData=this.context.getImageData(0,0,this.width,this.height),this.imageData.sequenceNumber=this.sequenceNumber),new gs.Color(this.imageData.data[4*(e*this.width+t)],this.imageData.data[4*(e*this.width+t)+1],this.imageData.data[4*(e*this.width+t)+2],this.imageData.data[4*(e*this.width+t)+3])},t.prototype.getImageData=function(t,e,i,r){return this.makeMutable(),this.context.getImageData(t,e,i,r)},t.prototype.setImageData=function(t,e,i){return this.makeMutable(),this.context.putImageData(t,e,i),this.dirtyRect.expand(0,0,this.width,this.height)},t.prototype.scale=function(t){var e,i;return i=document.createElement("canvas"),i.width=Math.floor(this.width*t),i.height=Math.floor(this.height*t),e=i.getContext("2d"),e.imageSmoothingEnabled=!1,e.webkitImageSmoothingEnabled=!1,e.mozImageSmoothingEnabled=!1,e.drawImage(this.image,0,0,this.width,this.height,0,0,i.width,i.height),this.image=i,this.width=i.width,this.height=i.height,this.context=e,this.sequenceNumber++},t.prototype.clear=function(){return this.clearRect(0,0,this.width,this.height),this.sequenceNumber++},t.prototype.clearRect=function(t,e,i,r){return this.makeMutable(),null!=e?(this.context.clearRect(t,e,i,r),this.dirtyRect.expand(t,e,i,r)):(this.context.clearRect(t.x,t.y,t.width,t.height),this.dirtyRect.expand(t.x,t.y,t.width,t.height)),this.sequenceNumber++},t.prototype.fillRect=function(t,e,i,r,o){return this.makeMutable(),null!=i?(this.context.fillStyle="rgba({0}, {1}, {2}, {3})".format(o.red,o.green,o.blue,o.alpha),this.context.fillRect(t,e,i,r),this.dirtyRect.expand(t,e,i,r)):(this.context.fillStyle="rgba({0}, {1}, {2}, {3})".format(e.red,e.green,e.blue,e.alpha),this.context.fillRect(t.x,t.y,t.width,t.height),this.dirtyRect.expand(t.x,t.y,t.width,t.height)),this.sequenceNumber++},t.prototype.gradientFillRect=function(t,e,i,r,o,s,n){var a;return this.makeMutable(),null!=o?((a=null!=n?this.context.createLinearGradient(t,e,t,e+r):this.context.createLinearGradient(t,0,t+i,r)).addColorStop(0,o.toString()),a.addColorStop(1,s.toString()),this.context.fillStyle=a,this.context.fillRect(t,e,i,r),this.dirtyRect.expand(t,e,i,r)):((a=null!=r?this.context.createLinearGradient(0,this.width,0,this.height):this.context.createLinearGradient(0,this.height,this.width,0)).addColorStop(0,e.toString()),a.addColorStop(1,i.toString()),this.context.fillStyle=a,this.context.fillRect(t.x,t.y,t.width,t.height),this.dirtyRect.expand(t.x,t.y,t.width,t.height)),this.sequenceNumber++},t.prototype.blt=function(t,e,i,r,o){return this.makeMutable(),i.makeMutable(),this.context.globalAlpha=null!=o?o/255:1,this.context.drawImage(i.image,r.x,r.y,Math.min(r.width,i.width),Math.min(r.height,i.height),t,e,r.width,r.height),this.sequenceNumber++,this.dirtyRect.expand(t,e,r.width,r.height)},t.prototype.stretchBlt=function(t,e,i,r){return this.makeMutable(),e.makeMutable(),this.context.globalAlpha=null!=r?r/255:1,this.context.drawImage(e.image,i.x,i.y,Math.min(i.width,e.width),Math.min(i.height,e.height),t.x,t.y,t.width,t.height),this.sequenceNumber++,this.dirtyRect.expand(t.x,t.y,t.width,t.height)},t.prototype.changeColor=function(t){return this.makeMutable(),this.context.globalCompositeOperation="source-atop",this.context.fillStyle=t.toString(),this.context.fillRect(0,0,this.width,this.height),this.context.globalCompositeOperation="source-over",this.dirtyRect.expand(0,0,this.width,this.height),this.sequenceNumber++},t.prototype.changeHue=function(t){var e,i,r,o,s,n,a;for(this.makeMutable(),i=null,a=null,r=s=0,n=(e=(o=this.context.getImageData(0,0,this.width,this.height)).data).length;s<n;r=s+=4)(i=Color.rgbToHsl(e[r],e[r+1],e[r+2])).h=i.h+t,i.h=i.h>359?i.h-360:i.h,a=Color.hslToRgb(i.h,i.s,i.l),e[r]=a.r,e[r+1]=a.g,e[r+2]=a.b;return this.sequenceNumber++,this.dirtyRect.expand(0,0,this.width,this.height),this.context.putImageData(o,0,0)},t.prototype.drawBitmapFontText=function(t,e,i,r,o,s){var n,a,h,l,u,c,d,p,f,m,g,w;switch(null==r&&(e=t.y,i=t.width,r=t.height,t=t.x),this.dirtyRect.expand(t,e,i,r),this.currentFont!==this.font&&(this.currentFont=this.font),w=this.font.measureText(o),a=this.font.color.toString(),m=null,f=0,h=Font.compositeContext,s){case 0:t=t;break;case 1:t=Math.floor(t+(i-w.width)/2);break;case 2:t=Math.floor(t+i-w.width)}for(l=this.font.bitmapFontData,e+=Math.floor((r-w.height)/2),this.context.globalAlpha=.00392156862745*this.font.color.alpha,c=d=0,g=o.length;0<=g?d<g:d>g;c=0<=g?++d:--d)n=o.charCodeAt(c),(u=this.font.bitmapFontData.charData[n])&&(m&&(p=l.kerningData[f])&&p[n]&&(t+=p[n]),this.font.color.equals(Color.WHITE)?0===c?this.context.drawImage(this.font.bitmaps[u.page].image,u.x,u.y,u.width,u.height,t,e+u.yoffset,u.width,u.height):this.context.drawImage(this.font.bitmaps[u.page].image,u.x,u.y,u.width,u.height,t+u.xoffset,e+u.yoffset,u.width,u.height):(h.drawImage(this.font.bitmaps[u.page].image,u.x,u.y,u.width,u.height,0,0,u.width,u.height),h.globalCompositeOperation="source-atop",h.fillStyle=a,h.fillRect(0,0,u.width,u.height),h.globalCompositeOperation="source-over",this.context.drawImage(Font.compositeBuffer,0,0,u.width,u.height,t+u.xoffset,e+u.yoffset,u.width,u.height),h.clearRect(0,0,u.width,u.height)),m=u,f=n,t+=u.xadvance);return this.sequenceNumber++,null},t.prototype.drawTextF=function(t,e,i,r,o,s,n){var a,h,l,u,c;if(this.makeMutable(),this.font.bitmaps.length>0)return this.drawBitmapFontText(t,e,i,r,o,s,n);switch(s=null!=s?s:0,n=null!=n?n:1,null==r&&(e=t.y,i=t.width,r=t.height,t=t.x),this.dirtyRect.expand(t,e,i,r),this.context.font=this.font.toString(),this.context.textBaseline="top",this.currentFont=this.font,c=this.font.measureText(o),a=this.font.borderColor.toFillStyle(),u=this.font.shadowColor.toString(),h=this.font.color.toString(),s){case 0:t=Math.floor(t);break;case 1:t=Math.floor(t+(i-c.width)/2);break;case 2:t=Math.floor(t+i-c.width)}switch(n){case 0:e=e;break;case 1:e=Math.floor(e+(r-c.height)/2);break;case 2:e=Math.floor(e+r-c.height)}return l=this.font.size/10,this.font.shadow?(this.context.shadowColor=u,this.context.shadowOffsetX=this.font.shadowOffsetX,this.context.shadowOffsetY=this.font.shadowOffsetY,this.context.shadowBlur=2):(this.context.shadowColor="",this.context.shadowOffsetX=0,this.context.shadowOffsetY=0,this.context.shadowBlur=0),this.font.border?(this.context.strokeStyle=a,this.context.fillStyle=h,this.context.lineWidth=this.font.borderSize,this.context.lineJoin="round",this.context.lineCap="round",this.context.strokeText(o,t,e,i),this.context.fillText(o,t,e,i),this.font.underline&&(this.context.strokeRect(t+this.font.borderSize,e+c.height-this.font.descent,c.width-2*this.font.borderSize,l),this.context.fillRect(t+this.font.borderSize,e+c.height-this.font.descent,c.width-2*this.font.borderSize,l)),this.font.strikeThrough&&(this.context.strokeRect(t+this.font.borderSize,e+c.height/2,c.width-2*this.font.borderSize,l),this.context.fillRect(t+this.font.borderSize,e+c.height/2,c.width-2*this.font.borderSize,l)),this.context.lineWidth=1):(this.context.fillStyle=h,this.context.lineWidth=1,this.context.fillText(o,t,e,i),this.font.underline&&this.context.fillRect(t,e+c.height-l-1-this.font.descent,c.width,2),this.font.strikeThrough&&this.context.fillRect(t,e+c.height/2,c.width,2)),this.sequenceNumber++,null},t.prototype.drawText=function(t,e,i,r,o,s,n){return this.drawTextF(t,e,i,r,o,s,n)},t.prototype.textSize=function(t){var e;return e=this.font.measureText(t),this.font.border?(e.width+=0,e.height-=0):this.font.shadow&&(e.width+=0,e.height+=0),e},t.prototype._fontHeight=function(t){var e,i,r,o;o=$("<span>"+t+"</span>").css({fontFamily:this.font.name,fontSize:this.font.size.toString()+"pt",fontWeight:this.font.bold?"bold":"normal"}),e=$('<div style="display: inline-block; width: 1px; height: 0px;"></div>'),(i=$("<div></div>")).append(o,e),$("body").append(i);try{r={},e.css({verticalAlign:"baseline"}),r.ascent=e.offset().top-o.offset().top,e.css({verticalAlign:"bottom"}),r.height=e.offset().top-o.offset().top,r.descent=r.height-r.ascent}finally{i.remove()}return r},t}(),window.Bitmap=t,gs.Bitmap=t}.call(this),function(){var t;t=function(){function t(e,i){this.viewport_=e,this.managed=null==i||i,this.z=0,this.index=0,this.onIndexChange=null,this.ox=0,this.oy=0,this.transform=mat2d.create(),this.anchor=new gs.Point(0,0),this.positionAnchor=new gs.Point(0,0),this.visible=!0,this.disposed=!1,this.position=vec2.create(),this.effects=new gs.EffectCollection,this.id=t.instanceCount,t.instanceCount++,this.initialize()}return t.instanceCount=0,t.prototype.onDataBundleRestore=function(t,e){},Object.defineProperty(t.prototype,"viewport",{set:function(t){if(this.viewport_!==t)return this.managed&&(null!=this.viewport_?this.viewport_.removeGraphicObject(this):Graphics.removeGraphicObject(this)),this.viewport_=t,this.managed?null==this.viewport_?Graphics.addGraphicObject(this):this.viewport_.addGraphicObject(this):void 0},get:function(){return this.viewport_}}),Object.defineProperty(t.prototype,"z",{set:function(t){var e;if(t!==this.z_)return this.z_=t,null!=(e=this.viewport)?e.needsSort=!0:void 0},get:function(){return this.z_}}),t.prototype.initialize=function(){if(this.managed)return null==this.viewport?(Graphics.addGraphicObject(this),this.viewport=Graphics.viewport):this.viewport.addGraphicObject(this)},t.prototype.dispose=function(){if(this.disposed=!0,this.managed)return null!=this.viewport?this.viewport.removeGraphicObject(this):Graphics.removeGraphicObject(this)},t.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-i*(this.zoomX-1)*this.anchor.x,this.position[1]=e-r*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=i*this.zoomX*this.anchor.x,this.position[1]=r*this.zoomY*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t-i*this.positionAnchor.x,this.position[1]=e-r*this.positionAnchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},t.prototype.update=function(){},t.prototype.draw=function(){},t}(),window.GraphicObject=t,gs.GraphicObject=t}.call(this),function(){var t;t=function(){function t(t,e){this.languageCode=e,this.lastCurrentTime=-1,this.filePath=t,this.loaded=!1,this.disposed=!1,this.texture=null,this.width=0,this.height=0,this.sequenceNumber=0,this.onError=null,this.onEnded=null,this.onCanPlay=null,this.videoElement=document.createElement("video"),this.videoElement.autoplay=!1,this.videoElement.preload="auto",jQuery(this.videoElement).attr("playsinline",!0),gs.Platform.isSafariMobile&&!gs.Platform.isCordova&&jQuery(this.videoElement).attr("muted",!0),jQuery(this.videoElement).attr("webkit-playsinline",!0),this.videoElement.playsInline=!0,this.videoElement.oncanplaythrough=function(t){return function(){return t.loaded=!0,t.texture=new Texture2D(t.videoElement.videoWidth,t.videoElement.videoHeight,!1,!0),t.texture.sequenceNumber=0,t.width=t.videoElement.videoWidth,t.height=t.videoElement.videoHeight,t.sequenceNumber=0,"function"==typeof t.onCanPlay?t.onCanPlay():void 0}}(this),this.videoElement.onerror=function(t){return function(e){return t.loaded=!0,t.error=!0,console.log("ERROR: "),console.log(e),"function"==typeof t.onError?t.onError():void 0}}(this),this.videoElement.onended=function(t){return function(e){return"function"==typeof t.onEnded?t.onEnded():void 0}}(this),t=gs.Application.getPlatformSpecificVideoFilePath(t,e),gs.Platform.isSafariMobile&&gs.Platform.isCordova?gs.Application.loadData(t,function(t){return function(e){return t.videoElement.src=e,t.videoElement.load()}}(this),function(t){return function(e){return t.videoElement.onerror(e)}}(this),1):(this.videoElement.src=t,this.videoElement.load())}return t.fromDataBundle=function(t,e){var i;return i=null,t.filePath&&(i=new gs.Video(t.filePath,null),t.isPlaying&&(i.videoElement.currentTime=t.currentTime,i.volume=t.volume,i.playbackRate=t.playbackRate,i.loop=t.loop,i.play())),i},t.toDataBundle=function(t,e){var i;return{filePath:t.filePath,loop:t.loop,isPlaying:t.isPlaying,currentTime:null!=(i=t.videoElement)?i.currentTime:void 0,volume:t.volume,playbackRate:t.playbackRate}},Object.defineProperty(t.prototype,"isPlaying",{get:function(){var t;return!(null!=(t=this.videoElement)?t.paused:void 0)}}),Object.defineProperty(t.prototype,"volume",{get:function(){var t;return null!=(t=this.videoElement)?t.volume:void 0},set:function(t){var e;return null!=(e=this.videoElement)?e.volume=t:void 0}}),Object.defineProperty(t.prototype,"playbackRate",{get:function(){var t;return null!=(t=this.videoElement)?t.playbackRate:void 0},set:function(t){var e;return null!=(e=this.videoElement)?e.playbackRate=t:void 0}}),Object.defineProperty(t.prototype,"loop",{get:function(){var t;return null!=(t=this.videoElement)?t.loop:void 0},set:function(t){var e;return null!=(e=this.videoElement)?e.loop=t:void 0}}),t.prototype.dispose=function(){var t;if(!this.disposed)return null!=(t=this.texture)&&t.dispose(),this.disposed=!0,this.videoElement.oncanplaythrough=null,this.videoElement.onerror=null,this.videoElement.onend=null,this.videoElement.pause(),this.videoElement.src="",delete this.videoElement},t.prototype.play=function(){var t;if(!this.error)return null!=(t=this.videoElement)?t.play():void 0},t.prototype.pause=function(){var t;if(!this.error)return null!=(t=this.videoElement)?t.pause():void 0},t.prototype.stop=function(){var t;return this.error||null!=(t=this.videoElement)&&t.pause(),"function"==typeof this.onEnded?this.onEnded():void 0},t.prototype.update=function(){if(this.loaded&&!this.disposed&&this.videoElement.currentTime!==this.lastCurrentTime)return Graphics.renderer.setTexture(this.texture),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,this.videoElement),this.lastCurrentTime=this.videoElement.currentTime},t}(),gs.Video=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t,e,r,o,s){i.__super__.constructor.call(this,s),this.rect=null!=e?new Rect(t,e,r,o):null!=t?new Rect(t.x,t.y,t.width,t.height):new Rect(0,0,Graphics.width,Graphics.height),this.color=new Color(255,255,255,0),this.tone=new Tone(0,0,0,0),this.angle=0,this.zoomX=1,this.zoomY=1,this.objects=[],this.needsSort=!0,this.position=vec2.create()}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,GraphicObject),i.prototype.dispose=function(){var t,e;for(i.__super__.dispose.call(this),this.disposed=!0,t=0;t<this.objects.length;)(null!=(e=this.objects[t])?e.disposed:void 0)?t++:null!=e&&e.dispose();return null},i.prototype._sort=function(t,e){return t.z<e.z?-1:t.z>e.z?1:t.id>e.id?1:-1},i.prototype.addGraphicObject=function(t){return this!==Graphics.viewport?Graphics.addGraphicObject(t):this.needsSort=!0,-1===this.objects.indexOf(t)&&this.objects.push(t),t.viewport_=this},i.prototype.removeGraphicObject=function(t){return this!==Graphics.viewport&&Graphics.removeGraphicObject(t),Array.remove(this.objects,t)},i.prototype.updateTransform=function(){return mat2d.identity(this.transform),this.viewport&&mat2d.mul(this.transform,this.viewport.transform,this.transform),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=this.ox-this.rect.width*(this.zoomX-1)*(this.anchor.x-this.ox/this.rect.width),this.position[1]=this.oy-this.rect.height*(this.zoomY-1)*(this.anchor.y-this.oy/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=this.rect.width*this.zoomX*(this.anchor.x-this.ox/this.rect.width),this.position[1]=this.rect.height*this.zoomY*(this.anchor.y-this.oy/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=this.zoomX,this.position[1]=this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=this.ox,this.position[1]=this.oy,mat2d.translate(this.transform,this.transform,this.position))},i.prototype.updateGhostTransform=function(t){var e,i;return mat2d.identity(this.transform),e=t.x,i=t.y,this.viewport&&mat2d.mul(this.transform,this.viewport.transform,this.transform),0!==this.angle||1!==t.zoomX||1!==t.zoomY?(this.position[0]=e-this.rect.width*(t.zoomX-1)*(this.anchor.x-e/this.rect.width),this.position[1]=i-this.rect.height*(t.zoomY-1)*(this.anchor.y-i/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=this.rect.width*t.zoomX*(this.anchor.x-e/this.rect.width),this.position[1]=this.rect.height*t.zoomY*(this.anchor.y-i/this.rect.height),mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(t.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=t.zoomX,this.position[1]=t.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=e,this.position[1]=i,mat2d.translate(this.transform,this.transform,this.position))},i.prototype.updateMotionBlur=function(){var t,e,i;if(this.motionBlur.enabled){for((Graphics.frameCount+1)%this.motionBlur.delay==0&&(t={srcRect:new Rect(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),x:this.x,y:this.y,zoomX:this.zoomX,zoomY:this.zoomY,opacity:this.motionBlur.opacity,angle:this.angle},this.motionBlurGhosts.push(t)),e=0,i=[];e<this.motionBlurGhosts.length;)0===(t=this.motionBlurGhosts[e]).opacity?i.push(this.motionBlurGhosts.remove(t)):(t.opacity=Math.max(t.opacity-this.motionBlur.dissolveSpeed,0),i.push(e++));return i}},i.prototype.update=function(){return i.__super__.update.call(this),this.updateTransform()},i.prototype.draw=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m;if(f=Graphics.renderer,m=f.tone,r=f.effects,f.reset(),this.needsSort&&(this.objects.sort(this._sort),this.needsSort=!1),this===Graphics.viewport)for(s=n=0,h=(d=this.objects).length;n<h;s=++n)(c=d[s]).index!==s&&(c.index=s,"function"==typeof c.onIndexChange&&c.onIndexChange()),c.visible&&c.draw();for(i=this.effects.wobble.enabled,u=!1,o=null,a=0,l=(p=this.effects.list).length;a<l;a++)if((e=p[a]).enabled){i=!0,u=e.mipmap,o=e.textureFilter;break}return(i||0!==this.tone.red||0!==this.tone.green||0!==this.tone.blue||0!==this.tone.grey)&&(f.prepareScreenRect(),f.effects=this.effects,f.tone=this.tone,f.drawScreenRect(this.rect,u,o),f.clear=!1,f.effects=r),0!==this.color.alpha&&(t=f.color,f.color=this.color,f.transform=f.transform_,mat2d.identity(f.transform_),this.position[0]=this.rect.x,this.position[1]=this.rect.y,mat2d.translate(f.transform_,f.transform_,this.position),this.position[0]=this.rect.width,this.position[1]=this.rect.height,mat2d.scale(f.transform_,f.transform_,this.position),f.drawRect(this.rect,0,0),f.color=t),f.tone=m},i}(),window.Viewport=t,gs.Viewport=t}.call(this),function(){var t,e,i,r,o,s,n,a,h,l,u,c=function(t,e){function i(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},d={}.hasOwnProperty;t=function(){function t(){}return t.NORMAL=0,t.ADDITIVE=1,t.SUBTRACTIVE=2,t}(),gs.BlendMode=t,r=function(){function t(){}return t.BASE=0,t.ADDON=1,t.INTERNAL=2,t}(),gs.GraphicEffectType=r,i=function(){function t(t){var e,i,r;this.type=null!=(e=null!=t?t.type:void 0)?e:gs.GraphicEffectType.ADDON,this.enabled=null!=(i=null!=t?t.enabled:void 0)&&i,this.id=null!=t?t.id:void 0,this.name=null!=(r=null!=t?t.name:void 0)?r:"unknown",this.mipmap=!1,this.textureFilter=null}return t.prototype.setup=function(t,e,i){},t}(),gs.GraphicEffect=i,u=function(t){function e(t){var i,r,o,s;e.__super__.constructor.call(this,t),this.type=gs.GraphicEffectType.INTERNAL,this.name="wobble",this.power=null!=(i=null!=t?t.power:void 0)?i:.001,this.speed=null!=(r=null!=t?t.speed:void 0)?r:.1,this.vertical=null==(o=null!=t?t.vertcial:void 0)||o,this.horizontal=null==(s=null!=t?t.horizontal:void 0)||s}return c(e,t),e.fromObject=function(t){return new gs.WobbleEffect(t)},e}(gs.GraphicEffect),gs.WobbleEffect=u,e=function(t){function e(t){var i;e.__super__.constructor.call(this,t),this.type=gs.GraphicEffectType.BASE,this.name="lod_blur",this.mipmap=!0,this.textureFilter=gs.TextureFilter.LINEAR,this.power=null!=(i=null!=t?t.power:void 0)?i:0}return c(e,t),e.prototype.setup=function(t,e){return t.setFloatValue("LodBlurPower",e.effects.blur.power-1)},e.fromObject=function(t){return new gs.BlurEffect(t)},e}(gs.GraphicEffect),gs.BlurEffect=e,a=function(t){function e(t){var i,r;e.__super__.constructor.call(this,t),this.type=gs.GraphicEffectType.BASE,this.name="pixelate",this.textureFilter=gs.TextureFilter.NEAREST,this.width=null!=(i=null!=t?t.width:void 0)?i:0,this.height=null!=(r=null!=t?t.height:void 0)?r:0}return c(e,t),e.prototype.setup=function(t,e,i){return t.setVector2Value("PixelateSize",Math.max(e.effects.pixelate.width,1)/i.realWidth,Math.max(e.effects.pixelate.height,1)/i.realHeight)},e.fromObject=function(t){return new gs.PixelateEffect(t)},e}(gs.GraphicEffect),gs.PixelateEffect=a,s=function(){function t(){}return t.STATIC=0,t.DYNAMIC=1,t}(),gs.MaskingType=s,o=function(){function t(t){var e,i,r,o,s;this.ox=null!=(e=null!=t?t.ox:void 0)?e:0,this.oy=null!=(i=null!=t?t.oy:void 0)?i:0,this.source=null,this.type=null!=(r=null!=t?t.type:void 0)?r:0,this.value=null!=(o=null!=t?t.value:void 0)?o:0,this.vague=null!=(s=null!=t?t.vague:void 0)?s:0}return t.prototype.set=function(t){return t?(this.ox=t.ox,this.oy=t.oy,this.source=t.source,this.type=t.type,this.value=t.value,this.vague=t.vague):(this.ox=0,this.oy=0,this.source=null,this.type=0,this.value=0,this.vague=0)},t.prototype.toDataBundle=function(){var t;return{ox:this.ox,oy:this.oy,type:this.type,value:this.value,vague:this.vague,source:null!=(t=this.source)?t.filePath:void 0}},t.fromObject=function(t){return new gs.Mask(t)},t}(),gs.Mask=o,n=function(){function t(t){var e,i,r,o;this.enabled=null!=(e=null!=t?t.enabled:void 0)&&e,this.dissolveSpeed=null!=(i=null!=t?t.dissolveSpeed:void 0)?i:3,this.delay=null!=(r=null!=t?t.delay:void 0)?r:2,this.opacity=null!=(o=null!=t?t.opacity:void 0)?o:100,this.color=Color.TRANSPARENT}return t.prototype.set=function(t){var e,i,r,o;return this.enabled=null!=(e=null!=t?t.enabled:void 0)&&e,this.dissolveSpeed=null!=(i=null!=t?t.dissolveSpeed:void 0)?i:3,this.delay=null!=(r=null!=t?t.delay:void 0)?r:2,this.opacity=null!=(o=null!=t?t.opacity:void 0)?o:100,this.color=Color.TRANSPARENT},t.prototype.toDataBundle=function(){var t;return t={},Object.mixin(t,this),t},t.fromObject=function(t){return new gs.MotionBlur(t)},t}(),gs.MotionBlur=n,function(){}(),l=function(t){function e(t,i){e.__super__.constructor.call(this,t,i),this.bitmap=null,this.video_=null,this.srcRect=null,this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.x=0,this.y=0,this.width=0,this.height=0,this.zoomX=1,this.zoomY=1,this.angle=0,this.mirror=!1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendingMode=0,this.motionBlur=new gs.MotionBlur,this.motionBlurGhosts=[],this.wobble=this.effects.wobble,this.clipRect=new Rect(0,0,Graphics.width,Graphics.height)}return c(e,t),e.objectCodecBlackList=["onIndexChange"],Object.defineProperty(e.prototype,"video",{set:function(t){return this.video_=t,this.bitmap=t},get:function(){return this.video_}}),e.prototype.updateGhostTransform=function(t){var e,i,r,o;return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),i=t.srcRect.width,e=t.srcRect.height,r=t.x-this.ox,o=t.y-this.oy,0!==t.angle||1!==t.zoomX||1!==t.zoomY?(this.position[0]=r-i*(t.zoomX-1)*this.anchor.x,this.position[1]=o-e*(t.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),0!==t.angle&&(this.position[0]=i*this.anchor.x,this.position[1]=e*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(t.angle)),this.position[0]=-i*this.anchor.x,this.position[1]=-e*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=i*t.zoomX,this.position[1]=e*t.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=r,this.position[1]=o,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=e,mat2d.scale(this.transform,this.transform,this.position))},e.prototype.update=function(){var t,i,r;if(e.__super__.update.call(this),this.motionBlur.enabled){for((Graphics.frameCount+1)%this.motionBlur.delay==0&&(t={srcRect:new Rect(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),transform:mat2d.clone(this.transform),opacity:this.motionBlur.opacity},this.motionBlurGhosts.push(t)),i=0,r=[];i<this.motionBlurGhosts.length;)0===(t=this.motionBlurGhosts[i]).opacity?r.push(this.motionBlurGhosts.remove(t)):(t.opacity=Math.max(t.opacity-this.motionBlur.dissolveSpeed,0),r.push(i++));return r}},e.prototype.draw=function(){var t,e,i,r,o,s,n,a,h;if(null!=this.srcRect){if(a=Graphics.renderer,null!=this.video&&this.video.loaded&&(this.bitmap=this.video),e=a.color,h=a.tone,t=a.blendType,i=a.effects,this.updateTransform(~~(this.x-this.ox),~~(this.y-this.oy),this.width||this.srcRect.width,this.height||this.srcRect.height),a.transform=this.transform,a.mirror=this.mirror,a.color=this.color,a.opacity=this.opacity,a.tone=this.tone,a.blendType=this.blendingMode,a.mask=this.mask,a.wobble=this.wobble,a.effects=this.effects,null!=this.clipRect?a.clipRect(this.clipRect):a.clipRect(Graphics.viewport.rect),null==this.bitmap||this.bitmap.disposed||(a.setBitmap(this.bitmap),a.setSourceRectangle(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),a.drawTransform()),this.motionBlur.enabled){for(o=s=0,n=this.motionBlurGhosts.length;0<=n?s<n:s>n;o=0<=n?++s:--s)r=this.motionBlurGhosts[o],a.mirror=this.mirror,a.color=this.motionBlur.color,a.opacity=r.opacity,a.tone=this.tone,a.blendType=this.blendingMode,null!=this.bitmap&&(a.transform=r.transform,a.setSourceRectangle(this.srcRect.x,this.srcRect.y,this.srcRect.width,this.srcRect.height),a.drawTransform());a.color=Color.TRANSPARENT,a.opacity=255}return a.opacity=255,a.tone=h,a.color=e,a.mask=null,a.blendType=t,a.effects=i,a.mirror=!1}},e}(GraphicObject),window.Sprite=l,gs.Sprite=l,h=function(t){function e(t){e.__super__.constructor.call(this,t),this.rect=new Rect(0,0,100,100),this.color=new Color(255,255,255,0),this.opacity=255,this.blendingMode=0,this.clipRect=null,this.zoomX=1,this.zoomY=1,this.angle=0}return c(e,t),e.objectCodecBlackList=["onIndexChange"],e.prototype.update=function(){if(e.__super__.update.call(this),this.flashCounter>0)return this.flashCounter--,this.flashColor.alpha=this.flashCounter/this.flashDuration*255,this.color=this.flashColor},e.prototype.draw=function(){var t,e,i,r;return r=Graphics.renderer,this.clipRect?r.clipRect(this.clipRect):r.clipRect(Graphics.viewport.rect),t=r.blendType,i=r.effects,r.blendType=this.blendingMode,r.mask=this.mask,r.wobble=this.wobble,r.effects=this.effects,0!==this.color.alpha&&(e=r.color,r.color=this.color,r.transform=this.transform,r.opacity=this.opacity,this.updateTransform(this.rect.x-this.ox,this.rect.y-this.oy,this.rect.width,this.rect.height),r.drawRect(this.rect,this.ox,this.oy),r.color=e,r.opacity=255),r.color=e,r.blendType=t,r.mask=null,r.effects=i,r.opacity=255},e}(GraphicObject),window.gs.Quad=h}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t,e){i.__super__.constructor.call(this,t,e),this.bitmap=null,this.video=null,this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendingMode=0,this.vertical=!0,this.horizontal=!0,this.effects=new gs.EffectCollection,this.motionBlur=new gs.MotionBlur,this.motionBlurGhosts=[],this.clipRect=new Rect(0,0,Graphics.width,Graphics.height),this.srcRect=null,this.x=0,this.y=0,this.zoomX=1,this.zoomY=1,this.angle=0}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,GraphicObject),i.objectCodecBlackList=["onIndexChange"],i.prototype.update=function(){return i.__super__.update.call(this)},i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle&&(this.position[0]=t+this.rect.width*this.anchor.x,this.position[1]=e+this.rect.height*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-this.rect.width*(this.zoomX-1)*this.anchor.x,this.position[1]=e-this.rect.height*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._drawTiles=function(t){var e,i,r,o;return i=Graphics.renderer,e=i.blendType,i.blendType=this.blendingMode,r=t.x-this.ox,o=t.y-this.oy,this.updateTransform(r,o,t.width,t.height),i.transform=this.transform,i.setBitmap(this.bitmap),i.setSourceRectangle(this.x,this.y,t.width,t.height),i.drawTransform(),i.blendType=e,null},i.prototype._draw=function(){if(null!=this.bitmap)return this._drawTiles(Graphics.viewport.rect)},i.prototype.draw=function(){var t,e,i,r,o,s;if(null!=(r=this.bitmap)?r.loaded:void 0)return null==this.srcRect&&(this.srcRect=new Rect(0,0,this.bitmap.width,this.bitmap.height)),o=Graphics.renderer,null!=this.video&&this.video.loaded&&(this.bitmap=this.video),e=o.color,s=o.tone,t=o.blendType,i=o.effects,o.mirror=!1,o.color=this.color,o.opacity=this.opacity,o.tone=this.tone,o.blendType=this.blendingMode,o.mask=this.mask,o.wobble=this.wobble,o.effects=this.effects,null!=this.clipRect?o.clipRect(this.clipRect):o.clipRect(Graphics.viewport.rect),this._draw(),o.opacity=255,o.tone=s,o.color=e,o.mask=null,o.blendType=t,o.effects=i},i}(),gs.TilingObject=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(){i.__super__.constructor.apply(this,arguments),this.rect=new Rect(0,0,Graphics.width,Graphics.height)}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,gs.TilingObject),i.objectCodecBlackList=["onIndexChange"],i.prototype._draw=function(){if(null!=this.bitmap)return this._drawTiles(this.rect)},i}(),gs.TilingSprite=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(){i.__super__.constructor.apply(this,arguments),this.rect=new Rect(0,0,Graphics.width,Graphics.height),this.x=0,this.y=0,this.viewportInverse_=mat2d.create()}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,gs.TilingObject),i.objectCodecBlackList=["onIndexChange"],i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.invert(this.viewportInverse_,this.viewport.transform),mat2d.mul(this.transform,this.transform,this.viewportInverse_),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-i*(this.zoomX-1)*this.anchor.x,this.position[1]=e-r*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),0!==this.angle&&(this.position[0]=i*this.anchor.x,this.position[1]=r*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-i*this.anchor.x,this.position[1]=-r*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position)),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._draw=function(){if(null!=this.bitmap)return this._drawTiles(this.rect)},i.prototype._drawTiles=function(t){var e,i,r;return r=Graphics.renderer,e=r.blendType,i=r.effects,r.blendType=this.blendingMode,this.updateTransform(~~-this.x,~~this.y,this.rect.width,this.rect.height),r.transform=this.transform,r.effects=this.effects,r.setBitmap(this.bitmap),r.drawTextureTransform(this.rect),r.blendType=e,r.effects=i,null},i}(),gs.TilingPlane=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(){i.__super__.constructor.apply(this,arguments),this.bitmap=null,this.zoomX=1,this.zoomY=1,this.color=new Color(255,255,255,0),this.opacity=255,this.tone=new Tone(0,0,0,0),this.blendType=0,this.srcRect=null,this.loopVertical=!0,this.loopHorizontal=!0}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,GraphicObject),i.prototype.draw=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y;if(null!=this.bitmap&&this.bitmap.loaded){if(this.srcRect||(this.srcRect=new Rect(0,0,this.bitmap.width,this.bitmap.height)),r=Graphics.renderer,h=this.srcRect.width*this.zoomX,t=this.srcRect.height*this.zoomY,s=Graphics.width,o=Graphics.height,n=this.loopHorizontal?Math.ceil(s/h):1,a=this.loopVertical?Math.ceil(o/t):1,e=0,i=0,r.zoom.x=this.zoomX,r.zoom.y=this.zoomY,r.angle=0,r.mirror=!1,r.color=this.color,r.opacity=this.opacity,r.tone=this.tone,r.blendingMode=this.blendType,this.loopVertical&&this.loopHorizontal)for(l=c=-1,m=n+2;-1<=m?c<=m:c>=m;l=-1<=m?++c:--c)for(u=d=-1,g=a+2;-1<=g?d<=g:d>=g;u=-1<=g?++d:--d)e=l*h+-this.ox%h,i=u*t+-this.oy%t,e+h>0&&e<s&&i+t>0&&i<o&&r.drawBitmap(this.bitmap,e,i,this.srcRect);else if(this.loopVertical)for(u=p=-1,w=a+2;-1<=w?p<=w:p>=w;u=-1<=w?++p:--p)e=l,i=u*t+-this.oy%t,e+h>0&&e<s&&i+t>0&&i<o&&r.drawBitmap(this.bitmap,e,i,this.srcRect);else if(this.loopHorizontal)for(l=f=-1,y=n+2;-1<=y?f<=y:f>=y;l=-1<=y?++f:--f)i=u,(e=l*h+-this.ox%h)+h>0&&e<s&&i+t>0&&i<o&&r.drawBitmap(this.bitmap,e,i,this.srcRect);return null}},i}(),window.Plane=t}.call(this),function(){var t,e,i={}.hasOwnProperty;t=function(){function t(){}return t.prototype.jsonParseFromBytes=function(t){var e,i;return i=null,e=new Uint8Array(t,0,3),i=239===e[0]&&187===e[1]&&191===e[2]?String.fromCharCode.apply(null,new Uint8Array(t,3)):String.fromCharCode.apply(null,new Uint8Array(t)),JSON.parse(i)},t.prototype.log=function(t){return console.log(t)},t}(),window.L2DPlatformManager=t,e=function(t){function e(t,i,r){e.__super__.constructor.apply(this,arguments),this.filePath=t,this.live2DModel=null,this.params=[],r=null!=r?r:0,this.disposed=!1,this.initialized=!1,this.textures=[],this.motions={},this.motionsByGroup={},this.expressions=[],this.pose=null,"string"==typeof t?this.loadFromFile(t,i,r):this.loadFromBuffer(t,r)}return function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,gs.EventEmitter),e.fromDataBundle=function(t,e){var i,r,o,s,n,a;if(a=null,t.filePath)if((a=ResourceManager.getLive2DModel(t.filePath)).loaded)for(i=r=0,o=(n=t.params).length;r<o;i=++r)s=n[i],a.live2DModel.setParamFloat(i,s);else a.once("modelDataLoaded",{params:t.params,model:a},function(t){var e,i,r,o,s,n;for(n=[],e=i=0,r=(s=t.data.params).length;i<r;e=++i)o=s[e],n.push(t.data.model.live2DModel.setParamFloat(e,o));return n});return a},e.toDataBundle=function(t,e){var i,r,o,s,n;for(s=[],i=r=0,n=(o=t.live2DModel._$5S._$_2).length;0<=n?r<=n:r>=n;i=0<=n?++r:--r)s[i]=o[i];return{filePath:t.filePath,params:s}},Object.defineProperty(e.prototype,"loaded",{get:function(){var t,e,i,r,o;for(r=this.textures.length>0,t=0,e=(i=this.textures).length;t<e;t++)if(!(o=i[t])||!o.loaded)return!1;return r}}),e.prototype.initialize=function(){var t,e,i,r,o;if(window.Live2DModelWebGL){for(t=0,e=(i=this.textures).length;t<e;t++)r=i[t],o=$gl.createTexture(),$gl.pixelStorei($gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,1),$gl.activeTexture($gl.TEXTURE0),$gl.bindTexture($gl.TEXTURE_2D,o),$gl.texImage2D($gl.TEXTURE_2D,0,$gl.RGBA,$gl.RGBA,$gl.UNSIGNED_BYTE,r),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MAG_FILTER,$gl.LINEAR),$gl.texParameteri($gl.TEXTURE_2D,$gl.TEXTURE_MIN_FILTER,$gl.LINEAR_MIPMAP_NEAREST),$gl.generateMipmap($gl.TEXTURE_2D),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.pixelStorei($gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),$gl.pixelStorei($gl.UNPACK_FLIP_Y_WEBGL,0),r.textureId=o;return this.initialized=!0}},e.prototype.dispose=function(){var t,e,i,r,o,s;if(!this.disposed){for(this.disposed=!0,o=[],t=e=0,i=(r=this.textures).length;e<i;t=++e)null!=(s=r[t])&&null!=s.textureId?($gl.deleteTexture(s.textureId),o.push(delete s.textureId)):o.push(void 0);return o}},e.prototype.reset=function(){var t,e,i,r,o,s;for(s=[],t=e=0,i=(o=this.params).length;e<i;t=++e)r=o[t],s.push(this.live2DModel.setParamFloat(t,r));return s},e.prototype.loadFromBuffer=function(t,e){var i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E,b,R,_,D,A,C,M;{if(window.Live2DModelWebGL){if(i=t,M=new JSZip(i),A=JSON.parse(M.file("settings.json").asText()),f=M.file("model.moc").asArrayBuffer(),this.live2DModel=Live2DModelWebGL.loadModel(f,null!=e?e:0),null!=A.motions)for(n in A.motions)for(this.motionsByGroup[n]=[],s=0,h=(S=A.motions[n]).length;s<h;s++)m=S[s],i=M.file(m.file).asArrayBuffer(),p=Live2DMotion.loadMotion(i),this.motions[m.file]=p,this.motionsByGroup[n].push(p);if(null!=A.expressions)for(a=0,l=(T=A.expressions).length;a<l;a++)r=T[a],i=M.file(r.file).asArrayBuffer(),this.expressions[r.name]=L2DExpressionMotion.loadJson(i);if(null!=A.pose&&(i=M.file(A.pose).asArrayBuffer(),this.pose=L2DPose.load(i)),null!=A.physics&&(i=M.file(A.physics).asArrayBuffer(),this.physics=L2DPhysics.load(i)),null!=A.init_param)for(g=0,u=(E=A.init_param).length;g<u;g++)y=E[g],this.live2DModel.setParamFloat(y.id,y.val);if(null!=A.init_parts_visible)for(w=0,c=(b=A.init_parts_visible).length;w<c;w++)y=b[w],this.live2DModel.setPartsOpacity(y.id,y.val);for(o=v=0,R=(x=this.live2DModel._$5S._$_2).length;0<=R?v<=R:v>=R;o=0<=R?++v:--v)this.params[o]=x[o];for(this.textures=new Array(A.textures.length),o=D=0,d=(_=A.textures).length;D<d;o=++D)C=_[o],i=M.file(C).asArrayBuffer(),function(t){return function(e,r){var o;return o=new FileReader,o.onload=function(e){var i;return i=new Image,t.textures[r]=i,i.onload=function(){return t.textures[r].loaded=!0},i.src=e.target.result.replace("data:","data:image/png")},o.onerror=function(t){return console.log(t)},o.readAsDataURL(new Blob([i]))}}(this)(C,o);return this.emit("modelDataLoaded")}this.textures=[{loaded:!0}]}},e.prototype.loadFromFile=function(t,e,i){var r,o,s;return null!=(o=GS.dataCache.RESOURCES.items.resources)[t+"_"+e]?(r=o[t+"_"+e],s="resources/"+GS.DataPreparer.prepareFilePath(t+"_"+e+r)):(r=o[t]||".live2d",s="resources/"+GS.DataPreparer.prepareFilePath(t+r)),gs.Application.loadData(s,function(t){return function(e){return t.loadFromBuffer(GS.DataPreparer.prepare(e),null!=i?i:0)}}(this),function(t){return console.log(t)})},e.prototype.update=function(){return this.live2DModel.update()},e}(),window.gs.Live2DModel=e}.call(this),function(){var t,e,i={}.hasOwnProperty;e=function(){function t(){}return t.ORDERED=0,t.RANDOM=1,t}(),window.gs.Live2DMotionPlayTypes=e,window.MotionQueueManager||(window.MotionQueueManager=Object,window.Live2D={isEnabled:!1,init:function(){return null},setGL:function(t){return null},getGL:function(){return null}},window.Live2DFramework={setPlatformManager:function(){return null}}),t=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.motion=null,this.group=null,this.playType=0,this.currentMotion=null,this.loop=!0}return function(t,e){function r(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,MotionQueueManager),e.prototype.startMotionGroup=function(t,e){return this.group=t,this.playType=e,this.currentMotion=t[0],this.startNextMotion()},e.prototype.startNextMotion=function(){switch(this.playType){case 0:this.currentMotion=this.group[this.group.indexOf(this.currentMotion)+1%this.group.length];break;case 1:this.currentMotion=this.group[Math.round(Math.random()*this.group.length)]}return this.startMotion(this.currentMotion,!1)},e.prototype.updateParam=function(t){if(e.__super__.updateParam.call(this,t),null!=this.group&&this.isFinished()&&this.loop)return this.startNextMotion()},e}(),window.gs.Live2DMotionManager=t}.call(this),function(){var t,e={}.hasOwnProperty;window.L2DEyeBlink&&(L2DEyeBlink.prototype.enabled=!0),t=function(t){function i(t){i.__super__.constructor.call(this,t),this.useRenderTexture=!0,this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.motionManager=new gs.Live2DMotionManager,this.expressionManager=new MotionQueueManager,this.eyeBlink=new L2DEyeBlink,this.model=null,this.currentMotion=null,this.loopMotion=!0,this.talking=!1,this.talkingVolume=0,this.lipSyncSensitivity=1,this.breathIntensity=1,this.idleIntensity=1,this.opacity=255,this.x=0,this.y=0,this.zoomX=1,this.zoomY=1,this.angle=0,this.blendingMode=0,this.transform4=mat4.create(),this.viewportTransform4=mat4.create(),this.position3=vec3.create(),this.proj=mat4.create()}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,GraphicObject),Object.defineProperty(i.prototype,"width",{get:function(){var t,e,i;return e=1,(null!=(t=this.model)?t.live2DModel:void 0)&&(i=Graphics.height/this.model.live2DModel.getCanvasHeight(),e=this.model.live2DModel.getCanvasWidth()*i*this.zoomX),e}}),Object.defineProperty(i.prototype,"height",{get:function(){var t,e,i;return e=1,(null!=(t=this.model)?t.live2DModel:void 0)&&(i=Graphics.height/this.model.live2DModel.getCanvasHeight(),e=this.model.live2DModel.getCanvasHeight()*i*this.zoomY),e}}),Object.defineProperty(i.prototype,"talking",{get:function(){return this.talking_},set:function(t){var e;if(t!==this.talking_)return this.talking_=t,null!=(e=this.model)?e.live2DModel.setParamFloat("PARAM_MOUTH_OPEN_Y",0):void 0}}),i.fromDataBundle=function(t,e){var i;return i=null,gs.ObjectCodec.decodeProperties(t,e),i=new gs.Live2DObject,Object.mixin(i,t),i},i.toDataBundle=function(t,e){return gs.ObjectCodec.encodeProperties(t,e,["motionManager","expressionManager"])},i.prototype.playMotionGroup=function(t,e){var i;if(null!=(i=this.model.motionsByGroup[t]))return this.motionManager.startMotionGroup(i,e||0)},i.prototype.playMotion=function(t,e){var i,r;if(null!=(i=null!=(r=this.model.motions[t])?r:this.model.motions[Object.keys(this.model.motions).first()]))return i.setFadeIn(e),this.motionManager.startMotionGroup([i],gs.Live2DMotionPlayTypes.ORDERED)},i.prototype.setPose=function(t){var e,i,r,o,s,n,a;for(this.model.pose.lastModel!==this.model.live2DModel&&(this.model.pose.initParam(this.model.live2DModel),this.model.pose.lastModel=this.model.live2DModel),a=[],i=0,r=(n=this.model.pose.partsGroups).length;i<r;i++)s=n[i],a.push(function(){var i,r,n;for(n=[],e=i=0,r=s.length;i<r;e=++i)o=s[e],e===t?(this.model.live2DModel.setParamFloat(o.paramIndex,1),n.push(this.model.live2DModel.setPartsOpacity(o.partsIndex,1))):(this.model.live2DModel.setParamFloat(o.paramIndex,0),n.push(this.model.live2DModel.setPartsOpacity(o.partsIndex,0)));return n}.call(this));return a},i.prototype.setExpression=function(t,e){var i,r;if(null!=(i=null!=(r=this.model.expressions[t])?r:this.model.expressions[Object.keys(this.model.expressions).first()]))return i.setFadeIn(null!=e?e:0),this.expressionManager.startMotion(i,!1)},i.prototype.setParameter=function(t,e){return this.model.live2DModel.setParamFloat(t,e)},i.prototype.getParameter=function(t){return this.model.live2DModel.getParamFloat(t)},i.prototype.update=function(){var t,e;if(null!=(t=this.model)?t.live2DModel:void 0)return this.motionManager.loop=this.loopMotion,this.motionManager.updateParam(this.model.live2DModel),this.expressionManager.isFinished()||this.expressionManager.updateParam(this.model.live2DModel),this.model.live2DModel.saveParam(),e=Date.now()/1e3*2*Math.PI,this.model.live2DModel.addToParamFloat("PARAM_ANGLE_X",Number(15*Math.sin(e/6.5345))*this.idleIntensity,.5),this.model.live2DModel.addToParamFloat("PARAM_ANGLE_Y",Number(8*Math.sin(e/3.5345))*this.idleIntensity,.5),this.model.live2DModel.addToParamFloat("PARAM_ANGLE_Z",Number(10*Math.sin(e/5.5345))*this.idleIntensity,.5),this.model.live2DModel.addToParamFloat("PARAM_BODY_ANGLE_X",Number(4*Math.sin(e/15.5345))*this.idleIntensity,.5),this.breathIntensity>0&&this.model.live2DModel.setParamFloat("PARAM_BREATH",Number(.5+.5*Math.sin(e/3.2345))*this.breathIntensity,1),this.talking&&this.model.live2DModel.setParamFloat("PARAM_MOUTH_OPEN_Y",this.talkingVolume*this.lipSyncSensitivity),null!=this.model.pose&&this.model.pose.updateParam(this.model.live2DModel),this.eyeBlink.enabled&&this.eyeBlink.updateParam(this.model.live2DModel),this.model.physics?this.model.physics.updateParam(this.model.live2DModel):void 0},i.prototype.draw_=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E;if(this.model&&this.model.live2DModel){for(this.update(),u=this.model.live2DModel,s=n=0,a=(d=this.model.textures).length;n<a;s=++n)g=d[s],u.setTexture(s,g.textureId);return mat4.identity(this.transform4),m=Graphics.height/u.getCanvasHeight(),l=Graphics.width,h=Graphics.height,mat4.identity(this.proj),mat4.ortho(this.proj,0,l,h,0,-.5,.5),S=this.y,x=u.getCanvasWidth()*m,o=u.getCanvasHeight()*m,v=this.x,T=this.zoomX,E=this.zoomY,this.position3[0]=v-x*(T-1)*this.anchor.x,this.position3[1]=S-o*(E-1)*this.anchor.y,mat4.translate(this.transform4,this.transform4,this.position3),0!==this.angle&&(this.position3[0]=x*T*this.anchor.x,this.position3[1]=o*E*this.anchor.y,mat4.translate(this.transform4,this.transform4,this.position3),mat4.rotateZ(this.transform4,this.transform4,Math.degreesToRadians(this.angle)),this.position3[0]=-this.position3[0],this.position3[1]=-this.position3[1],mat4.translate(this.transform4,this.transform4,this.position3)),this.position3[0]=Graphics.height/u.getCanvasHeight()*T,this.position3[1]=Graphics.height/u.getCanvasHeight()*E,mat4.scale(this.transform4,this.transform4,this.position3),mat4.identity(this.viewportTransform4),this.useRenderTexture?(this.viewportTransform4[0]=this.viewport.transform[0],this.viewportTransform4[3]=this.viewport.transform[1],this.viewportTransform4[4]=this.viewport.transform[2],this.viewportTransform4[5]=-this.viewport.transform[3],this.viewportTransform4[12]=this.viewport.transform[4],this.viewportTransform4[13]=-this.viewport.transform[5]+o):(this.viewportTransform4[0]=this.viewport.transform[0],this.viewportTransform4[3]=this.viewport.transform[1],this.viewportTransform4[4]=this.viewport.transform[2],this.viewportTransform4[5]=this.viewport.transform[3],this.viewportTransform4[12]=this.viewport.transform[4],this.viewportTransform4[13]=this.viewport.transform[5]),mat4.multiply(this.transform4,this.viewportTransform4,this.transform4),mat4.multiply(this.transform4,this.proj,this.transform4),u.setMatrix(this.transform4),this.useRenderTexture?($gl.cullFace($gl.FRONT),Graphics.frameBuffer.setTexture(Graphics.offscreenTexture),$gl.viewport(0,0,Graphics.width,Graphics.height),$gl.scissor(0,0,Graphics.width,Graphics.height),c=Graphics.renderer.projectionMatrix,$gl.clearColor(0,0,0,0),$gl.clear($gl.COLOR_BUFFER_BIT|$gl.DEPTH_BUFFER_BIT),$gl.clearColor(0,0,0,1),u.update(),u.draw(),$gl.activeTexture($gl.TEXTURE0,0),v=0,S=0,y=Graphics.offscreenTexture.width,r=Graphics.offscreenTexture.height,Graphics.renderer.vertexBuffer.bind(),Graphics.renderer.indexBuffer.bind(),Graphics.renderer.currentEffect=null,null!=(p=Graphics.renderer.texture)&&p.unbind(),Graphics.renderer.texture=null,Graphics.frameBuffer.bind(),Graphics.frameBuffer.setTexture(Graphics.screenTexture),$gl.viewport(0,0,Graphics.width,Graphics.height),$gl.scissor(0,0,Graphics.width,Graphics.height),Graphics.renderer.projectionMatrix=c,Graphics.renderer.setTexture(Graphics.offscreenTexture),Graphics.renderer.setSourceRectangle(v,S,y,r),Graphics.renderer.transform=this.transform,mat2d.identity(this.transform),this.position[0]=0,this.position[1]=0,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=y,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position),Graphics.renderer.opacity=this.opacity,Graphics.renderer.blendType=0,e=Graphics.renderer.color,w=Graphics.renderer.tone,i=Graphics.renderer.effects,Graphics.renderer.color=this.color,Graphics.renderer.tone=this.tone,Graphics.renderer.mask=this.mask,Graphics.renderer.effects=this.effects,Graphics.renderer.projectionMatrix=c,$gl.blendFunc($gl.SRC_ALPHA,$gl.ONE_MINUS_SRC_ALPHA),this.effects.pixelate.enabled&&null!==this.effects.pixelate.textureFilter&&Graphics.offscreenTexture.setFilter(this.effects.pixelate.textureFilter,this.effects.pixelate.mipmap),$gl.cullFace($gl.BACK),t=Graphics.renderer.blendType,Graphics.renderer.blendType=this.blendingMode,Graphics.renderer.drawTransform(),Graphics.renderer.render(),Graphics.renderer.setTexture(null),Graphics.renderer.blendType=t,Graphics.renderer.tone=w,Graphics.renderer.color=e,Graphics.renderer.mask=null,Graphics.renderer.effects=i,$gl.enable($gl.SCISSOR_TEST)):(u.update(),u.draw(),$gl.activeTexture($gl.TEXTURE0),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.activeTexture($gl.TEXTURE1),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.activeTexture($gl.TEXTURE2),$gl.bindTexture($gl.TEXTURE_2D,null),$gl.activeTexture($gl.TEXTURE0)),Graphics.renderer.setTexture(null),Graphics.renderer.vertexBuffer.bind(),Graphics.renderer.indexBuffer.bind(),Graphics.renderer.currentEffect=null,null!=(f=Graphics.renderer.texture)&&f.unbind(),Graphics.renderer.texture=null,this.model.live2DModel.loadParam(),Graphics.frameBuffer.bind(),Graphics.frameBuffer.setTexture(Graphics.screenTexture),$gl.disable($gl.CULL_FACE),$gl.enable($gl.SCISSOR_TEST),$gl.scissor(0,0,Graphics.width,Graphics.height)}},i.prototype.draw=function(){if(null!=this.model)return Graphics.renderer.drawLive2D(this)},i}(),window.gs.Live2DObject=t}.call(this),AutotileExpander.substitutableFrames=[34,36,38,40,16,20,24,28,46],AutotileExpander.tileSize=32,AutotileExpander.tilesetConfig=null,AutotileExpander.expand=function(t){var e=AutotileExpander.tileSize,i=AutotileExpander.tileSize;if(t.height>4*AutotileExpander.tileSize){if(t.width<=8*AutotileExpander.tileSize){for(var r=new Bitmap(8*i*4,8*e),o=0;o<4;o++)r.blt(8*i*o,0,t,new Rect(0,0,t.width,t.height));t=r}return t}var s=AutotileExpander.tilesetConfig.autoTiles,n=Math.floor(s.width/(8*i)),a=t.width,h=(t.height,Math.floor(a/(3*i))),l=new Bitmap(8*i*n,8*e),u=l.context,c=t;window.tw=i,window.th=e;for(o=0;o<n;o++)GSAutotileExpanderDrawImage.originX=o*(8*i),GSAutotileExpanderDrawImage.sourceOriginX=Math.min(o,h-1)*(3*i),GSAutotileExpanderDrawImage.originY=0,GSAutotileExpanderDrawImage.sourceOriginY=0,GSAutotileExpanderDrawBackground(0,0,u,c),GSAutotileExpanderDrawBackground(1*i,0*e,u,c),GSAutotileExpanderDrawLeftTopCorner(1*i,0*e,u,c),GSAutotileExpanderDrawBackground(2*i,0*e,u,c),GSAutotileExpanderDrawRightTopCorner(2*i+Math.floor(i/2),0*e,u,c),GSAutotileExpanderDrawBackground(3*i,0*e,u,c),GSAutotileExpanderDrawLeftTopCorner(3*i,0*e,u,c),GSAutotileExpanderDrawRightTopCorner(3*i+Math.floor(i/2),0*e,u,c),GSAutotileExpanderDrawBackground(4*i,0*e,u,c),GSAutotileExpanderDrawRightBottomCorner(4*i+Math.floor(i/2),0*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(5*i,0*e,u,c),GSAutotileExpanderDrawLeftTopCorner(5*i,0*e,u,c),GSAutotileExpanderDrawRightBottomCorner(5*i+Math.floor(i/2),0*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(6*i,0*e,u,c),GSAutotileExpanderDrawRightTopCorner(6*i+Math.floor(i/2),0*e,u,c),GSAutotileExpanderDrawRightBottomCorner(6*i+Math.floor(i/2),0*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(7*i,0*e,u,c),GSAutotileExpanderDrawLeftTopCorner(7*i,0*e,u,c),GSAutotileExpanderDrawRightTopCorner(7*i+Math.floor(i/2),0*e,u,c),GSAutotileExpanderDrawRightBottomCorner(7*i+Math.floor(i/2),0*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(0*i,1*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(0*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(1*i,1*e,u,c),GSAutotileExpanderDrawLeftTopCorner(1*i,1*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(1*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(2*i,1*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(2*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightTopCorner(2*i+Math.floor(i/2),1*e,u,c),GSAutotileExpanderDrawBackground(3*i,1*e,u,c),GSAutotileExpanderDrawLeftTopCorner(3*i,1*e,u,c),GSAutotileExpanderDrawRightTopCorner(3*i+Math.floor(i/2),1*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(3*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(4*i,1*e,u,c),GSAutotileExpanderDrawRightBottomCorner(4*i+Math.floor(i/2),1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftBottomCorner(4*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(5*i,1*e,u,c),GSAutotileExpanderDrawLeftTopCorner(5*i,1*e,u,c),GSAutotileExpanderDrawRightBottomCorner(5*i+Math.floor(i/2),1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftBottomCorner(5*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawBackground(6*i,1*e,u,c),GSAutotileExpanderDrawRightTopCorner(6*i+Math.floor(i/2),1*e,u,c),GSAutotileExpanderDrawRightBottomCorner(6*i+Math.floor(i/2),1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftBottomCorner(6*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftTopCorner(7*i,1*e,u,c),GSAutotileExpanderDrawRightTopCorner(7*i+Math.floor(i/2),1*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(7*i,1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightBottomCorner(7*i+Math.floor(i/2),1*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftSide(0*i,2*e,u,c),GSAutotileExpanderDrawLeftSide(1*i,2*e,u,c),GSAutotileExpanderDrawRightTopCorner(1*i+Math.floor(i/2),2*e,u,c),GSAutotileExpanderDrawLeftSide(2*i,2*e,u,c),GSAutotileExpanderDrawRightBottomCorner(2*i+Math.floor(i/2),2*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftSide(3*i,2*e,u,c),GSAutotileExpanderDrawRightTopCorner(3*i+Math.floor(i/2),2*e,u,c),GSAutotileExpanderDrawRightBottomCorner(3*i+Math.floor(i/2),2*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawUpSide(4*i,2*e,u,c),GSAutotileExpanderDrawUpSide(5*i,2*e,u,c),GSAutotileExpanderDrawRightBottomCorner(5*i+Math.floor(i/2),2*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawUpSide(6*i,2*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(6*i,2*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawUpSide(7*i,2*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(7*i,2*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightBottomCorner(7*i+Math.floor(i/2),2*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightSide(0*i,3*e,u,c),GSAutotileExpanderDrawRightSide(1*i,3*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(1*i,3*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightSide(2*i,3*e,u,c),GSAutotileExpanderDrawLeftTopCorner(2*i,3*e,u,c),GSAutotileExpanderDrawRightSide(3*i,3*e,u,c),GSAutotileExpanderDrawLeftTopCorner(3*i,3*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(3*i,3*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawDownSide(4*i,3*e,u,c),GSAutotileExpanderDrawDownSide(5*i,3*e,u,c),GSAutotileExpanderDrawLeftTopCorner(5*i,3*e,u,c),GSAutotileExpanderDrawDownSide(6*i,3*e,u,c),GSAutotileExpanderDrawRightTopCorner(6*i+Math.floor(i/2),3*e,u,c),GSAutotileExpanderDrawDownSide(7*i,3*e,u,c),GSAutotileExpanderDrawLeftTopCorner(7*i,3*e,u,c),GSAutotileExpanderDrawRightTopCorner(7*i+Math.floor(i/2),3*e,u,c),GSAutotileExpanderDrawLeftSideSmall(0*i,4*e,u,c),GSAutotileExpanderDrawRightSideSmall(0*i+Math.floor(i/2),4*e,u,c),GSAutotileExpanderDrawUpSideSmall(1*i,4*e,u,c),GSAutotileExpanderDrawDownSideSmall(1*i,4*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftTop(2*i,4*e,u,c),GSAutotileExpanderDrawLeftTop(3*i,4*e,u,c),GSAutotileExpanderDrawRightBottomCorner(3*i+Math.floor(i/2),4*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightTop(4*i,4*e,u,c),GSAutotileExpanderDrawRightTop(5*i,4*e,u,c),GSAutotileExpanderDrawLeftBottomCorner(5*i,4*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightBottom(6*i,4*e,u,c),GSAutotileExpanderDrawRightBottom(7*i,4*e,u,c),GSAutotileExpanderDrawLeftTopCorner(7*i,4*e,u,c),GSAutotileExpanderDrawLeftBottom(0*i,5*e,u,c),GSAutotileExpanderDrawLeftBottom(1*i,5*e,u,c),GSAutotileExpanderDrawRightTopCorner(1*i+Math.floor(i/2),5*e,u,c),GSAutotileExpanderDrawLeftSideTop(2*i,5*e,u,c),GSAutotileExpanderDrawRightSideTop(2*i+Math.floor(i/2),5*e,u,c),GSAutotileExpanderDrawUpSideLeft(3*i,5*e,u,c),GSAutotileExpanderDrawDownSideLeft(3*i,5*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftSideBottom(4*i,5*e,u,c),GSAutotileExpanderDrawRightSideBottom(4*i+Math.floor(i/2),5*e,u,c),GSAutotileExpanderDrawUpSideRight(5*i,5*e,u,c),GSAutotileExpanderDrawDownSideRight(5*i,5*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftTopSmall(6*i,5*e,u,c),GSAutotileExpanderDrawLeftBottomSmall(6*i,5*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightTopSmall(6*i+Math.floor(i/2),5*e,u,c),GSAutotileExpanderDrawRightBottomSmall(6*i+Math.floor(i/2),5*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawLeftTopSmall(7*i,5*e,u,c),GSAutotileExpanderDrawLeftBottomSmall(7*i,5*e+Math.floor(e/2),u,c),GSAutotileExpanderDrawRightTopSmall(7*i+Math.floor(i/2),5*e,u,c),GSAutotileExpanderDrawRightBottomSmall(7*i+Math.floor(i/2),5*e+Math.floor(e/2),u,c);return l},gs.AutotileExpander=AutotileExpander,function(){var t,e,i,r,o=function(t,e){function i(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},s={}.hasOwnProperty;e=function(t){function e(t,i){e.__super__.constructor.call(this,t),this.bitmap=null,this.x=0,this.y=0,this.z=-50,this.srcRect=new Rect(0,0,0,0),this.visible=!1,this.tileSize=i,this.contextInfo=Graphics.renderer.contextInfo,this.context=Graphics.renderer.context}return o(e,t),e.prototype.draw=function(){if(null!=this.bitmap)return null!=this.contextInfo&&0!==this.contextInfo.globalCompositeOperation&&(this.context.globalCompositeOperation="source-over",this.contextInfo.globalCompositeOperation=0),null!=this.contextInfo&&1!==this.contextInfo.globalAlpha&&(this.context.globalAlpha=1,this.contextInfo.globalAlpha=1),Graphics.renderer.drawBitmapSimple(this.bitmap,this.x-this.ox,this.y-this.oy,this.tileSize,this.tileSize,this.srcRect.x,this.srcRect.y,this.tileSize,this.tileSize)},e}(GraphicObject),function(t){function i(t){i.__super__.constructor.call(this,t),this.autotiles=new Array(7),this.expandedAutotiles=new Array(7),this.tileset=null,this.priorities=null,this.passages=null,this.mapData=null,this.tileSize=32,this.sprites=[],this.autotileOffset=0,this.autotileOffset2=0,this.depth=3,this.cache=[]}o(i,t),i.prototype.expandAutotiles=function(){var t,e,i,r;for(AutotileExpander.tileSize=this.tileSize,r=[],t=e=0,i=this.autotiles.length;0<=i?e<i:e>i;t=0<=i?++e:--e)this.autotiles[t]?r.push(this.expandedAutotiles[t]=AutotileExpander.expand(this.autotiles[t])):r.push(void 0);return r},i.prototype.clearCache=function(t){var e,i,r;for(e=i=0,r=t.length;0<=r?i<r:i>r;e=0<=r?++i:--i)this.cache[t[e]]=null;return null},i.prototype.draw=function(){},i.prototype.update=function(){var t,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w,y,x,v,S,T,E,b,R,_,D,A,C,M,I,P,G,O,$,B;if(i.__super__.update.call(this),this.visible&&null!=this.tileset&&this.tileset.loaded&&null!=this.mapData){for(Graphics.renderer,this.width*this.tileSize,this.height*this.tileSize,m=Math.floor(this.ox+this.viewport.ox),g=Math.floor(this.oy+this.viewport.oy),h=Math.ceil(this.tileset.width/this.tileSize),n=0,a=0,M=Math.floor(Graphics.width/this.tileSize)+2,I=Math.floor(Graphics.height/this.tileSize)+2,0,0,R=Math.floor(m/this.tileSize),_=Math.floor(g/this.tileSize),D=null,w=0,r=0,o=480===Graphics.height?256:128,A=0,P=0,G=0,0===Math.floor(Graphics.frameCount%16)&&(this.autotileOffset=(this.autotileOffset+1)%4,this.autotileOffset2=(this.autotileOffset2+1)%3),O=c=y=R,x=M+R;y<=x?c<x:c>x;O=y<=x?++c:--c)for(P=O<0?this.width+O:O>=this.width?O-this.width:O,$=d=v=_,S=I+_;v<=S?d<S:d>S;$=v<=S?++d:--d)for(G=$<0?this.height+$:$>=this.height?$-this.height:$,B=p=0,T=this.depth;0<=T?p<T:p>T;B=0<=T?++p:--p)if(u=G*this.width+P+this.width*this.height*B,null!=(s=this.cache[u]))s.visible&&(null==(D=this.sprites[A])&&(D=new e(this.viewport,this.tileSize),this.sprites[A]=D),A++,D.visible=!0,D.z=s.z,D.bitmap=s.bitmap,D.x=O*this.tileSize,D.y=$*this.tileSize,D.opacity=255,D.srcRect.x=s.frameX,D.srcRect.y=s.frameY,D.srcRect.width=this.tileSize,D.srcRect.height=this.tileSize,s.autotile&&null!=D.bitmap&&D.bitmap.width>o&&(r=D.bitmap.width>3*o?this.autotileOffset*o:this.autotileOffset2*o,D.srcRect.x+=r));else{if((C=this.mapData[u])<=0){this.cache[u]={visible:!1};continue}null==(D=this.sprites[A])&&(D=new e(this.viewport,this.tileSize),this.sprites[A]=D),A++,t=Math.floor(C/64),D.visible=!0,w=this.priorities[C]||0,D.z=32+32*w+B,t<=7?(C-=64*t,D.bitmap=this.expandedAutotiles[t],r=0,null!=D.bitmap&&D.bitmap.width>o&&(r=D.bitmap.width>3*o?this.autotileOffset*o:this.autotileOffset2*o),n=C%h*this.tileSize,a=Math.floor(C/h)*this.tileSize):(D.bitmap=this.tileset,n=(C-512)%h*this.tileSize,a=Math.floor((C-512)/h)*this.tileSize),D.x=O*this.tileSize,D.y=$*this.tileSize,D.srcRect.x=n,D.srcRect.y=a,D.srcRect.width=this.tileSize,D.srcRect.height=this.tileSize,this.cache[u]={x:D.x,y:D.y,frameX:n,frameY:a,bitmap:D.bitmap,z:D.z,visible:!0,autotile:t<=7}}for(l=f=E=A,b=this.sprites.length;E<=b?f<b:f>b;l=E<=b?++f:--f)this.sprites[l].visible=!1;return null}},i.prototype.dispose=function(){var t,e,r,o,s;for(i.__super__.dispose.apply(this,arguments),o=[],t=0,e=(r=this.sprites).length;t<e;t++)s=r[t],o.push(s.dispose());return o},i.prototype.hide=function(t){var e,r,o,s;for(i.__super__.hide.call(this,t),s=[],e=r=0,o=this.sprites.length;0<=o?r<o:r>o;e=0<=o?++r:--r)s.push(this.sprites[e].visible=!1);return s},i.prototype.show=function(t){var e,i,r,o,s;if(t!==this.visible&&null==this.hideCounter){if(t){for(e=i=0,o=this.sprites.length;0<=o?i<o:i>o;e=0<=o?++i:--i)this.sprites[e].initialize();this.visible=!0}else{for(e=r=0,s=this.sprites.length;0<=s?r<s:r>s;e=0<=s?++r:--r)this.sprites[e].dispose();this.visible=!1}return null}}}(GraphicObject),r=function(){return function(t){t=null!=t?t:32,this.useOriginalTileset=!0,this.invisibleTileId=32767,this.expandedSize={width:2048,height:2048},this.regularTiles=new gs.Rect(0,0,8*t,64*t),this.specialTiles=new gs.Rect(8*t,0,8*t*4,6*t*10),this.specialTileSize={width:8*t,height:6*t},this.animationFrames=4}}(),gs.TilesetConfiguration=r,i=function(e){function i(t){i.__super__.constructor.call(this,t),this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.autotiles=new Array(7),this.expandedAutotiles=new Array(7),this.tileset=null,this.tilesets=[],this.expandedTilesets=[],this.priorities=null,this.mapData=null,this.tileSize=32,this.autotileOffset=0,this.animationSpeed=16,this.width=50,this.height=50,this.depth=3,this.cache=[],this.layers=null,this.tilesetConfig=new gs.TilesetConfiguration(this.tileSize)}return o(i,e),i.prototype.dispose=function(){var t,e,i,r,o,s,n,a,h;for(this.tilesetConfig.useOriginalTileset||null!=(n=this.expandedTileset)&&n.dispose(),e=0,o=(a=this.expandedAutotiles).length;e<o;e++)null!=(t=a[e])&&t.dispose();for(i=0,s=(h=this.layers).length;i<s;i++)null!=(r=h[i])&&r.dispose();return null},i.prototype.setup=function(){return this.expandAutotiles()},i.prototype.expandAutotiles=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d;for(AutotileExpander.tileSize=this.tileSize,AutotileExpander.tilesetConfig=this.tilesetConfig,i=this.tilesetConfig.expandedSize.height,d=this.tilesetConfig.expandedSize.width,u=this.tilesetConfig.regularTiles,t=this.tilesetConfig.specialTiles,this.tileset?this.tilesets[0]=this.tileset:this.tileset=this.tilesets[0],this.expandedTilesets=new Array(this.tilesets.length),r=s=0,a=(h=this.tilesets).length;s<a;r=++s)if(c=h[r],this.tilesetConfig.useOriginalTileset)this.expandedTilesets[r]=c;else for(this.expandedTilesets[r]=new Bitmap(d,i),this.expandedTilesets[r].blt(u.x,u.y,c,new Rect(0,0,c.width,c.height)),o=n=0,l=this.autotiles.length;0<=l?n<l:n>l;o=0<=l?++n:--n)null!=this.autotiles[o]&&(e=AutotileExpander.expand(this.autotiles[o]),this.expandedTilesets[r].blt(t.x,t.y+6*this.tileSize*o,e,new Rect(0,0,e.width,e.height)));return this.calculateMapData(),this.splitMapData()},i.prototype.calculateMapData=function(){},i.prototype.convertTileId=function(t,e,i,r,o,s){return t},i.prototype.splitMapData=function(){var t,e,i,r,o,s,n,a,h,l,u,c;for(this.upperMapData=[],this.lowerMapData=[],8,t=i=0,s=this.depth;0<=s?i<s:i>s;t=0<=s?++i:--i)this.upperMapData[t]=[],this.lowerMapData[t]=[];for(a=[],l=r=0,n=this.width;0<=n?r<n:r>n;l=0<=n?++r:--r)a.push(function(){var t,i,r;for(r=[],u=t=0,i=this.height;0<=i?t<i:t>i;u=0<=i?++t:--t)r.push(function(){var t,i,r;for(r=[],c=t=0,i=this.depth;0<=i?t<i:t>i;c=0<=i?++t:--t)e=u*this.width+l+this.width*this.height*c,h=this.mapData[e],o=this.convertTileId(h,e,8,l,u,c),(this.priorities[h]||0)>0?(this.upperMapData[c][u*this.width+l]=o,r.push(this.lowerMapData[c][u*this.width+l]=this.tilesetConfig.invisibleTileId)):(this.upperMapData[c][u*this.width+l]=this.tilesetConfig.invisibleTileId,r.push(this.lowerMapData[c][u*this.width+l]=o));return r}.call(this));return r}.call(this));return a},i.prototype.shrinkLayers=function(t){var e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g,w;for(o=0,s=1,p=[];s<t.length;){for(a=!0,g=i=0,l=this.width;0<=l?i<l:i>l;g=0<=l?++i:--i)for(w=r=0,u=this.height;0<=u?r<u:r>u;w=0<=u?++r:--r)if(e=w*this.width+g,f=t[o][e],m=t[s][e],f!==this.tilesetConfig.invisibleTileId&&m!==this.tilesetConfig.invisibleTileId){a=!1;break}if(a){for(g=n=0,c=this.width;0<=c?n<c:n>c;g=0<=c?++n:--n)for(w=h=0,d=this.height;0<=d?h<d:h>d;w=0<=d?++h:--h)e=w*this.width+g,t[o][e]===this.tilesetConfig.invisibleTileId&&(t[o][e]=t[s][e]);p.push(t.splice(s,1))}else o++,p.push(s++)}return p},i.prototype.clearCache=function(){},i.prototype.createLayers=function(){var e,i,r,o,s,n,a,h,l;for(this.layers=[],e=i=0,s=this.lowerMapData.length;0<=s?i<s:i>s;e=0<=s?++i:--i)(o=new t(this.viewport,this,this.width,this.height,this.lowerMapData[e],this.tileSize,null!=(n=this.expandedTilesets[e])?n:this.expandedTilesets[0],this.animationSpeed)).z=0+e,this.layers.push(o);for(l=[],e=r=0,a=this.upperMapData.length;0<=a?r<a:r>a;e=0<=a?++r:--r)(o=new t(this.viewport,this,this.width,this.height,this.upperMapData[e],this.tileSize,null!=(h=this.expandedTilesets[e])?h:this.expandedTilesets[0],this.animationSpeed)).z=64+e,l.push(this.layers.push(o));return l},i.prototype.draw=function(){},i.prototype.update=function(){var t,e,i,r;if(this.visible&&null!=this.tileset&&this.tileset.loaded&&null!=this.mapData){for(null==this.layers&&this.createLayers(),r=[],t=e=0,i=this.layers.length;0<=i?e<i:e>i;t=0<=i?++e:--e)this.layers[t].ox=this.ox,this.layers[t].oy=this.oy,this.layers[t].tone=this.tone,this.layers[t].color=this.color,r.push(this.layers[t].mask=this.mask);return r}},i.prototype.show=function(t){},i.prototype.hide=function(t){},i}(GraphicObject),t=function(t){function e(t,i,r,o,s,n,a,h){var l,u,c,d,p,f,m,g,w,y,x;for(e.__super__.constructor.call(this,t),this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.mask={ox:0,oy:0,source:null,type:0,value:0,vague:0},this.tilemap=i,this.angle=0,this.zoomX=1,this.zoomY=1,this.tileSize=n,this.tilesetBitmap=a,this.dataBitmap=new Bitmap(r,o),this.autotileOffset=0,this.animationSpeed=16,d=this.tilemap.tilesetConfig.invisibleTileId,l=(c=this.dataBitmap.getImageData(0,0,r,o)).data,u=Math.ceil(this.tilesetBitmap.width/this.tileSize),y=p=0,m=r;0<=m?p<m:p>m;y=0<=m?++p:--p)for(x=f=0,g=o;0<=g?f<g:f>g;x=0<=g?++f:--f)w=s[x*r+y],l[4*(x*r+y)]=w===d?255:w%u,l[4*(x*r+y)+1]=w===d?255:Math.floor(w/u),l[4*(x*r+y)+3]=255;this.dataBitmap.setImageData(c,0,0)}return o(e,t),e.objectCodecBlackList=["onIndexChange"],e.prototype.dispose=function(){var t;return null!=(t=this.dataBitmap)?t.dispose():void 0},e.prototype.draw=function(){var t,i,r,o;return e.__super__.draw.call(this),r=Graphics.renderer,i=r.color,o=r.tone,r.color=this.color,r.tone=this.tone,r.mask=this.mask,this.updateTransform(0,0,Graphics.width,Graphics.height),r.transform=this.transform,0===Math.floor(Graphics.frameCount%this.animationSpeed)&&(t=this.tilemap.tilesetConfig.animationFrames,this.autotileOffset=(this.autotileOffset+1)%t),r.drawTiles(this.ox+this.viewport.ox,this.oy+this.viewport.oy,this.dataBitmap,this.tilesetBitmap,this.autotileOffset*this.tilemap.tilesetConfig.specialTileSize.width,this.tileSize,this.tilemap.tilesetConfig),r.tone=o,r.color=i,r.mask=null},e.prototype.update=function(){},e}(GraphicObject),window.Tilemap=i,gs.Tilemap=i,gs.TilemapLayer=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t){i.__super__.constructor.call(this,t),this.srcRect=new Rect(0,0,64,64),this.firstPartSize=16,this.middlePartSize=1,this.lastPartSize=16,this.x=0,this.y=0,this.width=100,this.height=100,this.skin=null,this.opacity=255,this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.orientation=1,this.clipRect=null,this.zoomX=1,this.zoomY=1,this.angle=0}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,GraphicObject),i.objectCodecBlackList=["onIndexChange"],i.prototype.dispose=function(){return i.__super__.dispose.call(this)},i.prototype.update=function(){return i.__super__.update.call(this)},i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle&&(this.position[0]=this.x-this.ox+this.width*this.anchor.x,this.position[1]=this.y-this.oy+this.height*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,this.angle),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-this.width*(this.zoomX-1)*this.anchor.x,this.position[1]=e-this.height*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._drawParts=function(){var t,e,i,r,o,s,n,a,h;if(null!=this.skin&&this.skin.loaded)return this.width=Math.max(this.firstPartSize+this.middlePartSize+this.lastPartSize,this.width),this.height=Math.max(this.firstPartSize+this.middlePartSize+this.lastPartSize,this.height),a=~~(this.x-this.ox),h=~~(this.y-this.oy),(o=Graphics.renderer).reset(),e=o.color,s=o.tone,t=o.blendType,i=o.effects,o.tone=this.tone,o.color=this.color,o.blendType=this.blendingMode,o.effects=this.effects,o.opacity=this.opacity,0===this.orientation?(n=this.width-this.firstPartSize-this.lastPartSize,this.updateTransform(a+this.firstPartSize,h,n,this.height),o.transform=this.transform,o.setBitmap(this.skin),o.setSourceRectangle(this.firstPartSize,0,this.middlePartSize,this.skin.height),o.drawTransform(),this.updateTransform(a,h,this.firstPartSize,this.height),o.setSourceRectangle(0,0,this.firstPartSize,this.skin.height),o.drawTransform(),this.updateTransform(a+this.firstPartSize+n,h,this.lastPartSize,this.height),o.setSourceRectangle(this.firstPartSize+this.middlePartSize,0,this.lastPartSize,this.skin.height),o.drawTransform()):(r=this.height-this.firstPartSize-this.lastPartSize,this.updateTransform(a,h+this.firstPartSize,this.width,r),o.transform=this.transform,o.setBitmap(this.skin),o.setSourceRectangle(0,this.firstPartSize,this.skin.width,this.middlePartSize),o.drawTransform(),this.updateTransform(a,h,this.width,this.firstPartSize),o.setSourceRectangle(0,0,this.skin.width,this.firstPartSize),o.drawTransform(),this.updateTransform(a,h+this.firstPartSize+r,this.width,this.lastPartSize),o.setSourceRectangle(0,this.firstPartSize+this.middlePartSize,this.skin.width,this.lastPartSize),o.drawTransform()),o.tone=s,o.color=e,o.blendType=t,o.effects=i,o.opacity=255,null},i.prototype.draw=function(){var t;if(t=Graphics.renderer,t.blendType=0,t.reset(),null!=this.clipRect?t.clipRect(this.clipRect):t.clipRect(Graphics.viewport.rect),this.opacity>0)return this._drawParts()},i}(),window.gs.ThreePartImage=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t){i.__super__.constructor.call(this,t),this.srcRect=new Rect(0,0,64,64),this.cornerSize=16,this.thickness=16,this.x=0,this.y=0,this.width=100,this.height=100,this.skin=null,this.opacity=255,this.tone=new Tone(0,0,0,0),this.color=new Color(255,255,255,0),this.zoomX=1,this.zoomY=1,this.useTiling=!1,this.angle=0,this.tmpRect=new Rect(0,0,0,0),this.scale=vec2.create(),this.scaleTransform=mat2d.create()}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,GraphicObject),i.objectCodecBlackList=["onIndexChange"],i.prototype.dispose=function(){return i.__super__.dispose.call(this)},i.prototype.update=function(){return i.__super__.update.call(this)},i.prototype.updateTransform=function(t,e,i,r){return mat2d.identity(this.transform),mat2d.mul(this.transform,this.transform,this.viewport.transform),0!==this.angle&&(this.position[0]=this.x-this.ox+this.width*this.anchor.x,this.position[1]=this.y-this.oy+this.height*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),mat2d.rotate(this.transform,this.transform,Math.degreesToRadians(this.angle)),this.position[0]=-this.position[0],this.position[1]=-this.position[1],mat2d.translate(this.transform,this.transform,this.position)),0!==this.angle||1!==this.zoomX||1!==this.zoomY?(this.position[0]=t-this.width*(this.zoomX-1)*this.anchor.x,this.position[1]=e-this.height*(this.zoomY-1)*this.anchor.y,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i*this.zoomX,this.position[1]=r*this.zoomY,mat2d.scale(this.transform,this.transform,this.position)):(this.position[0]=t,this.position[1]=e,mat2d.translate(this.transform,this.transform,this.position),this.position[0]=i,this.position[1]=r,mat2d.scale(this.transform,this.transform,this.position))},i.prototype._drawFrame=function(){var t,e,i,r,o,s,n,a,h,l,u,c;if(null!=this.skin&&this.skin.loaded)return this.srcRect.width=this.skin.width,this.srcRect.height=this.skin.height,l=this.width*this.zoomX,n=this.height*this.zoomY,u=~~(this.x-this.ox),c=~~(this.y-this.oy),i=this.cornerSize*this.zoomX,r=this.cornerSize*this.zoomY,a=Graphics.renderer,e=a.color,h=a.tone,t=a.blendType,s=a.effects,a.reset(),a.tone=this.tone,a.color=this.color,a.blendType=this.blendingMode,a.effects=this.effects,a.opacity=this.opacity,null!=this.clipRect?a.clipRect(this.clipRect):a.clipRect(Graphics.viewport.rect),o=2*this.cornerSize,this.updateTransform(u,c+r,this.thickness,this.height-o),a.transform=this.transform,a.setBitmap(this.skin),a.setSourceRectangle(this.srcRect.x,this.srcRect.y+this.cornerSize,this.thickness,this.srcRect.height-2*this.cornerSize),a.drawTransform(),this.updateTransform(u+i,c,this.width-o,this.thickness),a.setSourceRectangle(this.srcRect.x+this.cornerSize,this.srcRect.y,this.srcRect.width-2*this.cornerSize,this.thickness),a.drawTransform(),this.updateTransform(u+l-i,c+r,this.thickness,this.height-o),a.setSourceRectangle(this.srcRect.width-this.thickness,this.srcRect.y+this.cornerSize,this.thickness,this.srcRect.height-2*this.cornerSize),a.drawTransform(),this.updateTransform(u+i,c+n-r,this.width-o,this.thickness),a.setSourceRectangle(this.srcRect.x+this.cornerSize,this.srcRect.height-this.thickness,this.srcRect.width-2*this.cornerSize,this.thickness),a.drawTransform(),this.updateTransform(u,c,this.cornerSize,this.cornerSize),a.setSourceRectangle(this.srcRect.x,this.srcRect.y,this.cornerSize,this.cornerSize),a.drawTransform(),this.position[0]=(l-i)/i,this.position[1]=0,mat2d.translate(this.transform,this.transform,this.position),a.setSourceRectangle(this.srcRect.width-this.cornerSize,this.srcRect.y,this.cornerSize,this.cornerSize),a.drawTransform(),this.position[0]=0-this.position[0],this.position[1]=0+(n-r)/r-this.position[1],mat2d.translate(this.transform,this.transform,this.position),a.setSourceRectangle(this.srcRect.x,this.srcRect.height-this.cornerSize,this.cornerSize,this.cornerSize),a.drawTransform(),this.position[0]=0-this.position[0],this.position[1]=0+(n-r)/r-this.position[1],mat2d.translate(this.transform,this.transform,this.position),a.setSourceRectangle(this.srcRect.width-this.cornerSize,this.srcRect.height-this.cornerSize,this.cornerSize,this.cornerSize),a.drawTransform(),a.tone=h,a.color=e,a.blendType=t,a.effects=s,a.opacity=255,null},i.prototype.draw=function(){var t;if(t=Graphics.renderer,t.blendType=0,t.reset(),this.opacity>0)return this._drawFrame()},i}(),window.gs.Frame=t}.call(this),function(){var t,e={}.hasOwnProperty;t=function(t){function i(t){i.__super__.constructor.call(this,t),this.x=0,this.y=0,this.cx=0,this.cy=0,this.width=100,this.height=100,this.windowSkin=null,this.contents=null,this.window=null,this.cursorRect=new Rect(0,0,0,0),this.active=!0,this.arrowsVisible=!0,this.pause=!1,this.padding=i.padding||12,this.opacity=255,this.backOpacity=192,this.contentsOpacity=255,this.openness=255,this.tone=new Tone(0,0,0,0),this.animationIncrement=.1,this.cursorOpacity=1,this.pauseArrowPattern=0,this.pauseAnimationCount=0,this.renderer=null,this.oldWindowSkin=null}return function(t,i){function r(){this.constructor=t}for(var o in i)e.call(i,o)&&(t[o]=i[o]);r.prototype=i.prototype,t.prototype=new r,t.__super__=i.prototype}(i,GraphicObject),i.backRect=new Rect(0,0,64,64),i.backRect2=new Rect(0,64,64,64),i.frameRect=new Rect(64,0,64,64),i.frameThickness=16,i.framePadding=2,i.leftArrowRect=new Rect(i.frameRect.x+i.frameThickness,i.frameRect.y+24,16,16),i.topArrowRect=new Rect(i.frameRect.x+24,i.frameRect.y+i.frameThickness,16,16),i.rightArrowRect=new Rect(40+i.frameRect.x,i.frameRect.y+24,16,16),i.bottomArrowRect=new Rect(i.frameRect.x+24,40+i.frameRect.y,16,16),i.cornerSize=16,i.cursorRect=new Rect(64,64,32,32),i.cursorBorder=2,i.pauseRect=new Rect(96,64,32,32),i.padding=12,i.pauseIconSize=new Rect(0,0,16,16),i.textColorRect=new Rect(64,96,64,32),i.textColorSize=new Rect(0,0,8,8),i.prototype.dispose=function(){if(i.__super__.dispose.call(this),null!=this.window&&this.window.dispose(),null!=this.contents)return this.contents.dispose()},i.prototype.update=function(){if(i.__super__.update.call(this),this.active&&(this.cursorOpacity>=1&&(this.animationIncrement=-.025),this.cursorOpacity<=.5&&(this.animationIncrement=.025),this.cursorOpacity+=this.animationIncrement),this.pause&&(this.pauseAnimationCount++,this.pauseAnimationCount>15))return this.pauseAnimationCount=0,this.pauseArrowPattern=(this.pauseArrowPattern+1)%4},i.prototype._createWindowBitmap=function(){},i.prototype._drawWindow=function(){var t,e,i,r,o,s,n,a,h,l,u,c,d,p,f,m,g;if(null!=this.windowSkin&&this.windowSkin.loaded){for(this.oldWindowSkin=this.windowSkin,c=this.x,d=this.y,r=(n=Graphics.renderer).ox,o=n.oy,n.ox=0,n.oy=0,n.reset(),h=new Rect(0,0,0,0),n.size.width=this.width-2*this.constructor.framePadding,n.size.height=this.height-2*this.constructor.framePadding,n.tone=this.tone,n.drawBitmapSimple(this.windowSkin,c+this.constructor.framePadding,d+this.constructor.framePadding,this.width-2*this.constructor.framePadding,this.height-2*this.constructor.framePadding,new Rect(this.constructor.backRect.x,this.constructor.backRect.y,this.constructor.backRect.width,this.constructor.backRect.height)),n.size.width=0,n.size.height=0,n.tone=Tone.NORMAL,n.clip=new Rect(c+this.constructor.framePadding,d+this.constructor.framePadding,this.width-2*this.constructor.framePadding,this.height-2*this.constructor.framePadding),n.drawTiledBitmap(this.windowSkin,c+this.constructor.framePadding,d+this.constructor.framePadding,n.clip.width,n.clip.height,this.constructor.backRect2.x,this.constructor.backRect2.y,this.constructor.backRect2.width,this.constructor.backRect2.height),n.clip=new Rect(0,0,Graphics.width,Graphics.height),n.opacity=this.opacity,n.context.globalAlpha=.00392156862745*this.opacity,e=this.height-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x,this.constructor.frameRect.y+this.constructor.cornerSize,this.constructor.frameThickness,this.constructor.frameRect.height-2*this.constructor.cornerSize),a=Math.ceil(e/h.height),i=p=0;0<=a?p<a:p>a;i=0<=a?++p:--p)i+1===a?(s=d+this.constructor.cornerSize+i*h.height,t=h.height-(s+h.height-(d+this.constructor.cornerSize+e)),n.drawBitmapSimple(this.windowSkin,c,s,h.width,t,h.x,h.y,h.width,t)):n.drawBitmapSimple(this.windowSkin,c,d+this.constructor.cornerSize+i*h.height,h.width,h.height,h.x,h.y,h.width,h.height);for(u=this.width-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x+this.constructor.cornerSize,this.constructor.frameRect.y,this.constructor.frameRect.width-2*this.constructor.cornerSize,this.constructor.frameThickness),a=Math.ceil(u/h.width),i=f=0;0<=a?f<a:f>a;i=0<=a?++f:--f)i+1===a?(s=c+this.constructor.cornerSize+i*h.width,l=h.width-(s+h.width-(c+this.constructor.cornerSize+u)),n.drawBitmapSimple(this.windowSkin,s,d,l,h.height,h.x,h.y,l,h.height)):n.drawBitmapSimple(this.windowSkin,c+this.constructor.cornerSize+i*h.width,d,h.width,h.height,h.x,h.y,h.width,h.height);for(e=this.height-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x+3*this.constructor.cornerSize,this.constructor.frameRect.y+this.constructor.cornerSize,this.constructor.frameThickness,this.constructor.frameRect.height-2*this.constructor.cornerSize),a=Math.ceil(e/h.height),i=m=0;0<=a?m<a:m>a;i=0<=a?++m:--m)i+1===a?(s=d+this.constructor.cornerSize+i*h.height,t=h.height-(s+h.height-(d+this.constructor.cornerSize+e)),n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,s,h.width,t,h.x,h.y,h.width,t)):n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,d+this.constructor.cornerSize+i*h.height,h.width,h.height,h.x,h.y,h.width,h.height);for(u=this.width-2*this.constructor.cornerSize,h.set(this.constructor.frameRect.x+this.constructor.cornerSize,this.constructor.frameRect.y+3*this.constructor.cornerSize,this.constructor.frameRect.width-2*this.constructor.cornerSize,this.constructor.frameThickness),a=Math.ceil(u/h.width),i=g=0;0<=a?g<a:g>a;i=0<=a?++g:--g)i+1===a?(s=c+this.constructor.cornerSize+i*h.width,l=h.width-(s+h.width-(c+this.constructor.cornerSize+u)),n.drawBitmapSimple(this.windowSkin,s,d+this.height-this.constructor.cornerSize,l,h.height,h.x,h.y,l,h.height)):n.drawBitmapSimple(this.windowSkin,c+this.constructor.cornerSize+i*h.width,d+this.height-this.constructor.cornerSize,h.width,h.height,h.x,h.y,h.width,h.height);return n.drawBitmapSimple(this.windowSkin,c,d,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x,this.constructor.frameRect.y,this.constructor.cornerSize,this.constructor.cornerSize),n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,d,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x+3*this.constructor.cornerSize,this.constructor.frameRect.y,this.constructor.cornerSize,this.constructor.cornerSize),n.drawBitmapSimple(this.windowSkin,c,d+this.height-this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x,this.constructor.frameRect.y+3*this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize),n.drawBitmapSimple(this.windowSkin,c+this.width-this.constructor.cornerSize,d+this.height-this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.frameRect.x+3*this.constructor.cornerSize,this.constructor.frameRect.y+3*this.constructor.cornerSize,this.constructor.cornerSize,this.constructor.cornerSize),n.opacity=255,n.context.globalAlpha=1,n.ox=r,n.oy=o,null}},i.prototype.draw=function(){var t,e,i,r,o,s,n,a,h,l,u;if(h=Graphics.renderer,h.blendType=0,h.reset(),l=Math.floor(this.x)-this.ox,u=Math.floor(this.y)-this.oy,0===this.openness)return null;if(this.openness<255&&this.opacity>0)return this.height*(.00392156862745*this.openness),this._drawWindow(),null;if(this.opacity>0&&this._drawWindow(),i=this.constructor.cursorBorder,r=2*i,o=this.constructor.cursorRect,l=l+this.padding-this.cx,u=u+this.padding-this.cy,this.cursorRect.width>0&&this.cursorRect.height>0&&(h.context.globalAlpha=this.cursorOpacity,h.opacity=255*this.cursorOpacity,h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x+i,u+this.cursorRect.y,this.cursorRect.width-r,i,o.x+i,o.y,o.width-r,i),h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x,u+this.cursorRect.y+i,i,this.cursorRect.height-r,o.x,o.y+i,i,o.height-r),h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x+i,u+this.cursorRect.y+this.cursorRect.height-i,this.cursorRect.width-r,i,o.x+i,o.y+o.height-i,o.width-r,i),h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x+this.cursorRect.width-i,u+this.cursorRect.y+i,i,this.cursorRect.height-r,o.x+o.width-i,o.y+i,i,o.height-r),h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x,u+this.cursorRect.y,i,i,o.x,o.y,i,i),h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x+this.cursorRect.width-i,u+this.cursorRect.y,i,i,o.x+o.width-i,o.y,i,i),h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x+this.cursorRect.width-i,u+this.cursorRect.y+this.cursorRect.height-i,i,i,o.x+o.width-i,o.y+o.height-i,i,i),h.drawBitmapSimple(this.windowSkin,l+this.cursorRect.x,u+this.cursorRect.y+this.cursorRect.height-i,i,i,o.x,o.y+o.height-i,i,i),h.opacity=255,h.context.globalAlpha=1),l=l-this.padding+this.cx,u=u-this.padding+this.cy,this.pause)switch(n=this.constructor.pauseIconSize,a=this.constructor.pauseRect,s=Math.floor,this.pauseArrowPattern){case 0:h.drawBitmapSimple(this.windowSkin,s(l+.5*this.width-8),s(u+this.height-n.height),n.width,n.height,a.x,a.y,n.width,n.height);break;case 1:h.drawBitmapSimple(this.windowSkin,s(l+.5*this.width-8),s(u+this.height-n.height),n.width,n.height,a.x+n.width,a.y,n.width,n.height);break;case 2:h.drawBitmapSimple(this.windowSkin,s(l+.5*this.width-8),s(u+this.height-n.height),n.width,n.height,a.x,a.y+n.height,n.width,n.height);break;case 3:h.drawBitmapSimple(this.windowSkin,s(l+.5*this.width-8),s(u+this.height-n.height),n.width,n.height,a.x+n.width,a.y+n.height,n.width,n.height)}return this.arrowsVisible&&null!=this.contents&&(this.cx>0&&h.drawBitmapSimple(this.windowSkin,l+4,u+.5*this.height-8,this.constructor.leftArrowRect.width,this.constructor.leftArrowRect.height,this.constructor.leftArrowRect.x,this.constructor.leftArrowRect.y,this.constructor.leftArrowRect.width,this.constructor.leftArrowRect.height),this.cy>0&&h.drawBitmapSimple(this.windowSkin,l+.5*this.width-8,u+4,this.constructor.topArrowRect.width,this.constructor.topArrowRect.height,this.constructor.topArrowRect.x,this.constructor.topArrowRect.y,this.constructor.topArrowRect.width,this.constructor.topArrowRect.height),this.contents.width-this.cx>this.width-this.padding&&h.drawBitmapSimple(this.windowSkin,l+this.width-11,u+.5*this.height-8,this.constructor.rightArrowRect.width,this.constructor.rightArrowRect.height,this.constructor.rightArrowRect.x,this.constructor.rightArrowRect.y,this.constructor.rightArrowRect.width,this.constructor.rightArrowRect.height),this.contents.height-this.cy>this.height-this.padding&&h.drawBitmapSimple(this.windowSkin,l+.5*this.width-8,u+this.height-11,this.constructor.bottomArrowRect.width,this.constructor.bottomArrowRect.height,this.constructor.bottomArrowRect.x,this.constructor.bottomArrowRect.y,this.constructor.bottomArrowRect.width,this.constructor.bottomArrowRect.height)),null!=this.contents?(h.context.globalAlpha=.00392156862745*this.contentsOpacity,e=this.contents.width-this.cx>this.width-2*this.padding?this.width-2*this.padding:this.contents.width-this.cx,t=this.contents.height-this.cy>this.height-2*this.padding?this.height-2*this.padding:this.contents.height-this.cy,e=Math.min(e,this.contents.image.width),t=Math.min(t,this.contents.image.height),h.drawBitmapSimple(this.contents,l+this.padding,u+this.padding,e,t,Math.max(this.cx,0),Math.max(this.cy,0),e,t)):void 0},i}(),window.Window=t}.call(this),Function.prototype.accessors=function(t,e){Object.defineProperty(this.prototype,t,e)},Object.mixin=function(t,e,i){for(k in e)!e.hasOwnProperty(k)||i&&-1!=i.indexOf(k)||(t[k]=e[k]);return t},Object.extend=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.base=e.prototype,t.basec=e.prototype.constructor},Object.getConstructorOf=function(t){return Object.getPrototypeOf(t.prototype).constructor},Object.getClassFromString=function(t){for(var e=t.split("."),i=globalScope,r=0;r<e.length;r++)i=i[e[r]];return i},Object.flatCopy=function(t){var e={};for(k in t)e[k]=t[k];return e},Object.copy=function(t){return JSON.parse(JSON.stringify(t))},owl=function(){function t(){}function e(e){return"object"==typeof e?(t.prototype=e,new t):e}function i(t){for(var e in t)this[e]=t[e]}function r(){this.copiedObjects=[],thisPass=this,this.recursiveDeepCopy=function(t){return thisPass.deepCopy(t)},this.depth=0}function o(t,e){var i=new r;return e&&(i.maxDepth=e),i.deepCopy(t)}var s=[];return i.prototype={constructor:i,canCopy:function(t){return!1},create:function(t){},populate:function(t,e,i){}},r.prototype={constructor:r,maxDepth:256,cacheResult:function(t,e){this.copiedObjects.push([t,e])},getCachedResult:function(t){for(var e=this.copiedObjects,i=e.length,r=0;r<i;r++)if(e[r][0]===t)return e[r][1]},deepCopy:function(t){if(null===t)return null;if("object"!=typeof t)return t;var e=this.getCachedResult(t);if(e)return e;for(var i=0;i<s.length;i++){var r=s[i];if(r.canCopy(t))return this.applyDeepCopier(r,t)}throw new Error("no DeepCopier is able to copy "+t)},applyDeepCopier:function(t,e){var i=t.create(e);if(this.cacheResult(e,i),this.depth++,this.depth>this.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,i),this.depth--,i}},o.DeepCopier=i,o.deepCopiers=s,o.register=function(t){t instanceof i||(t=new i(t)),s.unshift(t)},o.register({canCopy:function(t){return!0},create:function(t){return t instanceof t.constructor?e(t.constructor.prototype):{}},populate:function(t,e,i){for(var r in e)e.hasOwnProperty(r)&&(i[r]=t(e[r]));return i}}),o.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,i){for(var r=0;r<e.length;r++)i.push(t(e[r]));return i}}),o.register({canCopy:function(t){return t instanceof Date},create:function(t){return new Date(t)}}),o.register({canCopy:function(t){return function(t){return window.Node?t instanceof Node:t===document||"number"==typeof t.nodeType&&t.attributes&&t.childNodes&&t.cloneNode}(t)},create:function(t){return t===document?document:t.cloneNode(!1)},populate:function(t,e,i){if(e===document)return document;if(e.childNodes&&e.childNodes.length)for(var r=0;r<e.childNodes.length;r++){var o=t(e.childNodes[r]);i.appendChild(o)}}}),{DeepCopyAlgorithm:r,copy:function(t){if("object"!=typeof t)return t;var i=t.valueOf();if(t!=i)return new t.constructor(i);if(t instanceof t.constructor&&t.constructor!==Object){var r=e(t.constructor.prototype);for(var o in t)t.hasOwnProperty(o)&&(r[o]=t[o])}else{r={};for(var o in t)r[o]=t[o]}return r},clone:e,deepCopy:o}}(),Object.values||(Object.values=function(t){var e=[];for(k in t)e.push(t[k]);return e}),Object.deepCopy=owl.deepCopy,gs.Utf8ArrayToStr=Utf8ArrayToStr,Math.degreesToRadians=function(t){return.017453292519943295*t},Math.nextPow2=function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},Math.toRadians=function(t){return.01745329251994*t},Math.mod=function(t,e){return(t%e+e)%e},Math.linearTween=function(t,e,i,r){return i*t/r+e},Math.easeInQuad=function(t,e,i,r){return t/=r,i*t*t+e},Math.easeOutQuad=function(t,e,i,r){return t/=r,-i*t*(t-2)+e},Math.easeInOutQuad=function(t,e,i,r){return(t/=r/2)<1?i/2*t*t+e:(t--,-i/2*(t*(t-2)-1)+e)},Math.easeInCubic=function(t,e,i,r){return t/=r,i*t*t*t+e},Math.easeOutCubic=function(t,e,i,r){return t/=r,t--,i*(t*t*t+1)+e},Math.easeInOutCubic=function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},Math.easeInQuart=function(t,e,i,r){return t/=r,i*t*t*t*t+e},Math.easeOutQuart=function(t,e,i,r){return t/=r,t--,-i*(t*t*t*t-1)+e},Math.easeInOutQuart=function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t+e:(t-=2,-i/2*(t*t*t*t-2)+e)},Math.easeInQuint=function(t,e,i,r){return t/=r,i*t*t*t*t*t+e},Math.easeOutQuint=function(t,e,i,r){return t/=r,t--,i*(t*t*t*t*t+1)+e},Math.easeInOutQuint=function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t*t+e:(t-=2,i/2*(t*t*t*t*t+2)+e)},Math.easeInSine=function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},Math.easeOutSine=function(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e},Math.easeInOutSine=function(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e},Math.easeInExpo=function(t,e,i,r){return i*Math.pow(2,10*(t/r-1))+e},Math.easeOutExpo=function(t,e,i,r){return i*(1-Math.pow(2,-10*t/r))+e},Math.easeInOutExpo=function(t,e,i,r){return(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:(t--,i/2*(2-Math.pow(2,-10*t))+e)},Math.easeInCirc=function(t,e,i,r){return t/=r,-i*(Math.sqrt(1-t*t)-1)+e},Math.easeOutCirc=function(t,e,i,r){return t/=r,t--,i*Math.sqrt(1-t*t)+e},Math.easeInOutCirc=function(t,e,i,r){return(t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:(t-=2,i/2*(Math.sqrt(1-t*t)+1)+e)},Math.easeInElastic=function(t,e,i,r){var o=1.70158,s=0,n=i;if(0==t)return e;if(1==(t/=r))return e+i;if(s||(s=.3*r),n<Math.abs(i)){n=i;o=s/4}else o=s/(2*Math.PI)*Math.asin(i/n);return-n*Math.pow(2,10*(t-=1))*Math.sin((t*r-o)*(2*Math.PI)/s)+e},Math.easeOutElastic=function(t,e,i,r){var o=1.70158,s=0,n=i;if(0==t)return e;if(1==(t/=r))return e+i;if(s||(s=.3*r),n<Math.abs(i)){n=i;o=s/4}else o=s/(2*Math.PI)*Math.asin(i/n);return n*Math.pow(2,-10*t)*Math.sin((t*r-o)*(2*Math.PI)/s)+i+e},Math.easeInOutElastic=function(t,e,i,r){var o=1.70158,s=0,n=i;if(0==t)return e;if(2==(t/=r/2))return e+i;if(s||(s=r*(.3*1.5)),n<Math.abs(i)){n=i;o=s/4}else o=s/(2*Math.PI)*Math.asin(i/n);return t<1?n*Math.pow(2,10*(t-=1))*Math.sin((t*r-o)*(2*Math.PI)/s)*-.5+e:n*Math.pow(2,-10*(t-=1))*Math.sin((t*r-o)*(2*Math.PI)/s)*.5+i+e},Math.easeInBack=function(t,e,i,r,o){return void 0==o&&(o=1.70158),i*(t/=r)*t*((o+1)*t-o)+e},Math.easeOutBack=function(t,e,i,r,o){return void 0==o&&(o=1.70158),i*((t=t/r-1)*t*((o+1)*t+o)+1)+e},Math.easeInOutBack=function(t,e,i,r,o){return void 0==o&&(o=1.70158),(t/=r/2)<1?i/2*(t*t*((1+(o*=1.525))*t-o))+e:i/2*((t-=2)*t*((1+(o*=1.525))*t+o)+2)+e},Math.easeInBounce=function(t,e,i,r){return i-Math.easeOutBounce(r-t,0,i,r)+e},Math.easeOutBounce=function(t,e,i,r){return(t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},Math.easeInOutBounce=function(t,e,i,r){return t<r/2?.5*Math.easeInBounce(2*t,0,i,r)+e:.5*Math.easeOutBounce(2*t-r,0,i,r)+.5*i+e},String.prototype.replaceAt=function(t,e){return this.substr(0,t)+e+this.substr(t+e.length)},String.prototype.fill=function(t,e,i){var r=this,o=0,s="";if(this.length<e){o=e-this.length;for(var n=0;n<o;n++)s+=t;r=0==i?s+r:r+s}return r},String.prototype.lfill=function(t,e){return this.fill(t,e,0)},String.prototype.rfill=function(t,e){return this.fill(t,e,1)},String.prototype.ltrim=function(){return this.replace(/^\s+/,"")},String.prototype.rtrim=function(){return this.replace(/\s+$/,"")},String.prototype.trim=function(){return this.ltrim().rtrim()},String.prototype.format=function(){var t=arguments;return this.replace(/{(\d+)}/g,function(e,i){return void 0!==t[i]?t[i]:e})},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.startsWith||(String.prototype.startsWith=function(t){return this.match("^"+t)==t}),String.prototype.endsWith||(String.prototype.endsWith=function(t){return this.match(t+"$")==t}),String.prototype.contains=function(t){return-1!=this.indexOf(t)},String.prototype.truncate=function(t){return this.length>t?this.substring(0,t):this},String.prototype.escapeHtml=function(){for(var t="",e=0;e<this.length;e++)"&"==this.charAt(e)?t+="&amp;":"<"==this.charAt(e)?t+="&lt;":">"==this.charAt(e)?t+="&gt;":t+=this.charAt(e);return t},String.prototype.unescapeHtml=function(){this.replace("&amp;","&");return this.replace("&gt;",">"),this.replace("&lt;","<")},String.prototype.withoutUnit=function(){var t=this,e=this.charAt(this.length-1);return(e>57||e<48)&&(t=this.substr(this.length-2,2)),t},Array.prototype.removeAll=function(t){for(var e=0,i=0;e<this.length;)t(this[e])&&(this.splice(e,1),e--,i++),e++;return i},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){for(var i=-1,r=e=e||0;r<this.length;r++)if(this[r]==t){i=r;break}return i}),Array.remove=function(t,e){var i=t.indexOf(e,0);-1!=i&&t.splice(i,1)},Array.prototype.remove=function(t){var e=Array.prototype.indexOf.call(this,t,0);-1!=e&&this.splice(e,1)},Array.prototype.toIndexArray=function(t){var e=[];t=t||0;for(var i=0;i<this.length;i++)e.push(t+i);return e},Array.prototype.toPropertyArray=function(t){for(var e=[],i=0;i<this.length;i++)e.push(this[i][t]);return e},Array.prototype.pushArray=function(t){for(var e=0;e<t.length;e++)this.push(t[e])},Array.prototype.fill=function(t,e,i){e=e||0,i=i||this.length;for(var r=e;r<i;r++)this[r]=t;return this};