babylonjs-loaders
Advanced tools
Comparing version 7.20.1 to 7.21.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t={597:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.d(o,{default:()=>ie});var a={};n.r(a),n.d(a,{GLTFValidation:()=>b});var i={};n.r(i),n.d(i,{GLTFFileLoader:()=>A,GLTFLoaderAnimationStartMode:()=>m,GLTFLoaderCoordinateSystemMode:()=>h,GLTFLoaderState:()=>v});var s={};n.r(s),n.d(s,{EBlendingFunction:()=>M,EComponentType:()=>g,ECullingType:()=>C,EParameterType:()=>O,EShaderType:()=>E,ETextureFilterType:()=>T,ETextureFormat:()=>N,ETextureWrapMode:()=>L,GLTFBinaryExtension:()=>re,GLTFLoader:()=>ee,GLTFLoaderBase:()=>$,GLTFLoaderExtension:()=>te,GLTFMaterialsCommonExtension:()=>ne,GLTFUtils:()=>P});var l={};n.r(l),n.d(l,{GLTF1:()=>s,GLTFFileLoader:()=>A,GLTFLoaderAnimationStartMode:()=>m,GLTFLoaderCoordinateSystemMode:()=>h,GLTFLoaderState:()=>v,GLTFValidation:()=>b});var u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},u(e,t)};function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var f=n(597);function d(e,t,r,n){var o={externalResourceFunction:n};return r&&(o.uri="file:"===t?r:t+r),ArrayBuffer.isView(e)?GLTFValidator.validateBytes(e,o):GLTFValidator.validateString(e,o)}function p(){var e=[];onmessage=function(t){var r=t.data;switch(r.id){case"init":importScripts(r.url);break;case"validate":d(r.data,r.rootUrl,r.fileName,(function(t){return new Promise((function(r,n){var o=e.length;e.push({resolve:r,reject:n}),postMessage({id:"getExternalResource",index:o,uri:t})}))})).then((function(e){postMessage({id:"validate.resolve",value:e})}),(function(e){postMessage({id:"validate.reject",reason:e})}));break;case"getExternalResource.resolve":e[r.index].resolve(r.value);break;case"getExternalResource.reject":e[r.index].reject(r.reason)}}}var h,m,v,b=function(){function e(){}return e.ValidateAsync=function(e,t,r,n){var o=this;return"function"==typeof Worker?new Promise((function(a,i){var s="".concat(d,"(").concat(p,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),u=new Worker(l),c=function(e){u.removeEventListener("error",c),u.removeEventListener("message",h),i(e)},h=function(e){var t=e.data;switch(t.id){case"getExternalResource":n(t.uri).then((function(e){u.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e.buffer])}),(function(e){u.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})}));break;case"validate.resolve":u.removeEventListener("error",c),u.removeEventListener("message",h),a(t.value),u.terminate();break;case"validate.reject":u.removeEventListener("error",c),u.removeEventListener("message",h),i(t.reason),u.terminate()}};if(u.addEventListener("error",c),u.addEventListener("message",h),u.postMessage({id:"init",url:f.Tools.GetBabylonScriptURL(o.Configuration.url)}),ArrayBuffer.isView(e)){var m=e.slice();u.postMessage({id:"validate",data:m,rootUrl:t,fileName:r},[m.buffer])}else u.postMessage({id:"validate",data:e,rootUrl:t,fileName:r})})):(this._LoadScriptPromise||(this._LoadScriptPromise=f.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return d(e,t,r,n)})))},e.Configuration={url:"".concat(f.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),y="gltf";function _(e,t,r){try{return Promise.resolve(new Uint8Array(e,t,r))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(h||(h={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(m||(m={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(v||(v={}));var A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onParsedObservable=new f.Observable,t.onMeshLoadedObservable=new f.Observable,t.onSkinLoadedObservable=new f.Observable,t.onTextureLoadedObservable=new f.Observable,t.onMaterialLoadedObservable=new f.Observable,t.onCameraLoadedObservable=new f.Observable,t.onCompleteObservable=new f.Observable,t.onErrorObservable=new f.Observable,t.onDisposeObservable=new f.Observable,t.onExtensionLoadedObservable=new f.Observable,t.validate=!1,t.onValidatedObservable=new f.Observable,t._loader=null,t._state=null,t._requests=new Array,t.name=y,t.extensions={".gltf":{isBinary:!1},".glb":{isBinary:!0}},t.onLoaderStateChangedObservable=new f.Observable,t._logIndentLevel=0,t._loggingEnabled=!1,t._log=t._logDisabled,t._capturePerformanceCounters=!1,t._startPerformanceCounter=t._startPerformanceCounterDisabled,t._endPerformanceCounter=t._endPerformanceCounterDisabled,t}return c(t,e),Object.defineProperty(t.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),this._onParsedObserver=this.onParsedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loggingEnabled",{get:function(){return this._loggingEnabled},set:function(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"capturePerformanceCounters",{get:function(){return this._capturePerformanceCounters},set:function(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},t.prototype.loadFile=function(e,t,r,n,o,a,i,s){var l=this;if(ArrayBuffer.isView(t))return this._loadBinary(e,t,r,n,i,s),null;this._progressCallback=o;var u=t.name||f.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&f.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new f.Observable},d={readAsync:function(r,n){return new Promise((function(o,a){l._loadFile(e,t,(function(e){o(new Uint8Array(e))}),!0,(function(e){a(e)}),(function(e){e.setRequestHeader("Range","bytes=".concat(r,"-").concat(r+n-1))}))}))},byteLength:0};return this._unpackBinaryAsync(new f.DataReader(d)).then((function(e){c.onCompleteObservable.notifyObservers(c),n(e)}),i?function(e){return i(void 0,e)}:void 0),c}return this._loadFile(e,t,(function(t){l._validate(e,new Uint8Array(t,0,t.byteLength),r,u),l._unpackBinaryAsync(new f.DataReader({readAsync:function(e,r){return _(t,e,r)},byteLength:t.byteLength})).then((function(e){n(e)}),i?function(e){return i(void 0,e)}:void 0)}),!0,i)}return this._loadFile(e,t,(function(t){try{l._validate(e,t,r,u),n({json:l._parseJson(t)})}catch(e){i&&i()}}),!1,i)},t.prototype._loadBinary=function(e,t,r,n,o,a){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r,a),this._unpackBinaryAsync(new f.DataReader({readAsync:function(e,r){return function(e,t,r){try{if(t<0||t>=e.byteLength)throw new RangeError("Offset is out of range.");if(t+r>e.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,r))}catch(e){return Promise.reject(e)}}(t,e,r)},byteLength:t.byteLength})).then((function(e){n(e)}),o?function(e){return o(void 0,e)}:void 0)},t.prototype.importMeshAsync=function(e,t,r,n,o,a){var i=this;return Promise.resolve().then((function(){return i.onParsedObservable.notifyObservers(r),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(r),i._loader.importMeshAsync(e,t,null,r,n,o,a)}))},t.prototype.loadAsync=function(e,t,r,n,o){var a=this;return Promise.resolve().then((function(){return a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t),a._loader.loadAsync(e,t,r,n,o)}))},t.prototype.loadAssetContainerAsync=function(e,t,r,n,o){var a=this;return Promise.resolve().then((function(){a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t);var i=new f.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var u=[];a.onCameraLoadedObservable.add((function(e){u.push(e)}));var c=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&c.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,r,n,o).then((function(e){return Array.prototype.push.apply(i.geometries,e.geometries),Array.prototype.push.apply(i.meshes,e.meshes),Array.prototype.push.apply(i.particleSystems,e.particleSystems),Array.prototype.push.apply(i.skeletons,e.skeletons),Array.prototype.push.apply(i.animationGroups,e.animationGroups),Array.prototype.push.apply(i.materials,s),Array.prototype.push.apply(i.textures,l),Array.prototype.push.apply(i.lights,e.lights),Array.prototype.push.apply(i.transformNodes,e.transformNodes),Array.prototype.push.apply(i.cameras,u),Array.prototype.push.apply(i.morphTargetManagers,c),i}))}))},t.prototype.canDirectLoad=function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+t._MagicBase64Encoded)||e.startsWith("data:;base64,"+t._MagicBase64Encoded)||e.startsWith("data:application/octet-stream;base64,"+t._MagicBase64Encoded)||e.startsWith("data:model/gltf-binary;base64,"+t._MagicBase64Encoded)},t.prototype.directLoad=function(e,r){if(r.startsWith("base64,"+t._MagicBase64Encoded)||r.startsWith(";base64,"+t._MagicBase64Encoded)||r.startsWith("application/octet-stream;base64,"+t._MagicBase64Encoded)||r.startsWith("model/gltf-binary;base64,"+t._MagicBase64Encoded)){var n=(0,f.DecodeBase64UrlToBinary)(r);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new f.DataReader({readAsync:function(e,t){return _(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,r),Promise.resolve({json:this._parseJson(r)})},t.prototype.createPlugin=function(e){return new t(e[y])},Object.defineProperty(t.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,r){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){r(e)}))}))},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(v[this._state]))},t.prototype._loadFile=function(e,t,r,n,o,a){var i=this,s=e._loadFile(t,r,(function(e){i._onProgress(e,s)}),!0,n,o,a);return s.onCompleteObservable.add((function(){s._lengthComputable=!0,s._total=s._loaded})),this._requests.push(s),s},t.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var r=!0,n=0,o=0,a=0,i=this._requests;a<i.length;a++){var s=i[a];if(void 0===s._lengthComputable||void 0===s._loaded||void 0===s._total)return;r=r&&s._lengthComputable,n+=s._loaded,o+=s._total}this._progressCallback({lengthComputable:r,loaded:n,total:r?o:0})}},t.prototype._validate=function(e,t,r,n){var o=this;void 0===r&&(r=""),void 0===n&&(n=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),b.ValidateAsync(t,r,n,(function(t){return o.preprocessUrlAsync(r+t).then((function(t){return e._loadFileAsync(t,void 0,!0,!0).then((function(e){return new Uint8Array(e,0,e.byteLength)}))}))})).then((function(e){o._endPerformanceCounter("Validate JSON"),o.onValidatedObservable.notifyObservers(e),o.onValidatedObservable.clear()}),(function(e){o._endPerformanceCounter("Validate JSON"),f.Tools.Warn("Failed to validate: ".concat(e.message)),o.onValidatedObservable.clear()})))},t.prototype._getLoader=function(e){var r=e.json.asset||{};this._log("Asset version: ".concat(r.version)),r.minVersion&&this._log("Asset minimum version: ".concat(r.minVersion)),r.generator&&this._log("Asset generator: ".concat(r.generator));var n=t._parseVersion(r.version);if(!n)throw new Error("Invalid version: "+r.version);if(void 0!==r.minVersion){var o=t._parseVersion(r.minVersion);if(!o)throw new Error("Invalid minimum version: "+r.minVersion);if(t._compareVersion(o,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+r.minVersion)}var a={1:t._CreateGLTF1Loader,2:t._CreateGLTF2Loader}[n.major];if(!a)throw new Error("Unsupported version: "+r.version);return a(this)},t.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: ".concat(e.length));var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},t.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var r=e.readUint32();if(1179937895!==r)throw new f.RuntimeError("Unexpected magic: "+r,f.ErrorCodes.GLTFLoaderUnexpectedMagicError);var n=e.readUint32();t.loggingEnabled&&t._log("Binary version: ".concat(n));var o,a=e.readUint32();switch(t.useRangeRequests||a===e.buffer.byteLength||f.Logger.Warn("Length in header does not match actual data length: ".concat(a," != ").concat(e.buffer.byteLength)),n){case 1:o=t._unpackBinaryV1Async(e,a);break;case 2:o=t._unpackBinaryV2Async(e,a);break;default:throw new Error("Unsupported version: "+n)}return t._endPerformanceCounter("Unpack Binary"),o}))},t.prototype._unpackBinaryV1Async=function(e,t){var r=e.readUint32(),n=e.readUint32();if(0!==n)throw new Error("Unexpected content format: ".concat(n));var o=t-e.byteOffset,a={json:this._parseJson(e.readString(r)),bin:null};if(0!==o){var i=e.byteOffset;a.bin={readAsync:function(t,r){return e.buffer.readAsync(i+t,r)},byteLength:o}}return Promise.resolve(a)},t.prototype._unpackBinaryV2Async=function(e,t){var r=this,n=1313821514,o=e.readUint32();if(e.readUint32()!==n)throw new Error("First chunk format is not JSON");return e.byteOffset+o===t?e.loadAsync(o).then((function(){return{json:r._parseJson(e.readString(o)),bin:null}})):e.loadAsync(o+8).then((function(){var a={json:r._parseJson(e.readString(o)),bin:null},i=function(){var r=e.readUint32();switch(e.readUint32()){case n:throw new Error("Unexpected JSON chunk");case 5130562:var o=e.byteOffset;a.bin={readAsync:function(t,r){return e.buffer.readAsync(o+t,r)},byteLength:r},e.skipBytes(r);break;default:e.skipBytes(r)}return e.byteOffset!==t?e.loadAsync(8).then(i):Promise.resolve(a)};return i()}))},t._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},t._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},t.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},t.prototype._logClose=function(){--this._logIndentLevel},t.prototype._logEnabled=function(e){var r=t._logSpaces.substr(0,2*this._logIndentLevel);f.Logger.Log("".concat(r).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){f.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){f.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._MagicBase64Encoded="Z2xURg",t._logSpaces=" ",t}((function(e){var t;if(this.coordinateSystemMode=h.AUTO,this.animationStartMode=m.FIRST,this.loadNodeAnimations=!0,this.loadSkins=!0,this.loadMorphTargets=!0,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this.useRangeRequests=!1,this.createInstances=!0,this.alwaysComputeBoundingBox=!1,this.loadAllMaterials=!1,this.loadOnlyMaterials=!1,this.skipMaterials=!1,this.useSRGBBuffers=!0,this.targetFps=60,this.alwaysComputeSkeletonRootNode=!1,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.extensionOptions={},e)for(var r in this){var n=r;this[n]=null!==(t=e[n])&&void 0!==t?t:this[n]}}));f.SceneLoader&&f.SceneLoader.RegisterPlugin(new A);var g,E,O,L,T,N,C,M,S=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==S){for(var x in S.BABYLON=S.BABYLON||{},i)S.BABYLON[x]=i[x];for(var x in a)S.BABYLON[x]=a[x]}!function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.FLOAT=5126]="FLOAT"}(g||(g={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(E||(E={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"}(O||(O={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(L||(L={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9728]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(T||(T={})),function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA"}(N||(N={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(C||(C={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"}(M||(M={}));var R,P=function(){function e(){}return e.SetMatrix=function(e,t,r,n,o){var a=null;if("MODEL"===r.semantic?a=t.getWorldMatrix():"PROJECTION"===r.semantic?a=e.getProjectionMatrix():"VIEW"===r.semantic?a=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===r.semantic?a=f.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===r.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===r.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===r.semantic?a=t.getWorldMatrix().invert():"VIEWINVERSE"===r.semantic?a=e.getViewMatrix().invert():"PROJECTIONINVERSE"===r.semantic?a=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===r.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===r.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===r.semantic&&(a=f.Matrix.Transpose(t.getWorldMatrix().invert())),a)switch(r.type){case O.FLOAT_MAT2:o.setMatrix2x2(n,f.Matrix.GetAsMatrix2x2(a));break;case O.FLOAT_MAT3:o.setMatrix3x3(n,f.Matrix.GetAsMatrix3x3(a));break;case O.FLOAT_MAT4:o.setMatrix(n,a)}},e.SetUniform=function(e,t,r,n){switch(n){case O.FLOAT:return e.setFloat(t,r),!0;case O.FLOAT_VEC2:return e.setVector2(t,f.Vector2.FromArray(r)),!0;case O.FLOAT_VEC3:return e.setVector3(t,f.Vector3.FromArray(r)),!0;case O.FLOAT_VEC4:return e.setVector4(t,f.Vector4.FromArray(r)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case L.CLAMP_TO_EDGE:return f.Texture.CLAMP_ADDRESSMODE;case L.MIRRORED_REPEAT:return f.Texture.MIRROR_ADDRESSMODE;case L.REPEAT:default:return f.Texture.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case T.LINEAR:case T.LINEAR_MIPMAP_NEAREST:case T.LINEAR_MIPMAP_LINEAR:return f.Texture.TRILINEAR_SAMPLINGMODE;case T.NEAREST:case T.NEAREST_MIPMAP_NEAREST:return f.Texture.NEAREST_SAMPLINGMODE;default:return f.Texture.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,r,n,o){r=t.byteOffset+r;var a=e.loadedBufferViews[t.buffer];if(r+n>a.byteLength)throw new Error("Buffer access is out of range");var i=a.buffer;switch(r+=a.byteOffset,o){case g.BYTE:return new Int8Array(i,r,n);case g.UNSIGNED_BYTE:return new Uint8Array(i,r,n);case g.SHORT:return new Int16Array(i,r,n);case g.UNSIGNED_SHORT:return new Uint16Array(i,r,n);default:return new Float32Array(i,r,n)}},e.GetBufferFromAccessor=function(t,r){var n=t.bufferViews[r.bufferView],o=r.count*e.GetByteStrideFromType(r);return e.GetBufferFromBufferView(t,n,r.byteOffset,o,r.componentType)},e.DecodeBufferToText=function(e){for(var t="",r=e.byteLength,n=0;n<r;++n)t+=String.fromCharCode(e[n]);return t},e.GetDefaultMaterial=function(t){if(!e._DefaultMaterial){f.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{"," gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),f.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var r={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new f.ShaderMaterial("GLTFDefaultMaterial",t,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},r),e._DefaultMaterial.setColor4("u_emission",new f.Color4(.5,.5,.5,1))}return e._DefaultMaterial},e._DefaultMaterial=null,e}();!function(e){e[e.IDENTIFIER=1]="IDENTIFIER",e[e.UNKNOWN=2]="UNKNOWN",e[e.END_OF_INPUT=3]="END_OF_INPUT"}(R||(R={}));var w=function(){function e(e){this._pos=0,this.currentToken=R.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}return e.prototype.getNextToken=function(){if(this.isEnd())return R.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=R.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=R.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},e.prototype.peek=function(){return this._toParse[this._pos]},e.prototype.read=function(){return this._toParse[this._pos++]},e.prototype.forward=function(){this._pos++},e.prototype.isEnd=function(){return this._pos>=this._maxPos},e}(),I=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],B=["world","view","projection","worldView","worldViewProjection","mBones"],F=["translation","rotation","scale"],V=["position","rotationQuaternion","scaling"],D=function(e,t,r){for(var n in e){var o=e[n];r[t][n]=o}},U=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},k=function(e){if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){var t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},G=function(e){var t=null;if(e.translation||e.rotation||e.scale){var r=f.Vector3.FromArray(e.scale||[1,1,1]),n=f.Quaternion.FromArray(e.rotation||[0,0,0,1]),o=f.Vector3.FromArray(e.translation||[0,0,0]);t=f.Matrix.Compose(r,n,o)}else t=f.Matrix.FromArray(e.matrix);return t},j=function(e,t,r,n){for(var o=0;o<n.bones.length;o++)if(n.bones[o].name===r)return n.bones[o];var a=e.nodes;for(var i in a){var s=a[i];if(s.jointName){var l=s.children;for(o=0;o<l.length;o++){var u=e.nodes[l[o]];if(u.jointName&&u.jointName===r){var c=G(s),d=new f.Bone(s.name||"",n,j(e,t,s.jointName,n),c);return d.id=i,d}}}}return null},H=function(e,t){for(var r=0;r<e.length;r++)for(var n=e[r],o=0;o<n.node.children.length;o++)if(n.node.children[o]===t)return n.bone;return null},W=function(e,t){var r=e.nodes,n=r[t];if(n)return{node:n,id:t};for(var o in r)if((n=r[o]).jointName===t)return{node:n,id:o};return null},Y=function(e,t){for(var r=0;r<e.jointNames.length;r++)if(e.jointNames[r]===t)return!0;return!1},J=function(e,t,r,n,o){if(o||(e.scene._blockEntityCollection=!!e.assetContainer,(o=new f.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,o.id=n),!t.babylonNode)return o;for(var a,i=[],s=null,l=[],u=[],c=[],d=[],p=0;p<r.length;p++){var h=r[p];if(x=e.meshes[h])for(var m=0;m<x.primitives.length;m++){var v=new f.VertexData,b=x.primitives[m];b.mode;var y=b.attributes,_=null,g=null;for(var E in y)if(_=e.accessors[y[E]],g=P.GetBufferFromAccessor(e,_),"NORMAL"===E)v.normals=new Float32Array(g.length),v.normals.set(g);else if("POSITION"===E){if(A.HomogeneousCoordinates){v.positions=new Float32Array(g.length-g.length/4);for(var O=0;O<g.length;O+=4)v.positions[O]=g[O],v.positions[O+1]=g[O+1],v.positions[O+2]=g[O+2]}else v.positions=new Float32Array(g.length),v.positions.set(g);u.push(v.positions.length)}else if(-1!==E.indexOf("TEXCOORD_")){var L=Number(E.split("_")[1]),T=f.VertexBuffer.UVKind+(0===L?"":L+1),N=new Float32Array(g.length);N.set(g),U(N),v.set(N,T)}else"JOINT"===E?(v.matricesIndices=new Float32Array(g.length),v.matricesIndices.set(g)):"WEIGHT"===E?(v.matricesWeights=new Float32Array(g.length),v.matricesWeights.set(g)):"COLOR"===E&&(v.colors=new Float32Array(g.length),v.colors.set(g));if(_=e.accessors[b.indices])g=P.GetBufferFromAccessor(e,_),v.indices=new Int32Array(g.length),v.indices.set(g),d.push(v.indices.length);else{var C=[];for(O=0;O<v.positions.length/3;O++)C.push(O);v.indices=new Int32Array(C),d.push(v.indices.length)}s?s.merge(v):s=v;var M=e.scene.getMaterialById(b.material);i.push(null===M?P.GetDefaultMaterial(e.scene):M),l.push(0===l.length?0:l[l.length-1]+u[u.length-2]),c.push(0===c.length?0:c[c.length-1]+d[d.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,i.length>1?(a=new f.MultiMaterial("multimat"+n,e.scene)).subMaterials=i:a=new f.StandardMaterial("multimat"+n,e.scene),1===i.length&&(a=i[0]),a._parentContainer=e.assetContainer,o.material||(o.material=a),new f.Geometry(n,e.scene,s,!1,o),o.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,o.subMeshes=[];var S=0;for(p=0;p<r.length;p++){var x;if(h=r[p],x=e.meshes[h])for(m=0;m<x.primitives.length;m++)x.primitives[m].mode,f.SubMesh.AddToMesh(S,l[S],u[S],c[S],d[S],o,o,!0),S++}return o},q=function(e,t,r,n){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=r),e.scaling&&(e.scaling=n)},Z=function(e,t,r){var n=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(a=J(e,t,t.meshes,r,t.babylonNode)).skeleton=e.scene.getLastSkeletonById(t.skin),null===a.skeleton&&(a.skeleton=function(e,t,r,n){if(n||(n=new f.Skeleton(t.name||"","",e.scene)),!t.babylonSkeleton)return n;var o=[],a=[];!function(e,t,r,n){for(var o in e.nodes){var a=e.nodes[o],i=o;if(a.jointName&&!Y(r,a.jointName)){var s=G(a),l=new f.Bone(a.name||"",t,null,s);l.id=i,n.push({bone:l,node:a,id:i})}}for(var u=0;u<n.length;u++)for(var c=n[u],d=c.node.children,p=0;p<d.length;p++){for(var h=null,m=0;m<n.length;m++)if(n[m].id===d[p]){h=n[m];break}h&&(h.bone._parent=c.bone,c.bone.children.push(h.bone))}}(e,n,t,o),n.bones=[];for(var i=0;i<t.jointNames.length;i++)if(A=W(e,t.jointNames[i])){var s=A.node;if(s){var l=A.id,u=e.scene.getBoneById(l);if(u)n.bones.push(u);else{for(var c=!1,d=null,p=0;p<i;p++){var h=W(e,t.jointNames[p]);if(h){var m=h.node;if(m){var v=m.children;if(v){c=!1;for(var b=0;b<v.length;b++)if(v[b]===l){d=j(e,t,t.jointNames[p],n),c=!0;break}if(c)break}}else f.Tools.Warn("Joint named "+t.jointNames[p]+" does not exist when looking for parent")}}var y=G(s);!d&&o.length>0&&(d=H(o,l))&&-1===a.indexOf(d)&&a.push(d),new f.Bone(s.jointName||"",n,d,y).id=l}}else f.Tools.Warn("Joint named "+t.jointNames[i]+" does not exist")}var _=n.bones;for(n.bones=[],i=0;i<t.jointNames.length;i++){var A;if(A=W(e,t.jointNames[i]))for(p=0;p<_.length;p++)if(_[p].id===A.id){n.bones.push(_[p]);break}}for(n.prepare(),i=0;i<a.length;i++)n.bones.push(a[i]);return n}(e,o,0,o.babylonSkeleton),o.babylonSkeleton||(o.babylonSkeleton=a.skeleton)),n=a}}else if(t.meshes){var a;n=a=J(e,t,t.mesh?[t.mesh]:t.meshes,r,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var i=e.cameras[t.camera];if(i){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===i.type){var s=new f.FreeCamera(t.camera,f.Vector3.Zero(),e.scene,!1);s.name=t.name||"",s.mode=f.Camera.ORTHOGRAPHIC_CAMERA,s.attachControl(),n=s,s._parentContainer=e.assetContainer}else if("perspective"===i.type){var l=i[i.type],u=new f.FreeCamera(t.camera,f.Vector3.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),l.aspectRatio||(l.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),l.znear&&l.zfar&&(u.maxZ=l.zfar,u.minZ=l.znear),n=u,u._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var c=e.lights[t.light];if(c)if("ambient"===c.type){var d=c[c.type],p=new f.HemisphericLight(t.light,f.Vector3.Zero(),e.scene);p.name=t.name||"",d.color&&(p.diffuse=f.Color3.FromArray(d.color)),n=p}else if("directional"===c.type){var h=c[c.type],m=new f.DirectionalLight(t.light,f.Vector3.Zero(),e.scene);m.name=t.name||"",h.color&&(m.diffuse=f.Color3.FromArray(h.color)),n=m}else if("point"===c.type){var v=c[c.type],b=new f.PointLight(t.light,f.Vector3.Zero(),e.scene);b.name=t.name||"",v.color&&(b.diffuse=f.Color3.FromArray(v.color)),n=b}else if("spot"===c.type){var y=c[c.type],_=new f.SpotLight(t.light,f.Vector3.Zero(),f.Vector3.Zero(),0,0,e.scene);_.name=t.name||"",y.color&&(_.diffuse=f.Color3.FromArray(y.color)),y.fallOfAngle&&(_.angle=y.fallOfAngle),y.fallOffExponent&&(_.exponent=y.fallOffExponent),n=_}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===n){e.scene._blockEntityCollection=!!e.assetContainer;var A=new f.Mesh(t.name||"",e.scene);A._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,t.babylonNode=A,n=A}}if(null!==n){if(t.matrix&&n instanceof f.Mesh)!function(e,t){if(t.matrix){var r=new f.Vector3(0,0,0),n=new f.Quaternion,o=new f.Vector3(0,0,0);f.Matrix.FromArray(t.matrix).decompose(o,n,r),q(e,r,n,o)}else t.translation&&t.rotation&&t.scale&&q(e,f.Vector3.FromArray(t.translation),f.Quaternion.FromArray(t.rotation),f.Vector3.FromArray(t.scale));e.computeWorldMatrix(!0)}(n,t);else{var g=t.translation||[0,0,0],E=t.rotation||[0,0,0,1],O=t.scale||[1,1,1];q(n,f.Vector3.FromArray(g),f.Quaternion.FromArray(E),f.Vector3.FromArray(O))}n.updateCache(!0),t.babylonNode=n}return n},K=function(e,t,r,n){void 0===n&&(n=!1);var o=e.nodes[t],a=null;if(n=!(e.importOnlyMeshes&&!n&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&n&&null!==(a=Z(e,o,t))&&(a.id=t,a.parent=r),o.children)for(var i=0;i<o.children.length;i++)K(e,o.children[i],a,n)},Q=function(e){var t=e.currentScene;if(t)for(var r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null);else for(var n in e.scenes)for(t=e.scenes[n],r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null);for(function(e){for(var t in e.animations){var r=e.animations[t];if(r.channels&&r.samplers)for(var n=null,o=0;o<r.channels.length;o++){var a=r.channels[o],i=r.samplers[a.sampler];if(i){var s=null,l=null;r.parameters?(s=r.parameters[i.input],l=r.parameters[i.output]):(s=i.input,l=i.output);var u=P.GetBufferFromAccessor(e,e.accessors[s]),c=P.GetBufferFromAccessor(e,e.accessors[l]),d=a.target.id,p=e.scene.getNodeById(d);if(null===p&&(p=e.scene.getNodeByName(d)),null!==p){var h=p instanceof f.Bone,m=a.target.path,v=F.indexOf(m);-1!==v&&(m=V[v]);var b=f.Animation.ANIMATIONTYPE_MATRIX;h||("rotationQuaternion"===m?(b=f.Animation.ANIMATIONTYPE_QUATERNION,p.rotationQuaternion=new f.Quaternion):b=f.Animation.ANIMATIONTYPE_VECTOR3);var y=null,_=[],A=0,g=!1;h&&n&&n.getKeys().length===u.length&&(y=n,g=!0),g||(e.scene._blockEntityCollection=!!e.assetContainer,y=new f.Animation(t,h?"_matrix":m,1,b,f.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var E=0;E<u.length;E++){var O=null;if("rotationQuaternion"===m?(O=f.Quaternion.FromArray([c[A],c[A+1],c[A+2],c[A+3]]),A+=4):(O=f.Vector3.FromArray([c[A],c[A+1],c[A+2]]),A+=3),h){var L=p,T=f.Vector3.Zero(),N=new f.Quaternion,C=f.Vector3.Zero(),M=L.getBaseMatrix();g&&n&&(M=n.getKeys()[E].value),M.decompose(C,N,T),"position"===m?T=O:"rotationQuaternion"===m?N=O:C=O,O=f.Matrix.Compose(C,N,T)}g?n&&(n.getKeys()[E].value=O):_.push({frame:u[E],value:O})}!g&&y&&(y.setKeys(_),p.animations.push(y)),n=y,e.scene.stopAnimation(p),e.scene.beginAnimation(p,0,u[u.length-1],!0,1)}else f.Tools.Warn("Creating animation named "+t+". But cannot find node named "+d+" to attach to")}}}}(e),r=0;r<e.scene.skeletons.length;r++){var o=e.scene.skeletons[r];e.scene.beginAnimation(o,0,Number.MAX_VALUE,!0,1)}},X=function(e,t,r){for(var n in t.uniforms){var o=t.uniforms[n],a=t.parameters[o];if(e.currentIdentifier===n&&a.semantic&&!a.source&&!a.node){var i=I.indexOf(a.semantic);if(-1!==i)return delete r[n],B[i]}}return e.currentIdentifier},z=function(e){for(var t in e.materials)te.LoadMaterialAsync(e,t,(function(){}),(function(){}))},$=function(){function e(){}return e.CreateRuntime=function(e,t,r){var n={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:r,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&D(e.extensions,"extensions",n),e.extensionsUsed&&D(e.extensionsUsed,"extensionsUsed",n),e.buffers&&function(e,t){for(var r in e){var n=e[r];t.buffers[r]=n,t.buffersCount++}}(e.buffers,n),e.bufferViews&&D(e.bufferViews,"bufferViews",n),e.accessors&&D(e.accessors,"accessors",n),e.meshes&&D(e.meshes,"meshes",n),e.lights&&D(e.lights,"lights",n),e.cameras&&D(e.cameras,"cameras",n),e.nodes&&D(e.nodes,"nodes",n),e.images&&D(e.images,"images",n),e.textures&&D(e.textures,"textures",n),e.shaders&&function(e,t){for(var r in e){var n=e[r];t.shaders[r]=n,t.shaderscount++}}(e.shaders,n),e.programs&&D(e.programs,"programs",n),e.samplers&&D(e.samplers,"samplers",n),e.techniques&&D(e.techniques,"techniques",n),e.materials&&D(e.materials,"materials",n),e.animations&&D(e.animations,"animations",n),e.skins&&D(e.skins,"skins",n),e.scenes&&(n.scenes=e.scenes),e.scene&&e.scenes&&(n.currentScene=e.scenes[e.scene]),n},e.LoadBufferAsync=function(e,t,r,n,o){var a=e.buffers[t];f.Tools.IsBase64(a.uri)?setTimeout((function(){return r(new Uint8Array(f.Tools.DecodeBase64(a.uri)))})):f.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return r(new Uint8Array(e))}),o,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))},e.LoadTextureBufferAsync=function(e,t,r,n){var o=e.textures[t];if(o&&o.source)if(o.babylonTexture)r(null);else{var a=e.images[o.source];f.Tools.IsBase64(a.uri)?setTimeout((function(){return r(new Uint8Array(f.Tools.DecodeBase64(a.uri)))})):f.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return r(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))}else n("")},e.CreateTextureAsync=function(e,t,r,n){var o=e.textures[t];if(o.babylonTexture)n(o.babylonTexture);else{var a=e.samplers[o.sampler],i=a.minFilter===T.NEAREST_MIPMAP_NEAREST||a.minFilter===T.NEAREST_MIPMAP_LINEAR||a.minFilter===T.LINEAR_MIPMAP_NEAREST||a.minFilter===T.LINEAR_MIPMAP_LINEAR,s=f.Texture.BILINEAR_SAMPLINGMODE,l=null==r?new Blob:new Blob([r]),u=URL.createObjectURL(l),c=function(){return URL.revokeObjectURL(u)},d=new f.Texture(u,e.scene,!i,!0,s,c,c);void 0!==a.wrapS&&(d.wrapU=P.GetWrapMode(a.wrapS)),void 0!==a.wrapT&&(d.wrapV=P.GetWrapMode(a.wrapT)),d.name=t,o.babylonTexture=d,n(d)}},e.LoadShaderStringAsync=function(e,t,r,n){var o=e.shaders[t];if(f.Tools.IsBase64(o.uri)){var a=atob(o.uri.split(",")[1]);r&&r(a)}else f.Tools.LoadFile(e.rootUrl+o.uri,r,void 0,void 0,!1,(function(e){e&&n&&n(e.status+" "+e.statusText)}))},e.LoadMaterialAsync=function(e,t,r,n){var o=e.materials[t];if(o.technique){var a=e.techniques[o.technique];if(!a){e.scene._blockEntityCollection=!!e.assetContainer;var i=new f.StandardMaterial(t,e.scene);return i._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,i.diffuseColor=new f.Color3(.5,.5,.5),i.sideOrientation=f.Material.CounterClockWiseSideOrientation,void r(i)}var s=e.programs[a.program],l=a.states,u=f.Effect.ShadersStore[s.vertexShader+"VertexShader"],c=f.Effect.ShadersStore[s.fragmentShader+"PixelShader"],d="",p="",h=new w(u),m=new w(c),v={},b=[],y=[],_=[];for(var A in a.uniforms){var g=a.uniforms[A],E=a.parameters[g];if(v[A]=E,!E.semantic||E.node||E.source)E.type===O.SAMPLER_2D?_.push(A):b.push(A);else{var L=I.indexOf(E.semantic);-1!==L?(b.push(B[L]),delete v[A]):b.push(A)}}for(var T in a.attributes){var N=a.attributes[T];if((F=a.parameters[N]).semantic){var S=k(F);S&&y.push(S)}}for(;!h.isEnd()&&h.getNextToken();)if(h.currentToken===R.IDENTIFIER){var x=!1;for(var T in a.attributes){N=a.attributes[T];var F=a.parameters[N];if(h.currentIdentifier===T&&F.semantic){d+=k(F),x=!0;break}}x||(d+=X(h,a,v))}else d+=h.currentString;for(;!m.isEnd()&&m.getNextToken();)m.currentToken===R.IDENTIFIER?p+=X(m,a,v):p+=m.currentString;var V={vertex:s.vertexShader+t,fragment:s.fragmentShader+t},D={attributes:y,uniforms:b,samplers:_,needAlphaBlending:l&&l.enable&&-1!==l.enable.indexOf(3042)};f.Effect.ShadersStore[s.vertexShader+t+"VertexShader"]=d,f.Effect.ShadersStore[s.fragmentShader+t+"PixelShader"]=p;var U=new f.ShaderMaterial(t,e.scene,V,D);if(U.onError=function(e,t,r){return function(n,o){t.dispose(!0),r("Cannot compile program named "+e.name+". Error: "+o+". Default material will be applied")}}(s,U,n),U.onCompiled=function(e,t,r,n,o,a){return function(i){!function(e,t,r,n,o){var a=n.values||r.parameters,i=r.uniforms,s=function(r){var s=o[r],l=s.type,u=a[i[r]];if(void 0===u&&(u=s.value),!u)return"continue";var c=function(e){return function(r){s.value&&e&&(t.setTexture(e,r),delete o[e])}};l===O.SAMPLER_2D?te.LoadTextureAsync(e,n.values?u:s.value,c(r),(function(){return c(null)})):s.value&&P.SetUniform(t,r,n.values?u:s.value,l)&&delete o[r]};for(var l in o)s(l)}(e,t,r,n,o),t.onBind=function(i){!function(e,t,r,n,o,a,i){var s=a.values||o.parameters;for(var l in r){var u=r[l],c=u.type;if(c===O.FLOAT_MAT2||c===O.FLOAT_MAT3||c===O.FLOAT_MAT4)if(!u.semantic||u.source||u.node){if(u.semantic&&(u.source||u.node)){var f=t.scene.getNodeByName(u.source||u.node||"");if(null===f&&(f=t.scene.getNodeById(u.source||u.node||"")),null===f)continue;P.SetMatrix(t.scene,f,u,l,n.getEffect())}}else P.SetMatrix(t.scene,e,u,l,n.getEffect());else{var d=s[o.uniforms[l]];if(!d)continue;if(c===O.SAMPLER_2D){var p=t.textures[a.values?d:u.value].babylonTexture;if(null==p)continue;n.getEffect().setTexture(l,p)}else P.SetUniform(n.getEffect(),l,d,c)}}i(n)}(i,e,o,t,r,n,a)}}}(e,U,a,o,v,r),U.sideOrientation=f.Material.CounterClockWiseSideOrientation,l&&l.functions){var G=l.functions;G.cullFace&&G.cullFace[0]!==C.BACK&&(U.backFaceCulling=!1);var j=G.blendFuncSeparate;j&&(j[0]===M.SRC_ALPHA&&j[1]===M.ONE_MINUS_SRC_ALPHA&&j[2]===M.ONE&&j[3]===M.ONE?U.alphaMode=f.Constants.ALPHA_COMBINE:j[0]===M.ONE&&j[1]===M.ONE&&j[2]===M.ZERO&&j[3]===M.ONE?U.alphaMode=f.Constants.ALPHA_ONEONE:j[0]===M.SRC_ALPHA&&j[1]===M.ONE&&j[2]===M.ZERO&&j[3]===M.ONE?U.alphaMode=f.Constants.ALPHA_ADD:j[0]===M.ZERO&&j[1]===M.ONE_MINUS_SRC_COLOR&&j[2]===M.ONE&&j[3]===M.ONE?U.alphaMode=f.Constants.ALPHA_SUBTRACT:j[0]===M.DST_COLOR&&j[1]===M.ZERO&&j[2]===M.ONE&&j[3]===M.ONE?U.alphaMode=f.Constants.ALPHA_MULTIPLY:j[0]===M.SRC_ALPHA&&j[1]===M.ONE_MINUS_SRC_COLOR&&j[2]===M.ONE&&j[3]===M.ONE&&(U.alphaMode=f.Constants.ALPHA_MAXIMIZED))}}else n&&n("No technique found.")},e}(),ee=function(){function e(){}return e.RegisterExtension=function(t){e.Extensions[t.name]?f.Tools.Error('Tool with the same name "'+t.name+'" already exists'):e.Extensions[t.name]=t},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,t,r,n,o,a,i,s){var l=this;return t.useRightHandedSystem=!0,te.LoadRuntimeAsync(t,r,n,(function(t){t.assetContainer=o,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],f.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],l._createNodes(t);var r=[],n=[];for(var i in t.nodes){var s=t.nodes[i];s.babylonNode instanceof f.AbstractMesh&&r.push(s.babylonNode)}for(var u in t.skins){var c=t.skins[u];c.babylonSkeleton instanceof f.Skeleton&&n.push(c.babylonSkeleton)}l._loadBuffersAsync(t,(function(){l._loadShadersAsync(t,(function(){z(t),Q(t),!A.IncrementalLoading&&a&&a(r,n)}))})),A.IncrementalLoading&&a&&a(r,n)}),s),!0},e.prototype.importMeshAsync=function(e,t,r,n,o,a){var i=this;return new Promise((function(s,l){i._importMeshAsync(e,t,n,o,r,(function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[],spriteManagers:[]})}),a,(function(e){l(new Error(e))}))}))},e.prototype._loadAsync=function(e,t,r,n,o,a){var i=this;e.useRightHandedSystem=!0,te.LoadRuntimeAsync(e,t,r,(function(e){te.LoadRuntimeExtensionsAsync(e,(function(){i._createNodes(e),i._loadBuffersAsync(e,(function(){i._loadShadersAsync(e,(function(){z(e),Q(e),A.IncrementalLoading||n()}))})),A.IncrementalLoading&&n()}),a)}),a)},e.prototype.loadAsync=function(e,t,r,n){var o=this;return new Promise((function(a,i){o._loadAsync(e,t,r,(function(){a()}),n,(function(e){i(new Error(e))}))}))},e.prototype._loadShadersAsync=function(e,t){var r=!1,n=function(r,n){te.LoadShaderStringAsync(e,r,(function(o){o instanceof ArrayBuffer||(e.loadedShaderCount++,o&&(f.Effect.ShadersStore[r+(n.type===E.VERTEX?"VertexShader":"PixelShader")]=o),e.loadedShaderCount===e.shaderscount&&t())}),(function(){f.Tools.Error("Error when loading shader program named "+r+" located at "+n.uri)}))};for(var o in e.shaders){r=!0;var a=e.shaders[o];a?n.bind(this,o,a)():f.Tools.Error("No shader named: "+o)}r||t()},e.prototype._loadBuffersAsync=function(e,t){var r=!1,n=function(r,n){te.LoadBufferAsync(e,r,(function(o){e.loadedBufferCount++,o&&(o.byteLength!=e.buffers[r].byteLength&&f.Tools.Error("Buffer named "+r+" is length "+o.byteLength+". Expected: "+n.byteLength),e.loadedBufferViews[r]=o),e.loadedBufferCount===e.buffersCount&&t()}),(function(){f.Tools.Error("Error when loading buffer named "+r+" located at "+n.uri)}))};for(var o in e.buffers){r=!0;var a=e.buffers[o];a?n.bind(this,o,a)():f.Tools.Error("No buffer named: "+o)}r||t()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null);else for(var n in e.scenes)for(t=e.scenes[n],r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null)},e.Extensions={},e}(),te=function(){function e(e){this._name=e}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),e.prototype.loadRuntimeAsync=function(e,t,r,n,o){return!1},e.prototype.loadRuntimeExtensionsAsync=function(e,t,r){return!1},e.prototype.loadBufferAsync=function(e,t,r,n,o){return!1},e.prototype.loadTextureBufferAsync=function(e,t,r,n){return!1},e.prototype.createTextureAsync=function(e,t,r,n,o){return!1},e.prototype.loadShaderStringAsync=function(e,t,r,n){return!1},e.prototype.loadMaterialAsync=function(e,t,r,n){return!1},e.LoadRuntimeAsync=function(t,r,n,o,a){e._ApplyExtensions((function(e){return e.loadRuntimeAsync(t,r,n,o,a)}),(function(){setTimeout((function(){o&&o($.CreateRuntime(r.json,t,n))}))}))},e.LoadRuntimeExtensionsAsync=function(t,r,n){e._ApplyExtensions((function(e){return e.loadRuntimeExtensionsAsync(t,r,n)}),(function(){setTimeout((function(){r()}))}))},e.LoadBufferAsync=function(t,r,n,o,a){e._ApplyExtensions((function(e){return e.loadBufferAsync(t,r,n,o,a)}),(function(){$.LoadBufferAsync(t,r,n,o,a)}))},e.LoadTextureAsync=function(t,r,n,o){e._LoadTextureBufferAsync(t,r,(function(a){a&&e._CreateTextureAsync(t,r,a,n,o)}),o)},e.LoadShaderStringAsync=function(t,r,n,o){e._ApplyExtensions((function(e){return e.loadShaderStringAsync(t,r,n,o)}),(function(){$.LoadShaderStringAsync(t,r,n,o)}))},e.LoadMaterialAsync=function(t,r,n,o){e._ApplyExtensions((function(e){return e.loadMaterialAsync(t,r,n,o)}),(function(){$.LoadMaterialAsync(t,r,n,o)}))},e._LoadTextureBufferAsync=function(t,r,n,o){e._ApplyExtensions((function(e){return e.loadTextureBufferAsync(t,r,n,o)}),(function(){$.LoadTextureBufferAsync(t,r,n,o)}))},e._CreateTextureAsync=function(t,r,n,o,a){e._ApplyExtensions((function(e){return e.createTextureAsync(t,r,n,o,a)}),(function(){$.CreateTextureAsync(t,r,n,o)}))},e._ApplyExtensions=function(e,t){for(var r in ee.Extensions)if(e(ee.Extensions[r]))return;t()},e}();A._CreateGLTF1Loader=function(){return new ee};var re=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return c(t,e),t.prototype.loadRuntimeAsync=function(e,t,r,n){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,n($.CreateRuntime(t.json,e,r)),0))},t.prototype.loadBufferAsync=function(e,t,r,n){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(r,(function(e){return n(e.message)})),!0)},t.prototype.loadTextureBufferAsync=function(e,t,r){var n=e.textures[t],o=e.images[n.source];if(!o.extensions||!(this.name in o.extensions))return!1;var a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return r(P.GetBufferFromBufferView(e,i,0,i.byteLength,g.UNSIGNED_BYTE)),!0},t.prototype.loadShaderStringAsync=function(e,t,r){var n=e.shaders[t];if(!n.extensions||!(this.name in n.extensions))return!1;var o=n.extensions[this.name],a=e.bufferViews[o.bufferView],i=P.GetBufferFromBufferView(e,a,0,a.byteLength,g.UNSIGNED_BYTE);return setTimeout((function(){var e=P.DecodeBufferToText(i);r(e)})),!0},t}(te);ee.RegisterExtension(new re);var ne=function(e){function t(){return e.call(this,"KHR_materials_common")||this}return c(t,e),t.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var t=e.extensions[this.name];if(!t)return!1;var r=t.lights;if(r)for(var n in r){var o=r[n];switch(o.type){case"ambient":var a=new f.HemisphericLight(o.name,new f.Vector3(0,1,0),e.scene),i=o.ambient;i&&(a.diffuse=f.Color3.FromArray(i.color||[1,1,1]));break;case"point":var s=new f.PointLight(o.name,new f.Vector3(10,10,10),e.scene),l=o.point;l&&(s.diffuse=f.Color3.FromArray(l.color||[1,1,1]));break;case"directional":var u=new f.DirectionalLight(o.name,new f.Vector3(0,-1,0),e.scene),c=o.directional;c&&(u.diffuse=f.Color3.FromArray(c.color||[1,1,1]));break;case"spot":var d=o.spot;d&&(new f.SpotLight(o.name,new f.Vector3(0,10,0),new f.Vector3(0,-1,0),d.fallOffAngle||Math.PI,d.fallOffExponent||0,e.scene).diffuse=f.Color3.FromArray(d.color||[1,1,1]));break;default:f.Tools.Warn('GLTF Material Common extension: light type "'+o.type+"” not supported")}}return!1},t.prototype.loadMaterialAsync=function(e,t,r,n){var o=e.materials[t];if(!o||!o.extensions)return!1;var a=o.extensions[this.name];if(!a)return!1;var i=new f.StandardMaterial(t,e.scene);return i.sideOrientation=f.Material.CounterClockWiseSideOrientation,"CONSTANT"===a.technique&&(i.disableLighting=!0),i.backFaceCulling=void 0!==a.doubleSided&&!a.doubleSided,i.alpha=void 0===a.values.transparency?1:a.values.transparency,i.specularPower=void 0===a.values.shininess?0:a.values.shininess,"string"==typeof a.values.ambient?this._loadTexture(e,a.values.ambient,i,"ambientTexture",n):i.ambientColor=f.Color3.FromArray(a.values.ambient||[0,0,0]),"string"==typeof a.values.diffuse?this._loadTexture(e,a.values.diffuse,i,"diffuseTexture",n):i.diffuseColor=f.Color3.FromArray(a.values.diffuse||[0,0,0]),"string"==typeof a.values.emission?this._loadTexture(e,a.values.emission,i,"emissiveTexture",n):i.emissiveColor=f.Color3.FromArray(a.values.emission||[0,0,0]),"string"==typeof a.values.specular?this._loadTexture(e,a.values.specular,i,"specularTexture",n):i.specularColor=f.Color3.FromArray(a.values.specular||[0,0,0]),!0},t.prototype._loadTexture=function(e,t,r,n,o){$.LoadTextureBufferAsync(e,t,(function(o){$.CreateTextureAsync(e,t,o,(function(e){return r[n]=e}))}),o)},t}(te);ee.RegisterExtension(new ne);var oe=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==oe)for(var ae in oe.BABYLON=oe.BABYLON||{},oe.BABYLON.GLTF1=oe.BABYLON.GLTF1||{},s)oe.BABYLON.GLTF1[ae]=s[ae];const ie=l;return o.default})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t={597:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.d(o,{default:()=>ie});var a={};n.r(a),n.d(a,{GLTFValidation:()=>b});var i={};n.r(i),n.d(i,{GLTFFileLoader:()=>A,GLTFLoaderAnimationStartMode:()=>m,GLTFLoaderCoordinateSystemMode:()=>h,GLTFLoaderState:()=>v});var s={};n.r(s),n.d(s,{EBlendingFunction:()=>S,EComponentType:()=>g,ECullingType:()=>C,EParameterType:()=>E,EShaderType:()=>O,ETextureFilterType:()=>T,ETextureFormat:()=>N,ETextureWrapMode:()=>L,GLTFBinaryExtension:()=>re,GLTFLoader:()=>ee,GLTFLoaderBase:()=>$,GLTFLoaderExtension:()=>te,GLTFMaterialsCommonExtension:()=>ne,GLTFUtils:()=>P});var l={};n.r(l),n.d(l,{GLTF1:()=>s,GLTFFileLoader:()=>A,GLTFLoaderAnimationStartMode:()=>m,GLTFLoaderCoordinateSystemMode:()=>h,GLTFLoaderState:()=>v,GLTFValidation:()=>b});var u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},u(e,t)};function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var d=n(597);function f(e,t,r,n){var o={externalResourceFunction:n};return r&&(o.uri="file:"===t?r:t+r),ArrayBuffer.isView(e)?GLTFValidator.validateBytes(e,o):GLTFValidator.validateString(e,o)}function p(){var e=[];onmessage=function(t){var r=t.data;switch(r.id){case"init":importScripts(r.url);break;case"validate":f(r.data,r.rootUrl,r.fileName,(function(t){return new Promise((function(r,n){var o=e.length;e.push({resolve:r,reject:n}),postMessage({id:"getExternalResource",index:o,uri:t})}))})).then((function(e){postMessage({id:"validate.resolve",value:e})}),(function(e){postMessage({id:"validate.reject",reason:e})}));break;case"getExternalResource.resolve":e[r.index].resolve(r.value);break;case"getExternalResource.reject":e[r.index].reject(r.reason)}}}var h,m,v,b=function(){function e(){}return e.ValidateAsync=function(e,t,r,n){var o=this;return"function"==typeof Worker?new Promise((function(a,i){var s="".concat(f,"(").concat(p,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),u=new Worker(l),c=function(e){u.removeEventListener("error",c),u.removeEventListener("message",h),i(e)},h=function(e){var t=e.data;switch(t.id){case"getExternalResource":n(t.uri).then((function(e){u.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e.buffer])}),(function(e){u.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})}));break;case"validate.resolve":u.removeEventListener("error",c),u.removeEventListener("message",h),a(t.value),u.terminate();break;case"validate.reject":u.removeEventListener("error",c),u.removeEventListener("message",h),i(t.reason),u.terminate()}};if(u.addEventListener("error",c),u.addEventListener("message",h),u.postMessage({id:"init",url:d.Tools.GetBabylonScriptURL(o.Configuration.url)}),ArrayBuffer.isView(e)){var m=e.slice();u.postMessage({id:"validate",data:m,rootUrl:t,fileName:r},[m.buffer])}else u.postMessage({id:"validate",data:e,rootUrl:t,fileName:r})})):(this._LoadScriptPromise||(this._LoadScriptPromise=d.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return f(e,t,r,n)})))},e.Configuration={url:"".concat(d.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),y="gltf";function _(e,t,r){try{return Promise.resolve(new Uint8Array(e,t,r))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(h||(h={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(m||(m={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(v||(v={}));var A=function(e){function t(t){var r=e.call(this)||this;return r.onParsedObservable=new d.Observable,r.onMeshLoadedObservable=new d.Observable,r.onSkinLoadedObservable=new d.Observable,r.onTextureLoadedObservable=new d.Observable,r.onMaterialLoadedObservable=new d.Observable,r.onCameraLoadedObservable=new d.Observable,r.onCompleteObservable=new d.Observable,r.onErrorObservable=new d.Observable,r.onDisposeObservable=new d.Observable,r.onExtensionLoadedObservable=new d.Observable,r.validate=!1,r.onValidatedObservable=new d.Observable,r._loader=null,r._state=null,r._requests=new Array,r.name=y,r.extensions={".gltf":{isBinary:!1},".glb":{isBinary:!0}},r.onLoaderStateChangedObservable=new d.Observable,r._logIndentLevel=0,r._loggingEnabled=!1,r._log=r._logDisabled,r._capturePerformanceCounters=!1,r._startPerformanceCounter=r._startPerformanceCounterDisabled,r._endPerformanceCounter=r._endPerformanceCounterDisabled,r.copyFrom(t),r}return c(t,e),Object.defineProperty(t.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),this._onParsedObserver=this.onParsedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSkinLoaded",{set:function(e){this._onSkinLoadedObserver&&this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver),this._onSkinLoadedObserver=this.onSkinLoadedObservable.add((function(t){return e(t.node,t.skinnedNode)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loggingEnabled",{get:function(){return this._loggingEnabled},set:function(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"capturePerformanceCounters",{get:function(){return this._capturePerformanceCounters},set:function(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},t.prototype.loadFile=function(e,t,r,n,o,a,i,s){var l=this;if(ArrayBuffer.isView(t))return this._loadBinary(e,t,r,n,i,s),null;this._progressCallback=o;var u=t.name||d.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&d.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new d.Observable},f={readAsync:function(r,n){return new Promise((function(o,a){l._loadFile(e,t,(function(e){o(new Uint8Array(e))}),!0,(function(e){a(e)}),(function(e){e.setRequestHeader("Range","bytes=".concat(r,"-").concat(r+n-1))}))}))},byteLength:0};return this._unpackBinaryAsync(new d.DataReader(f)).then((function(e){c.onCompleteObservable.notifyObservers(c),n(e)}),i?function(e){return i(void 0,e)}:void 0),c}return this._loadFile(e,t,(function(t){l._validate(e,new Uint8Array(t,0,t.byteLength),r,u),l._unpackBinaryAsync(new d.DataReader({readAsync:function(e,r){return _(t,e,r)},byteLength:t.byteLength})).then((function(e){n(e)}),i?function(e){return i(void 0,e)}:void 0)}),!0,i)}return this._loadFile(e,t,(function(t){try{l._validate(e,t,r,u),n({json:l._parseJson(t)})}catch(e){i&&i()}}),!1,i)},t.prototype._loadBinary=function(e,t,r,n,o,a){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r,a),this._unpackBinaryAsync(new d.DataReader({readAsync:function(e,r){return function(e,t,r){try{if(t<0||t>=e.byteLength)throw new RangeError("Offset is out of range.");if(t+r>e.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,r))}catch(e){return Promise.reject(e)}}(t,e,r)},byteLength:t.byteLength})).then((function(e){n(e)}),o?function(e){return o(void 0,e)}:void 0)},t.prototype.importMeshAsync=function(e,t,r,n,o,a){var i=this;return Promise.resolve().then((function(){return i.onParsedObservable.notifyObservers(r),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(r),i._loader.importMeshAsync(e,t,null,r,n,o,a)}))},t.prototype.loadAsync=function(e,t,r,n,o){var a=this;return Promise.resolve().then((function(){return a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t),a._loader.loadAsync(e,t,r,n,o)}))},t.prototype.loadAssetContainerAsync=function(e,t,r,n,o){var a=this;return Promise.resolve().then((function(){a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t);var i=new d.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var u=[];a.onCameraLoadedObservable.add((function(e){u.push(e)}));var c=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&c.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,r,n,o).then((function(e){return Array.prototype.push.apply(i.geometries,e.geometries),Array.prototype.push.apply(i.meshes,e.meshes),Array.prototype.push.apply(i.particleSystems,e.particleSystems),Array.prototype.push.apply(i.skeletons,e.skeletons),Array.prototype.push.apply(i.animationGroups,e.animationGroups),Array.prototype.push.apply(i.materials,s),Array.prototype.push.apply(i.textures,l),Array.prototype.push.apply(i.lights,e.lights),Array.prototype.push.apply(i.transformNodes,e.transformNodes),Array.prototype.push.apply(i.cameras,u),Array.prototype.push.apply(i.morphTargetManagers,c),i}))}))},t.prototype.canDirectLoad=function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+t._MagicBase64Encoded)||e.startsWith("data:;base64,"+t._MagicBase64Encoded)||e.startsWith("data:application/octet-stream;base64,"+t._MagicBase64Encoded)||e.startsWith("data:model/gltf-binary;base64,"+t._MagicBase64Encoded)},t.prototype.directLoad=function(e,r){if(r.startsWith("base64,"+t._MagicBase64Encoded)||r.startsWith(";base64,"+t._MagicBase64Encoded)||r.startsWith("application/octet-stream;base64,"+t._MagicBase64Encoded)||r.startsWith("model/gltf-binary;base64,"+t._MagicBase64Encoded)){var n=(0,d.DecodeBase64UrlToBinary)(r);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new d.DataReader({readAsync:function(e,t){return _(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,r),Promise.resolve({json:this._parseJson(r)})},t.prototype.createPlugin=function(e){return new t(e[y])},Object.defineProperty(t.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,r){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){r(e)}))}))},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(v[this._state]))},t.prototype._loadFile=function(e,t,r,n,o,a){var i=this,s=e._loadFile(t,r,(function(e){i._onProgress(e,s)}),!0,n,o,a);return s.onCompleteObservable.add((function(){s._lengthComputable=!0,s._total=s._loaded})),this._requests.push(s),s},t.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var r=!0,n=0,o=0,a=0,i=this._requests;a<i.length;a++){var s=i[a];if(void 0===s._lengthComputable||void 0===s._loaded||void 0===s._total)return;r=r&&s._lengthComputable,n+=s._loaded,o+=s._total}this._progressCallback({lengthComputable:r,loaded:n,total:r?o:0})}},t.prototype._validate=function(e,t,r,n){var o=this;void 0===r&&(r=""),void 0===n&&(n=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),b.ValidateAsync(t,r,n,(function(t){return o.preprocessUrlAsync(r+t).then((function(t){return e._loadFileAsync(t,void 0,!0,!0).then((function(e){return new Uint8Array(e,0,e.byteLength)}))}))})).then((function(e){o._endPerformanceCounter("Validate JSON"),o.onValidatedObservable.notifyObservers(e),o.onValidatedObservable.clear()}),(function(e){o._endPerformanceCounter("Validate JSON"),d.Tools.Warn("Failed to validate: ".concat(e.message)),o.onValidatedObservable.clear()})))},t.prototype._getLoader=function(e){var r=e.json.asset||{};this._log("Asset version: ".concat(r.version)),r.minVersion&&this._log("Asset minimum version: ".concat(r.minVersion)),r.generator&&this._log("Asset generator: ".concat(r.generator));var n=t._parseVersion(r.version);if(!n)throw new Error("Invalid version: "+r.version);if(void 0!==r.minVersion){var o=t._parseVersion(r.minVersion);if(!o)throw new Error("Invalid minimum version: "+r.minVersion);if(t._compareVersion(o,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+r.minVersion)}var a={1:t._CreateGLTF1Loader,2:t._CreateGLTF2Loader}[n.major];if(!a)throw new Error("Unsupported version: "+r.version);return a(this)},t.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: ".concat(e.length));var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},t.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var r=e.readUint32();if(1179937895!==r)throw new d.RuntimeError("Unexpected magic: "+r,d.ErrorCodes.GLTFLoaderUnexpectedMagicError);var n=e.readUint32();t.loggingEnabled&&t._log("Binary version: ".concat(n));var o,a=e.readUint32();switch(t.useRangeRequests||a===e.buffer.byteLength||d.Logger.Warn("Length in header does not match actual data length: ".concat(a," != ").concat(e.buffer.byteLength)),n){case 1:o=t._unpackBinaryV1Async(e,a);break;case 2:o=t._unpackBinaryV2Async(e,a);break;default:throw new Error("Unsupported version: "+n)}return t._endPerformanceCounter("Unpack Binary"),o}))},t.prototype._unpackBinaryV1Async=function(e,t){var r=e.readUint32(),n=e.readUint32();if(0!==n)throw new Error("Unexpected content format: ".concat(n));var o=t-e.byteOffset,a={json:this._parseJson(e.readString(r)),bin:null};if(0!==o){var i=e.byteOffset;a.bin={readAsync:function(t,r){return e.buffer.readAsync(i+t,r)},byteLength:o}}return Promise.resolve(a)},t.prototype._unpackBinaryV2Async=function(e,t){var r=this,n=1313821514,o=e.readUint32();if(e.readUint32()!==n)throw new Error("First chunk format is not JSON");return e.byteOffset+o===t?e.loadAsync(o).then((function(){return{json:r._parseJson(e.readString(o)),bin:null}})):e.loadAsync(o+8).then((function(){var a={json:r._parseJson(e.readString(o)),bin:null},i=function(){var r=e.readUint32();switch(e.readUint32()){case n:throw new Error("Unexpected JSON chunk");case 5130562:var o=e.byteOffset;a.bin={readAsync:function(t,r){return e.buffer.readAsync(o+t,r)},byteLength:r},e.skipBytes(r);break;default:e.skipBytes(r)}return e.byteOffset!==t?e.loadAsync(8).then(i):Promise.resolve(a)};return i()}))},t._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},t._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},t.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},t.prototype._logClose=function(){--this._logIndentLevel},t.prototype._logEnabled=function(e){var r=t._logSpaces.substr(0,2*this._logIndentLevel);d.Logger.Log("".concat(r).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){d.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){d.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._MagicBase64Encoded="Z2xURg",t._logSpaces=" ",t}(function(){function e(){this.coordinateSystemMode=h.AUTO,this.animationStartMode=m.FIRST,this.loadNodeAnimations=!0,this.loadSkins=!0,this.loadMorphTargets=!0,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this.useRangeRequests=!1,this.createInstances=!0,this.alwaysComputeBoundingBox=!1,this.loadAllMaterials=!1,this.loadOnlyMaterials=!1,this.skipMaterials=!1,this.useSRGBBuffers=!0,this.targetFps=60,this.alwaysComputeSkeletonRootNode=!1,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.extensionOptions={}}return e.prototype.copyFrom=function(e){var t=this;if(e){var r=function(r){var n,o=r;t[o]=null!==(n=e[o])&&void 0!==n?n:t[o]};for(var n in this)r(n);for(var o=0,a=["onParsed","onMeshLoaded","onSkinLoaded","onTextureLoaded","onMaterialLoaded","onCameraLoaded"];o<a.length;o++)r(n=a[o])}},e}());(0,d.registerSceneLoaderPlugin)(new A);var g,O,E,L,T,N,C,S,M=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==M){for(var x in M.BABYLON=M.BABYLON||{},i)M.BABYLON[x]=i[x];for(var x in a)M.BABYLON[x]=a[x]}!function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.FLOAT=5126]="FLOAT"}(g||(g={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(O||(O={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"}(E||(E={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(L||(L={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9728]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(T||(T={})),function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA"}(N||(N={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(C||(C={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"}(S||(S={}));var R,P=function(){function e(){}return e.SetMatrix=function(e,t,r,n,o){var a=null;if("MODEL"===r.semantic?a=t.getWorldMatrix():"PROJECTION"===r.semantic?a=e.getProjectionMatrix():"VIEW"===r.semantic?a=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===r.semantic?a=d.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===r.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===r.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===r.semantic?a=t.getWorldMatrix().invert():"VIEWINVERSE"===r.semantic?a=e.getViewMatrix().invert():"PROJECTIONINVERSE"===r.semantic?a=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===r.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===r.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===r.semantic&&(a=d.Matrix.Transpose(t.getWorldMatrix().invert())),a)switch(r.type){case E.FLOAT_MAT2:o.setMatrix2x2(n,d.Matrix.GetAsMatrix2x2(a));break;case E.FLOAT_MAT3:o.setMatrix3x3(n,d.Matrix.GetAsMatrix3x3(a));break;case E.FLOAT_MAT4:o.setMatrix(n,a)}},e.SetUniform=function(e,t,r,n){switch(n){case E.FLOAT:return e.setFloat(t,r),!0;case E.FLOAT_VEC2:return e.setVector2(t,d.Vector2.FromArray(r)),!0;case E.FLOAT_VEC3:return e.setVector3(t,d.Vector3.FromArray(r)),!0;case E.FLOAT_VEC4:return e.setVector4(t,d.Vector4.FromArray(r)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case L.CLAMP_TO_EDGE:return d.Texture.CLAMP_ADDRESSMODE;case L.MIRRORED_REPEAT:return d.Texture.MIRROR_ADDRESSMODE;case L.REPEAT:default:return d.Texture.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case T.LINEAR:case T.LINEAR_MIPMAP_NEAREST:case T.LINEAR_MIPMAP_LINEAR:return d.Texture.TRILINEAR_SAMPLINGMODE;case T.NEAREST:case T.NEAREST_MIPMAP_NEAREST:return d.Texture.NEAREST_SAMPLINGMODE;default:return d.Texture.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,r,n,o){r=t.byteOffset+r;var a=e.loadedBufferViews[t.buffer];if(r+n>a.byteLength)throw new Error("Buffer access is out of range");var i=a.buffer;switch(r+=a.byteOffset,o){case g.BYTE:return new Int8Array(i,r,n);case g.UNSIGNED_BYTE:return new Uint8Array(i,r,n);case g.SHORT:return new Int16Array(i,r,n);case g.UNSIGNED_SHORT:return new Uint16Array(i,r,n);default:return new Float32Array(i,r,n)}},e.GetBufferFromAccessor=function(t,r){var n=t.bufferViews[r.bufferView],o=r.count*e.GetByteStrideFromType(r);return e.GetBufferFromBufferView(t,n,r.byteOffset,o,r.componentType)},e.DecodeBufferToText=function(e){for(var t="",r=e.byteLength,n=0;n<r;++n)t+=String.fromCharCode(e[n]);return t},e.GetDefaultMaterial=function(t){if(!e._DefaultMaterial){d.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{"," gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),d.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var r={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new d.ShaderMaterial("GLTFDefaultMaterial",t,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},r),e._DefaultMaterial.setColor4("u_emission",new d.Color4(.5,.5,.5,1))}return e._DefaultMaterial},e._DefaultMaterial=null,e}();!function(e){e[e.IDENTIFIER=1]="IDENTIFIER",e[e.UNKNOWN=2]="UNKNOWN",e[e.END_OF_INPUT=3]="END_OF_INPUT"}(R||(R={}));var w=function(){function e(e){this._pos=0,this.currentToken=R.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}return e.prototype.getNextToken=function(){if(this.isEnd())return R.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=R.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=R.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},e.prototype.peek=function(){return this._toParse[this._pos]},e.prototype.read=function(){return this._toParse[this._pos++]},e.prototype.forward=function(){this._pos++},e.prototype.isEnd=function(){return this._pos>=this._maxPos},e}(),I=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],B=["world","view","projection","worldView","worldViewProjection","mBones"],F=["translation","rotation","scale"],V=["position","rotationQuaternion","scaling"],D=function(e,t,r){for(var n in e){var o=e[n];r[t][n]=o}},k=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},U=function(e){if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){var t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},j=function(e){var t=null;if(e.translation||e.rotation||e.scale){var r=d.Vector3.FromArray(e.scale||[1,1,1]),n=d.Quaternion.FromArray(e.rotation||[0,0,0,1]),o=d.Vector3.FromArray(e.translation||[0,0,0]);t=d.Matrix.Compose(r,n,o)}else t=d.Matrix.FromArray(e.matrix);return t},G=function(e,t,r,n){for(var o=0;o<n.bones.length;o++)if(n.bones[o].name===r)return n.bones[o];var a=e.nodes;for(var i in a){var s=a[i];if(s.jointName){var l=s.children;for(o=0;o<l.length;o++){var u=e.nodes[l[o]];if(u.jointName&&u.jointName===r){var c=j(s),f=new d.Bone(s.name||"",n,G(e,t,s.jointName,n),c);return f.id=i,f}}}}return null},H=function(e,t){for(var r=0;r<e.length;r++)for(var n=e[r],o=0;o<n.node.children.length;o++)if(n.node.children[o]===t)return n.bone;return null},W=function(e,t){var r=e.nodes,n=r[t];if(n)return{node:n,id:t};for(var o in r)if((n=r[o]).jointName===t)return{node:n,id:o};return null},Y=function(e,t){for(var r=0;r<e.jointNames.length;r++)if(e.jointNames[r]===t)return!0;return!1},J=function(e,t,r,n,o){if(o||(e.scene._blockEntityCollection=!!e.assetContainer,(o=new d.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,o.id=n),!t.babylonNode)return o;for(var a,i=[],s=null,l=[],u=[],c=[],f=[],p=0;p<r.length;p++){var h=r[p];if(x=e.meshes[h])for(var m=0;m<x.primitives.length;m++){var v=new d.VertexData,b=x.primitives[m];b.mode;var y=b.attributes,_=null,g=null;for(var O in y)if(_=e.accessors[y[O]],g=P.GetBufferFromAccessor(e,_),"NORMAL"===O)v.normals=new Float32Array(g.length),v.normals.set(g);else if("POSITION"===O){if(A.HomogeneousCoordinates){v.positions=new Float32Array(g.length-g.length/4);for(var E=0;E<g.length;E+=4)v.positions[E]=g[E],v.positions[E+1]=g[E+1],v.positions[E+2]=g[E+2]}else v.positions=new Float32Array(g.length),v.positions.set(g);u.push(v.positions.length)}else if(-1!==O.indexOf("TEXCOORD_")){var L=Number(O.split("_")[1]),T=d.VertexBuffer.UVKind+(0===L?"":L+1),N=new Float32Array(g.length);N.set(g),k(N),v.set(N,T)}else"JOINT"===O?(v.matricesIndices=new Float32Array(g.length),v.matricesIndices.set(g)):"WEIGHT"===O?(v.matricesWeights=new Float32Array(g.length),v.matricesWeights.set(g)):"COLOR"===O&&(v.colors=new Float32Array(g.length),v.colors.set(g));if(_=e.accessors[b.indices])g=P.GetBufferFromAccessor(e,_),v.indices=new Int32Array(g.length),v.indices.set(g),f.push(v.indices.length);else{var C=[];for(E=0;E<v.positions.length/3;E++)C.push(E);v.indices=new Int32Array(C),f.push(v.indices.length)}s?s.merge(v):s=v;var S=e.scene.getMaterialById(b.material);i.push(null===S?P.GetDefaultMaterial(e.scene):S),l.push(0===l.length?0:l[l.length-1]+u[u.length-2]),c.push(0===c.length?0:c[c.length-1]+f[f.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,i.length>1?(a=new d.MultiMaterial("multimat"+n,e.scene)).subMaterials=i:a=new d.StandardMaterial("multimat"+n,e.scene),1===i.length&&(a=i[0]),a._parentContainer=e.assetContainer,o.material||(o.material=a),new d.Geometry(n,e.scene,s,!1,o),o.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,o.subMeshes=[];var M=0;for(p=0;p<r.length;p++){var x;if(h=r[p],x=e.meshes[h])for(m=0;m<x.primitives.length;m++)x.primitives[m].mode,d.SubMesh.AddToMesh(M,l[M],u[M],c[M],f[M],o,o,!0),M++}return o},q=function(e,t,r,n){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=r),e.scaling&&(e.scaling=n)},Z=function(e,t,r){var n=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(a=J(e,t,t.meshes,r,t.babylonNode)).skeleton=e.scene.getLastSkeletonById(t.skin),null===a.skeleton&&(a.skeleton=function(e,t,r,n){if(n||(n=new d.Skeleton(t.name||"","",e.scene)),!t.babylonSkeleton)return n;var o=[],a=[];!function(e,t,r,n){for(var o in e.nodes){var a=e.nodes[o],i=o;if(a.jointName&&!Y(r,a.jointName)){var s=j(a),l=new d.Bone(a.name||"",t,null,s);l.id=i,n.push({bone:l,node:a,id:i})}}for(var u=0;u<n.length;u++)for(var c=n[u],f=c.node.children,p=0;p<f.length;p++){for(var h=null,m=0;m<n.length;m++)if(n[m].id===f[p]){h=n[m];break}h&&(h.bone._parent=c.bone,c.bone.children.push(h.bone))}}(e,n,t,o),n.bones=[];for(var i=0;i<t.jointNames.length;i++)if(A=W(e,t.jointNames[i])){var s=A.node;if(s){var l=A.id,u=e.scene.getBoneById(l);if(u)n.bones.push(u);else{for(var c=!1,f=null,p=0;p<i;p++){var h=W(e,t.jointNames[p]);if(h){var m=h.node;if(m){var v=m.children;if(v){c=!1;for(var b=0;b<v.length;b++)if(v[b]===l){f=G(e,t,t.jointNames[p],n),c=!0;break}if(c)break}}else d.Tools.Warn("Joint named "+t.jointNames[p]+" does not exist when looking for parent")}}var y=j(s);!f&&o.length>0&&(f=H(o,l))&&-1===a.indexOf(f)&&a.push(f),new d.Bone(s.jointName||"",n,f,y).id=l}}else d.Tools.Warn("Joint named "+t.jointNames[i]+" does not exist")}var _=n.bones;for(n.bones=[],i=0;i<t.jointNames.length;i++){var A;if(A=W(e,t.jointNames[i]))for(p=0;p<_.length;p++)if(_[p].id===A.id){n.bones.push(_[p]);break}}for(n.prepare(),i=0;i<a.length;i++)n.bones.push(a[i]);return n}(e,o,0,o.babylonSkeleton),o.babylonSkeleton||(o.babylonSkeleton=a.skeleton)),n=a}}else if(t.meshes){var a;n=a=J(e,t,t.mesh?[t.mesh]:t.meshes,r,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var i=e.cameras[t.camera];if(i){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===i.type){var s=new d.FreeCamera(t.camera,d.Vector3.Zero(),e.scene,!1);s.name=t.name||"",s.mode=d.Camera.ORTHOGRAPHIC_CAMERA,s.attachControl(),n=s,s._parentContainer=e.assetContainer}else if("perspective"===i.type){var l=i[i.type],u=new d.FreeCamera(t.camera,d.Vector3.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),l.aspectRatio||(l.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),l.znear&&l.zfar&&(u.maxZ=l.zfar,u.minZ=l.znear),n=u,u._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var c=e.lights[t.light];if(c)if("ambient"===c.type){var f=c[c.type],p=new d.HemisphericLight(t.light,d.Vector3.Zero(),e.scene);p.name=t.name||"",f.color&&(p.diffuse=d.Color3.FromArray(f.color)),n=p}else if("directional"===c.type){var h=c[c.type],m=new d.DirectionalLight(t.light,d.Vector3.Zero(),e.scene);m.name=t.name||"",h.color&&(m.diffuse=d.Color3.FromArray(h.color)),n=m}else if("point"===c.type){var v=c[c.type],b=new d.PointLight(t.light,d.Vector3.Zero(),e.scene);b.name=t.name||"",v.color&&(b.diffuse=d.Color3.FromArray(v.color)),n=b}else if("spot"===c.type){var y=c[c.type],_=new d.SpotLight(t.light,d.Vector3.Zero(),d.Vector3.Zero(),0,0,e.scene);_.name=t.name||"",y.color&&(_.diffuse=d.Color3.FromArray(y.color)),y.fallOfAngle&&(_.angle=y.fallOfAngle),y.fallOffExponent&&(_.exponent=y.fallOffExponent),n=_}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===n){e.scene._blockEntityCollection=!!e.assetContainer;var A=new d.Mesh(t.name||"",e.scene);A._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,t.babylonNode=A,n=A}}if(null!==n){if(t.matrix&&n instanceof d.Mesh)!function(e,t){if(t.matrix){var r=new d.Vector3(0,0,0),n=new d.Quaternion,o=new d.Vector3(0,0,0);d.Matrix.FromArray(t.matrix).decompose(o,n,r),q(e,r,n,o)}else t.translation&&t.rotation&&t.scale&&q(e,d.Vector3.FromArray(t.translation),d.Quaternion.FromArray(t.rotation),d.Vector3.FromArray(t.scale));e.computeWorldMatrix(!0)}(n,t);else{var g=t.translation||[0,0,0],O=t.rotation||[0,0,0,1],E=t.scale||[1,1,1];q(n,d.Vector3.FromArray(g),d.Quaternion.FromArray(O),d.Vector3.FromArray(E))}n.updateCache(!0),t.babylonNode=n}return n},K=function(e,t,r,n){void 0===n&&(n=!1);var o=e.nodes[t],a=null;if(n=!(e.importOnlyMeshes&&!n&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&n&&null!==(a=Z(e,o,t))&&(a.id=t,a.parent=r),o.children)for(var i=0;i<o.children.length;i++)K(e,o.children[i],a,n)},Q=function(e){var t=e.currentScene;if(t)for(var r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null);else for(var n in e.scenes)for(t=e.scenes[n],r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null);for(function(e){for(var t in e.animations){var r=e.animations[t];if(r.channels&&r.samplers)for(var n=null,o=0;o<r.channels.length;o++){var a=r.channels[o],i=r.samplers[a.sampler];if(i){var s=null,l=null;r.parameters?(s=r.parameters[i.input],l=r.parameters[i.output]):(s=i.input,l=i.output);var u=P.GetBufferFromAccessor(e,e.accessors[s]),c=P.GetBufferFromAccessor(e,e.accessors[l]),f=a.target.id,p=e.scene.getNodeById(f);if(null===p&&(p=e.scene.getNodeByName(f)),null!==p){var h=p instanceof d.Bone,m=a.target.path,v=F.indexOf(m);-1!==v&&(m=V[v]);var b=d.Animation.ANIMATIONTYPE_MATRIX;h||("rotationQuaternion"===m?(b=d.Animation.ANIMATIONTYPE_QUATERNION,p.rotationQuaternion=new d.Quaternion):b=d.Animation.ANIMATIONTYPE_VECTOR3);var y=null,_=[],A=0,g=!1;h&&n&&n.getKeys().length===u.length&&(y=n,g=!0),g||(e.scene._blockEntityCollection=!!e.assetContainer,y=new d.Animation(t,h?"_matrix":m,1,b,d.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var O=0;O<u.length;O++){var E=null;if("rotationQuaternion"===m?(E=d.Quaternion.FromArray([c[A],c[A+1],c[A+2],c[A+3]]),A+=4):(E=d.Vector3.FromArray([c[A],c[A+1],c[A+2]]),A+=3),h){var L=p,T=d.Vector3.Zero(),N=new d.Quaternion,C=d.Vector3.Zero(),S=L.getBaseMatrix();g&&n&&(S=n.getKeys()[O].value),S.decompose(C,N,T),"position"===m?T=E:"rotationQuaternion"===m?N=E:C=E,E=d.Matrix.Compose(C,N,T)}g?n&&(n.getKeys()[O].value=E):_.push({frame:u[O],value:E})}!g&&y&&(y.setKeys(_),p.animations.push(y)),n=y,e.scene.stopAnimation(p),e.scene.beginAnimation(p,0,u[u.length-1],!0,1)}else d.Tools.Warn("Creating animation named "+t+". But cannot find node named "+f+" to attach to")}}}}(e),r=0;r<e.scene.skeletons.length;r++){var o=e.scene.skeletons[r];e.scene.beginAnimation(o,0,Number.MAX_VALUE,!0,1)}},X=function(e,t,r){for(var n in t.uniforms){var o=t.uniforms[n],a=t.parameters[o];if(e.currentIdentifier===n&&a.semantic&&!a.source&&!a.node){var i=I.indexOf(a.semantic);if(-1!==i)return delete r[n],B[i]}}return e.currentIdentifier},z=function(e){for(var t in e.materials)te.LoadMaterialAsync(e,t,(function(){}),(function(){}))},$=function(){function e(){}return e.CreateRuntime=function(e,t,r){var n={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:r,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&D(e.extensions,"extensions",n),e.extensionsUsed&&D(e.extensionsUsed,"extensionsUsed",n),e.buffers&&function(e,t){for(var r in e){var n=e[r];t.buffers[r]=n,t.buffersCount++}}(e.buffers,n),e.bufferViews&&D(e.bufferViews,"bufferViews",n),e.accessors&&D(e.accessors,"accessors",n),e.meshes&&D(e.meshes,"meshes",n),e.lights&&D(e.lights,"lights",n),e.cameras&&D(e.cameras,"cameras",n),e.nodes&&D(e.nodes,"nodes",n),e.images&&D(e.images,"images",n),e.textures&&D(e.textures,"textures",n),e.shaders&&function(e,t){for(var r in e){var n=e[r];t.shaders[r]=n,t.shaderscount++}}(e.shaders,n),e.programs&&D(e.programs,"programs",n),e.samplers&&D(e.samplers,"samplers",n),e.techniques&&D(e.techniques,"techniques",n),e.materials&&D(e.materials,"materials",n),e.animations&&D(e.animations,"animations",n),e.skins&&D(e.skins,"skins",n),e.scenes&&(n.scenes=e.scenes),e.scene&&e.scenes&&(n.currentScene=e.scenes[e.scene]),n},e.LoadBufferAsync=function(e,t,r,n,o){var a=e.buffers[t];d.Tools.IsBase64(a.uri)?setTimeout((function(){return r(new Uint8Array(d.Tools.DecodeBase64(a.uri)))})):d.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return r(new Uint8Array(e))}),o,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))},e.LoadTextureBufferAsync=function(e,t,r,n){var o=e.textures[t];if(o&&o.source)if(o.babylonTexture)r(null);else{var a=e.images[o.source];d.Tools.IsBase64(a.uri)?setTimeout((function(){return r(new Uint8Array(d.Tools.DecodeBase64(a.uri)))})):d.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return r(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))}else n("")},e.CreateTextureAsync=function(e,t,r,n){var o=e.textures[t];if(o.babylonTexture)n(o.babylonTexture);else{var a=e.samplers[o.sampler],i=a.minFilter===T.NEAREST_MIPMAP_NEAREST||a.minFilter===T.NEAREST_MIPMAP_LINEAR||a.minFilter===T.LINEAR_MIPMAP_NEAREST||a.minFilter===T.LINEAR_MIPMAP_LINEAR,s=d.Texture.BILINEAR_SAMPLINGMODE,l=null==r?new Blob:new Blob([r]),u=URL.createObjectURL(l),c=function(){return URL.revokeObjectURL(u)},f=new d.Texture(u,e.scene,!i,!0,s,c,c);void 0!==a.wrapS&&(f.wrapU=P.GetWrapMode(a.wrapS)),void 0!==a.wrapT&&(f.wrapV=P.GetWrapMode(a.wrapT)),f.name=t,o.babylonTexture=f,n(f)}},e.LoadShaderStringAsync=function(e,t,r,n){var o=e.shaders[t];if(d.Tools.IsBase64(o.uri)){var a=atob(o.uri.split(",")[1]);r&&r(a)}else d.Tools.LoadFile(e.rootUrl+o.uri,r,void 0,void 0,!1,(function(e){e&&n&&n(e.status+" "+e.statusText)}))},e.LoadMaterialAsync=function(e,t,r,n){var o=e.materials[t];if(o.technique){var a=e.techniques[o.technique];if(!a){e.scene._blockEntityCollection=!!e.assetContainer;var i=new d.StandardMaterial(t,e.scene);return i._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,i.diffuseColor=new d.Color3(.5,.5,.5),i.sideOrientation=d.Material.CounterClockWiseSideOrientation,void r(i)}var s=e.programs[a.program],l=a.states,u=d.Effect.ShadersStore[s.vertexShader+"VertexShader"],c=d.Effect.ShadersStore[s.fragmentShader+"PixelShader"],f="",p="",h=new w(u),m=new w(c),v={},b=[],y=[],_=[];for(var A in a.uniforms){var g=a.uniforms[A],O=a.parameters[g];if(v[A]=O,!O.semantic||O.node||O.source)O.type===E.SAMPLER_2D?_.push(A):b.push(A);else{var L=I.indexOf(O.semantic);-1!==L?(b.push(B[L]),delete v[A]):b.push(A)}}for(var T in a.attributes){var N=a.attributes[T];if((F=a.parameters[N]).semantic){var M=U(F);M&&y.push(M)}}for(;!h.isEnd()&&h.getNextToken();)if(h.currentToken===R.IDENTIFIER){var x=!1;for(var T in a.attributes){N=a.attributes[T];var F=a.parameters[N];if(h.currentIdentifier===T&&F.semantic){f+=U(F),x=!0;break}}x||(f+=X(h,a,v))}else f+=h.currentString;for(;!m.isEnd()&&m.getNextToken();)m.currentToken===R.IDENTIFIER?p+=X(m,a,v):p+=m.currentString;var V={vertex:s.vertexShader+t,fragment:s.fragmentShader+t},D={attributes:y,uniforms:b,samplers:_,needAlphaBlending:l&&l.enable&&-1!==l.enable.indexOf(3042)};d.Effect.ShadersStore[s.vertexShader+t+"VertexShader"]=f,d.Effect.ShadersStore[s.fragmentShader+t+"PixelShader"]=p;var k=new d.ShaderMaterial(t,e.scene,V,D);if(k.onError=function(e,t,r){return function(n,o){t.dispose(!0),r("Cannot compile program named "+e.name+". Error: "+o+". Default material will be applied")}}(s,k,n),k.onCompiled=function(e,t,r,n,o,a){return function(i){!function(e,t,r,n,o){var a=n.values||r.parameters,i=r.uniforms,s=function(r){var s=o[r],l=s.type,u=a[i[r]];if(void 0===u&&(u=s.value),!u)return"continue";var c=function(e){return function(r){s.value&&e&&(t.setTexture(e,r),delete o[e])}};l===E.SAMPLER_2D?te.LoadTextureAsync(e,n.values?u:s.value,c(r),(function(){return c(null)})):s.value&&P.SetUniform(t,r,n.values?u:s.value,l)&&delete o[r]};for(var l in o)s(l)}(e,t,r,n,o),t.onBind=function(i){!function(e,t,r,n,o,a,i){var s=a.values||o.parameters;for(var l in r){var u=r[l],c=u.type;if(c===E.FLOAT_MAT2||c===E.FLOAT_MAT3||c===E.FLOAT_MAT4)if(!u.semantic||u.source||u.node){if(u.semantic&&(u.source||u.node)){var d=t.scene.getNodeByName(u.source||u.node||"");if(null===d&&(d=t.scene.getNodeById(u.source||u.node||"")),null===d)continue;P.SetMatrix(t.scene,d,u,l,n.getEffect())}}else P.SetMatrix(t.scene,e,u,l,n.getEffect());else{var f=s[o.uniforms[l]];if(!f)continue;if(c===E.SAMPLER_2D){var p=t.textures[a.values?f:u.value].babylonTexture;if(null==p)continue;n.getEffect().setTexture(l,p)}else P.SetUniform(n.getEffect(),l,f,c)}}i(n)}(i,e,o,t,r,n,a)}}}(e,k,a,o,v,r),k.sideOrientation=d.Material.CounterClockWiseSideOrientation,l&&l.functions){var j=l.functions;j.cullFace&&j.cullFace[0]!==C.BACK&&(k.backFaceCulling=!1);var G=j.blendFuncSeparate;G&&(G[0]===S.SRC_ALPHA&&G[1]===S.ONE_MINUS_SRC_ALPHA&&G[2]===S.ONE&&G[3]===S.ONE?k.alphaMode=d.Constants.ALPHA_COMBINE:G[0]===S.ONE&&G[1]===S.ONE&&G[2]===S.ZERO&&G[3]===S.ONE?k.alphaMode=d.Constants.ALPHA_ONEONE:G[0]===S.SRC_ALPHA&&G[1]===S.ONE&&G[2]===S.ZERO&&G[3]===S.ONE?k.alphaMode=d.Constants.ALPHA_ADD:G[0]===S.ZERO&&G[1]===S.ONE_MINUS_SRC_COLOR&&G[2]===S.ONE&&G[3]===S.ONE?k.alphaMode=d.Constants.ALPHA_SUBTRACT:G[0]===S.DST_COLOR&&G[1]===S.ZERO&&G[2]===S.ONE&&G[3]===S.ONE?k.alphaMode=d.Constants.ALPHA_MULTIPLY:G[0]===S.SRC_ALPHA&&G[1]===S.ONE_MINUS_SRC_COLOR&&G[2]===S.ONE&&G[3]===S.ONE&&(k.alphaMode=d.Constants.ALPHA_MAXIMIZED))}}else n&&n("No technique found.")},e}(),ee=function(){function e(){}return e.RegisterExtension=function(t){e.Extensions[t.name]?d.Tools.Error('Tool with the same name "'+t.name+'" already exists'):e.Extensions[t.name]=t},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,t,r,n,o,a,i,s){var l=this;return t.useRightHandedSystem=!0,te.LoadRuntimeAsync(t,r,n,(function(t){t.assetContainer=o,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],d.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],l._createNodes(t);var r=[],n=[];for(var i in t.nodes){var s=t.nodes[i];s.babylonNode instanceof d.AbstractMesh&&r.push(s.babylonNode)}for(var u in t.skins){var c=t.skins[u];c.babylonSkeleton instanceof d.Skeleton&&n.push(c.babylonSkeleton)}l._loadBuffersAsync(t,(function(){l._loadShadersAsync(t,(function(){z(t),Q(t),!A.IncrementalLoading&&a&&a(r,n)}))})),A.IncrementalLoading&&a&&a(r,n)}),s),!0},e.prototype.importMeshAsync=function(e,t,r,n,o,a){var i=this;return new Promise((function(s,l){i._importMeshAsync(e,t,n,o,r,(function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[],spriteManagers:[]})}),a,(function(e){l(new Error(e))}))}))},e.prototype._loadAsync=function(e,t,r,n,o,a){var i=this;e.useRightHandedSystem=!0,te.LoadRuntimeAsync(e,t,r,(function(e){te.LoadRuntimeExtensionsAsync(e,(function(){i._createNodes(e),i._loadBuffersAsync(e,(function(){i._loadShadersAsync(e,(function(){z(e),Q(e),A.IncrementalLoading||n()}))})),A.IncrementalLoading&&n()}),a)}),a)},e.prototype.loadAsync=function(e,t,r,n){var o=this;return new Promise((function(a,i){o._loadAsync(e,t,r,(function(){a()}),n,(function(e){i(new Error(e))}))}))},e.prototype._loadShadersAsync=function(e,t){var r=!1,n=function(r,n){te.LoadShaderStringAsync(e,r,(function(o){o instanceof ArrayBuffer||(e.loadedShaderCount++,o&&(d.Effect.ShadersStore[r+(n.type===O.VERTEX?"VertexShader":"PixelShader")]=o),e.loadedShaderCount===e.shaderscount&&t())}),(function(){d.Tools.Error("Error when loading shader program named "+r+" located at "+n.uri)}))};for(var o in e.shaders){r=!0;var a=e.shaders[o];a?n.bind(this,o,a)():d.Tools.Error("No shader named: "+o)}r||t()},e.prototype._loadBuffersAsync=function(e,t){var r=!1,n=function(r,n){te.LoadBufferAsync(e,r,(function(o){e.loadedBufferCount++,o&&(o.byteLength!=e.buffers[r].byteLength&&d.Tools.Error("Buffer named "+r+" is length "+o.byteLength+". Expected: "+n.byteLength),e.loadedBufferViews[r]=o),e.loadedBufferCount===e.buffersCount&&t()}),(function(){d.Tools.Error("Error when loading buffer named "+r+" located at "+n.uri)}))};for(var o in e.buffers){r=!0;var a=e.buffers[o];a?n.bind(this,o,a)():d.Tools.Error("No buffer named: "+o)}r||t()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null);else for(var n in e.scenes)for(t=e.scenes[n],r=0;r<t.nodes.length;r++)K(e,t.nodes[r],null)},e.Extensions={},e}(),te=function(){function e(e){this._name=e}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),e.prototype.loadRuntimeAsync=function(e,t,r,n,o){return!1},e.prototype.loadRuntimeExtensionsAsync=function(e,t,r){return!1},e.prototype.loadBufferAsync=function(e,t,r,n,o){return!1},e.prototype.loadTextureBufferAsync=function(e,t,r,n){return!1},e.prototype.createTextureAsync=function(e,t,r,n,o){return!1},e.prototype.loadShaderStringAsync=function(e,t,r,n){return!1},e.prototype.loadMaterialAsync=function(e,t,r,n){return!1},e.LoadRuntimeAsync=function(t,r,n,o,a){e._ApplyExtensions((function(e){return e.loadRuntimeAsync(t,r,n,o,a)}),(function(){setTimeout((function(){o&&o($.CreateRuntime(r.json,t,n))}))}))},e.LoadRuntimeExtensionsAsync=function(t,r,n){e._ApplyExtensions((function(e){return e.loadRuntimeExtensionsAsync(t,r,n)}),(function(){setTimeout((function(){r()}))}))},e.LoadBufferAsync=function(t,r,n,o,a){e._ApplyExtensions((function(e){return e.loadBufferAsync(t,r,n,o,a)}),(function(){$.LoadBufferAsync(t,r,n,o,a)}))},e.LoadTextureAsync=function(t,r,n,o){e._LoadTextureBufferAsync(t,r,(function(a){a&&e._CreateTextureAsync(t,r,a,n,o)}),o)},e.LoadShaderStringAsync=function(t,r,n,o){e._ApplyExtensions((function(e){return e.loadShaderStringAsync(t,r,n,o)}),(function(){$.LoadShaderStringAsync(t,r,n,o)}))},e.LoadMaterialAsync=function(t,r,n,o){e._ApplyExtensions((function(e){return e.loadMaterialAsync(t,r,n,o)}),(function(){$.LoadMaterialAsync(t,r,n,o)}))},e._LoadTextureBufferAsync=function(t,r,n,o){e._ApplyExtensions((function(e){return e.loadTextureBufferAsync(t,r,n,o)}),(function(){$.LoadTextureBufferAsync(t,r,n,o)}))},e._CreateTextureAsync=function(t,r,n,o,a){e._ApplyExtensions((function(e){return e.createTextureAsync(t,r,n,o,a)}),(function(){$.CreateTextureAsync(t,r,n,o)}))},e._ApplyExtensions=function(e,t){for(var r in ee.Extensions)if(e(ee.Extensions[r]))return;t()},e}();A._CreateGLTF1Loader=function(){return new ee};var re=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return c(t,e),t.prototype.loadRuntimeAsync=function(e,t,r,n){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,n($.CreateRuntime(t.json,e,r)),0))},t.prototype.loadBufferAsync=function(e,t,r,n){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(r,(function(e){return n(e.message)})),!0)},t.prototype.loadTextureBufferAsync=function(e,t,r){var n=e.textures[t],o=e.images[n.source];if(!o.extensions||!(this.name in o.extensions))return!1;var a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return r(P.GetBufferFromBufferView(e,i,0,i.byteLength,g.UNSIGNED_BYTE)),!0},t.prototype.loadShaderStringAsync=function(e,t,r){var n=e.shaders[t];if(!n.extensions||!(this.name in n.extensions))return!1;var o=n.extensions[this.name],a=e.bufferViews[o.bufferView],i=P.GetBufferFromBufferView(e,a,0,a.byteLength,g.UNSIGNED_BYTE);return setTimeout((function(){var e=P.DecodeBufferToText(i);r(e)})),!0},t}(te);ee.RegisterExtension(new re);var ne=function(e){function t(){return e.call(this,"KHR_materials_common")||this}return c(t,e),t.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var t=e.extensions[this.name];if(!t)return!1;var r=t.lights;if(r)for(var n in r){var o=r[n];switch(o.type){case"ambient":var a=new d.HemisphericLight(o.name,new d.Vector3(0,1,0),e.scene),i=o.ambient;i&&(a.diffuse=d.Color3.FromArray(i.color||[1,1,1]));break;case"point":var s=new d.PointLight(o.name,new d.Vector3(10,10,10),e.scene),l=o.point;l&&(s.diffuse=d.Color3.FromArray(l.color||[1,1,1]));break;case"directional":var u=new d.DirectionalLight(o.name,new d.Vector3(0,-1,0),e.scene),c=o.directional;c&&(u.diffuse=d.Color3.FromArray(c.color||[1,1,1]));break;case"spot":var f=o.spot;f&&(new d.SpotLight(o.name,new d.Vector3(0,10,0),new d.Vector3(0,-1,0),f.fallOffAngle||Math.PI,f.fallOffExponent||0,e.scene).diffuse=d.Color3.FromArray(f.color||[1,1,1]));break;default:d.Tools.Warn('GLTF Material Common extension: light type "'+o.type+"” not supported")}}return!1},t.prototype.loadMaterialAsync=function(e,t,r,n){var o=e.materials[t];if(!o||!o.extensions)return!1;var a=o.extensions[this.name];if(!a)return!1;var i=new d.StandardMaterial(t,e.scene);return i.sideOrientation=d.Material.CounterClockWiseSideOrientation,"CONSTANT"===a.technique&&(i.disableLighting=!0),i.backFaceCulling=void 0!==a.doubleSided&&!a.doubleSided,i.alpha=void 0===a.values.transparency?1:a.values.transparency,i.specularPower=void 0===a.values.shininess?0:a.values.shininess,"string"==typeof a.values.ambient?this._loadTexture(e,a.values.ambient,i,"ambientTexture",n):i.ambientColor=d.Color3.FromArray(a.values.ambient||[0,0,0]),"string"==typeof a.values.diffuse?this._loadTexture(e,a.values.diffuse,i,"diffuseTexture",n):i.diffuseColor=d.Color3.FromArray(a.values.diffuse||[0,0,0]),"string"==typeof a.values.emission?this._loadTexture(e,a.values.emission,i,"emissiveTexture",n):i.emissiveColor=d.Color3.FromArray(a.values.emission||[0,0,0]),"string"==typeof a.values.specular?this._loadTexture(e,a.values.specular,i,"specularTexture",n):i.specularColor=d.Color3.FromArray(a.values.specular||[0,0,0]),!0},t.prototype._loadTexture=function(e,t,r,n,o){$.LoadTextureBufferAsync(e,t,(function(o){$.CreateTextureAsync(e,t,o,(function(e){return r[n]=e}))}),o)},t}(te);ee.RegisterExtension(new ne);var oe=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==oe)for(var ae in oe.BABYLON=oe.BABYLON||{},oe.BABYLON.GLTF1=oe.BABYLON.GLTF1||{},s)oe.BABYLON.GLTF1[ae]=s[ae];const ie=l;return o.default})())); | ||
//# sourceMappingURL=babylon.glTF1FileLoader.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-loaders"]=e(require("babylonjs")):t.LOADERS=e(t.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},s={};function i(t){var r=s[t];if(void 0!==r)return r.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};i.d(r,{default:()=>u});var o={};i.r(o),i.d(o,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var a={};i.r(a),i.d(a,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var n=i(597),l=function(){function t(){this.materials=[]}return t.prototype.parseMTL=function(e,s,i,r){if(!(s instanceof ArrayBuffer)){for(var o,a=s.split("\n"),l=/\s+/,h=null,p=0;p<a.length;p++){var _=a[p].trim();if(0!==_.length&&"#"!==_.charAt(0)){var d=_.indexOf(" "),u=d>=0?_.substring(0,d):_;u=u.toLowerCase();var m=d>=0?_.substring(d+1).trim():"";if("newmtl"===u)h&&this.materials.push(h),e._blockEntityCollection=!!r,(h=new n.StandardMaterial(m,e))._parentContainer=r,e._blockEntityCollection=!1;else if("kd"===u&&h)o=m.split(l,3).map(parseFloat),h.diffuseColor=n.Color3.FromArray(o);else if("ka"===u&&h)o=m.split(l,3).map(parseFloat),h.ambientColor=n.Color3.FromArray(o);else if("ks"===u&&h)o=m.split(l,3).map(parseFloat),h.specularColor=n.Color3.FromArray(o);else if("ke"===u&&h)o=m.split(l,3).map(parseFloat),h.emissiveColor=n.Color3.FromArray(o);else if("ns"===u&&h)h.specularPower=parseFloat(m);else if("d"===u&&h)h.alpha=parseFloat(m);else if("map_ka"===u&&h)h.ambientTexture=t._GetTexture(i,m,e);else if("map_kd"===u&&h)h.diffuseTexture=t._GetTexture(i,m,e);else if("map_ks"===u&&h)h.specularTexture=t._GetTexture(i,m,e);else if("map_ns"===u);else if("map_bump"===u&&h){var c=m.split(l),f=c.indexOf("-bm"),g=null;f>=0&&(g=c[f+1],c.splice(f,2)),h.bumpTexture=t._GetTexture(i,c.join(" "),e),h.bumpTexture&&null!==g&&(h.bumpTexture.level=parseFloat(g))}else"map_d"===u&&h&&(h.opacityTexture=t._GetTexture(i,m,e))}}h&&this.materials.push(h)}},t._GetTexture=function(e,s,i){if(!s)return null;var r=e;if("file:"===e){var o=s.lastIndexOf("\\");-1===o&&(o=s.lastIndexOf("/")),r+=o>-1?s.substr(o+1):s}else r+=s;return new n.Texture(r,i,!1,t.INVERT_TEXTURE_Y)},t.INVERT_TEXTURE_Y=!0,t}(),h=function(){function t(t,e,s){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new n.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=t,this._babylonMeshesArray=e,this._loadingOptions=s}return t.prototype._isInArray=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[]});var s=t[e[0]].normals.indexOf(e[1]);return-1===s?-1:t[e[0]].idx[s]},t.prototype._isInArrayUV=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[],uv:[]});var s=t[e[0]].normals.indexOf(e[1]);return 1!=s&&e[2]===t[e[0]].uv[s]?t[e[0]].idx[s]:-1},t.prototype._setData=function(t,e,s,i,r,o,a){var n;-1===(n=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[t,s,e]):this._isInArray(this._tuplePosNorm,[t,s]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(i),this._wrappedUvsForBabylon.push(r),this._wrappedNormalsForBabylon.push(o),void 0!==a&&this._wrappedColorsForBabylon.push(a),this._tuplePosNorm[t].normals.push(s),this._tuplePosNorm[t].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[t].uv.push(e)):this._indicesForBabylon.push(n)},t.prototype._unwrapData=function(){for(var t=0;t<this._wrappedPositionForBabylon.length;t++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[t].x*this._handednessSign,this._wrappedPositionForBabylon[t].y,this._wrappedPositionForBabylon[t].z),this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[t].x*this._handednessSign,this._wrappedNormalsForBabylon[t].y,this._wrappedNormalsForBabylon[t].z),this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[t].x,this._wrappedUvsForBabylon[t].y),this._loadingOptions.importVertexColors&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[t].r,this._wrappedColorsForBabylon[t].g,this._wrappedColorsForBabylon[t].b,this._wrappedColorsForBabylon[t].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0},t.prototype._getTriangles=function(t,e){for(var s=e;s<t.length-1;s++)this._pushTriangle(t,s)},t.prototype._setDataForCurrentFaceWithPattern1=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=parseInt(this._triangles[s])-1;this._setData(i,0,0,this._positions[i],n.Vector2.Zero(),n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[i]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern2=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=parseInt(i[0])-1,o=parseInt(i[1])-1;this._setData(r,o,0,this._positions[r],this._uvs[o],n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern3=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=parseInt(i[0])-1,o=parseInt(i[1])-1,a=parseInt(i[2])-1;this._setData(r,o,a,this._positions[r],this._uvs[o],this._normals[a])}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern4=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("//"),r=parseInt(i[0])-1,o=parseInt(i[1])-1;this._setData(r,1,o,this._positions[r],n.Vector2.Zero(),this._normals[o],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern5=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=this._positions.length+parseInt(i[0]),o=this._uvs.length+parseInt(i[1]),a=this._normals.length+parseInt(i[2]);this._setData(r,o,a,this._positions[r],this._uvs[o],this._normals[a],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice(),this._handledMesh.uvs=this._unwrappedUVForBabylon.slice(),this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},t.prototype._optimizeNormals=function(t){var e=t.getVerticesData(n.VertexBuffer.PositionKind),s=t.getVerticesData(n.VertexBuffer.NormalKind),i={};if(e&&s){for(var r=0;r<e.length/3;r++)(l=i[a=e[3*r+0]+"_"+e[3*r+1]+"_"+e[3*r+2]])||(l=[],i[a]=l),l.push(r);var o=new n.Vector3;for(var a in i){var l;if(!((l=i[a]).length<2)){var h=l[0];for(r=1;r<l.length;++r){var p=l[r];s[3*h+0]+=s[3*p+0],s[3*h+1]+=s[3*p+1],s[3*h+2]+=s[3*p+2]}for(o.copyFromFloats(s[3*h+0],s[3*h+1],s[3*h+2]),o.normalize(),r=0;r<l.length;++r)s[3*(p=l[r])+0]=o.x,s[3*p+1]=o.y,s[3*p+2]=o.z}}t.setVerticesData(n.VertexBuffer.NormalKind,s)}},t.prototype.parse=function(e,s,i,r,o){var a,l,h=this;this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=1):i.useRightHandedSystem?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e+1],t[e])},this._handednessSign=1):(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=-1);for(var p=s.split("\n"),_=0;_<p.length;_++){var d=p[_].trim().replace(/\s\s/g," "),u=void 0;if(0!==d.length&&"#"!==d.charAt(0))if(t.VertexPattern.test(d)){if(u=d.match(/[^ ]+/g),this._positions.push(new n.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]))),this._loadingOptions.importVertexColors)if(u.length>=7){var m=parseFloat(u[4]),c=parseFloat(u[5]),f=parseFloat(u[6]);this._colors.push(new n.Color4(m>1?m/255:m,c>1?c/255:c,f>1?f/255:f,7===u.length||void 0===u[7]?1:parseFloat(u[7])))}else this._colors.push(this._grayColor)}else if(null!==(u=t.NormalPattern.exec(d)))this._normals.push(new n.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])));else if(null!==(u=t.UVPattern.exec(d)))this._uvs.push(new n.Vector2(parseFloat(u[1])*this._loadingOptions.UVScaling.x,parseFloat(u[2])*this._loadingOptions.UVScaling.y));else if(null!==(u=t.FacePattern3.exec(d)))this._setDataForCurrentFaceWithPattern3(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern4.exec(d)))this._setDataForCurrentFaceWithPattern4(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern5.exec(d)))this._setDataForCurrentFaceWithPattern5(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern2.exec(d)))this._setDataForCurrentFaceWithPattern2(u[1].trim().split(" "),1);else if(null!==(u=t.FacePattern1.exec(d)))this._setDataForCurrentFaceWithPattern1(u[1].trim().split(" "),1);else if(null!==(u=t.LinePattern1.exec(d)))this._setDataForCurrentFaceWithPattern1(u[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(u=t.LinePattern2.exec(d)))this._setDataForCurrentFaceWithPattern2(u[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(u=t.LinePattern3.exec(d)))this._setDataForCurrentFaceWithPattern3(u[1].trim().split(" "),0),this._hasLineData=!0;else if(t.GroupDescriptor.test(d)||t.ObjectDescriptor.test(d)){var g={name:d.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:t.ObjectDescriptor.test(d)};this._addPreviousObjMesh(),this._meshesFromObj.push(g),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else t.UseMtlDescriptor.test(d)?(this._materialNameFromObj=d.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),g={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(g),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):t.MtlLibGroupDescriptor.test(d)?o(d.substring(7).trim()):t.SmoothDescriptor.test(d)||n.Logger.Log("Unhandled expression at line : "+d)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._handledMesh.normals=this._unwrappedNormalsForBabylon,this._handledMesh.uvs=this._unwrappedUVForBabylon,this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon)),!this._hasMeshes){var b=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var F=0,y=this._positions;F<y.length;F++){var v=y[F];this._unwrappedPositionsForBabylon.push(v.x,v.y,v.z)}if(this._normals.length)for(var O=0,M=this._normals;O<M.length;O++){var w=M[O];this._unwrappedNormalsForBabylon.push(w.x,w.y,w.z)}if(this._uvs.length)for(var P=0,B=this._uvs;P<B.length;P++){var T=B[P];this._unwrappedUVForBabylon.push(T.x,T.y)}if(this._colors.length)for(var x=0,L=this._colors;x<L.length;x++){var C=L[x];this._unwrappedColorsForBabylon.push(C.r,C.g,C.b,C.a)}this._materialNameFromObj||((b=new n.StandardMaterial(n.Geometry.RandomId(),i)).pointsCloud=!0,this._materialNameFromObj=b.name,this._normals.length||(b.disableLighting=!0,b.emissiveColor=n.Color3.White()))}this._meshesFromObj.push({name:n.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:b,isObject:!0})}for(var N=0;N<this._meshesFromObj.length;N++){if(e&&this._meshesFromObj[N].name)if(e instanceof Array){if(-1===e.indexOf(this._meshesFromObj[N].name))continue}else if(this._meshesFromObj[N].name!==e)continue;this._handledMesh=this._meshesFromObj[N],i._blockEntityCollection=!!r;var I=new n.Mesh(this._meshesFromObj[N].name,i);if(I._parentContainer=r,i._blockEntityCollection=!1,this._handledMesh._babylonMesh=I,!this._handledMesh.isObject)for(var V=N-1;V>=0;--V)if(this._meshesFromObj[V].isObject&&this._meshesFromObj[V]._babylonMesh){I.parent=this._meshesFromObj[V]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[N].materialName),this._handledMesh.hasLines&&(null!==(a=I._internalMetadata)&&void 0!==a||(I._internalMetadata={}),I._internalMetadata._isLine=!0),0!==(null===(l=this._handledMesh.positions)||void 0===l?void 0:l.length)){var j=new n.VertexData;if(j.uvs=this._handledMesh.uvs,j.indices=this._handledMesh.indices,j.positions=this._handledMesh.positions,this._loadingOptions.computeNormals){var E=new Array;n.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,E),j.normals=E}else j.normals=this._handledMesh.normals;this._loadingOptions.importVertexColors&&(j.colors=this._handledMesh.colors),j.applyToMesh(I),this._loadingOptions.invertY&&(I.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(I),this._babylonMeshesArray.push(I),this._handledMesh.directMaterial&&(I.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(I)}},t.ObjectDescriptor=/^o/,t.GroupDescriptor=/^g/,t.MtlLibGroupDescriptor=/^mtllib /,t.UseMtlDescriptor=/^usemtl /,t.SmoothDescriptor=/^s /,t.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,t.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,t.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,t.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,t.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t}(),p=function(){function t(e){this.name="obj",this.extensions=".obj",this._assetContainer=null,this._loadingOptions=e||t._DefaultLoadingOptions}return Object.defineProperty(t,"INVERT_TEXTURE_Y",{get:function(){return l.INVERT_TEXTURE_Y},set:function(t){l.INVERT_TEXTURE_Y=t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"_DefaultLoadingOptions",{get:function(){return{computeNormals:t.COMPUTE_NORMALS,optimizeNormals:t.OPTIMIZE_NORMALS,importVertexColors:t.IMPORT_VERTEX_COLORS,invertY:t.INVERT_Y,invertTextureY:t.INVERT_TEXTURE_Y,UVScaling:t.UV_SCALING,materialLoadingFailsSilently:t.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:t.OPTIMIZE_WITH_UV,skipMaterials:t.SKIP_MATERIALS,useLegacyBehavior:t.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),t.prototype._loadMTL=function(t,e,s,i){var r=e+t;n.Tools.LoadFile(r,s,void 0,void 0,!1,(function(t,e){i(r,e)}))},t.prototype.createPlugin=function(){return new t(t._DefaultLoadingOptions)},t.prototype.canDirectLoad=function(){return!1},t.prototype.importMeshAsync=function(t,e,s,i){return this._parseSolid(t,e,s,i).then((function(t){return{meshes:t,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))},t.prototype.loadAsync=function(t,e,s){return this.importMeshAsync(null,t,e,s).then((function(){}))},t.prototype.loadAssetContainerAsync=function(t,e,s){var i=this,r=new n.AssetContainer(t);return this._assetContainer=r,this.importMeshAsync(null,t,e,s).then((function(t){return t.meshes.forEach((function(t){return r.meshes.push(t)})),t.meshes.forEach((function(t){var e=t.material;e&&-1==r.materials.indexOf(e)&&(r.materials.push(e),e.getActiveTextures().forEach((function(t){-1==r.textures.indexOf(t)&&r.textures.push(t)})))})),i._assetContainer=null,r})).catch((function(t){throw i._assetContainer=null,t}))},t.prototype._parseSolid=function(t,e,s,i){var r=this,o="",a=new l,p=[],_=[];s=s.replace(/#.*$/gm,"").trim(),new h(p,_,this._loadingOptions).parse(t,s,e,this._assetContainer,(function(t){o=t}));var d=[];return""===o||this._loadingOptions.skipMaterials||d.push(new Promise((function(t,s){r._loadMTL(o,i,(function(l){try{a.parseMTL(e,l,i,r._assetContainer);for(var h=0;h<a.materials.length;h++){for(var d=0,u=[],m=void 0;(m=p.indexOf(a.materials[h].name,d))>-1;)u.push(m),d=m+1;if(-1===m&&0===u.length)a.materials[h].dispose();else for(var c=0;c<u.length;c++){var f=_[u[c]],g=a.materials[h];f.material=g,f.getTotalIndices()||(g.pointsCloud=!0)}}t()}catch(e){n.Tools.Warn("Error processing MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(e)}}),(function(e,i){n.Tools.Warn("Error downloading MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(i)}))}))),Promise.all(d).then((function(){var t=function(t){var e,s;return Boolean(null!==(s=null===(e=t._internalMetadata)||void 0===e?void 0:e._isLine)&&void 0!==s&&s)};return _.forEach((function(s){var i,r;if(t(s)){var o=null!==(i=s.material)&&void 0!==i?i:new n.StandardMaterial(s.name+"_line",e);o.getBindedMeshes().filter((function(e){return!t(e)})).length>0&&(o=null!==(r=o.clone(o.name+"_line"))&&void 0!==r?r:o),o.wireframe=!0,s.material=o,s._internalMetadata&&(s._internalMetadata._isLine=void 0)}})),_}))},t.OPTIMIZE_WITH_UV=!0,t.INVERT_Y=!1,t.IMPORT_VERTEX_COLORS=!1,t.COMPUTE_NORMALS=!1,t.OPTIMIZE_NORMALS=!1,t.UV_SCALING=new n.Vector2(1,1),t.SKIP_MATERIALS=!1,t.MATERIAL_LOADING_FAILS_SILENTLY=!0,t.USE_LEGACY_BEHAVIOR=!1,t}();n.SceneLoader&&n.SceneLoader.RegisterPlugin(new p);var _=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==_)for(var d in o)_.BABYLON[d]||(_.BABYLON[d]=o[d]);const u=a;return r.default})())); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-loaders"]=e(require("babylonjs")):t.LOADERS=e(t.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},s={};function i(t){var r=s[t];if(void 0!==r)return r.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};i.d(r,{default:()=>d});var o={};i.r(o),i.d(o,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var n={};i.r(n),i.d(n,{MTLFileLoader:()=>l,OBJFileLoader:()=>p,SolidParser:()=>h});var a=i(597),l=function(){function t(){this.materials=[]}return t.prototype.parseMTL=function(e,s,i,r){if(!(s instanceof ArrayBuffer)){for(var o,n=s.split("\n"),l=/\s+/,h=null,p=0;p<n.length;p++){var _=n[p].trim();if(0!==_.length&&"#"!==_.charAt(0)){var u=_.indexOf(" "),d=u>=0?_.substring(0,u):_;d=d.toLowerCase();var m=u>=0?_.substring(u+1).trim():"";if("newmtl"===d)h&&this.materials.push(h),e._blockEntityCollection=!!r,(h=new a.StandardMaterial(m,e))._parentContainer=r,e._blockEntityCollection=!1;else if("kd"===d&&h)o=m.split(l,3).map(parseFloat),h.diffuseColor=a.Color3.FromArray(o);else if("ka"===d&&h)o=m.split(l,3).map(parseFloat),h.ambientColor=a.Color3.FromArray(o);else if("ks"===d&&h)o=m.split(l,3).map(parseFloat),h.specularColor=a.Color3.FromArray(o);else if("ke"===d&&h)o=m.split(l,3).map(parseFloat),h.emissiveColor=a.Color3.FromArray(o);else if("ns"===d&&h)h.specularPower=parseFloat(m);else if("d"===d&&h)h.alpha=parseFloat(m);else if("map_ka"===d&&h)h.ambientTexture=t._GetTexture(i,m,e);else if("map_kd"===d&&h)h.diffuseTexture=t._GetTexture(i,m,e);else if("map_ks"===d&&h)h.specularTexture=t._GetTexture(i,m,e);else if("map_ns"===d);else if("map_bump"===d&&h){var c=m.split(l),f=c.indexOf("-bm"),g=null;f>=0&&(g=c[f+1],c.splice(f,2)),h.bumpTexture=t._GetTexture(i,c.join(" "),e),h.bumpTexture&&null!==g&&(h.bumpTexture.level=parseFloat(g))}else"map_d"===d&&h&&(h.opacityTexture=t._GetTexture(i,m,e))}}h&&this.materials.push(h)}},t._GetTexture=function(e,s,i){if(!s)return null;var r=e;if("file:"===e){var o=s.lastIndexOf("\\");-1===o&&(o=s.lastIndexOf("/")),r+=o>-1?s.substr(o+1):s}else r+=s;return new a.Texture(r,i,!1,t.INVERT_TEXTURE_Y)},t.INVERT_TEXTURE_Y=!0,t}(),h=function(){function t(t,e,s){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new a.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=t,this._babylonMeshesArray=e,this._loadingOptions=s}return t.prototype._isInArray=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[]});var s=t[e[0]].normals.indexOf(e[1]);return-1===s?-1:t[e[0]].idx[s]},t.prototype._isInArrayUV=function(t,e){t[e[0]]||(t[e[0]]={normals:[],idx:[],uv:[]});var s=t[e[0]].normals.indexOf(e[1]);return 1!=s&&e[2]===t[e[0]].uv[s]?t[e[0]].idx[s]:-1},t.prototype._setData=function(t,e,s,i,r,o,n){var l;-1===(l=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[t,s,e]):this._isInArray(this._tuplePosNorm,[t,s]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(i),r=null!=r?r:new a.Vector2(0,0),this._wrappedUvsForBabylon.push(r),this._wrappedNormalsForBabylon.push(o),void 0!==n&&this._wrappedColorsForBabylon.push(n),this._tuplePosNorm[t].normals.push(s),this._tuplePosNorm[t].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[t].uv.push(e)):this._indicesForBabylon.push(l)},t.prototype._unwrapData=function(){for(var t=0;t<this._wrappedPositionForBabylon.length;t++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[t].x*this._handednessSign,this._wrappedPositionForBabylon[t].y,this._wrappedPositionForBabylon[t].z),this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[t].x*this._handednessSign,this._wrappedNormalsForBabylon[t].y,this._wrappedNormalsForBabylon[t].z),this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[t].x,this._wrappedUvsForBabylon[t].y),this._loadingOptions.importVertexColors&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[t].r,this._wrappedColorsForBabylon[t].g,this._wrappedColorsForBabylon[t].b,this._wrappedColorsForBabylon[t].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0},t.prototype._getTriangles=function(t,e){for(var s=e;s<t.length-1;s++)this._pushTriangle(t,s)},t.prototype._setDataForCurrentFaceWithPattern1=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=parseInt(this._triangles[s])-1;this._setData(i,0,0,this._positions[i],a.Vector2.Zero(),a.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[i]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern2=function(t,e){var s;this._getTriangles(t,e);for(var i=0;i<this._triangles.length;i++){var r=this._triangles[i].split("/"),o=parseInt(r[0])-1,n=parseInt(r[1])-1;this._setData(o,n,0,this._positions[o],null!==(s=this._uvs[n])&&void 0!==s?s:a.Vector2.Zero(),a.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[o]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern3=function(t,e){var s,i;this._getTriangles(t,e);for(var r=0;r<this._triangles.length;r++){var o=this._triangles[r].split("/"),n=parseInt(o[0])-1,l=parseInt(o[1])-1,h=parseInt(o[2])-1;this._setData(n,l,h,this._positions[n],null!==(s=this._uvs[l])&&void 0!==s?s:a.Vector2.Zero(),null!==(i=this._normals[h])&&void 0!==i?i:a.Vector3.Up())}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern4=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("//"),r=parseInt(i[0])-1,o=parseInt(i[1])-1;this._setData(r,1,o,this._positions[r],a.Vector2.Zero(),this._normals[o],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._setDataForCurrentFaceWithPattern5=function(t,e){this._getTriangles(t,e);for(var s=0;s<this._triangles.length;s++){var i=this._triangles[s].split("/"),r=this._positions.length+parseInt(i[0]),o=this._uvs.length+parseInt(i[1]),n=this._normals.length+parseInt(i[2]);this._setData(r,o,n,this._positions[r],this._uvs[o],this._normals[n],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},t.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice(),this._handledMesh.uvs=this._unwrappedUVForBabylon.slice(),this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},t.prototype._optimizeNormals=function(t){var e=t.getVerticesData(a.VertexBuffer.PositionKind),s=t.getVerticesData(a.VertexBuffer.NormalKind),i={};if(e&&s){for(var r=0;r<e.length/3;r++)(l=i[n=e[3*r+0]+"_"+e[3*r+1]+"_"+e[3*r+2]])||(l=[],i[n]=l),l.push(r);var o=new a.Vector3;for(var n in i){var l;if(!((l=i[n]).length<2)){var h=l[0];for(r=1;r<l.length;++r){var p=l[r];s[3*h+0]+=s[3*p+0],s[3*h+1]+=s[3*p+1],s[3*h+2]+=s[3*p+2]}for(o.copyFromFloats(s[3*h+0],s[3*h+1],s[3*h+2]),o.normalize(),r=0;r<l.length;++r)s[3*(p=l[r])+0]=o.x,s[3*p+1]=o.y,s[3*p+2]=o.z}}t.setVerticesData(a.VertexBuffer.NormalKind,s)}},t._IsLineElement=function(t){return t.startsWith("l")},t._IsObjectElement=function(t){return t.startsWith("o")},t._IsGroupElement=function(t){return t.startsWith("g")},t.prototype.parse=function(e,s,i,r,o){var n,l,h=this;this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=1):i.useRightHandedSystem?(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e+1],t[e])},this._handednessSign=1):(this._pushTriangle=function(t,e){return h._triangles.push(t[0],t[e],t[e+1])},this._handednessSign=-1);var p=s.split("\n"),_=[],u=[];_.push(u);for(var d=0;d<p.length;d++)if(0!==(g=p[d].trim().replace(/\s\s/g," ")).length&&"#"!==g.charAt(0))if((t._IsGroupElement(g)||t._IsObjectElement(g))&&(u=[],_.push(u)),t._IsLineElement(g))for(var m=g.split(" "),c=1;c<m.length-1;c++)u.push("l ".concat(m[c]," ").concat(m[c+1]));else u.push(g);var f=_.flat();for(d=0;d<f.length;d++){var g,b=void 0;if(0!==(g=f[d].trim().replace(/\s\s/g," ")).length&&"#"!==g.charAt(0))if(t.VertexPattern.test(g)){if(b=g.match(/[^ ]+/g),this._positions.push(new a.Vector3(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3]))),this._loadingOptions.importVertexColors)if(b.length>=7){var F=parseFloat(b[4]),y=parseFloat(b[5]),v=parseFloat(b[6]);this._colors.push(new a.Color4(F>1?F/255:F,y>1?y/255:y,v>1?v/255:v,7===b.length||void 0===b[7]?1:parseFloat(b[7])))}else this._colors.push(this._grayColor)}else if(null!==(b=t.NormalPattern.exec(g)))this._normals.push(new a.Vector3(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3])));else if(null!==(b=t.UVPattern.exec(g)))this._uvs.push(new a.Vector2(parseFloat(b[1])*this._loadingOptions.UVScaling.x,parseFloat(b[2])*this._loadingOptions.UVScaling.y));else if(null!==(b=t.FacePattern3.exec(g)))this._setDataForCurrentFaceWithPattern3(b[1].trim().split(" "),1);else if(null!==(b=t.FacePattern4.exec(g)))this._setDataForCurrentFaceWithPattern4(b[1].trim().split(" "),1);else if(null!==(b=t.FacePattern5.exec(g)))this._setDataForCurrentFaceWithPattern5(b[1].trim().split(" "),1);else if(null!==(b=t.FacePattern2.exec(g)))this._setDataForCurrentFaceWithPattern2(b[1].trim().split(" "),1);else if(null!==(b=t.FacePattern1.exec(g)))this._setDataForCurrentFaceWithPattern1(b[1].trim().split(" "),1);else if(null!==(b=t.LinePattern1.exec(g)))this._setDataForCurrentFaceWithPattern1(b[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(b=t.LinePattern2.exec(g)))this._setDataForCurrentFaceWithPattern2(b[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(b=t.LinePattern3.exec(g)))this._setDataForCurrentFaceWithPattern3(b[1].trim().split(" "),0),this._hasLineData=!0;else if(t.GroupDescriptor.test(g)||t.ObjectDescriptor.test(g)){var O={name:g.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:t.ObjectDescriptor.test(g)};this._addPreviousObjMesh(),this._meshesFromObj.push(O),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else t.UseMtlDescriptor.test(g)?(this._materialNameFromObj=g.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),O={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(O),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):t.MtlLibGroupDescriptor.test(g)?o(g.substring(7).trim()):t.SmoothDescriptor.test(g)||a.Logger.Log("Unhandled expression at line : "+g)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._handledMesh.normals=this._unwrappedNormalsForBabylon,this._handledMesh.uvs=this._unwrappedUVForBabylon,this._handledMesh.hasLines=this._hasLineData,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon)),!this._hasMeshes){var M=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var w=0,P=this._positions;w<P.length;w++){var B=P[w];this._unwrappedPositionsForBabylon.push(B.x,B.y,B.z)}if(this._normals.length)for(var T=0,L=this._normals;T<L.length;T++){var x=L[T];this._unwrappedNormalsForBabylon.push(x.x,x.y,x.z)}if(this._uvs.length)for(var C=0,I=this._uvs;C<I.length;C++){var N=I[C];this._unwrappedUVForBabylon.push(N.x,N.y)}if(this._colors.length)for(var V=0,E=this._colors;V<E.length;V++){var j=E[V];this._unwrappedColorsForBabylon.push(j.r,j.g,j.b,j.a)}this._materialNameFromObj||((M=new a.StandardMaterial(a.Geometry.RandomId(),i)).pointsCloud=!0,this._materialNameFromObj=M.name,this._normals.length||(M.disableLighting=!0,M.emissiveColor=a.Color3.White()))}this._meshesFromObj.push({name:a.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:M,isObject:!0,hasLines:this._hasLineData})}for(var D=0;D<this._meshesFromObj.length;D++){if(e&&this._meshesFromObj[D].name)if(e instanceof Array){if(-1===e.indexOf(this._meshesFromObj[D].name))continue}else if(this._meshesFromObj[D].name!==e)continue;this._handledMesh=this._meshesFromObj[D],i._blockEntityCollection=!!r;var A=new a.Mesh(this._meshesFromObj[D].name,i);if(A._parentContainer=r,i._blockEntityCollection=!1,this._handledMesh._babylonMesh=A,!this._handledMesh.isObject)for(var S=D-1;S>=0;--S)if(this._meshesFromObj[S].isObject&&this._meshesFromObj[S]._babylonMesh){A.parent=this._meshesFromObj[S]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[D].materialName),this._handledMesh.hasLines&&(null!==(n=A._internalMetadata)&&void 0!==n||(A._internalMetadata={}),A._internalMetadata._isLine=!0),0!==(null===(l=this._handledMesh.positions)||void 0===l?void 0:l.length)){var U=new a.VertexData;if(U.uvs=this._handledMesh.uvs,U.indices=this._handledMesh.indices,U.positions=this._handledMesh.positions,this._loadingOptions.computeNormals){var R=new Array;a.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,R),U.normals=R}else U.normals=this._handledMesh.normals;this._loadingOptions.importVertexColors&&(U.colors=this._handledMesh.colors),U.applyToMesh(A),this._loadingOptions.invertY&&(A.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(A),this._babylonMeshesArray.push(A),this._handledMesh.directMaterial&&(A.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(A)}},t.ObjectDescriptor=/^o/,t.GroupDescriptor=/^g/,t.MtlLibGroupDescriptor=/^mtllib /,t.UseMtlDescriptor=/^usemtl /,t.SmoothDescriptor=/^s /,t.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,t.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,t.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,t.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,t.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,t.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,t.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,t}(),p=function(){function t(e){this.name="obj",this.extensions=".obj",this._assetContainer=null,this._loadingOptions=e||t._DefaultLoadingOptions}return Object.defineProperty(t,"INVERT_TEXTURE_Y",{get:function(){return l.INVERT_TEXTURE_Y},set:function(t){l.INVERT_TEXTURE_Y=t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"_DefaultLoadingOptions",{get:function(){return{computeNormals:t.COMPUTE_NORMALS,optimizeNormals:t.OPTIMIZE_NORMALS,importVertexColors:t.IMPORT_VERTEX_COLORS,invertY:t.INVERT_Y,invertTextureY:t.INVERT_TEXTURE_Y,UVScaling:t.UV_SCALING,materialLoadingFailsSilently:t.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:t.OPTIMIZE_WITH_UV,skipMaterials:t.SKIP_MATERIALS,useLegacyBehavior:t.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),t.prototype._loadMTL=function(t,e,s,i){var r=e+t;a.Tools.LoadFile(r,s,void 0,void 0,!1,(function(t,e){i(r,e)}))},t.prototype.createPlugin=function(){return new t(t._DefaultLoadingOptions)},t.prototype.canDirectLoad=function(){return!1},t.prototype.importMeshAsync=function(t,e,s,i){return this._parseSolid(t,e,s,i).then((function(t){return{meshes:t,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))},t.prototype.loadAsync=function(t,e,s){return this.importMeshAsync(null,t,e,s).then((function(){}))},t.prototype.loadAssetContainerAsync=function(t,e,s){var i=this,r=new a.AssetContainer(t);return this._assetContainer=r,this.importMeshAsync(null,t,e,s).then((function(t){return t.meshes.forEach((function(t){return r.meshes.push(t)})),t.meshes.forEach((function(t){var e=t.material;e&&-1==r.materials.indexOf(e)&&(r.materials.push(e),e.getActiveTextures().forEach((function(t){-1==r.textures.indexOf(t)&&r.textures.push(t)})))})),i._assetContainer=null,r})).catch((function(t){throw i._assetContainer=null,t}))},t.prototype._parseSolid=function(t,e,s,i){var r=this,o="",n=new l,p=[],_=[];s=s.replace(/#.*$/gm,"").trim(),new h(p,_,this._loadingOptions).parse(t,s,e,this._assetContainer,(function(t){o=t}));var u=[];return""===o||this._loadingOptions.skipMaterials||u.push(new Promise((function(t,s){r._loadMTL(o,i,(function(l){try{n.parseMTL(e,l,i,r._assetContainer);for(var h=0;h<n.materials.length;h++){for(var u=0,d=[],m=void 0;(m=p.indexOf(n.materials[h].name,u))>-1;)d.push(m),u=m+1;if(-1===m&&0===d.length)n.materials[h].dispose();else for(var c=0;c<d.length;c++){var f=_[d[c]],g=n.materials[h];f.material=g,f.getTotalIndices()||(g.pointsCloud=!0)}}t()}catch(e){a.Tools.Warn("Error processing MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(e)}}),(function(e,i){a.Tools.Warn("Error downloading MTL file: '".concat(o,"'")),r._loadingOptions.materialLoadingFailsSilently?t():s(i)}))}))),Promise.all(u).then((function(){var t=function(t){var e,s;return Boolean(null!==(s=null===(e=t._internalMetadata)||void 0===e?void 0:e._isLine)&&void 0!==s&&s)};return _.forEach((function(s){var i,r;if(t(s)){var o=null!==(i=s.material)&&void 0!==i?i:new a.StandardMaterial(s.name+"_line",e);o.getBindedMeshes().filter((function(e){return!t(e)})).length>0&&(o=null!==(r=o.clone(o.name+"_line"))&&void 0!==r?r:o),o.wireframe=!0,s.material=o,s._internalMetadata&&(s._internalMetadata._isLine=void 0)}})),_}))},t.OPTIMIZE_WITH_UV=!0,t.INVERT_Y=!1,t.IMPORT_VERTEX_COLORS=!1,t.COMPUTE_NORMALS=!1,t.OPTIMIZE_NORMALS=!1,t.UV_SCALING=new a.Vector2(1,1),t.SKIP_MATERIALS=!1,t.MATERIAL_LOADING_FAILS_SILENTLY=!0,t.USE_LEGACY_BEHAVIOR=!1,t}();(0,a.registerSceneLoaderPlugin)(new p);var _=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==_)for(var u in o)_.BABYLON[u]||(_.BABYLON[u]=o[u]);const d=n;return r.default})())); | ||
//# sourceMappingURL=babylon.objFileLoader.min.js.map |
@@ -282,5 +282,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
}()); | ||
if (babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__.SceneLoader) { | ||
babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__.SceneLoader.RegisterPlugin(new STLFileLoader()); | ||
} | ||
(0,babylonjs_Misc_tools__WEBPACK_IMPORTED_MODULE_0__.registerSceneLoaderPlugin)(new STLFileLoader()); | ||
@@ -429,2 +427,2 @@ | ||
}); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFieWxvbi5zdGxGaWxlTG9hZGVyLmpzIiwibWFwc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cclxuICAgICAgICAgICAgICAgIHRoaXMuX3BhcnNlQmluYXJ5KGJhYnlsb25NZXNoLCBkYXRhKTtcclxuICAgICAgICAgICAgICAgIGlmIChtZXNoZXMpIHtcclxuICAgICAgICAgICAgICAgICAgICBtZXNoZXMucHVzaChiYWJ5bG9uTWVzaCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLy8gQVNDSUkgLnN0bFxyXG5cclxuICAgICAgICAgICAgLy8gY29udmVydCB0byBzdHJpbmdcclxuICAgICAgICAgICAgZGF0YSA9IG5ldyBUZXh0RGVjb2RlcigpLmRlY29kZShuZXcgVWludDhBcnJheShkYXRhKSk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICAvL2lmIGFycml2ZWQgaGVyZSwgZGF0YSBpcyBhIHN0cmluZywgY29udGFpbmluZyB0aGUgU1RMQSBkYXRhLlxyXG5cclxuICAgICAgICB3aGlsZSAoKG1hdGNoZXMgPSB0aGlzLnNvbGlkUGF0dGVybi5leGVjKGRhdGEpKSkge1xyXG4gICAgICAgICAgICBsZXQgbWVzaE5hbWUgPSBtYXRjaGVzWzFdO1xyXG4gICAgICAgICAgICBjb25zdCBtZXNoTmFtZUZyb21FbmQgPSBtYXRjaGVzWzNdO1xyXG4gICAgICAgICAgICBpZiAobWVzaE5hbWVGcm9tRW5kICYmIG1lc2hOYW1lICE9IG1lc2hOYW1lRnJvbUVuZCkge1xyXG4gICAgICAgICAgICAgICAgVG9vbHMuRXJyb3IoXCJFcnJvciBpbiBTVEwsIHNvbGlkIG5hbWUgIT0gZW5kc29saWQgbmFtZVwiKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLy8gY2hlY2sgbWVzaGVzTmFtZXNcclxuICAgICAgICAgICAgaWYgKG1lc2hlc05hbWVzICYmIG1lc2hOYW1lKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAobWVzaGVzTmFtZXMgaW5zdGFuY2VvZiBBcnJheSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmICghbWVzaGVzTmFtZXMuaW5kZXhPZihtZXNoTmFtZSkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAobWVzaE5hbWUgIT09IG1lc2hlc05hbWVzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLy8gc3RsIG1lc2ggbmFtZSBjYW4gYmUgZW1wdHkgYXMgd2VsbFxyXG4gICAgICAgICAgICBtZXNoTmFtZSA9IG1lc2hOYW1lIHx8IFwic3RsbWVzaFwiO1xyXG5cclxuICAgICAgICAgICAgY29uc3QgYmFieWxvbk1lc2ggPSBuZXcgTWVzaChtZXNoTmFtZSwgc2NlbmUpO1xyXG4gICAgICAgICAgICB0aGlzLl9wYXJzZUFTQ0lJKGJhYnlsb25NZXNoLCBtYXRjaGVzWzJdKTtcclxuICAgICAgICAgICAgaWYgKG1lc2hlcykge1xyXG4gICAgICAgICAgICAgICAgbWVzaGVzLnB1c2goYmFieWxvbk1lc2gpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIExvYWQgaW50byBhIHNjZW5lLlxyXG4gICAgICogQHBhcmFtIHNjZW5lIFRoZSBzY2VuZSB0byBsb2FkIGludG9cclxuICAgICAqIEBwYXJhbSBkYXRhIFRoZSBkYXRhI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ICBjb25zdCBub3JtYWxYID0gcmVhZGVyLmdldEZsb2F0MzIoc3RhcnQsIHRydWUpO1xyXG4gICAgICAgICAgICBjb25zdCBub3JtYWxZID0gcmVhZGVyLmdldEZsb2F0MzIoc3RhcnQgKyA0LCB0cnVlKTtcclxuICAgICAgICAgICAgY29uc3Qgbm9ybWFsWiA9IHJlYWRlci5nZXRGbG9hdDMyKHN0YXJ0ICsgOCwgdHJ1ZSk7XHJcblxyXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMTsgaSA8PSAzOyBpKyspIHtcclxuICAgICAgICAgICAgICAgIGNvbnN0IHZlcnRleHN0YXJ0ID0gc3RhcnQgKyBpICogMTI7XHJcblxyXG4gICAgICAgICAgICAgICAgLy8gb3JkZXJpbmcgaXMgaW50ZW50aW9uYWwgdG8gbWF0Y2ggYXNjaWkgaW1wb3J0XHJcbiAgICAgICAgICAgICAgICBwb3NpdGlvbnNbb2Zmc2V0XSA9IHJlYWRlci5nZXRGbG9hdDMyKHZlcnRleHN0YXJ0LCB0cnVlKTtcclxuICAgICAgICAgICAgICAgIG5vcm1hbHNbb2Zmc2V0XSA9IG5vcm1hbFg7XHJcblxyXG4gICAgICAgICAgICAgICAgaWYgKCFTVExGaWxlTG9hZGVyLkRPX05PVF9BTFRFUl9GSUxFX0NPT1JESU5BVEVTKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb25zW29mZnNldCArIDJdID0gcmVhZGVyLmdldEZsb2F0MzIodmVydGV4c3RhcnQgKyA0LCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbnNbb2Zmc2V0ICsgMV0gPSByZWFkZXIuZ2V0RmxvYXQzMih2ZXJ0ZXhzdGFydCArIDgsIHRydWUpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICBub3JtYWxzW29mZnNldCArIDJdID0gbm9ybWFsWTtcclxuICAgICAgICAgICAgICAgICAgICBub3JtYWxzW29mZnNldCArIDFdID0gbm9ybWFsWjtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb25zW29mZnNldCArIDFdID0gcmVhZGVyLmdldEZsb2F0MzIodmVydGV4c3RhcnQgKyA0LCB0cnVlKTtcclxuICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbnNbb2Zmc2V0ICsgMl0gPSByZWFkZXIuZ2V0RmxvYXQzMih2ZXJ0ZXhzdGFydCArIDgsIHRydWUpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICBub3JtYWxzW29mZnNldCArIDFdID0gbm9ybWFsWTtcclxuICAgICAgICAgICAgICAgICAgICBub3JtYWxzW29mZnNldCArIDJdID0gbm9ybWFsWjtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICBvZmZzZXQgKz0gMztcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgaWYgKFNUTEZpbGVMb2FkZXIuRE9fTk9UX0FMVEVSX0ZJTEVfQ09PUkRJTkFURVMpIHtcclxuICAgICAgICAgICAgICAgIGluZGljZXNbaW5kaWNlc0NvdW50XSA9IGluZGljZXNDb3VudDtcclxuICAgICAgICAgICAgICAgIGluZGljZXNbaW5kaWNlc0NvdW50ICsgMV0gPSBpbmRpY2VzQ291bnQgKyAyO1xyXG4gICAgICAgICAgICAgICAgaW5kaWNlc1tpbmRpY2VzQ291bnQgKyAyXSA9IGluZGljZXNDb3VudCArIDE7XHJcbiAgICAgICAgICAgICAgICBpbmRpY2VzQ291bnQgKz0gMztcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGluZGljZXNbaW5kaWNlc0NvdW50XSA9IGluZGljZXNDb3VudCsrO1xyXG4gICAgICAgICAgICAgICAgaW5kaWNlc1tpbmRpY2VzQ291bnRdID0gaW5kaWNlc0NvdW50Kys7XHJcbiAgICAgICAgICAgICAgICBpbmRpY2VzW2luZGljZXNDb3VudF0gPSBpbmRpY2V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lZC5cclxuICAgICAgICAgICAgICAgICAgICBub3JtYWxzLnB1c2gobm9ybWFsWzBdLCBub3JtYWxbMl0sIG5vcm1hbFsxXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKFNUTEZpbGVMb2FkZXIuRE9fTk9UX0FMVEVSX0ZJTEVfQ09PUkRJTkFURVMpIHtcclxuICAgICAgICAgICAgICAgIGluZGljZXMucHVzaChpbmRpY2VzQ291bnQsIGluZGljZXNDb3VudCArIDIsIGluZGljZXNDb3VudCArIDEpO1xyXG4gICAgICAgICAgICAgICAgaW5kaWNlc0NvdW50ICs9IDM7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpbmRpY2VzLnB1c2goaW5kaWNlc0NvdW50KyssIGluZGljZXNDb3VudCsrLCBpbmRpY2VzQ291bnQrKyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdGhpcy52ZXJ0ZXhQYXR0ZXJuLmxhc3RJbmRleCA9IDA7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICB0aGlzLmZhY2V0c1BhdHRlcm4ubGFzdEluZGV4ID0gMDtcclxuICAgICAgICBtZXNoLnNldFZlcnRpY2VzRGF0YShWZXJ0ZXhCdWZmZXIuUG9zaXRpb25LaW5kLCBwb3NpdGlvbnMpO1xyXG4gICAgICAgIG1lc2guc2V0VmVydGljZXNEYXRhKFZlcnRleEJ1ZmZlci5Ob3JtYWxLaW5kLCBub3JtYWxzKTtcclxuICAgICAgICBtZXNoLnNldEluZGljZXMoaW5kaWNlcyk7XHJcbiAgICAgICAgbWVzaC5jb21wdXRlV29ybGRNYXRyaXgodHJ1ZSk7XHJcbiAgICB9XHJcbn1cclxuXHJcbmlmIChTY2VuZUxvYWRlcikge1xyXG4gICAgU2NlbmVMb2FkZXIuUmVnaXN0ZXJQbHVnaW4obmV3IFNUTEZpbGVMb2FkZXIoKSk7XH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gLy9pZiBhcnJpdmVkIGhlcmUsIGRhdGEgaXMgYSBzdHJpbmcsIGNvbnRhaW5pbmcgdGhlIFNUTEEgZGF0YS5cclxuXHJcbiAgICAgICAgd2hpbGUgKChtYXRjaGVzID0gdGhpcy5zb2xpZFBhdHRlcm4uZXhlYyhkYXRhKSkpIHtcclxuICAgICAgICAgICAgbGV0IG1lc2hOYW1lID0gbWF0Y2hlc1sxXTtcclxuICAgICAgICAgICAgY29uc3QgbWVzaE5hbWVGcm9tRW5kID0gbWF0Y2hlc1szXTtcclxuICAgICAgICAgICAgaWYgKG1lc2hOYW1lRnJvbUVuZCAmJiBtZXNoTmFtZSAhPSBtZXNoTmFtZUZyb21FbmQpIHtcclxuICAgICAgICAgICAgICAgIFRvb2xzLkVycm9yKFwiRXJyb3IgaW4gU1RMLCBzb2xpZCBuYW1lICE9IGVuZHNvbGlkIG5hbWVcIik7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIC8vIGNoZWNrIG1lc2hlc05hbWVzXHJcbiAgICAgICAgICAgIGlmIChtZXNoZXNOYW1lcyAmJiBtZXNoTmFtZSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKG1lc2hlc05hbWVzIGluc3RhbmNlb2YgQXJyYXkpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW1lc2hlc05hbWVzLmluZGV4T2YobWVzaE5hbWUpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1lc2hOYW1lICE9PSBtZXNoZXNOYW1lcykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAg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G4gICAgICAgIC8vIHRoYXQgdGhlbiBpdCdzIG5vdCBhIGJpbmFyeSBTVEwuXHJcbiAgICAgICAgaWYgKHJlYWRlci5ieXRlTGVuZ3RoIDw9IDgwKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGNvbnN0IGZhY2VTaXplID0gKDMyIC8gOCkgKiAzICsgKDMyIC8gOCkgKiAzICogMyArIDE2IC8gODtcclxuICAgICAgICBjb25zdCBuRmFjZXMgPSByZWFkZXIuZ2V0VWludDMyKDgwLCB0cnVlKTtcclxuXHJcbiAgICAgICAgaWYgKDgwICsgMzIgLyA4ICsgbkZhY2VzICogZmFjZVNpemUgPT09IHJlYWRlci5ieXRlTGVuZ3RoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgLy8gVVMtQVNDSUkgYmVnaW4gd2l0aCAncycsICdvJywgJ2wnLCAnaScsICdkJ1xyXG4gICAgICAgIGNvbnN0IGFzY2lpID0gWzExNSwgMTExLCAxMDgsIDEwNSwgMTAwXTtcclxuICAgICAgICBmb3IgKGxldCBvZmYgPSAwOyBvZmYgPCA1OyBvZmYrKykge1xyXG4gICAgICAgICAgICBpZiAocmVhZGVyLmdldFVpbnQ4KG9mZikgIT09IGFzY2lpW29mZl0pIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICB9XHJcblxyXG4gICAgcHJpdmF0ZSBfcGFyc2VCaW5hcnkobWVzaDogTWVzaCwgZGF0YTogQXJyYXlCdWZmZXIpIHtcclxuICAgICAgICBjb25zdCByZWFkZXIgPSBuZXcgRGF0YVZpZXcoZGF0YSk7XHJcbiAgICAgICAgY29uc3QgZmFjZXMgPSByZWFkZXIuZ2V0VWludDMyKDgw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gICAgICAgcG9zaXRpb25zW29mZnNldF0gPSByZWFkZXIuZ2V0RmxvYXQzMih2ZXJ0ZXhzdGFydCwgdHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICBub3JtYWxzW29mZnNldF0gPSBub3JtYWxYO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmICghU1RMRmlsZUxvYWRlci5ET19OT1RfQUxURVJfRklMRV9DT09SRElOQVRFUykge1xyXG4gICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uc1tvZmZzZXQgKyAyXSA9IHJlYWRlci5nZXRGbG9hdDMyKHZlcnRleHN0YXJ0ICsgNCwgdHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb25zW29mZnNldCArIDFdID0gcmVhZGVyLmdldEZsb2F0MzIodmVydGV4c3RhcnQgKyA4LCB0cnVlKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgbm9ybWFsc1tvZmZzZXQgKyAyXSA9IG5vcm1hbFk7XHJcbiAgICAgICAgICAgICAgICAgICAgbm9ybWFsc1tvZmZzZXQgKyAxXSA9IG5vcm1hbFo7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uc1tvZmZzZXQgKyAxXSA9IHJlYWRlci5nZXRGbG9hdDMyKHZlcnRleHN0YXJ0ICsgNCwgdHJ1ZSk7XHJcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb25zW29mZnNldCArIDJdID0gcmVhZGVyLmdldEZsb2F0MzIodmVydGV4c3RhcnQgKyA4LCB0cnVlKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgbm9ybWFsc1tvZmZzZXQgKyAxXSA9IG5vcm1hbFk7XHJcbiAgICAgICAgICAgICAgICAgICAgbm9ybWFsc1tvZmZzZXQgKyAyXSA9IG5vcm1hbFo7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgb2Zmc2V0ICs9IDM7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGlmIChTVExGaWxlTG9hZGVyLkRPX05PVF9BTFRFUl9GSUxFX0NPT1JESU5BVEVTKSB7XHJcbiAgICAgICAgICAgICAgICBpbmRpY2VzW2luZGljZXNDb3VudF0gPSBpbmRpY2VzQ291bnQ7XHJcbiAgICAgICAgICAgICAgICBpbmRpY2VzW2luZGljZXNDb3VudCArIDFdID0gaW5kaWNlc0NvdW50ICsgMjtcclxuICAgICAgICAgICAgICAgIGluZGljZXNbaW5kaWNlc0NvdW50ICsgMl0gPSBpbmRpY2VzQ291bnQgKyAxO1xyXG4gICAgICAgICAgICAgICAgaW5kaWNlc0NvdW50ICs9IDM7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpbmRpY2VzW2luZGljZXNDb3VudF0gPSBpbmRpY2VzQ291bnQrKztcclxuICAgICAgICAgICAgICAgIGluZGljZXNbaW5kaWNlc0NvdW50XSA9IGluZGljZXNDb3VudCsrO1xyXG4gICAgICAgICAgICAgICAgaW5kaWNlc1tpbmRpY2VzQ291bnRdID0gaW5kaWNlc0NvdW50Kys7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIG1lc2guc2V0VmVydGljZXNEYXRhKFZlcnRleEJ1ZmZlci5Qb3NpdGlvbktpbmQsIHBvc2l0aW9ucyk7XHJcbiAgICAgICAgbWVzaC5zZXRWZXJ0aWNlc0RhdGEoVmVydGV4QnVmZmVyLk5vcm1hbEtpbmQsIG5vcm1hbHMpO1xyXG4gICAgICAgIG1lc2guc2V0SW5kaWNlcyhpbmRpY2VzKTtcclxuICAgICAgICBtZXNoLmNvbXB1dGVXb3JsZE1hdHJpeCh0cnVlKTtcclxuICAgIH1cclxuXHJcbiAgICBwcml2YXRlIF9wYXJzZUFTQ0lJKG1lc2g6IE1lc2gsIHNvbGlkRGF0YTogc3RyaW5nKSB7XHJcbiAgICAg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VExGaWxlTG9hZGVyLkRPX05PVF9BTFRFUl9GSUxFX0NPT1JESU5BVEVTKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb25zLnB1c2goTnVtYmVyKHZlcnRleE1hdGNoWzFdKSwgTnVtYmVyKHZlcnRleE1hdGNoWzVdKSwgTnVtYmVyKHZlcnRleE1hdGNoWzNdKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgbm9ybWFscy5wdXNoKG5vcm1hbFswXSwgbm9ybWFsWzFdLCBub3JtYWxbMl0pO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbnMucHVzaChOdW1iZXIodmVydGV4TWF0Y2hbMV0pLCBOdW1iZXIodmVydGV4TWF0Y2hbM10pLCBOdW1iZXIodmVydGV4TWF0Y2hbNV0pKTtcclxuXHJcbiAgICAgICAgICAgICAgICAgICAgLy8gRmxpcHBpbmcgdGhlIHNlY29uZCBhbmQgdGhpcmQgY29tcG9uZW50IGJlY2F1c2UgaW52ZXJ0ZWRcclxuICAgICAgICAgICAgICAgICAgICAvLyB3aGVuIG5vcm1hbCB3YXMgZGVjbGFyZWQuXHJcbiAgICAgICAgICAgICAgICAgICAgbm9ybWFscy5wdXNoKG5vcm1hbFswXSwgbm9ybWFsWzJdLCBub3JtYWxbMV0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChTVExGaWxlTG9hZGVyLkRPX05PVF9BTFRFUl9GSUxFX0NPT1JESU5BVEVTKSB7XHJcbiAgICAgICAgICAgICAgICBpbmRpY2VzLnB1c2goaW5kaWNlc0NvdW50LCBpbmRpY2VzQ291bnQgKyAyLCBpbmRpY2VzQ291bnQgKyAxKTtcclxuICAgICAgICAgICAgICAgIGluZGljZXNDb3VudCArPSAzO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaW5kaWNlcy5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ifQ== |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t={597:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.d(o,{default:()=>d});var i={};n.r(i),n.d(i,{STLFileLoader:()=>l});var a={};n.r(a),n.d(a,{STLFileLoader:()=>l});var s=n(597),l=function(){function e(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name="stl",this.extensions={".stl":{isBinary:!0}}}return e.prototype.importMesh=function(e,t,r,n,o){var i;if("string"!=typeof r){if(this._isBinary(r)){var a=new s.Mesh("stlmesh",t);return this._parseBinary(a,r),o&&o.push(a),!0}r=(new TextDecoder).decode(new Uint8Array(r))}for(;i=this.solidPattern.exec(r);){var l=i[1],f=i[3];if(f&&l!=f)return s.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(e&&l)if(e instanceof Array){if(!e.indexOf(l))continue}else if(l!==e)continue;l=l||"stlmesh",a=new s.Mesh(l,t),this._parseASCII(a,i[2]),o&&o.push(a)}return!0},e.prototype.load=function(e,t,r){return this.importMesh(null,e,t,r,null)},e.prototype.loadAssetContainer=function(e,t,r){var n=new s.AssetContainer(e);return e._blockEntityCollection=!0,this.importMesh(null,e,t,r,n.meshes),e._blockEntityCollection=!1,n},e.prototype._isBinary=function(e){var t=new DataView(e);if(t.byteLength<=80)return!1;if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var r=[115,111,108,105,100],n=0;n<5;n++)if(t.getUint8(n)!==r[n])return!0;return!1},e.prototype._parseBinary=function(t,r){for(var n=new DataView(r),o=n.getUint32(80,!0),i=0,a=new Float32Array(3*o*3),l=new Float32Array(3*o*3),f=new Uint32Array(3*o),u=0,d=0;d<o;d++){for(var c=84+50*d,p=n.getFloat32(c,!0),y=n.getFloat32(c+4,!0),h=n.getFloat32(c+8,!0),b=1;b<=3;b++){var m=c+12*b;a[i]=n.getFloat32(m,!0),l[i]=p,e.DO_NOT_ALTER_FILE_COORDINATES?(a[i+1]=n.getFloat32(m+4,!0),a[i+2]=n.getFloat32(m+8,!0),l[i+1]=y,l[i+2]=h):(a[i+2]=n.getFloat32(m+4,!0),a[i+1]=n.getFloat32(m+8,!0),l[i+2]=y,l[i+1]=h),i+=3}e.DO_NOT_ALTER_FILE_COORDINATES?(f[u]=u,f[u+1]=u+2,f[u+2]=u+1,u+=3):(f[u]=u++,f[u]=u++,f[u]=u++)}t.setVerticesData(s.VertexBuffer.PositionKind,a),t.setVerticesData(s.VertexBuffer.NormalKind,l),t.setIndices(f),t.computeWorldMatrix(!0)},e.prototype._parseASCII=function(t,r){for(var n,o=[],i=[],a=[],l=0;n=this.facetsPattern.exec(r);){var f=n[1],u=this.normalPattern.exec(f);if(this.normalPattern.lastIndex=0,u){for(var d=[Number(u[1]),Number(u[5]),Number(u[3])],c=void 0;c=this.vertexPattern.exec(f);)e.DO_NOT_ALTER_FILE_COORDINATES?(o.push(Number(c[1]),Number(c[3]),Number(c[5])),i.push(d[0],d[2],d[1])):(o.push(Number(c[1]),Number(c[5]),Number(c[3])),i.push(d[0],d[1],d[2]));e.DO_NOT_ALTER_FILE_COORDINATES?(a.push(l,l+2,l+1),l+=3):a.push(l++,l++,l++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,t.setVerticesData(s.VertexBuffer.PositionKind,o),t.setVerticesData(s.VertexBuffer.NormalKind,i),t.setIndices(a),t.computeWorldMatrix(!0)},e.DO_NOT_ALTER_FILE_COORDINATES=!1,e}();s.SceneLoader&&s.SceneLoader.RegisterPlugin(new l);var f=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==f)for(var u in i)f.BABYLON[u]||(f.BABYLON[u]=i[u]);const d=a;return o.default})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t={597:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.d(o,{default:()=>d});var i={};n.r(i),n.d(i,{STLFileLoader:()=>l});var s={};n.r(s),n.d(s,{STLFileLoader:()=>l});var a=n(597),l=function(){function e(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name="stl",this.extensions={".stl":{isBinary:!0}}}return e.prototype.importMesh=function(e,t,r,n,o){var i;if("string"!=typeof r){if(this._isBinary(r)){var s=new a.Mesh("stlmesh",t);return this._parseBinary(s,r),o&&o.push(s),!0}r=(new TextDecoder).decode(new Uint8Array(r))}for(;i=this.solidPattern.exec(r);){var l=i[1],f=i[3];if(f&&l!=f)return a.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(e&&l)if(e instanceof Array){if(!e.indexOf(l))continue}else if(l!==e)continue;l=l||"stlmesh",s=new a.Mesh(l,t),this._parseASCII(s,i[2]),o&&o.push(s)}return!0},e.prototype.load=function(e,t,r){return this.importMesh(null,e,t,r,null)},e.prototype.loadAssetContainer=function(e,t,r){var n=new a.AssetContainer(e);return e._blockEntityCollection=!0,this.importMesh(null,e,t,r,n.meshes),e._blockEntityCollection=!1,n},e.prototype._isBinary=function(e){var t=new DataView(e);if(t.byteLength<=80)return!1;if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var r=[115,111,108,105,100],n=0;n<5;n++)if(t.getUint8(n)!==r[n])return!0;return!1},e.prototype._parseBinary=function(t,r){for(var n=new DataView(r),o=n.getUint32(80,!0),i=0,s=new Float32Array(3*o*3),l=new Float32Array(3*o*3),f=new Uint32Array(3*o),u=0,d=0;d<o;d++){for(var p=84+50*d,c=n.getFloat32(p,!0),y=n.getFloat32(p+4,!0),h=n.getFloat32(p+8,!0),b=1;b<=3;b++){var m=p+12*b;s[i]=n.getFloat32(m,!0),l[i]=c,e.DO_NOT_ALTER_FILE_COORDINATES?(s[i+1]=n.getFloat32(m+4,!0),s[i+2]=n.getFloat32(m+8,!0),l[i+1]=y,l[i+2]=h):(s[i+2]=n.getFloat32(m+4,!0),s[i+1]=n.getFloat32(m+8,!0),l[i+2]=y,l[i+1]=h),i+=3}e.DO_NOT_ALTER_FILE_COORDINATES?(f[u]=u,f[u+1]=u+2,f[u+2]=u+1,u+=3):(f[u]=u++,f[u]=u++,f[u]=u++)}t.setVerticesData(a.VertexBuffer.PositionKind,s),t.setVerticesData(a.VertexBuffer.NormalKind,l),t.setIndices(f),t.computeWorldMatrix(!0)},e.prototype._parseASCII=function(t,r){for(var n,o=[],i=[],s=[],l=0;n=this.facetsPattern.exec(r);){var f=n[1],u=this.normalPattern.exec(f);if(this.normalPattern.lastIndex=0,u){for(var d=[Number(u[1]),Number(u[5]),Number(u[3])],p=void 0;p=this.vertexPattern.exec(f);)e.DO_NOT_ALTER_FILE_COORDINATES?(o.push(Number(p[1]),Number(p[3]),Number(p[5])),i.push(d[0],d[2],d[1])):(o.push(Number(p[1]),Number(p[5]),Number(p[3])),i.push(d[0],d[1],d[2]));e.DO_NOT_ALTER_FILE_COORDINATES?(s.push(l,l+2,l+1),l+=3):s.push(l++,l++,l++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,t.setVerticesData(a.VertexBuffer.PositionKind,o),t.setVerticesData(a.VertexBuffer.NormalKind,i),t.setIndices(s),t.computeWorldMatrix(!0)},e.DO_NOT_ALTER_FILE_COORDINATES=!1,e}();(0,a.registerSceneLoaderPlugin)(new l);var f=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==f)for(var u in i)f.BABYLON[u]||(f.BABYLON[u]=i[u]);const d=s;return o.default})())); | ||
//# sourceMappingURL=babylon.stlFileLoader.min.js.map |
{ | ||
"name": "babylonjs-loaders", | ||
"version": "7.20.1", | ||
"version": "7.21.0", | ||
"main": "babylonjs.loaders.js", | ||
@@ -18,4 +18,4 @@ "types": "babylonjs.loaders.module.d.ts", | ||
"dependencies": { | ||
"babylonjs": "^7.20.1", | ||
"babylonjs-gltf2interface": "^7.20.1" | ||
"babylonjs": "^7.21.0", | ||
"babylonjs-gltf2interface": "^7.21.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8649125
52876
Updatedbabylonjs@^7.21.0