"use strict";var AssetLoader=function(){};AssetLoader.NO_OBJECT_INSTANCE=AssetLoader.NO_RUN_CALLBACK=null,AssetLoader.loadedScenes={},AssetLoader.loadedImages={},AssetLoader.loadedFiles={},AssetLoader.prototype.makeDummyJob=function(e,s,t){var a=AssetJob.createJob(e,s?Asset.AssetType.DUMMY_START_ITSELF:Asset.AssetType.DUMMY,AssetLoader.NO_OBJECT_INSTANCE,t);return a.asset},AssetLoader.prototype.makeExternalLoadingJob=function(e,s,t){var a=s;return Util.isInitialized(s)&&Util.isInitialized(t)&&(a=function(){s(t)}),assetLoader.makeDummyJob(e,!0,a)},AssetLoader.prototype.loadScene=function(e){if(e in AssetLoader.loadedScenes)return AssetLoader.loadedScenes[e];var s=new SceneGraph(e),t=AssetJob.createJobObjectCreation(e,Asset.AssetType.SCENE_DEF,s);return t.asset},AssetLoader.prototype.loadImage=function(e){if(e=e.trim(),e in AssetLoader.loadedImages)return AssetLoader.loadedImages[e];var s=AssetJob.createJob(e,Asset.AssetType.IMAGE,AssetLoader.NO_OBJECT_INSTANCE,AssetLoader.NO_RUN_CALLBACK);return s.asset},AssetLoader.prototype.loadImageRawData=function(e,s,t){var a=assetLoader.loadImage(e);a.job.startItselfOnly();var o=assetLoader.makeDummyJob("image data for "+e,!1,function(){renderer.getImageData(a.job.getDownloadedData(),s,t)});return o.waitFor(a),o.startJob(),a},AssetLoader.prototype.loadFileAsText=function(e){if(e=e.trim(),e in AssetLoader.loadedFiles)return AssetLoader.loadedFiles[e];var s=AssetJob.createJob(e,Asset.AssetType.TEXT,AssetLoader.NO_OBJECT_INSTANCE,AssetLoader.NO_RUN_CALLBACK);return s.asset},AssetLoader.prototype.loadFilesForShaderProgram=function(e,s,t){var a=assetLoader.makeDummyJob("shaders retrieval: "+e+", "+s,!1,t),o=assetLoader.loadFileAsText(e),r=assetLoader.loadFileAsText(s);return a.waitFor(o),a.waitFor(r),a},AssetLoader.prototype.loadFileAsJSON=function(e,s){if(e=e.trim(),e in AssetLoader.loadedFiles)return AssetLoader.loadedFiles[e];var t=AssetJob.createJob(e,Asset.AssetType.JSON,AssetLoader.NO_OBJECT_INSTANCE,Util.isInitialized(s)?s:AssetLoader.NO_RUN_CALLBACK);return t.asset},AssetLoader.prototype.saveAssetIntoLibrary=function(e,s){switch(s){case Asset.AssetType.IMAGE:AssetLoader.loadedImages[e.name]=e;break;case Asset.AssetType.SCENE_DEF:AssetLoader.loadedScenes[e.name]=e;break;case Asset.AssetType.TEXT:case Asset.AssetType.JSON:AssetLoader.loadedFiles[e.name]=e;break;default:throw new Error("ERROR: unrecognized asset type for the asset "+e.name)}};