babylonjs-loaders 9.6.2 → 9.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))(function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,s)}l((r=r.apply(e,t||[])).next())})}function i(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function s(e,t,n,r){var o={externalResourceFunction:r};return n&&(o.uri="file:"===t?n:t+n),ArrayBuffer.isView(e)?GLTFValidator.validateBytes(e,o):GLTFValidator.validateString(e,o)}function l(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":s(n.data,n.rootUrl,n.fileName,function(t){return new Promise(function(n,r){var o=e.length;e.push({resolve:n,reject:r}),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[n.index].resolve(n.value);break;case"getExternalResource.reject":e[n.index].reject(n.reason)}}}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var u,c,f,h=function(){function e(){}return e.ValidateAsync=function(n,r,o,a){var i=this;return"function"==typeof Worker?new Promise(function(u,c){var f="".concat(s,"(").concat(l,")()"),h=URL.createObjectURL(new Blob([f],{type:"application/javascript"})),d=new Worker(h),p=function(e){d.removeEventListener("error",p),d.removeEventListener("message",m),c(e)},m=function(t){var n=t.data;switch(n.id){case"getExternalResource":a(n.uri).then(function(e){d.postMessage({id:"getExternalResource.resolve",index:n.index,value:e},[e.buffer])},function(e){d.postMessage({id:"getExternalResource.reject",index:n.index,reason:e})});break;case"validate.resolve":d.removeEventListener("error",p),d.removeEventListener("message",m),e._LastResults=n.value,u(n.value),d.terminate();break;case"validate.reject":d.removeEventListener("error",p),d.removeEventListener("message",m),c(n.reason),d.terminate()}};if(d.addEventListener("error",p),d.addEventListener("message",m),d.postMessage({id:"init",url:t.Tools.GetBabylonScriptURL(i.Configuration.url)}),ArrayBuffer.isView(n)){var _=n.slice();d.postMessage({id:"validate",data:_,rootUrl:r,fileName:o},[_.buffer])}else d.postMessage({id:"validate",data:n,rootUrl:r,fileName:o})}):(this._LoadScriptPromise||(this._LoadScriptPromise=t.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then(function(){return s(n,r,o,a)}))},e.Configuration={url:"".concat(t.Tools._DefaultCdnUrl,"/gltf_validator.js")},e._LastResults=null,e}(),d={__proto__:null,GLTFValidation:h},p="Z2xURg",m="gltf",_={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};function g(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}e.GLTFLoaderCoordinateSystemMode=void 0,(u=e.GLTFLoaderCoordinateSystemMode||(e.GLTFLoaderCoordinateSystemMode={}))[u.AUTO=0]="AUTO",u[u.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED",e.GLTFLoaderAnimationStartMode=void 0,(c=e.GLTFLoaderAnimationStartMode||(e.GLTFLoaderAnimationStartMode={}))[c.NONE=0]="NONE",c[c.FIRST=1]="FIRST",c[c.ALL=2]="ALL",e.GLTFLoaderState=void 0,(f=e.GLTFLoaderState||(e.GLTFLoaderState={}))[f.LOADING=0]="LOADING",f[f.READY=1]="READY",f[f.COMPLETE=2]="COMPLETE";var y=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=e.GLTFLoaderAnimationStartMode.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=e.GLTFLoaderCoordinateSystemMode.AUTO,this.createInstances=!0,this.loadAllMaterials=!1,this.loadMorphTargets=!0,this.loadNodeAnimations=!0,this.loadOnlyMaterials=!1,this.loadSkins=!0,this.skipMaterials=!1,this.targetFps=60,this.transparencyAsCoverage=!1,this.useClipPlane=!1,this.useGltfTextureNames=!1,this.useRangeRequests=!1,this.useSRGBBuffers=!0,this.validate=!1,this.useOpenPBR=!1,this.dontUseTransmissionHelper=!1},b=new y,v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.extensionOptions={},t.preprocessUrlAsync=function(e){return Promise.resolve(e)},t}return r(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,y,b,v,T,x,A,C,O,w;e&&(this.alwaysComputeBoundingBox=null!==(t=e.alwaysComputeBoundingBox)&&void 0!==t?t:this.alwaysComputeBoundingBox,this.alwaysComputeSkeletonRootNode=null!==(n=e.alwaysComputeSkeletonRootNode)&&void 0!==n?n:this.alwaysComputeSkeletonRootNode,this.animationStartMode=null!==(r=e.animationStartMode)&&void 0!==r?r:this.animationStartMode,this.capturePerformanceCounters=null!==(o=e.capturePerformanceCounters)&&void 0!==o?o:this.capturePerformanceCounters,this.compileMaterials=null!==(a=e.compileMaterials)&&void 0!==a?a:this.compileMaterials,this.compileShadowGenerators=null!==(i=e.compileShadowGenerators)&&void 0!==i?i:this.compileShadowGenerators,this.coordinateSystemMode=null!==(s=e.coordinateSystemMode)&&void 0!==s?s:this.coordinateSystemMode,this.createInstances=null!==(l=e.createInstances)&&void 0!==l?l:this.createInstances,this.customRootNode=e.customRootNode,this.extensionOptions=null!==(u=e.extensionOptions)&&void 0!==u?u:this.extensionOptions,this.loadAllMaterials=null!==(c=e.loadAllMaterials)&&void 0!==c?c:this.loadAllMaterials,this.loadMorphTargets=null!==(f=e.loadMorphTargets)&&void 0!==f?f:this.loadMorphTargets,this.loadNodeAnimations=null!==(h=e.loadNodeAnimations)&&void 0!==h?h:this.loadNodeAnimations,this.loadOnlyMaterials=null!==(d=e.loadOnlyMaterials)&&void 0!==d?d:this.loadOnlyMaterials,this.loadSkins=null!==(p=e.loadSkins)&&void 0!==p?p:this.loadSkins,this.loggingEnabled=null!==(m=e.loggingEnabled)&&void 0!==m?m:this.loggingEnabled,this.onCameraLoaded=e.onCameraLoaded,this.onMaterialLoaded=e.onMaterialLoaded,this.onMeshLoaded=e.onMeshLoaded,this.onParsed=e.onParsed,this.onSkinLoaded=e.onSkinLoaded,this.onTextureLoaded=e.onTextureLoaded,this.onValidated=e.onValidated,this.preprocessUrlAsync=null!==(_=e.preprocessUrlAsync)&&void 0!==_?_:this.preprocessUrlAsync,this.skipMaterials=null!==(g=e.skipMaterials)&&void 0!==g?g:this.skipMaterials,this.targetFps=null!==(y=e.targetFps)&&void 0!==y?y:this.targetFps,this.transparencyAsCoverage=null!==(b=e.transparencyAsCoverage)&&void 0!==b?b:this.transparencyAsCoverage,this.useClipPlane=null!==(v=e.useClipPlane)&&void 0!==v?v:this.useClipPlane,this.useGltfTextureNames=null!==(T=e.useGltfTextureNames)&&void 0!==T?T:this.useGltfTextureNames,this.useOpenPBR=null!==(x=e.useOpenPBR)&&void 0!==x?x:this.useOpenPBR,this.useRangeRequests=null!==(A=e.useRangeRequests)&&void 0!==A?A:this.useRangeRequests,this.useSRGBBuffers=null!==(C=e.useSRGBBuffers)&&void 0!==C?C:this.useSRGBBuffers,this.validate=null!==(O=e.validate)&&void 0!==O?O:this.validate,this.dontUseTransmissionHelper=null!==(w=e.dontUseTransmissionHelper)&&void 0!==w?w:this.dontUseTransmissionHelper)},t}(y),T=function(n){function a(e){var r=n.call(this)||this;return r.onParsedObservable=new t.Observable,r.onMeshLoadedObservable=new t.Observable,r.onSkinLoadedObservable=new t.Observable,r.onTextureLoadedObservable=new t.Observable,r.onMaterialLoadedObservable=new t.Observable,r.onCameraLoadedObservable=new t.Observable,r.onCompleteObservable=new t.Observable,r.onErrorObservable=new t.Observable,r.onDisposeObservable=new t.Observable,r.onExtensionLoadedObservable=new t.Observable,r.onValidatedObservable=new t.Observable,r._loader=null,r._state=null,r._requests=new Array,r.name=m,r.extensions=_,r.onLoaderStateChangedObservable=new t.Observable,r._logIndentLevel=0,r._loggingEnabled=!1,r._log=r._logDisabled,r._capturePerformanceCounters=!1,r._startPerformanceCounter=r._startPerformanceCounterDisabled,r._endPerformanceCounter=r._endPerformanceCounterDisabled,r.copyFrom(Object.assign(o({},b),e)),r}return r(a,n),Object.defineProperty(a.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),e&&(this._onParsedObserver=this.onParsedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),e&&(this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onSkinLoaded",{set:function(e){this._onSkinLoadedObserver&&this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver),e&&(this._onSkinLoadedObserver=this.onSkinLoadedObservable.add(function(t){return e(t.node,t.skinnedNode)}))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),e&&(this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),e&&(this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),e&&(this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.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(a.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(a.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),a.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()},a.prototype.loadFile=function(e,n,r,o,a,i,s,l){var u=this;if(ArrayBuffer.isView(n))return this._loadBinary(e,n,r,o,s,l),null;this._progressCallback=a;var c=n.name||t.Tools.GetFilename(n);if(i){if(this.useRangeRequests){this.validate&&t.Logger.Warn("glTF validation is not supported when range requests are enabled");var f={abort:function(){},onCompleteObservable:new t.Observable},h={readAsync:function(t,r){return new Promise(function(o,a){u._loadFile(e,n,function(e){o(new Uint8Array(e))},!0,function(e){a(e)},function(e){e.setRequestHeader("Range","bytes=".concat(t,"-").concat(t+r-1))})})},byteLength:0};return this._unpackBinaryAsync(new t.DataReader(h)).then(function(e){f.onCompleteObservable.notifyObservers(f),o(e)},s?function(e){return s(void 0,e)}:void 0),f}return this._loadFile(e,n,function(n){u._validate(e,new Uint8Array(n,0,n.byteLength),r,c),u._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){return g(n,e,t)},byteLength:n.byteLength})).then(function(e){o(e)},s?function(e){return s(void 0,e)}:void 0)},!0,s)}return this._loadFile(e,n,function(t){try{u._validate(e,t,r,c),o({json:u._parseJson(t)})}catch(e){s&&s()}},!1,s)},a.prototype._loadBinary=function(e,n,r,o,a,i){this._validate(e,new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r,i),this._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){return function(e,t,n){try{if(t<0||t>=e.byteLength)throw new RangeError("Offset is out of range.");if(t+n>e.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,n))}catch(e){return Promise.reject(e)}}(n,e,t)},byteLength:n.byteLength})).then(function(e){o(e)},a?function(e){return a(void 0,e)}:void 0)},a.prototype.importMeshAsync=function(e,t,n,r,o,a){var i=this;return Promise.resolve().then(function(){return i.onParsedObservable.notifyObservers(n),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(n),i._loader.importMeshAsync(e,t,null,n,r,o,a)})},a.prototype.loadAsync=function(e,t,n,r,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,n,r,o)})},a.prototype.loadAssetContainerAsync=function(e,n,r,o,a){var i=this;return Promise.resolve().then(function(){i.onParsedObservable.notifyObservers(n),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(n);var s=new t.AssetContainer(e),l=[];i.onMaterialLoadedObservable.add(function(e){l.push(e)});var u=[];i.onTextureLoadedObservable.add(function(e){u.push(e)});var c=[];i.onCameraLoadedObservable.add(function(e){c.push(e)});var f=[];return i.onMeshLoadedObservable.add(function(e){e.morphTargetManager&&f.push(e.morphTargetManager)}),i._loader.importMeshAsync(null,e,s,n,r,o,a).then(function(e){return Array.prototype.push.apply(s.geometries,e.geometries),Array.prototype.push.apply(s.meshes,e.meshes),Array.prototype.push.apply(s.particleSystems,e.particleSystems),Array.prototype.push.apply(s.skeletons,e.skeletons),Array.prototype.push.apply(s.animationGroups,e.animationGroups),Array.prototype.push.apply(s.materials,l),Array.prototype.push.apply(s.textures,u),Array.prototype.push.apply(s.lights,e.lights),Array.prototype.push.apply(s.transformNodes,e.transformNodes),Array.prototype.push.apply(s.cameras,c),Array.prototype.push.apply(s.morphTargetManagers,f),s})})},a.prototype.canDirectLoad=function(e){return function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+p)||e.startsWith("data:;base64,"+p)||e.startsWith("data:application/octet-stream;base64,"+p)||e.startsWith("data:model/gltf-binary;base64,"+p)}(e)},a.prototype.directLoad=function(e,n){if(n.startsWith("base64,"+p)||n.startsWith(";base64,"+p)||n.startsWith("application/octet-stream;base64,"+p)||n.startsWith("model/gltf-binary;base64,"+p)){var r=t.DecodeBase64UrlToBinary(n);return this._validate(e,new Uint8Array(r,0,r.byteLength)),this._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){return g(r,e,t)},byteLength:r.byteLength}))}return this._validate(e,n),Promise.resolve({json:this._parseJson(n)})},a.prototype.createPlugin=function(e){return new a(e[m])},Object.defineProperty(a.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),a.prototype.whenCompleteAsync=function(){var e=this;return new Promise(function(t,n){e.onCompleteObservable.addOnce(function(){t()}),e.onErrorObservable.addOnce(function(e){n(e)})})},a.prototype._setState=function(t){this._state!==t&&(this._state=t,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(e.GLTFLoaderState[this._state]))},a.prototype._loadFile=function(e,t,n,r,o,a){var i=this,s=e._loadFile(t,n,function(e){i._onProgress(e,s)},!0,r,o,a);return s.onCompleteObservable.add(function(){s._lengthComputable=!0,s._total=s._loaded}),this._requests.push(s),s},a.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var n=!0,r=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;n=n&&s._lengthComputable,r+=s._loaded,o+=s._total}this._progressCallback({lengthComputable:n,loaded:r,total:n?o:0})}},a.prototype._validate=function(e,n,r,o){var a=this;void 0===r&&(r=""),void 0===o&&(o=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),h.ValidateAsync(n,r,o,function(t){return a.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){a._endPerformanceCounter("Validate JSON"),a.onValidatedObservable.notifyObservers(e),a.onValidatedObservable.clear()},function(e){a._endPerformanceCounter("Validate JSON"),t.Tools.Warn("Failed to validate: ".concat(e.message)),a.onValidatedObservable.clear()}))},a.prototype._getLoader=function(e){var t=e.json.asset||{};this._log("Asset version: ".concat(t.version)),t.minVersion&&this._log("Asset minimum version: ".concat(t.minVersion)),t.generator&&this._log("Asset generator: ".concat(t.generator));var n=a._parseVersion(t.version);if(!n)throw new Error("Invalid version: "+t.version);if(void 0!==t.minVersion){var r=a._parseVersion(t.minVersion);if(!r)throw new Error("Invalid minimum version: "+t.minVersion);if(a._compareVersion(r,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+t.minVersion)}var o={1:a._CreateGLTF1Loader,2:a._CreateGLTF2Loader}[n.major];if(!o)throw new Error("Unsupported version: "+t.version);return o(this)},a.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},a.prototype._unpackBinaryAsync=function(e){var n=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then(function(){var r=e.readUint32();if(1179937895!==r)throw new t.RuntimeError("Unexpected magic: "+r,t.ErrorCodes.GLTFLoaderUnexpectedMagicError);var o=e.readUint32();n.loggingEnabled&&n._log("Binary version: ".concat(o));var a,i=e.readUint32();switch(n.useRangeRequests||i===e.buffer.byteLength||t.Logger.Warn("Length in header does not match actual data length: ".concat(i," != ").concat(e.buffer.byteLength)),o){case 1:a=n._unpackBinaryV1Async(e,i);break;case 2:a=n._unpackBinaryV2Async(e,i);break;default:throw new Error("Unsupported version: "+o)}return n._endPerformanceCounter("Unpack Binary"),a})},a.prototype._unpackBinaryV1Async=function(e,t){var n=e.readUint32(),r=e.readUint32();if(0!==r)throw new Error("Unexpected content format: ".concat(r));var o=t-e.byteOffset,a={json:this._parseJson(e.readString(n)),bin:null};if(0!==o){var i=e.byteOffset;a.bin={readAsync:function(t,n){return e.buffer.readAsync(i+t,n)},byteLength:o}}return Promise.resolve(a)},a.prototype._unpackBinaryV2Async=function(e,t){var n=this,r=1313821514,o=e.readUint32();if(e.readUint32()!==r)throw new Error("First chunk format is not JSON");return e.byteOffset+o===t?e.loadAsync(o).then(function(){return{json:n._parseJson(e.readString(o)),bin:null}}):e.loadAsync(o+8).then(function(){var a={json:n._parseJson(e.readString(o)),bin:null},i=function(){var n=e.readUint32();switch(e.readUint32()){case r:throw new Error("Unexpected JSON chunk");case 5130562:var o=e.byteOffset;a.bin={readAsync:function(t,n){return e.buffer.readAsync(o+t,n)},byteLength:n},e.skipBytes(n);break;default:e.skipBytes(n)}return e.byteOffset!==t?e.loadAsync(8).then(i):Promise.resolve(a)};return i()})},a._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},a._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},a.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},a.prototype._logClose=function(){--this._logIndentLevel},a.prototype._logEnabled=function(e){var n=a._logSpaces.substring(0,2*this._logIndentLevel);t.Logger.Log("".concat(n).concat(e))},a.prototype._logDisabled=function(e){},a.prototype._startPerformanceCounterEnabled=function(e){t.Tools.StartPerformanceCounter(e)},a.prototype._startPerformanceCounterDisabled=function(e){},a.prototype._endPerformanceCounterEnabled=function(e){t.Tools.EndPerformanceCounter(e)},a.prototype._endPerformanceCounterDisabled=function(e){},a.IncrementalLoading=!0,a.HomogeneousCoordinates=!1,a._logSpaces=" ",a}(v);t.RegisterSceneLoaderPlugin(new T);var x,A,C,O,w,M,E,R,L={__proto__:null,GLTFFileLoader:T,get GLTFLoaderAnimationStartMode(){return e.GLTFLoaderAnimationStartMode},get GLTFLoaderCoordinateSystemMode(){return e.GLTFLoaderCoordinateSystemMode},GLTFLoaderDefaultOptions:b,get GLTFLoaderState(){return e.GLTFLoaderState}},P="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==P){for(var S in P.BABYLON=P.BABYLON||{},L)P.BABYLON[S]=L[S];for(var S in d)P.BABYLON[S]=d[S]}!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"}(x||(x={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(A||(A={})),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"}(C||(C={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(O||(O={})),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"}(w||(w={})),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"}(M||(M={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(E||(E={})),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"}(R||(R={}));var F,N=function(){function e(){}return e.SetMatrix=function(e,n,r,o,a){var i=null;if("MODEL"===r.semantic?i=n.getWorldMatrix():"PROJECTION"===r.semantic?i=e.getProjectionMatrix():"VIEW"===r.semantic?i=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===r.semantic?i=t.Matrix.Transpose(n.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===r.semantic?i=n.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===r.semantic?i=n.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===r.semantic?i=n.getWorldMatrix().invert():"VIEWINVERSE"===r.semantic?i=e.getViewMatrix().invert():"PROJECTIONINVERSE"===r.semantic?i=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===r.semantic?i=n.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===r.semantic?i=n.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===r.semantic&&(i=t.Matrix.Transpose(n.getWorldMatrix().invert())),i)switch(r.type){case C.FLOAT_MAT2:a.setMatrix2x2(o,t.Matrix.GetAsMatrix2x2(i));break;case C.FLOAT_MAT3:a.setMatrix3x3(o,t.Matrix.GetAsMatrix3x3(i));break;case C.FLOAT_MAT4:a.setMatrix(o,i)}},e.SetUniform=function(e,n,r,o){switch(o){case C.FLOAT:return e.setFloat(n,r),!0;case C.FLOAT_VEC2:return e.setVector2(n,t.Vector2.FromArray(r)),!0;case C.FLOAT_VEC3:return e.setVector3(n,t.Vector3.FromArray(r)),!0;case C.FLOAT_VEC4:return e.setVector4(n,t.Vector4.FromArray(r)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case O.CLAMP_TO_EDGE:return t.Texture.CLAMP_ADDRESSMODE;case O.MIRRORED_REPEAT:return t.Texture.MIRROR_ADDRESSMODE;case O.REPEAT:default:return t.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 w.LINEAR:case w.LINEAR_MIPMAP_NEAREST:case w.LINEAR_MIPMAP_LINEAR:return t.Texture.TRILINEAR_SAMPLINGMODE;case w.NEAREST:case w.NEAREST_MIPMAP_NEAREST:return t.Texture.NEAREST_SAMPLINGMODE;default:return t.Texture.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,n,r,o){n=t.byteOffset+n;var a=e.loadedBufferViews[t.buffer];if(n+r>a.byteLength)throw new Error("Buffer access is out of range");var i=a.buffer;switch(n+=a.byteOffset,o){case x.BYTE:return new Int8Array(i,n,r);case x.UNSIGNED_BYTE:return new Uint8Array(i,n,r);case x.SHORT:return new Int16Array(i,n,r);case x.UNSIGNED_SHORT:return new Uint16Array(i,n,r);default:return new Float32Array(i,n,r)}},e.GetBufferFromAccessor=function(t,n){var r=t.bufferViews[n.bufferView],o=n.count*e.GetByteStrideFromType(n);return e.GetBufferFromBufferView(t,r,n.byteOffset,o,n.componentType)},e.DecodeBufferToText=function(e){for(var t="",n=e.byteLength,r=0;r<n;++r)t+=String.fromCharCode(e[r]);return t},e.GetDefaultMaterial=function(n){if(!e._DefaultMaterial){t.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"),t.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 t.ShaderMaterial("GLTFDefaultMaterial",n,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},r),e._DefaultMaterial.setColor4("u_emission",new t.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"}(F||(F={}));var I=function(){function e(e){this._pos=0,this.currentToken=F.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 F.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=F.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=F.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}(),k=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],B=["world","view","projection","worldView","worldViewProjection","mBones"],G=["translation","rotation","scale"],V=["position","rotationQuaternion","scaling"],D=function(e,t,n){for(var r in e){var o=e[r];n[t][r]=o}},H=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},j=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},K=function(e){var n;if(e.translation||e.rotation||e.scale){var r=t.Vector3.FromArray(e.scale||[1,1,1]),o=t.Quaternion.FromArray(e.rotation||[0,0,0,1]),a=t.Vector3.FromArray(e.translation||[0,0,0]);n=t.Matrix.Compose(r,o,a)}else n=t.Matrix.FromArray(e.matrix);return n},W=function(e,n,r,o){for(var a=0;a<o.bones.length;a++)if(o.bones[a].name===r)return o.bones[a];var i=e.nodes;for(var s in i){var l=i[s];if(l.jointName){var u=l.children;for(a=0;a<u.length;a++){var c=e.nodes[u[a]];if(c.jointName&&c.jointName===r){var f=K(l),h=new t.Bone(l.name||"",o,W(e,n,l.jointName,o),f);return h.id=s,h}}}}return null},U=function(e,t){for(var n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.node.children.length;o++)if(r.node.children[o]===t)return r.bone;return null},z=function(e,t){var n=e.nodes,r=n[t];if(r)return{node:r,id:t};for(var o in n)if((r=n[o]).jointName===t)return{node:r,id:o};return null},q=function(e,t){for(var n=0;n<e.jointNames.length;n++)if(e.jointNames[n]===t)return!0;return!1},Y=function(e,n,r,o,a){if(a||(e.scene._blockEntityCollection=!!e.assetContainer,(a=new t.Mesh(n.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,a.id=o),!n.babylonNode)return a;for(var i,s=[],l=null,u=[],c=[],f=[],h=[],d=0;d<r.length;d++){var p=r[d];if(L=e.meshes[p])for(var m=0;m<L.primitives.length;m++){var _=new t.VertexData,g=L.primitives[m];g.mode;var y=g.attributes,b=void 0,v=void 0;for(var x in y)if(b=e.accessors[y[x]],v=N.GetBufferFromAccessor(e,b),"NORMAL"===x)_.normals=new Float32Array(v.length),_.normals.set(v);else if("POSITION"===x){if(T.HomogeneousCoordinates){_.positions=new Float32Array(v.length-v.length/4);for(var A=0;A<v.length;A+=4)_.positions[A]=v[A],_.positions[A+1]=v[A+1],_.positions[A+2]=v[A+2]}else _.positions=new Float32Array(v.length),_.positions.set(v);c.push(_.positions.length)}else if(-1!==x.indexOf("TEXCOORD_")){var C=Number(x.split("_")[1]),O=t.VertexBuffer.UVKind+(0===C?"":C+1),w=new Float32Array(v.length);w.set(v),H(w),_.set(w,O)}else"JOINT"===x?(_.matricesIndices=new Float32Array(v.length),_.matricesIndices.set(v)):"WEIGHT"===x?(_.matricesWeights=new Float32Array(v.length),_.matricesWeights.set(v)):"COLOR"===x&&(_.colors=new Float32Array(v.length),_.colors.set(v));if(b=e.accessors[g.indices])v=N.GetBufferFromAccessor(e,b),_.indices=new Int32Array(v.length),_.indices.set(v),h.push(_.indices.length);else{var M=[];for(A=0;A<_.positions.length/3;A++)M.push(A);_.indices=new Int32Array(M),h.push(_.indices.length)}l?l.merge(_):l=_;var E=e.scene.getMaterialById(g.material);s.push(null===E?N.GetDefaultMaterial(e.scene):E),u.push(0===u.length?0:u[u.length-1]+c[c.length-2]),f.push(0===f.length?0:f[f.length-1]+h[h.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,s.length>1?(i=new t.MultiMaterial("multimat"+o,e.scene)).subMaterials=s:i=new t.StandardMaterial("multimat"+o,e.scene),1===s.length&&(i=s[0]),i._parentContainer=e.assetContainer,a.material||(a.material=i),new t.Geometry(o,e.scene,l,!1,a),a.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,a.subMeshes=[];var R=0;for(d=0;d<r.length;d++){var L;if(p=r[d],L=e.meshes[p])for(m=0;m<L.primitives.length;m++)L.primitives[m].mode,t.SubMesh.AddToMesh(R,u[R],c[R],f[R],h[R],a,a,!0),R++}return a},X=function(e,t,n,r){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=n),e.scaling&&(e.scaling=r)},Q=function(e,n,r){var o=null;if(e.importOnlyMeshes&&(n.skin||n.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(n.name||""))return null;if(n.skin){if(n.meshes){var a=e.skins[n.skin];(i=Y(e,n,n.meshes,r,n.babylonNode)).skeleton=e.scene.getLastSkeletonById(n.skin),null===i.skeleton&&(i.skeleton=function(e,n,r,o){if(o||(o=new t.Skeleton(n.name||"","",e.scene)),!n.babylonSkeleton)return o;var a=[],i=[];!function(e,n,r,o){for(var a in e.nodes){var i=e.nodes[a],s=a;if(i.jointName&&!q(r,i.jointName)){var l=K(i),u=new t.Bone(i.name||"",n,null,l);u.id=s,o.push({bone:u,node:i,id:s})}}for(var c=0;c<o.length;c++)for(var f=o[c],h=f.node.children,d=0;d<h.length;d++){for(var p=null,m=0;m<o.length;m++)if(o[m].id===h[d]){p=o[m];break}p&&(p.bone._parent=f.bone,f.bone.children.push(p.bone))}}(e,o,n,a),o.bones=[];for(var s=0;s<n.jointNames.length;s++)if(v=z(e,n.jointNames[s])){var l=v.node;if(l){var u=v.id,c=e.scene.getBoneById(u);if(c)o.bones.push(c);else{for(var f=void 0,h=null,d=0;d<s;d++){var p=z(e,n.jointNames[d]);if(p){var m=p.node;if(m){var _=m.children;if(_){f=!1;for(var g=0;g<_.length;g++)if(_[g]===u){h=W(e,n,n.jointNames[d],o),f=!0;break}if(f)break}}else t.Tools.Warn("Joint named "+n.jointNames[d]+" does not exist when looking for parent")}}var y=K(l);!h&&a.length>0&&(h=U(a,u))&&-1===i.indexOf(h)&&i.push(h),new t.Bone(l.jointName||"",o,h,y).id=u}}else t.Tools.Warn("Joint named "+n.jointNames[s]+" does not exist")}var b=o.bones;for(o.bones=[],s=0;s<n.jointNames.length;s++){var v;if(v=z(e,n.jointNames[s]))for(d=0;d<b.length;d++)if(b[d].id===v.id){o.bones.push(b[d]);break}}for(o.prepare(),s=0;s<i.length;s++)o.bones.push(i[s]);return o}(e,a,0,a.babylonSkeleton),a.babylonSkeleton||(a.babylonSkeleton=i.skeleton)),o=i}}else if(n.meshes){var i;o=i=Y(e,n,n.mesh?[n.mesh]:n.meshes,r,n.babylonNode)}else if(!n.light||n.babylonNode||e.importOnlyMeshes){if(n.camera&&!n.babylonNode&&!e.importOnlyMeshes){var s=e.cameras[n.camera];if(s){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===s.type){var l=new t.FreeCamera(n.camera,t.Vector3.Zero(),e.scene,!1);l.name=n.name||"",l.mode=t.Camera.ORTHOGRAPHIC_CAMERA,l.attachControl(),o=l,l._parentContainer=e.assetContainer}else if("perspective"===s.type){var u=s[s.type],c=new t.FreeCamera(n.camera,t.Vector3.Zero(),e.scene,!1);c.name=n.name||"",c.attachControl(),u.aspectRatio||(u.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),u.znear&&u.zfar&&(c.maxZ=u.zfar,c.minZ=u.znear),o=c,c._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var f=e.lights[n.light];if(f)if("ambient"===f.type){var h=f[f.type],d=new t.HemisphericLight(n.light,t.Vector3.Zero(),e.scene);d.name=n.name||"",h.color&&(d.diffuse=t.Color3.FromArray(h.color)),o=d}else if("directional"===f.type){var p=f[f.type],m=new t.DirectionalLight(n.light,t.Vector3.Zero(),e.scene);m.name=n.name||"",p.color&&(m.diffuse=t.Color3.FromArray(p.color)),o=m}else if("point"===f.type){var _=f[f.type],g=new t.PointLight(n.light,t.Vector3.Zero(),e.scene);g.name=n.name||"",_.color&&(g.diffuse=t.Color3.FromArray(_.color)),o=g}else if("spot"===f.type){var y=f[f.type],b=new t.SpotLight(n.light,t.Vector3.Zero(),t.Vector3.Zero(),0,0,e.scene);b.name=n.name||"",y.color&&(b.diffuse=t.Color3.FromArray(y.color)),y.fallOfAngle&&(b.angle=y.fallOfAngle),y.fallOffExponent&&(b.exponent=y.fallOffExponent),o=b}}if(!n.jointName){if(n.babylonNode)return n.babylonNode;if(null===o){e.scene._blockEntityCollection=!!e.assetContainer;var v=new t.Mesh(n.name||"",e.scene);v._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,n.babylonNode=v,o=v}}if(null!==o){if(n.matrix&&o instanceof t.Mesh)!function(e,n){if(n.matrix){var r=new t.Vector3(0,0,0),o=new t.Quaternion,a=new t.Vector3(0,0,0);t.Matrix.FromArray(n.matrix).decompose(a,o,r),X(e,r,o,a)}else n.translation&&n.rotation&&n.scale&&X(e,t.Vector3.FromArray(n.translation),t.Quaternion.FromArray(n.rotation),t.Vector3.FromArray(n.scale));e.computeWorldMatrix(!0)}(o,n);else{var T=n.translation||[0,0,0],x=n.rotation||[0,0,0,1],A=n.scale||[1,1,1];X(o,t.Vector3.FromArray(T),t.Quaternion.FromArray(x),t.Vector3.FromArray(A))}o.updateCache(!0),n.babylonNode=o}return o},Z=function(e,t,n,r){void 0===r&&(r=!1);var o=e.nodes[t],a=null;if(r=!(e.importOnlyMeshes&&!r&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&r&&null!==(a=Q(e,o,t))&&(a.id=t,a.parent=n),o.children)for(var i=0;i<o.children.length;i++)Z(e,o.children[i],a,r)},J=function(e){var n=e.currentScene;if(n)for(var r=0;r<n.nodes.length;r++)Z(e,n.nodes[r],null);else for(var o in e.scenes)for(n=e.scenes[o],r=0;r<n.nodes.length;r++)Z(e,n.nodes[r],null);for(function(e){for(var n in e.animations){var r=e.animations[n];if(r.channels&&r.samplers)for(var o=null,a=0;a<r.channels.length;a++){var i=r.channels[a],s=r.samplers[i.sampler];if(s){var l=void 0,u=void 0;r.parameters?(l=r.parameters[s.input],u=r.parameters[s.output]):(l=s.input,u=s.output);var c=N.GetBufferFromAccessor(e,e.accessors[l]),f=N.GetBufferFromAccessor(e,e.accessors[u]),h=i.target.id,d=e.scene.getNodeById(h);if(null===d&&(d=e.scene.getNodeByName(h)),null!==d){var p=d instanceof t.Bone,m=i.target.path,_=G.indexOf(m);-1!==_&&(m=V[_]);var g=t.Animation.ANIMATIONTYPE_MATRIX;p||("rotationQuaternion"===m?(g=t.Animation.ANIMATIONTYPE_QUATERNION,d.rotationQuaternion=new t.Quaternion):g=t.Animation.ANIMATIONTYPE_VECTOR3);var y=null,b=[],v=0,T=!1;p&&o&&o.getKeys().length===c.length&&(y=o,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,y=new t.Animation(n,p?"_matrix":m,1,g,t.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var x=0;x<c.length;x++){var A=void 0;if("rotationQuaternion"===m?(A=t.Quaternion.FromArray([f[v],f[v+1],f[v+2],f[v+3]]),v+=4):(A=t.Vector3.FromArray([f[v],f[v+1],f[v+2]]),v+=3),p){var C=d,O=t.Vector3.Zero(),w=new t.Quaternion,M=t.Vector3.Zero(),E=C.getBaseMatrix();T&&o&&(E=o.getKeys()[x].value),E.decompose(M,w,O),"position"===m?O=A:"rotationQuaternion"===m?w=A:M=A,A=t.Matrix.Compose(M,w,O)}T?o&&(o.getKeys()[x].value=A):b.push({frame:c[x],value:A})}!T&&y&&(y.setKeys(b),d.animations.push(y)),o=y,e.scene.stopAnimation(d),e.scene.beginAnimation(d,0,c[c.length-1],!0,1)}else t.Tools.Warn("Creating animation named "+n+". But cannot find node named "+h+" to attach to")}}}}(e),r=0;r<e.scene.skeletons.length;r++){var a=e.scene.skeletons[r];e.scene.beginAnimation(a,0,Number.MAX_VALUE,!0,1)}},$=function(e,t,n){for(var r in t.uniforms){var o=t.uniforms[r],a=t.parameters[o];if(e.currentIdentifier===r&&a.semantic&&!a.source&&!a.node){var i=k.indexOf(a.semantic);if(-1!==i)return delete n[r],B[i]}}return e.currentIdentifier},ee=function(e){for(var t in e.materials)re.LoadMaterialAsync(e,t,function(){},function(){})},te=function(){function e(){}return e.CreateRuntime=function(e,t,n){var r={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:n,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&D(e.extensions,"extensions",r),e.extensionsUsed&&D(e.extensionsUsed,"extensionsUsed",r),e.buffers&&function(e,t){for(var n in e){var r=e[n];t.buffers[n]=r,t.buffersCount++}}(e.buffers,r),e.bufferViews&&D(e.bufferViews,"bufferViews",r),e.accessors&&D(e.accessors,"accessors",r),e.meshes&&D(e.meshes,"meshes",r),e.lights&&D(e.lights,"lights",r),e.cameras&&D(e.cameras,"cameras",r),e.nodes&&D(e.nodes,"nodes",r),e.images&&D(e.images,"images",r),e.textures&&D(e.textures,"textures",r),e.shaders&&function(e,t){for(var n in e){var r=e[n];t.shaders[n]=r,t.shaderscount++}}(e.shaders,r),e.programs&&D(e.programs,"programs",r),e.samplers&&D(e.samplers,"samplers",r),e.techniques&&D(e.techniques,"techniques",r),e.materials&&D(e.materials,"materials",r),e.animations&&D(e.animations,"animations",r),e.skins&&D(e.skins,"skins",r),e.scenes&&(r.scenes=e.scenes),e.scene&&e.scenes&&(r.currentScene=e.scenes[e.scene]),r},e.LoadBufferAsync=function(e,n,r,o,a){var i=e.buffers[n];t.Tools.IsBase64(i.uri)?setTimeout(function(){return r(new Uint8Array(t.Tools.DecodeBase64(i.uri)))}):t.Tools.LoadFile(e.rootUrl+i.uri,function(e){return r(new Uint8Array(e))},a,void 0,!0,function(e){e&&o(e.status+" "+e.statusText)})},e.LoadTextureBufferAsync=function(e,n,r,o){var a=e.textures[n];if(a&&a.source)if(a.babylonTexture)r(null);else{var i=e.images[a.source];t.Tools.IsBase64(i.uri)?setTimeout(function(){return r(new Uint8Array(t.Tools.DecodeBase64(i.uri)))}):t.Tools.LoadFile(e.rootUrl+i.uri,function(e){return r(new Uint8Array(e))},void 0,void 0,!0,function(e){e&&o(e.status+" "+e.statusText)})}else o("")},e.CreateTextureAsync=function(e,n,r,o){var a=e.textures[n];if(a.babylonTexture)o(a.babylonTexture);else{var i=e.samplers[a.sampler],s=i.minFilter===w.NEAREST_MIPMAP_NEAREST||i.minFilter===w.NEAREST_MIPMAP_LINEAR||i.minFilter===w.LINEAR_MIPMAP_NEAREST||i.minFilter===w.LINEAR_MIPMAP_LINEAR,l=t.Texture.BILINEAR_SAMPLINGMODE,u=null==r?new Blob:new Blob([t.GetBlobBufferSource(r)]),c=URL.createObjectURL(u),f=function(){return URL.revokeObjectURL(c)},h=new t.Texture(c,e.scene,!s,!0,l,f,f);void 0!==i.wrapS&&(h.wrapU=N.GetWrapMode(i.wrapS)),void 0!==i.wrapT&&(h.wrapV=N.GetWrapMode(i.wrapT)),h.name=n,a.babylonTexture=h,o(h)}},e.LoadShaderStringAsync=function(e,n,r,o){var a=e.shaders[n];if(t.Tools.IsBase64(a.uri)){var i=atob(a.uri.split(",")[1]);r&&r(i)}else t.Tools.LoadFile(e.rootUrl+a.uri,r,void 0,void 0,!1,function(e){e&&o&&o(e.status+" "+e.statusText)})},e.LoadMaterialAsync=function(e,n,r,o){var a=e.materials[n];if(a.technique){var i=e.techniques[a.technique];if(!i){e.scene._blockEntityCollection=!!e.assetContainer;var s=new t.StandardMaterial(n,e.scene);return s._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,s.diffuseColor=new t.Color3(.5,.5,.5),s.sideOrientation=t.Material.CounterClockWiseSideOrientation,void r(s)}var l=e.programs[i.program],u=i.states,c=t.Effect.ShadersStore[l.vertexShader+"VertexShader"],f=t.Effect.ShadersStore[l.fragmentShader+"PixelShader"],h="",d="",p=new I(c),m=new I(f),_={},g=[],y=[],b=[];for(var v in i.uniforms){var T=i.uniforms[v],x=i.parameters[T];if(_[v]=x,!x.semantic||x.node||x.source)x.type===C.SAMPLER_2D?b.push(v):g.push(v);else{var A=k.indexOf(x.semantic);-1!==A?(g.push(B[A]),delete _[v]):g.push(v)}}for(var O in i.attributes){var w=i.attributes[O];if((P=i.parameters[w]).semantic){var M=j(P);M&&y.push(M)}}for(;!p.isEnd()&&p.getNextToken();)if(p.currentToken===F.IDENTIFIER){var L=!1;for(var O in i.attributes){w=i.attributes[O];var P=i.parameters[w];if(p.currentIdentifier===O&&P.semantic){h+=j(P),L=!0;break}}L||(h+=$(p,i,_))}else h+=p.currentString;for(;!m.isEnd()&&m.getNextToken();)m.currentToken===F.IDENTIFIER?d+=$(m,i,_):d+=m.currentString;var S={vertex:l.vertexShader+n,fragment:l.fragmentShader+n},G={attributes:y,uniforms:g,samplers:b,needAlphaBlending:u&&u.enable&&-1!==u.enable.indexOf(3042)};t.Effect.ShadersStore[l.vertexShader+n+"VertexShader"]=h,t.Effect.ShadersStore[l.fragmentShader+n+"PixelShader"]=d;var V=new t.ShaderMaterial(n,e.scene,S,G);if(V.onError=function(e,t,n){return function(r,o){t.dispose(!0),n("Cannot compile program named "+e.name+". Error: "+o+". Default material will be applied")}}(l,V,o),V.onCompiled=function(e,t,n,r,o,a){return function(i){!function(e,t,n,r,o){var a=r.values||n.parameters,i=n.uniforms,s=function(n){var s=o[n],l=s.type,u=a[i[n]];if(void 0===u&&(u=s.value),!u)return"continue";var c=function(e){return function(n){s.value&&e&&(t.setTexture(e,n),delete o[e])}};l===C.SAMPLER_2D?re.LoadTextureAsync(e,r.values?u:s.value,c(n),function(){return c(null)}):s.value&&N.SetUniform(t,n,r.values?u:s.value,l)&&delete o[n]};for(var l in o)s(l)}(e,t,n,r,o),t.onBind=function(i){!function(e,t,n,r,o,a,i){var s=a.values||o.parameters;for(var l in n){var u=n[l],c=u.type;if(c===C.FLOAT_MAT2||c===C.FLOAT_MAT3||c===C.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;N.SetMatrix(t.scene,f,u,l,r.getEffect())}}else N.SetMatrix(t.scene,e,u,l,r.getEffect());else{var h=s[o.uniforms[l]];if(!h)continue;if(c===C.SAMPLER_2D){var d=t.textures[a.values?h:u.value].babylonTexture;if(null==d)continue;r.getEffect().setTexture(l,d)}else N.SetUniform(r.getEffect(),l,h,c)}}i(r)}(i,e,o,t,n,r,a)}}}(e,V,i,a,_,r),V.sideOrientation=t.Material.CounterClockWiseSideOrientation,u&&u.functions){var D=u.functions;D.cullFace&&D.cullFace[0]!==E.BACK&&(V.backFaceCulling=!1);var H=D.blendFuncSeparate;H&&(H[0]===R.SRC_ALPHA&&H[1]===R.ONE_MINUS_SRC_ALPHA&&H[2]===R.ONE&&H[3]===R.ONE?V.alphaMode=t.Constants.ALPHA_COMBINE:H[0]===R.ONE&&H[1]===R.ONE&&H[2]===R.ZERO&&H[3]===R.ONE?V.alphaMode=t.Constants.ALPHA_ONEONE:H[0]===R.SRC_ALPHA&&H[1]===R.ONE&&H[2]===R.ZERO&&H[3]===R.ONE?V.alphaMode=t.Constants.ALPHA_ADD:H[0]===R.ZERO&&H[1]===R.ONE_MINUS_SRC_COLOR&&H[2]===R.ONE&&H[3]===R.ONE?V.alphaMode=t.Constants.ALPHA_SUBTRACT:H[0]===R.DST_COLOR&&H[1]===R.ZERO&&H[2]===R.ONE&&H[3]===R.ONE?V.alphaMode=t.Constants.ALPHA_MULTIPLY:H[0]===R.SRC_ALPHA&&H[1]===R.ONE_MINUS_SRC_COLOR&&H[2]===R.ONE&&H[3]===R.ONE&&(V.alphaMode=t.Constants.ALPHA_MAXIMIZED))}}else o&&o("No technique found.")},e}(),ne=function(){function e(){}return e.RegisterExtension=function(n){e.Extensions[n.name]?t.Tools.Error('Tool with the same name "'+n.name+'" already exists'):e.Extensions[n.name]=n},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,n,r,o,a,i,s,l){var u=this;return n.useRightHandedSystem=!0,re.LoadRuntimeAsync(n,r,o,function(n){n.assetContainer=a,n.importOnlyMeshes=!0,""===e?n.importMeshesNames=[]:"string"==typeof e?n.importMeshesNames=[e]:!e||e instanceof Array?(n.importMeshesNames=[],t.Tools.Warn("Argument meshesNames must be of type string or string[]")):n.importMeshesNames=[e],u._createNodes(n);var r=[],o=[];for(var s in n.nodes){var l=n.nodes[s];l.babylonNode instanceof t.AbstractMesh&&r.push(l.babylonNode)}for(var c in n.skins){var f=n.skins[c];f.babylonSkeleton instanceof t.Skeleton&&o.push(f.babylonSkeleton)}u._loadBuffersAsync(n,function(){u._loadShadersAsync(n,function(){ee(n),J(n),!T.IncrementalLoading&&i&&i(r,o)})}),T.IncrementalLoading&&i&&i(r,o)},l),!0},e.prototype.importMeshAsync=function(e,t,n,r,o,a){var i=this;return new Promise(function(s,l){i._importMeshAsync(e,t,r,o,n,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,n,r,o,a){var i=this;e.useRightHandedSystem=!0,re.LoadRuntimeAsync(e,t,n,function(e){re.LoadRuntimeExtensionsAsync(e,function(){i._createNodes(e),i._loadBuffersAsync(e,function(){i._loadShadersAsync(e,function(){ee(e),J(e),T.IncrementalLoading||r()})}),T.IncrementalLoading&&r()},a)},a)},e.prototype.loadAsync=function(e,t,n,r){return a(this,void 0,void 0,function(){var o=this;return i(this,function(a){switch(a.label){case 0:return[4,new Promise(function(a,i){o._loadAsync(e,t,n,function(){a()},r,function(e){i(new Error(e))})})];case 1:return[2,a.sent()]}})})},e.prototype._loadShadersAsync=function(e,n){var r=!1,o=function(r,o){re.LoadShaderStringAsync(e,r,function(a){a instanceof ArrayBuffer||(e.loadedShaderCount++,a&&(t.Effect.ShadersStore[r+(o.type===A.VERTEX?"VertexShader":"PixelShader")]=a),e.loadedShaderCount===e.shaderscount&&n())},function(){t.Tools.Error("Error when loading shader program named "+r+" located at "+o.uri)})};for(var a in e.shaders){r=!0;var i=e.shaders[a];i?o.bind(this,a,i)():t.Tools.Error("No shader named: "+a)}r||n()},e.prototype._loadBuffersAsync=function(e,n){var r=!1,o=function(r,o){re.LoadBufferAsync(e,r,function(a){e.loadedBufferCount++,a&&(a.byteLength!=e.buffers[r].byteLength&&t.Tools.Error("Buffer named "+r+" is length "+a.byteLength+". Expected: "+o.byteLength),e.loadedBufferViews[r]=a),e.loadedBufferCount===e.buffersCount&&n()},function(){t.Tools.Error("Error when loading buffer named "+r+" located at "+o.uri)})};for(var a in e.buffers){r=!0;var i=e.buffers[a];i?o.bind(this,a,i)():t.Tools.Error("No buffer named: "+a)}r||n()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)Z(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)Z(e,t.nodes[n],null)},e.Extensions={},e}(),re=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,n,r,o){return!1},e.prototype.loadRuntimeExtensionsAsync=function(e,t,n){return!1},e.prototype.loadBufferAsync=function(e,t,n,r,o){return!1},e.prototype.loadTextureBufferAsync=function(e,t,n,r){return!1},e.prototype.createTextureAsync=function(e,t,n,r,o){return!1},e.prototype.loadShaderStringAsync=function(e,t,n,r){return!1},e.prototype.loadMaterialAsync=function(e,t,n,r){return!1},e.LoadRuntimeAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.loadRuntimeAsync(t,n,r,o,a)},function(){setTimeout(function(){o&&o(te.CreateRuntime(n.json,t,r))})})},e.LoadRuntimeExtensionsAsync=function(t,n,r){e._ApplyExtensions(function(e){return e.loadRuntimeExtensionsAsync(t,n,r)},function(){setTimeout(function(){n()})})},e.LoadBufferAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.loadBufferAsync(t,n,r,o,a)},function(){te.LoadBufferAsync(t,n,r,o,a)})},e.LoadTextureAsync=function(t,n,r,o){e._LoadTextureBufferAsync(t,n,function(a){a&&e._CreateTextureAsync(t,n,a,r,o)},o)},e.LoadShaderStringAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadShaderStringAsync(t,n,r,o)},function(){te.LoadShaderStringAsync(t,n,r,o)})},e.LoadMaterialAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadMaterialAsync(t,n,r,o)},function(){te.LoadMaterialAsync(t,n,r,o)})},e._LoadTextureBufferAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadTextureBufferAsync(t,n,r,o)},function(){te.LoadTextureBufferAsync(t,n,r,o)})},e._CreateTextureAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.createTextureAsync(t,n,r,o,a)},function(){te.CreateTextureAsync(t,n,r,o)})},e._ApplyExtensions=function(e,t){for(var n in ne.Extensions)if(e(ne.Extensions[n]))return;t()},e}();T._CreateGLTF1Loader=function(){return new ne};var oe=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return r(t,e),t.prototype.loadRuntimeAsync=function(e,t,n,r){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,r(te.CreateRuntime(t.json,e,n)),0))},t.prototype.loadBufferAsync=function(e,t,n,r){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(n,function(e){return r(e.message)}),!0)},t.prototype.loadTextureBufferAsync=function(e,t,n){var r=e.textures[t],o=e.images[r.source];if(!o.extensions||!(this.name in o.extensions))return!1;var a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return n(N.GetBufferFromBufferView(e,i,0,i.byteLength,x.UNSIGNED_BYTE)),!0},t.prototype.loadShaderStringAsync=function(e,t,n){var r=e.shaders[t];if(!r.extensions||!(this.name in r.extensions))return!1;var o=r.extensions[this.name],a=e.bufferViews[o.bufferView],i=N.GetBufferFromBufferView(e,a,0,a.byteLength,x.UNSIGNED_BYTE);return setTimeout(function(){var e=N.DecodeBufferToText(i);n(e)}),!0},t}(re);ne.RegisterExtension(new oe);var ae=function(e){function n(){return e.call(this,"KHR_materials_common")||this}return r(n,e),n.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var n=e.extensions[this.name];if(!n)return!1;var r=n.lights;if(r)for(var o in r){var a=r[o];switch(a.type){case"ambient":var i=new t.HemisphericLight(a.name,new t.Vector3(0,1,0),e.scene),s=a.ambient;s&&(i.diffuse=t.Color3.FromArray(s.color||[1,1,1]));break;case"point":var l=new t.PointLight(a.name,new t.Vector3(10,10,10),e.scene),u=a.point;u&&(l.diffuse=t.Color3.FromArray(u.color||[1,1,1]));break;case"directional":var c=new t.DirectionalLight(a.name,new t.Vector3(0,-1,0),e.scene),f=a.directional;f&&(c.diffuse=t.Color3.FromArray(f.color||[1,1,1]));break;case"spot":var h=a.spot;h&&(new t.SpotLight(a.name,new t.Vector3(0,10,0),new t.Vector3(0,-1,0),h.fallOffAngle||Math.PI,h.fallOffExponent||0,e.scene).diffuse=t.Color3.FromArray(h.color||[1,1,1]));break;default:t.Tools.Warn('GLTF Material Common extension: light type "'+a.type+"” not supported")}}return!1},n.prototype.loadMaterialAsync=function(e,n,r,o){var a=e.materials[n];if(!a||!a.extensions)return!1;var i=a.extensions[this.name];if(!i)return!1;var s=new t.StandardMaterial(n,e.scene);return s.sideOrientation=t.Material.CounterClockWiseSideOrientation,"CONSTANT"===i.technique&&(s.disableLighting=!0),s.backFaceCulling=void 0!==i.doubleSided&&!i.doubleSided,s.alpha=void 0===i.values.transparency?1:i.values.transparency,s.specularPower=void 0===i.values.shininess?0:i.values.shininess,"string"==typeof i.values.ambient?this._loadTexture(e,i.values.ambient,s,"ambientTexture",o):s.ambientColor=t.Color3.FromArray(i.values.ambient||[0,0,0]),"string"==typeof i.values.diffuse?this._loadTexture(e,i.values.diffuse,s,"diffuseTexture",o):s.diffuseColor=t.Color3.FromArray(i.values.diffuse||[0,0,0]),"string"==typeof i.values.emission?this._loadTexture(e,i.values.emission,s,"emissiveTexture",o):s.emissiveColor=t.Color3.FromArray(i.values.emission||[0,0,0]),"string"==typeof i.values.specular?this._loadTexture(e,i.values.specular,s,"specularTexture",o):s.specularColor=t.Color3.FromArray(i.values.specular||[0,0,0]),!0},n.prototype._loadTexture=function(e,t,n,r,o){te.LoadTextureBufferAsync(e,t,function(o){te.CreateTextureAsync(e,t,o,function(e){return n[r]=e})},o)},n}(re);ne.RegisterExtension(new ae);var ie={__proto__:null,get EBlendingFunction(){return R},get EComponentType(){return x},get ECullingType(){return E},get EParameterType(){return C},get EShaderType(){return A},get ETextureFilterType(){return w},get ETextureFormat(){return M},get ETextureWrapMode(){return O},GLTFBinaryExtension:oe,GLTFLoader:ne,GLTFLoaderBase:te,GLTFLoaderExtension:re,GLTFMaterialsCommonExtension:ae,GLTFUtils:N},se="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==se)for(var le in se.BABYLON=se.BABYLON||{},se.BABYLON.GLTF1=se.BABYLON.GLTF1||{},ie)se.BABYLON.GLTF1[le]=ie[le];var ue=[{regex:new RegExp("^/nodes/\\d+/extensions/")}],ce=function(){function e(e,t){this._gltf=e,this._infoTree=t}return e.prototype.convert=function(e){var t=this._gltf,n=this._infoTree,r=void 0;if(!e.startsWith("/"))throw new Error("Path must start with a /");var o=e.split("/");if(o.shift(),o[o.length-1].includes(".length")){var a=o[o.length-1].split(".");o.pop(),o.push.apply(o,a)}for(var i=!1,s=0,l=o;s<l.length;s++){var u=l[s],c="length"===u;if(c&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(i=!0),n.__array__&&!c)n=n.__array__;else if(!(n=n[u]))throw new Error("Path ".concat(e," is invalid"));if(!i)if(void 0===t){if(!ue.find(function(t){return t.regex.test(e)}))throw new Error("Path ".concat(e," is invalid"))}else c||(t=null==t?void 0:t[u]);(n.__target__||c)&&(r=t)}return{object:r,info:n}},e}(),fe={length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map(function(e){return e._babylonTransformNode})},getPropertyName:[function(){return"length"}]},__array__:{__target__:!0,translation:{type:"Vector3",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.position},set:function(e,t){var n;return null===(n=t._babylonTransformNode)||void 0===n?void 0:n.position.copyFrom(e)},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"position"}]},rotation:{type:"Quaternion",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.rotationQuaternion},set:function(e,t){var n,r;return null===(r=null===(n=t._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion)||void 0===r?void 0:r.copyFrom(e)},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"rotationQuaternion"}]},scale:{type:"Vector3",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.scaling},set:function(e,t){var n;return null===(n=t._babylonTransformNode)||void 0===n?void 0:n.scaling.copyFrom(e)},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"scaling"}]},weights:{length:{type:"number",get:function(e){return e._numMorphTargets},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"influence"}]},__array__:{__target__:!0,type:"number",get:function(e,t){var n,r;return void 0!==t?null===(r=null===(n=e._primitiveBabylonMeshes)||void 0===n?void 0:n[0].morphTargetManager)||void 0===r?void 0:r.getTarget(t).influence:void 0},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"influence"}]},type:"number[]",get:function(e,t){return[0]},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"influence"}]},matrix:{type:"Matrix",get:function(e){var n,r,o;return t.Matrix.Compose(null===(n=e._babylonTransformNode)||void 0===n?void 0:n.scaling,null===(r=e._babylonTransformNode)||void 0===r?void 0:r.rotationQuaternion,null===(o=e._babylonTransformNode)||void 0===o?void 0:o.position)},getTarget:function(e){return e._babylonTransformNode},isReadOnly:!0},globalMatrix:{type:"Matrix",get:function(e){for(var n,r,o,a,i,s,l,u=t.Matrix.Identity(),c=e.parent;c&&c.parent;)c=c.parent;var f=(null===(n=e._babylonTransformNode)||void 0===n?void 0:n.position._isDirty)||(null===(o=null===(r=e._babylonTransformNode)||void 0===r?void 0:r.rotationQuaternion)||void 0===o?void 0:o._isDirty)||(null===(a=e._babylonTransformNode)||void 0===a?void 0:a.scaling._isDirty);if(c){var h=null===(i=c._babylonTransformNode)||void 0===i?void 0:i.computeWorldMatrix(!0).invert();h&&(null===(l=null===(s=e._babylonTransformNode)||void 0===s?void 0:s.computeWorldMatrix(f))||void 0===l||l.multiplyToRef(h,u))}else e._babylonTransformNode&&u.copyFrom(e._babylonTransformNode.computeWorldMatrix(f));return u},getTarget:function(e){return e._babylonTransformNode},isReadOnly:!0},extensions:{EXT_lights_ies:{multiplier:{type:"number",get:function(e){var n,r;return null===(r=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0])||void 0===r?void 0:r.intensity},getTarget:function(e){var n;return null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0]},set:function(e,n){if(n._babylonTransformNode){var r=n._babylonTransformNode.getChildren(function(e){return e instanceof t.SpotLight},!0)[0];r&&(r.intensity=e)}}},color:{type:"Color3",get:function(e){var n,r;return null===(r=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0])||void 0===r?void 0:r.diffuse},getTarget:function(e){var n;return null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0]},set:function(e,n){if(n._babylonTransformNode){var r=n._babylonTransformNode.getChildren(function(e){return e instanceof t.SpotLight},!0)[0];r&&(r.diffuse=e)}}}},KHR_node_visibility:{visible:{type:"boolean",get:function(e){return!!e._primitiveBabylonMeshes&&e._primitiveBabylonMeshes[0].isVisible},getTarget:function(){},set:function(e,t){t._primitiveBabylonMeshes&&t._primitiveBabylonMeshes.forEach(function(t){return t.isVisible=e})}}}}}},he={__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var n,r,o,a;return new t.Vector2(null!==(r=null===(n=e._babylonCamera)||void 0===n?void 0:n.orthoLeft)&&void 0!==r?r:0,null!==(a=null===(o=e._babylonCamera)||void 0===o?void 0:o.orthoRight)&&void 0!==a?a:0)},set:function(e,t){t._babylonCamera&&(t._babylonCamera.orthoLeft=e.x,t._babylonCamera.orthoRight=e.y)},getTarget:function(e){return e},getPropertyName:[function(){return"orthoLeft"},function(){return"orthoRight"}]},ymag:{componentsCount:2,type:"Vector2",get:function(e){var n,r,o,a;return new t.Vector2(null!==(r=null===(n=e._babylonCamera)||void 0===n?void 0:n.orthoBottom)&&void 0!==r?r:0,null!==(a=null===(o=e._babylonCamera)||void 0===o?void 0:o.orthoTop)&&void 0!==a?a:0)},set:function(e,t){t._babylonCamera&&(t._babylonCamera.orthoBottom=e.x,t._babylonCamera.orthoTop=e.y)},getTarget:function(e){return e},getPropertyName:[function(){return"orthoBottom"},function(){return"orthoTop"}]},zfar:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.maxZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.maxZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"maxZ"}]},znear:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.minZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.minZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"minZ"}]}},perspective:{aspectRatio:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.getEngine().getAspectRatio(e._babylonCamera)},getTarget:function(e){return e},getPropertyName:[function(){return"aspectRatio"}],isReadOnly:!0},yfov:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.fov},set:function(e,t){t._babylonCamera&&(t._babylonCamera.fov=e)},getTarget:function(e){return e},getPropertyName:[function(){return"fov"}]},zfar:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.maxZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.maxZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"maxZ"}]},znear:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.minZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.minZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"minZ"}]}}}},de={__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return _e(e,0,n).emissiveColor},set:function(e,t,n,r){return _e(t,0,r).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:ge("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=me(e,n,"bumpTexture"))||void 0===r?void 0:r.level},set:function(e,t,n,r){var o=me(t,r,"bumpTexture");o&&(o.level=e)},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:ge("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return _e(e,0,n).ambientTextureStrength},set:function(e,t,n,r){var o=_e(t,0,r);o&&(o.ambientTextureStrength=e)},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:ge("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,n,r){var o=_e(e,0,r);return t.Color4.FromColor3(o.albedoColor,o.alpha)},set:function(e,t,n,r){var o=_e(t,0,r);o.albedoColor.set(e.r,e.g,e.b),o.alpha=e.a},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:ge("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).metallic},set:function(e,t,n,r){var o=_e(t,0,r);o&&(o.metallic=e)},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).roughness},set:function(e,t,n,r){var o=_e(t,0,r);o&&(o.roughness=e)},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:ge("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return _e(e,0,n).anisotropy.intensity},set:function(e,t,n,r){_e(t,0,r).anisotropy.intensity=e},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return _e(e,0,n).anisotropy.angle},set:function(e,t,n,r){_e(t,0,r).anisotropy.angle=e},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:ge("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).clearCoat.intensity},set:function(e,t,n,r){_e(t,0,r).clearCoat.intensity=e},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).clearCoat.roughness},set:function(e,t,n,r){_e(t,0,r).clearCoat.roughness=e},getTarget:function(e,t,n){return _e(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:ge("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=_e(e,0,n).clearCoat.bumpTexture)||void 0===r?void 0:r.level},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:ge("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:ge("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return _e(e,0,n).subSurface.dispersion},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return _e(e,0,n).emissiveIntensity},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return _e(e,0,n).indexOfRefraction},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).iridescence.intensity},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return _e(e,0,n).iridescence.indexOfRefraction},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:ge("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return _e(e,0,n).iridescence.maximumThickness},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return _e(e,0,n).iridescence.minimumThickness},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:ge("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return _e(e,0,n).sheen.color},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:ge("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).sheen.intensity},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:ge("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).metallicF0Factor},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return _e(e,0,n).metallicReflectanceColor},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:ge("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:ge("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).subSurface.refractionIntensity},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:ge("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).subSurface.translucencyIntensity},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:ge("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return _e(e,0,n).subSurface.translucencyColor},getTarget:_e,set:function(e,t,n,r){var o;return e&&(null===(o=_e(t,0,r).subSurface.translucencyColor)||void 0===o?void 0:o.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:ge("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return _e(e,0,n).subSurface.tintColor},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return _e(e,0,n).subSurface.tintColorAtDistance},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return _e(e,0,n).subSurface.maximumThickness},getTarget:_e,set:function(e,t,n,r){return _e(t,0,r).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:ge("subSurface","thicknessTexture")}}}}}},pe={KHR_lights_punctual:{lights:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map(function(e){return e._babylonLight})},getPropertyName:[function(e){return"length"}]},__array__:{__target__:!0,color:{type:"Color3",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.diffuse},set:function(e,t){var n;return null===(n=t._babylonLight)||void 0===n?void 0:n.diffuse.copyFrom(e)},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"diffuse"}]},intensity:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.intensity},set:function(e,t){return t._babylonLight?t._babylonLight.intensity=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"intensity"}]},range:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.range},set:function(e,t){return t._babylonLight?t._babylonLight.range=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"range"}]},spot:{innerConeAngle:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.innerAngle},set:function(e,t){return t._babylonLight?t._babylonLight.innerAngle=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"innerConeAngle"}]},outerConeAngle:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.angle},set:function(e,t){return t._babylonLight?t._babylonLight.angle=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"outerConeAngle"}]}}}}},EXT_lights_area:{lights:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map(function(e){return e._babylonLight})},getPropertyName:[function(e){return"length"}]},__array__:{__target__:!0,color:{type:"Color3",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.diffuse},set:function(e,t){var n;return null===(n=t._babylonLight)||void 0===n?void 0:n.diffuse.copyFrom(e)},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"diffuse"}]},intensity:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.intensity},set:function(e,t){return t._babylonLight?t._babylonLight.intensity=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"intensity"}]},size:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.height},set:function(e,t){return t._babylonLight?t._babylonLight.height=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"size"}]},rect:{aspect:{type:"number",get:function(e){var t,n;return(null===(t=e._babylonLight)||void 0===t?void 0:t.width)/(null===(n=e._babylonLight)||void 0===n?void 0:n.height)},set:function(e,t){return t._babylonLight?t._babylonLight.width=e*t._babylonLight.height:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"aspect"}]}}}}},EXT_lights_ies:{lights:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map(function(e){return e._babylonLight})},getPropertyName:[function(e){return"length"}]}}},EXT_lights_image_based:{lights:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map(function(e){return e._babylonTexture})},getPropertyName:[function(e){return"length"}]},__array__:{__target__:!0,intensity:{type:"number",get:function(e){var t;return null===(t=e._babylonTexture)||void 0===t?void 0:t.level},set:function(e,t){t._babylonTexture&&(t._babylonTexture.level=e)},getTarget:function(e){return e._babylonTexture}},rotation:{type:"Quaternion",get:function(e){var n;return e._babylonTexture&&t.Quaternion.FromRotationMatrix(null===(n=e._babylonTexture)||void 0===n?void 0:n.getReflectionTextureMatrix())},set:function(e,n){var r;n._babylonTexture&&((null===(r=n._babylonTexture.getScene())||void 0===r?void 0:r.useRightHandedSystem)||(e=t.Quaternion.Inverse(e)),t.Matrix.FromQuaternionToRef(e,n._babylonTexture.getReflectionTextureMatrix()))},getTarget:function(e){return e._babylonTexture}}}}}};function me(e,t,n,r){var o=_e(e);return r?o[n][r]:o[n]}function _e(e,n,r){var o,a,i;return null===(i=null===(o=e._data)||void 0===o?void 0:o[null!==(a=null==r?void 0:r.fillMode)&&void 0!==a?a:t.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function ge(e,n){return{offset:{componentsCount:2,type:"Vector2",get:function(r,o,a){var i=me(r,0,e,n);return new t.Vector2(null==i?void 0:i.uOffset,null==i?void 0:i.vOffset)},getTarget:_e,set:function(t,r,o,a){var i=me(r,0,e,n);i.uOffset=t.x,i.vOffset=t.y},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".uOffset")},function(){return"".concat(e).concat(n?"."+n:"",".vOffset")}]},rotation:{type:"number",get:function(t,r,o){var a;return null===(a=me(t,0,e,n))||void 0===a?void 0:a.wAng},getTarget:_e,set:function(t,r,o,a){return me(r,0,e,n).wAng=t},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(r,o,a){var i=me(r,0,e,n);return new t.Vector2(null==i?void 0:i.uScale,null==i?void 0:i.vScale)},getTarget:_e,set:function(t,r,o,a){var i=me(r,0,e,n);i.uScale=t.x,i.vScale=t.y},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".uScale")},function(){return"".concat(e).concat(n?"."+n:"",".vScale")}]}}}var ye={cameras:he,nodes:fe,materials:de,extensions:pe,animations:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map(function(e){return e._babylonAnimationGroup})},getPropertyName:[function(){return"length"}]},__array__:{}},meshes:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map(function(e){var t;return null===(t=e.primitives[0]._instanceData)||void 0===t?void 0:t.babylonSourceMesh})},getPropertyName:[function(){return"length"}]},__array__:{}}};function be(e){return new ce(e,ye)}function ve(e){for(var t=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),n=ye,r=0,o=t;r<o.length;r++){var a=o[r];a&&(n=n[a])}if(n&&n.type&&n.get)return n}function Te(e,t){for(var n=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),r=ye,o=0,a=n;o<a.length;o++){var i=a[o];i&&(r=r[i])}r&&r.type&&r.get&&(r.interpolation=t)}function xe(e,t){for(var n=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),r=ye,o=0,a=n;o<a.length;o++){var i=a[o];if(i){if(!r[i]){if("?"===i){r.__ignoreObjectTree__=!0;continue}r[i]={},"__array__"===i&&(r[i].__target__=!0)}r=r[i]}}Object.assign(r,t)}var Ae=new Map,Ce=Ae;function Oe(e,n,r){we(e)&&t.Logger.Warn("Extension with the name '".concat(e,"' already exists")),Ae.set(e,{isGLTFExtension:n,factory:r})}function we(e){return Ae.delete(e)}var Me=new t.Lazy(function(){return Promise.resolve(BABYLON)}),Ee=new t.Lazy(function(){return Promise.resolve().then(function(){return qt})}),Re=function(){function e(){}return e.Get=function(e,t,n){if(!t||null==n||!t[n])throw new Error("".concat(e,": Failed to find index (").concat(n,")"));return t[n]},e.TryGet=function(e,t){return e&&null!=t&&e[t]?e[t]:null},e.Assign=function(e){if(e)for(var t=0;t<e.length;t++)e[t].index=t},e}();function Le(e){if(e.min&&e.max){var n=e.min,r=e.max,o=t.TmpVectors.Vector3[0].copyFromFloats(n[0],n[1],n[2]),a=t.TmpVectors.Vector3[1].copyFromFloats(r[0],r[1],r[2]);if(e.normalized&&5126!==e.componentType){var i=1;switch(e.componentType){case 5120:i=127;break;case 5121:i=255;break;case 5122:i=32767;break;case 5123:i=65535}var s=1/i;o.scaleInPlace(s),a.scaleInPlace(s)}return new t.BoundingInfo(o,a)}return null}var Pe=function(){function n(e){this._completePromises=new Array,this._assetContainer=null,this._babylonLights=[],this._disableInstancedMesh=0,this._allMaterialsDirtyRequired=!1,this._skipStartAnimationStep=!1,this._extensions=new Array,this._disposed=!1,this._rootUrl=null,this._fileName=null,this._uniqueRootUrl=null,this._bin=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions=new Array,this._materialAdapterCache=new WeakMap,this._materialAdapters=new Set,this._pbrMaterialImpl=null,this._parent=e}return n.prototype.isMatchingMaterialType=function(e){return!(!e||!this._pbrMaterialImpl)&&e instanceof this._pbrMaterialImpl.materialClass},n.RegisterExtension=function(e,t){Oe(e,!1,t)},n.UnregisterExtension=function(e){return we(e)},Object.defineProperty(n.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rootUrl",{get:function(){return this._rootUrl},enumerable:!1,configurable:!0}),n.prototype._getOrCreateMaterialAdapter=function(e){var t=this._materialAdapterCache.get(e);if(!t){if(!this._pbrMaterialImpl)throw new Error("Appropriate material adapter class not found");var n=t=new this._pbrMaterialImpl.adapterClass(e);this._materialAdapterCache.set(e,n),this._materialAdapters.add(n)}return t},n.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._completePromises.length=0,this._extensions.forEach(function(e){return e.dispose&&e.dispose()}),this._extensions.length=0,this._materialAdapters.clear(),this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())},n.prototype.importMeshAsync=function(e,t,n,r,o,s){return a(this,arguments,void 0,function(e,t,n,r,o,s,l){var u=this;return void 0===l&&(l=""),i(this,function(s){switch(s.label){case 0:return[4,Promise.resolve().then(function(){return a(u,void 0,void 0,function(){var a,s,u,c,f,h=this;return i(this,function(i){switch(i.label){case 0:if(this._babylonScene=t,this._assetContainer=n,this._loadData(r),a=null,e){if(s={},this._gltf.nodes)for(u=0,c=this._gltf.nodes;u<c.length;u++)(f=c[u]).name&&(s[f.name]=f.index);a=(e instanceof Array?e:[e]).map(function(e){var t=s[e];if(void 0===t)throw new Error("Failed to find node '".concat(e,"'"));return t})}return[4,this._loadAsync(o,l,a,function(){return{meshes:h._getMeshes(),particleSystems:[],skeletons:h._getSkeletons(),animationGroups:h._getAnimationGroups(),lights:h._babylonLights,transformNodes:h._getTransformNodes(),geometries:h._getGeometries(),spriteManagers:[]}})];case 1:return[2,i.sent()]}})})})];case 1:return[2,s.sent()]}})})},n.prototype.loadAsync=function(e,t,n,r){return a(this,arguments,void 0,function(e,t,n,r,o){return void 0===o&&(o=""),i(this,function(r){switch(r.label){case 0:return this._babylonScene=e,this._loadData(t),[4,this._loadAsync(n,o,null,function(){})];case 1:return[2,r.sent()]}})})},n.prototype._loadAsync=function(n,r,o,s){return a(this,void 0,void 0,function(){var l=this;return i(this,function(u){switch(u.label){case 0:return[4,Promise.resolve().then(function(){return a(l,void 0,void 0,function(){var a,l,u,c,f,h,d,p,m,_,g,y,b,v,T=this;return i(this,function(i){switch(i.label){case 0:return this._rootUrl=n,this._uniqueRootUrl=!n.startsWith("file:")&&r?n:"".concat(n).concat(Date.now(),"/"),this._fileName=r,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:return i.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(a=this,b={},[4,Promise.resolve(BABYLON)]):[3,4];case 2:return b.materialClass=i.sent().OpenPBRMaterial,[4,Promise.resolve().then(function(){return ur})];case 3:return a._pbrMaterialImpl=(b.adapterClass=i.sent().OpenPBRMaterialLoadingAdapter,b),[3,7];case 4:return l=this,v={},[4,Promise.resolve(BABYLON)];case 5:return v.materialClass=i.sent().PBRMaterial,[4,Promise.resolve().then(function(){return fr})];case 6:l._pbrMaterialImpl=(v.adapterClass=i.sent().PBRMaterialLoadingAdapter,v),i.label=7;case 7:if(u="".concat(e.GLTFLoaderState[e.GLTFLoaderState.LOADING]," => ").concat(e.GLTFLoaderState[e.GLTFLoaderState.READY]),c="".concat(e.GLTFLoaderState[e.GLTFLoaderState.LOADING]," => ").concat(e.GLTFLoaderState[e.GLTFLoaderState.COMPLETE]),this._parent._startPerformanceCounter(u),this._parent._startPerformanceCounter(c),this._parent._setState(e.GLTFLoaderState.LOADING),this._extensionsOnLoading(),f=new Array,h=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(o?f.push(this.loadSceneAsync("/nodes",{nodes:o,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(d=Re.Get("/scene",this._gltf.scenes,this._gltf.scene||0),f.push(this.loadSceneAsync("/scenes/".concat(d.index),d)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(p=0;p<this._gltf.materials.length;++p)m=this._gltf.materials[p],_="/materials/"+p,g=t.Material.TriangleFillMode,f.push(this._loadMaterialAsync(_,m,null,g,function(){}));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=h:this._babylonScene._forceBlockMaterialDirtyMechanism(h),this._parent.compileMaterials&&f.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&f.push(this._compileShadowGeneratorsAsync()),y=Promise.all(f).then(function(){T._rootBabylonMesh&&T._rootBabylonMesh!==T._parent.customRootNode&&T._rootBabylonMesh.setEnabled(!0);for(var t=0,n=T._babylonScene.materials;t<n.length;t++){var r=n[t];void 0!==r.maxSimultaneousLights&&(r.maxSimultaneousLights=Math.max(r.maxSimultaneousLights,T._babylonScene.lights.length))}for(var o=0,a=Array.from(T._materialAdapters);o<a.length;o++){var i=a[o];T._completePromises.push(i.finalizeAsync(T))}return T._extensionsOnReady(),T._parent._setState(e.GLTFLoaderState.READY),T._skipStartAnimationStep||T._startAnimations(),s()}),[4,y.then(function(n){return T._parent._endPerformanceCounter(u),t.Tools.SetImmediate(function(){T._disposed||Promise.all(T._completePromises).then(function(){T._parent._endPerformanceCounter(c),T._parent._setState(e.GLTFLoaderState.COMPLETE),T._parent.onCompleteObservable.notifyObservers(void 0),T._parent.onCompleteObservable.clear(),T.dispose()},function(e){T._parent.onErrorObservable.notifyObservers(e),T._parent.onErrorObservable.clear(),T.dispose()})}),n})];case 8:return[2,i.sent()]}})})}).catch(function(e){throw l._disposed||(l._parent.onErrorObservable.notifyObservers(e),l._parent.onErrorObservable.clear(),l.dispose()),e})];case 1:return[2,u.sent()]}})})},n.prototype._loadData=function(e){if(this._gltf=e.json,this._setupData(),e.bin){var n=this._gltf.buffers;if(n&&n[0]&&!n[0].uri){var r=n[0];(r.byteLength<e.bin.byteLength-3||r.byteLength>e.bin.byteLength)&&t.Logger.Warn("Binary buffer length (".concat(r.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else t.Logger.Warn("Unexpected BIN chunk")}},n.prototype._setupData=function(){if(Re.Assign(this._gltf.accessors),Re.Assign(this._gltf.animations),Re.Assign(this._gltf.buffers),Re.Assign(this._gltf.bufferViews),Re.Assign(this._gltf.cameras),Re.Assign(this._gltf.images),Re.Assign(this._gltf.materials),Re.Assign(this._gltf.meshes),Re.Assign(this._gltf.nodes),Re.Assign(this._gltf.samplers),Re.Assign(this._gltf.scenes),Re.Assign(this._gltf.skins),Re.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},t=0,n=this._gltf.nodes;t<n.length;t++)if((l=n[t]).children)for(var r=0,o=l.children;r<o.length;r++)e[o[r]]=l.index;for(var a=this._createRootNode(),i=0,s=this._gltf.nodes;i<s.length;i++){var l,u=e[(l=s[i]).index];l.parent=void 0===u?a:this._gltf.nodes[u]}}},n.prototype._loadExtensionsAsync=function(){return a(this,void 0,void 0,function(){var e,n,r,o,s,l,u,c,f,h,d,p=this;return i(this,function(m){switch(m.label){case 0:return e=[],Ce.forEach(function(n,r){var o;!1===(null===(o=p.parent.extensionOptions[r])||void 0===o?void 0:o.enabled)?n.isGLTFExtension&&p.isExtensionUsed(r)&&t.Logger.Warn("Extension ".concat(r," is used but has been explicitly disabled.")):n.isGLTFExtension&&!p.isExtensionUsed(r)||e.push(a(p,void 0,void 0,function(){var e;return i(this,function(o){switch(o.label){case 0:return[4,n.factory(this)];case 1:return(e=o.sent()).name!==r&&t.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(r)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}})}))}),r=(n=(h=this._extensions).push).apply,o=[h],[4,Promise.all(e)];case 1:if(r.apply(n,o.concat([m.sent()])),this._extensions.sort(function(e,t){return(e.order||Number.MAX_VALUE)-(t.order||Number.MAX_VALUE)}),this._parent.onExtensionLoadedObservable.clear(),this._gltf.extensionsRequired)for(s=function(e){if(!l._extensions.some(function(t){return t.name===e&&t.enabled})){if(!1===(null===(d=l.parent.extensionOptions[e])||void 0===d?void 0:d.enabled))throw new Error("Required extension ".concat(e," is disabled"));throw new Error("Required extension ".concat(e," is not available"))}},l=this,u=0,c=this._gltf.extensionsRequired;u<c.length;u++)f=c[u],s(f);return[2]}})})},n.prototype._createRootNode=function(){if(void 0!==this._parent.customRootNode)return this._rootBabylonMesh=this._parent.customRootNode,{_babylonTransformNode:null===this._rootBabylonMesh?void 0:this._rootBabylonMesh,index:-1};this._babylonScene._blockEntityCollection=!!this._assetContainer;var r=new t.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=r,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var o={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case e.GLTFLoaderCoordinateSystemMode.AUTO:this._babylonScene.useRightHandedSystem||(o.rotation=[0,1,0,0],o.scale=[1,1,-1],n._LoadTransform(o,this._rootBabylonMesh));break;case e.GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED:this._babylonScene.useRightHandedSystem=!0;break;default:throw new Error("Invalid coordinate system mode (".concat(this._parent.coordinateSystemMode,")"))}return this._parent.onMeshLoadedObservable.notifyObservers(r),o},n.prototype.loadSceneAsync=function(e,t){var n=this,r=this._extensionsLoadSceneAsync(e,t);if(r)return r;var o=new Array;if(this.logOpen("".concat(e," ").concat(t.name||"")),t.nodes)for(var a=0,i=t.nodes;a<i.length;a++){var s=i[a],l=Re.Get("".concat(e,"/nodes/").concat(s),this._gltf.nodes,s);o.push(this.loadNodeAsync("/nodes/".concat(l.index),l,function(e){e.parent=n._rootBabylonMesh}))}for(var u=0,c=this._postSceneLoadActions;u<c.length;u++)(0,c[u])();return o.push(this._loadAnimationsAsync()),this.logClose(),Promise.all(o).then(function(){})},n.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var n=0,r=e._primitiveBabylonMeshes;n<r.length;n++)t(r[n])},n.prototype._getGeometries=function(){var e=[],t=this._gltf.nodes;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];this._forEachPrimitive(o,function(t){var n=t.geometry;n&&-1===e.indexOf(n)&&e.push(n)})}return e},n.prototype._getMeshes=function(){var e=[];this._rootBabylonMesh instanceof t.AbstractMesh&&e.push(this._rootBabylonMesh);var n=this._gltf.nodes;if(n)for(var r=0,o=n;r<o.length;r++){var a=o[r];this._forEachPrimitive(a,function(t){e.push(t)})}return e},n.prototype._getTransformNodes=function(){var e=[],t=this._gltf.nodes;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];o._babylonTransformNode&&"TransformNode"===o._babylonTransformNode.getClassName()&&e.push(o._babylonTransformNode),o._babylonTransformNodeForSkin&&e.push(o._babylonTransformNodeForSkin)}return e},n.prototype._getSkeletons=function(){var e=[],t=this._gltf.skins;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];o._data&&e.push(o._data.babylonSkeleton)}return e},n.prototype._getAnimationGroups=function(){var e=[],t=this._gltf.animations;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];o._babylonAnimationGroup&&e.push(o._babylonAnimationGroup)}return e},n.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case e.GLTFLoaderAnimationStartMode.NONE:break;case e.GLTFLoaderAnimationStartMode.FIRST:0!==(n=this._getAnimationGroups()).length&&n[0].start(!0);break;case e.GLTFLoaderAnimationStartMode.ALL:for(var n,r=0,o=n=this._getAnimationGroups();r<o.length;r++)o[r].start(!0);break;default:return void t.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},n.prototype.loadNodeAsync=function(e,r,o){var a=this;void 0===o&&(o=function(){});var i=this._extensionsLoadNodeAsync(e,r,o);if(i)return i;if(r._babylonTransformNode)throw new Error("".concat(e,": Invalid recursive node hierarchy"));var s=new Array;this.logOpen("".concat(e," ").concat(r.name||""));var l=function(t){if(n.AddPointerMetadata(t,e),n._LoadTransform(r,t),null!=r.camera){var i=Re.Get("".concat(e,"/camera"),a._gltf.cameras,r.camera);s.push(a.loadCameraAsync("/cameras/".concat(i.index),i,function(e){e.parent=t,a._babylonScene.useRightHandedSystem||(t.scaling.x=-1)}))}if(r.children)for(var l=0,u=r.children;l<u.length;l++){var c=u[l],f=Re.Get("".concat(e,"/children/").concat(c),a._gltf.nodes,c);s.push(a.loadNodeAsync("/nodes/".concat(f.index),f,function(e){e.parent=t}))}o(t)},u=null!=r.mesh,c=this._parent.loadSkins&&null!=r.skin;if(!u||c){var f=r.name||"node".concat(r.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var h=new t.TransformNode(f,this._babylonScene);h._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==r.mesh?r._babylonTransformNode=h:r._babylonTransformNodeForSkin=h,l(h)}if(u)if(c){var d=Re.Get("".concat(e,"/mesh"),this._gltf.meshes,r.mesh);s.push(this._loadMeshAsync("/meshes/".concat(d.index),r,d,function(n){var o=r._babylonTransformNodeForSkin;n.metadata=t.deepMerge(o.metadata,n.metadata||{});var i=Re.Get("".concat(e,"/skin"),a._gltf.skins,r.skin);s.push(a._loadSkinAsync("/skins/".concat(i.index),r,i,function(e){a._forEachPrimitive(r,function(t){t.skeleton=e}),a._postSceneLoadActions.push(function(){if(null!=i.skeleton){var e=Re.Get("/skins/".concat(i.index,"/skeleton"),a._gltf.nodes,i.skeleton).parent;r.index===e.index?n.parent=o.parent:n.parent=e._babylonTransformNode}else n.parent=a._rootBabylonMesh;a._parent.onSkinLoadedObservable.notifyObservers({node:o,skinnedNode:n})})}))}))}else d=Re.Get("".concat(e,"/mesh"),this._gltf.meshes,r.mesh),s.push(this._loadMeshAsync("/meshes/".concat(d.index),r,d,l));return this.logClose(),Promise.all(s).then(function(){return a._forEachPrimitive(r,function(e){var t=e;!t.isAnInstance&&t.geometry&&t.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)}),r._babylonTransformNode})},n.prototype._loadMeshAsync=function(e,n,r,o){var a=r.primitives;if(!a||!a.length)throw new Error("".concat(e,": Primitives are missing"));null==a[0].index&&Re.Assign(a);var i=new Array;this.logOpen("".concat(e," ").concat(r.name||""));var s=n.name||"node".concat(n.index);if(1===a.length){var l=r.primitives[0];i.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(l.index),s,n,r,l,function(e){n._babylonTransformNode=e,n._primitiveBabylonMeshes=[e]}))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,n._babylonTransformNode=new t.TransformNode(s,this._babylonScene),n._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._primitiveBabylonMeshes=[];for(var u=0,c=a;u<c.length;u++)l=c[u],i.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(l.index),"".concat(s,"_primitive").concat(l.index),n,r,l,function(e){e.parent=n._babylonTransformNode,n._primitiveBabylonMeshes.push(e)}))}return o(n._babylonTransformNode),this.logClose(),Promise.all(i).then(function(){return n._babylonTransformNode})},n.prototype._loadMeshPrimitiveAsync=function(e,r,o,s,l,u){var c=this,f=this._extensionsLoadMeshPrimitiveAsync(e,r,o,s,l,u);if(f)return f;this.logOpen("".concat(e));var h,d,p=0===this._disableInstancedMesh&&this._parent.createInstances&&null==o.skin&&!s.primitives[0].targets;if(p&&l._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(h=l._instanceData.babylonSourceMesh.createInstance(r))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,d=l._instanceData.promise;else{var m=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var _=new t.Mesh(r,this._babylonScene);if(_._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,_.sideOrientation=this._babylonScene.useRightHandedSystem?t.Material.CounterClockWiseSideOrientation:t.Material.ClockWiseSideOrientation,this._createMorphTargets(e,o,s,l,_),m.push(this._loadVertexDataAsync(e,l,_).then(function(t){return a(c,void 0,void 0,function(){var n=this;return i(this,function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(e,l,_,t).then(function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,t.applyToMesh(_),t._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1)})];case 1:return[2,r.sent()]}})})})),!this.parent.skipMaterials){var g=n._GetDrawMode(e,l.mode);if(null==l.material){var y=this._defaultBabylonMaterialData[g];y||(y=this._createDefaultMaterial("__GLTFLoader._default",g),this._parent.onMaterialLoadedObservable.notifyObservers(y),this._defaultBabylonMaterialData[g]=y),_.material=y}else{var b=Re.Get("".concat(e,"/material"),this._gltf.materials,l.material);m.push(this._loadMaterialAsync("/materials/".concat(b.index),b,_,g,function(e){_.material=e}))}}d=Promise.all(m),p&&(l._instanceData={babylonSourceMesh:_,promise:d}),h=_}return n.AddPointerMetadata(h,e),this._parent.onMeshLoadedObservable.notifyObservers(h),u(h),this.logClose(),d.then(function(){return h})},n.prototype._loadVertexDataAsync=function(e,n,r){var o=this,a=this._extensionsLoadVertexDataAsync(e,n,r);if(a)return a;var i=n.attributes;if(!i)throw new Error("".concat(e,": Attributes are missing"));var s=new Array,l=new t.Geometry(r.name,this._babylonScene);if(null==n.indices)r.isUnIndexed=!0;else{var u=Re.Get("".concat(e,"/indices"),this._gltf.accessors,n.indices);s.push(this._loadIndicesAccessorAsync("/accessors/".concat(u.index),u).then(function(e){l.setIndices(e)}))}var c=function(n,a,u){if(null!=i[n]){r._delayInfo=r._delayInfo||[],-1===r._delayInfo.indexOf(a)&&r._delayInfo.push(a);var c=Re.Get("".concat(e,"/attributes/").concat(n),o._gltf.accessors,i[n]);s.push(o._loadVertexAccessorAsync("/accessors/".concat(c.index),c,a).then(function(e){if(e.getKind()===t.VertexBuffer.PositionKind&&!o.parent.alwaysComputeBoundingBox&&!r.skeleton){var n=Le(c);n&&(l._boundingInfo=n,l.useBoundingInfoFromGeometry=!0)}l.setVerticesBuffer(e,c.count)})),a==t.VertexBuffer.MatricesIndicesExtraKind&&(r.numBoneInfluencers=8),u&&u(c)}};return c("POSITION",t.VertexBuffer.PositionKind),c("NORMAL",t.VertexBuffer.NormalKind),c("TANGENT",t.VertexBuffer.TangentKind),c("TEXCOORD_0",t.VertexBuffer.UVKind),c("TEXCOORD_1",t.VertexBuffer.UV2Kind),c("TEXCOORD_2",t.VertexBuffer.UV3Kind),c("TEXCOORD_3",t.VertexBuffer.UV4Kind),c("TEXCOORD_4",t.VertexBuffer.UV5Kind),c("TEXCOORD_5",t.VertexBuffer.UV6Kind),c("JOINTS_0",t.VertexBuffer.MatricesIndicesKind),c("WEIGHTS_0",t.VertexBuffer.MatricesWeightsKind),c("JOINTS_1",t.VertexBuffer.MatricesIndicesExtraKind),c("WEIGHTS_1",t.VertexBuffer.MatricesWeightsExtraKind),c("COLOR_0",t.VertexBuffer.ColorKind,function(e){"VEC4"===e.type&&(r.hasVertexAlpha=!0)}),Promise.all(s).then(function(){return l})},n.prototype._createMorphTargets=function(e,n,r,o,a){if(o.targets&&this._parent.loadMorphTargets){if(null==n._numMorphTargets)n._numMorphTargets=o.targets.length;else if(o.targets.length!==n._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var i=r.extras?r.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,a.morphTargetManager=new t.MorphTargetManager(this._babylonScene),a.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,a.morphTargetManager.areUpdatesFrozen=!0;for(var s=0;s<o.targets.length;s++){var l=n.weights?n.weights[s]:r.weights?r.weights[s]:0,u=i?i[s]:"morphTarget".concat(s);a.morphTargetManager.addTarget(new t.MorphTarget(u,l,a.getScene()))}}},n.prototype._loadMorphTargetsAsync=function(e,t,n,r){if(!t.targets||!this._parent.loadMorphTargets)return Promise.resolve();for(var o=new Array,a=n.morphTargetManager,i=0;i<a.numTargets;i++){var s=a.getTarget(i);o.push(this._loadMorphTargetVertexDataAsync("".concat(e,"/targets/").concat(i),r,t.targets[i],s))}return Promise.all(o).then(function(){a.areUpdatesFrozen=!1})},n.prototype._loadMorphTargetVertexDataAsync=function(e,n,r,o){return a(this,void 0,void 0,function(){var a,s,l=this;return i(this,function(i){switch(i.label){case 0:return a=new Array,(s=function(t,o,i){if(null!=r[t]){var s=n.getVertexBuffer(o);if(s){var u=Re.Get("".concat(e,"/").concat(t),l._gltf.accessors,r[t]);a.push(l._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then(function(e){i(s,e)}))}}})("POSITION",t.VertexBuffer.PositionKind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setPositions(n)}),s("NORMAL",t.VertexBuffer.NormalKind,function(e,t){var n=new Float32Array(t.length);e.forEach(n.length,function(e,r){n[r]=t[r]+e}),o.setNormals(n)}),s("TANGENT",t.VertexBuffer.TangentKind,function(e,t){var n=new Float32Array(t.length/3*4),r=0;e.forEach(t.length/3*4,function(e,o){(o+1)%4!=0&&(n[r]=t[r]+e,r++)}),o.setTangents(n)}),s("TEXCOORD_0",t.VertexBuffer.UVKind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setUVs(n)}),s("TEXCOORD_1",t.VertexBuffer.UV2Kind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setUV2s(n)}),s("COLOR_0",t.VertexBuffer.ColorKind,function(t,n){var r=null,a=t.getSize();if(3===a){r=new Float32Array(n.length/3*4),t.forEach(n.length,function(e,t){var o=Math.floor(t/3),a=t%3;r[4*o+a]=n[3*o+a]+e});for(var i=0;i<n.length/3;++i)r[4*i+3]=1}else{if(4!==a)throw new Error("".concat(e,": Invalid number of components (").concat(a,") for COLOR_0 attribute"));r=new Float32Array(n.length),t.forEach(n.length,function(e,t){r[t]=n[t]+e})}o.setColors(r)}),[4,Promise.all(a).then(function(){})];case 1:return[2,i.sent()]}})})},n._LoadTransform=function(e,n){if(null==e.skin){var r=t.Vector3.Zero(),o=t.Quaternion.Identity(),a=t.Vector3.One();e.matrix?t.Matrix.FromArray(e.matrix).decompose(a,o,r):(e.translation&&(r=t.Vector3.FromArray(e.translation)),e.rotation&&(o=t.Quaternion.FromArray(e.rotation)),e.scale&&(a=t.Vector3.FromArray(e.scale))),n.position=r,n.rotationQuaternion=o,n.scaling=a}},n.prototype._loadSkinAsync=function(e,n,r,o){var a=this;if(!this._parent.loadSkins)return Promise.resolve();var i=this._extensionsLoadSkinAsync(e,n,r);if(i)return i;if(r._data)return o(r._data.babylonSkeleton),r._data.promise;var s="skeleton".concat(r.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var l=new t.Skeleton(r.name||s,s,this._babylonScene);l._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,r,l);var u=this._loadSkinInverseBindMatricesDataAsync(e,r).then(function(e){a._updateBoneMatrices(l,e)});return r._data={babylonSkeleton:l,promise:u},o(l),u},n.prototype._loadBones=function(e,n,r){if(null==n.skeleton||this._parent.alwaysComputeSkeletonRootNode){var o=this._findSkeletonRootNode("".concat(e,"/joints"),n.joints);if(o)if(void 0===n.skeleton)n.skeleton=o.index;else{var a=Re.Get("".concat(e,"/skeleton"),this._gltf.nodes,n.skeleton);a===o||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1}(a,o)||(t.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),n.skeleton=o.index)}else t.Logger.Warn("".concat(e,": Failed to find common root"))}for(var i={},s=0,l=n.joints;s<l.length;s++){var u=l[s],c=Re.Get("".concat(e,"/joints/").concat(u),this._gltf.nodes,u);this._loadBone(c,n,r,i)}},n.prototype._findSkeletonRootNode=function(e,t){if(0===t.length)return null;for(var n={},r=0,o=t;r<o.length;r++){for(var a=o[r],i=[],s=Re.Get("".concat(e,"/").concat(a),this._gltf.nodes,a);-1!==s.index;)i.unshift(s),s=s.parent;n[a]=i}for(var l=null,u=0;;++u){if(u>=(i=n[t[0]]).length)return l;s=i[u];for(var c=1;c<t.length;++c)if(u>=(i=n[t[c]]).length||s!==i[u])return l;l=s}},n.prototype._loadBone=function(e,n,r,o){e._isJoint=!0;var a=o[e.index];if(a)return a;var i=null;e.index!==n.skeleton&&(e.parent&&-1!==e.parent.index?i=this._loadBone(e.parent,n,r,o):void 0!==n.skeleton&&t.Logger.Warn("/skins/".concat(n.index,"/skeleton: Skeleton node is not a common root")));var s=n.joints.indexOf(e.index);return a=new t.Bone(e.name||"joint".concat(e.index),r,i,this._getNodeMatrix(e),null,null,s),o[e.index]=a,this._postSceneLoadActions.push(function(){a.linkTransformNode(e._babylonTransformNode)}),a},n.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);var n=Re.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("/accessors/".concat(n.index),n)},n.prototype._updateBoneMatrices=function(e,n){for(var r=0,o=e.bones;r<o.length;r++){var a=o[r],i=t.Matrix.Identity(),s=a._index;n&&-1!==s&&(t.Matrix.FromArrayToRef(n,16*s,i),i.invertToRef(i));var l=a.getParent();l&&i.multiplyToRef(l.getAbsoluteInverseBindMatrix(),i),a.updateMatrix(i,!1,!1),a._updateAbsoluteBindMatrices(void 0,!1)}},n.prototype._getNodeMatrix=function(e){return e.matrix?t.Matrix.FromArray(e.matrix):t.Matrix.Compose(e.scale?t.Vector3.FromArray(e.scale):t.Vector3.One(),e.rotation?t.Quaternion.FromArray(e.rotation):t.Quaternion.Identity(),e.translation?t.Vector3.FromArray(e.translation):t.Vector3.Zero())},n.prototype.loadCameraAsync=function(e,r,o){void 0===o&&(o=function(){});var a=this._extensionsLoadCameraAsync(e,r,o);if(a)return a;var i=new Array;this.logOpen("".concat(e," ").concat(r.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var s=new t.FreeCamera(r.name||"camera".concat(r.index),t.Vector3.Zero(),this._babylonScene,!1);switch(s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,r._babylonCamera=s,s.setTarget(new t.Vector3(0,0,-1)),r.type){case"perspective":var l=r.perspective;if(!l)throw new Error("".concat(e,": Camera perspective properties are missing"));s.fov=l.yfov,s.minZ=l.znear,s.maxZ=l.zfar||0;break;case"orthographic":if(!r.orthographic)throw new Error("".concat(e,": Camera orthographic properties are missing"));s.mode=t.Camera.ORTHOGRAPHIC_CAMERA,s.orthoLeft=-r.orthographic.xmag,s.orthoRight=r.orthographic.xmag,s.orthoBottom=-r.orthographic.ymag,s.orthoTop=r.orthographic.ymag,s.minZ=r.orthographic.znear,s.maxZ=r.orthographic.zfar;break;default:throw new Error("".concat(e,": Invalid camera type (").concat(r.type,")"))}return n.AddPointerMetadata(s,e),this._parent.onCameraLoadedObservable.notifyObservers(s),o(s),this.logClose(),Promise.all(i).then(function(){return s})},n.prototype._loadAnimationsAsync=function(){var e=this;this._parent._startPerformanceCounter("Load animations");var t=this._gltf.animations;if(!t)return Promise.resolve();for(var n=new Array,r=0;r<t.length;r++){var o=t[r];n.push(this.loadAnimationAsync("/animations/".concat(o.index),o).then(function(e){0===e.targetedAnimations.length&&e.dispose()}))}return Promise.all(n).then(function(){e._parent._endPerformanceCounter("Load animations")})},n.prototype.loadAnimationAsync=function(e,t){var n=this;return this._parent._startPerformanceCounter("Load animation"),this._extensionsLoadAnimationAsync(e,t)||Me.value.then(function(r){var o=r.AnimationGroup;n._babylonScene._blockEntityCollection=!!n._assetContainer;var a=new o(t.name||"animation".concat(t.index),n._babylonScene);a._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1,t._babylonAnimationGroup=a;var i=new Array;Re.Assign(t.channels),Re.Assign(t.samplers);for(var s=0,l=t.channels;s<l.length;s++){var u=l[s];i.push(n._loadAnimationChannelAsync("".concat(e,"/channels/").concat(u.index),e,t,u,function(e,t){e.animations=e.animations||[],e.animations.push(t),a.addTargetedAnimation(t,e)}))}return n._parent._endPerformanceCounter("Load animation"),Promise.all(i).then(function(){return a.normalize(0),a})})},n.prototype._loadAnimationChannelAsync=function(e,t,n,r,o){var a=this,i=this._extensionsLoadAnimationChannelAsync(e,t,n,r,o);if(i)return i;if(null==r.target.node)return Promise.resolve();var s=Re.Get("".concat(e,"/target/node"),this._gltf.nodes,r.target.node),l=r.target.path,u="weights"===l;return u&&!s._numMorphTargets||!u&&!s._babylonTransformNode?Promise.resolve():this._parent.loadNodeAnimations||u||s._isJoint?Ee.value.then(function(){var i,u,c,f,h;switch(l){case"translation":h=null===(i=ve("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":h=null===(u=ve("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":h=null===(c=ve("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":h=null===(f=ve("/nodes/{}/weights"))||void 0===f?void 0:f.interpolation;break;default:throw new Error("".concat(e,"/target/path: Invalid value (").concat(r.target.path,")"))}if(!h)throw new Error("".concat(e,"/target/path: Could not find interpolation properties for target path (").concat(r.target.path,")"));var d={object:s,info:h};return a._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,d,o)}):Promise.resolve()},n.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=Re.Get("".concat(e,"/sampler"),n.samplers,r.sampler);return this._loadAnimationSamplerAsync("".concat(t,"/samplers/").concat(r.sampler),l).then(function(e){for(var t=0,l=o.object,u=0,c=o.info;u<c.length;u++){var f=c[u],h=f.getStride(l),d=e.input,p=e.output,m=new Array(d.length),_=0;switch(e.interpolation){case"STEP":for(var g=0;g<d.length;g++){var y=f.getValue(l,p,_,1);_+=h,m[g]={frame:d[g]*i,value:y,interpolation:1}}break;case"CUBICSPLINE":for(g=0;g<d.length;g++){var b=f.getValue(l,p,_,s);_+=h,y=f.getValue(l,p,_,1),_+=h;var v=f.getValue(l,p,_,s);_+=h,m[g]={frame:d[g]*i,inTangent:b,value:y,outTangent:v}}break;case"LINEAR":for(g=0;g<d.length;g++)y=f.getValue(l,p,_,1),_+=h,m[g]={frame:d[g]*i,value:y}}if(_>0)for(var T="".concat(n.name||"animation".concat(n.index),"_channel").concat(r.index,"_").concat(t),x=0,A=f.buildAnimations(l,T,i,m);x<A.length;x++){var C=A[x];t++,a(C.babylonAnimatable,C.babylonAnimation)}}})},n.prototype._loadAnimationSamplerAsync=function(e,t){if(t._data)return t._data;var n=t.interpolation||"LINEAR";switch(n){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error("".concat(e,"/interpolation: Invalid value (").concat(t.interpolation,")"))}var r=Re.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=Re.Get("".concat(e,"/output"),this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync("/accessors/".concat(r.index),r),this._loadFloatAccessorAsync("/accessors/".concat(o.index),o)]).then(function(e){var t=e[0],r=e[1];return{input:t,interpolation:n,output:r}}),t._data},n.prototype.loadBufferAsync=function(e,t,n,r){var o=this._extensionsLoadBufferAsync(e,t,n,r);if(o)return o;if(!t._data)if(t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{if(!this._bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));t._data=this._bin.readAsync(0,t.byteLength)}return t._data.then(function(t){try{return new Uint8Array(t.buffer,t.byteOffset+n,r)}catch(t){throw new Error("".concat(e,": ").concat(t.message),{cause:t})}})},n.prototype.loadBufferViewAsync=function(e,t){var n=this._extensionsLoadBufferViewAsync(e,t);if(n)return n;if(t._data)return t._data;var r=Re.Get("".concat(e,"/buffer"),this._gltf.buffers,t.buffer);return t._data=this.loadBufferAsync("/buffers/".concat(r.index),r,t.byteOffset||0,t.byteLength),t._data},n.prototype._loadAccessorAsync=function(e,r,o){var a=this;if(r._data)return r._data;var i=n._GetNumComponents(e,r.type),s=i*t.VertexBufferGetTypeByteLength(r.componentType),l=i*r.count;if(null==r.bufferView)r._data=Promise.resolve(new o(l));else{var u=Re.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,r.bufferView);r._data=this.loadBufferViewAsync("/bufferViews/".concat(u.index),u).then(function(a){if(5126!==r.componentType||r.normalized||u.byteStride&&u.byteStride!==s){var c=new o(l);return t.VertexBufferForEach(a,r.byteOffset||0,u.byteStride||s,i,r.componentType,c.length,r.normalized||!1,function(e,t){c[t]=e}),c}return n._GetTypedArray(e,r.componentType,a,r.byteOffset,l)})}if(r.sparse){var c=r.sparse;r._data=r._data.then(function(l){var u=l,f=Re.Get("".concat(e,"/sparse/indices/bufferView"),a._gltf.bufferViews,c.indices.bufferView),h=Re.Get("".concat(e,"/sparse/values/bufferView"),a._gltf.bufferViews,c.values.bufferView);return Promise.all([a.loadBufferViewAsync("/bufferViews/".concat(f.index),f),a.loadBufferViewAsync("/bufferViews/".concat(h.index),h)]).then(function(a){var l,f=a[0],h=a[1],d=n._GetTypedArray("".concat(e,"/sparse/indices"),c.indices.componentType,f,c.indices.byteOffset,c.count),p=i*c.count;if(5126!==r.componentType||r.normalized){var m=n._GetTypedArray("".concat(e,"/sparse/values"),r.componentType,h,c.values.byteOffset,p);l=new o(p),t.VertexBufferForEach(m,0,s,i,r.componentType,l.length,r.normalized||!1,function(e,t){l[t]=e})}else l=n._GetTypedArray("".concat(e,"/sparse/values"),r.componentType,h,c.values.byteOffset,p);for(var _=0,g=0;g<d.length;g++)for(var y=d[g]*i,b=0;b<i;b++)u[y++]=l[_++];return u})})}return r._data},n.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},n.prototype._loadIndicesAccessorAsync=function(e,t){if("SCALAR"!==t.type)throw new Error("".concat(e,"/type: Invalid value ").concat(t.type));if(5121!==t.componentType&&5123!==t.componentType&&5125!==t.componentType)throw new Error("".concat(e,"/componentType: Invalid value ").concat(t.componentType));if(t._data)return t._data;if(t.sparse){var r=n._GetTypedArrayConstructor("".concat(e,"/componentType"),t.componentType);t._data=this._loadAccessorAsync(e,t,r)}else{var o=Re.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(o.index),o).then(function(r){return n._GetTypedArray(e,t.componentType,r,t.byteOffset,t.count)})}return t._data},n.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var n=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then(function(e){return new t.Buffer(n,e,!1)}),e._babylonBuffer},n.prototype._loadVertexAccessorAsync=function(e,r,o){var a;if(null===(a=r._babylonVertexBuffer)||void 0===a?void 0:a[o])return r._babylonVertexBuffer[o];r._babylonVertexBuffer||(r._babylonVertexBuffer={});var i=this._babylonScene.getEngine();if(r.sparse||null==r.bufferView)r._babylonVertexBuffer[o]=this._loadFloatAccessorAsync(e,r).then(function(e){return new t.VertexBuffer(i,e,o,!1)});else{var s=Re.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,r.bufferView);r._babylonVertexBuffer[o]=this._loadVertexBufferViewAsync(s).then(function(a){var l=n._GetNumComponents(e,r.type);return new t.VertexBuffer(i,a,o,!1,void 0,s.byteStride,void 0,r.byteOffset,l,r.componentType,r.normalized,!0,void 0,!0)})}return r._babylonVertexBuffer[o]},n.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,n,r){var o=new Array,a=this._getOrCreateMaterialAdapter(r);return n&&(n.baseColorFactor?(a.baseColor=t.Color3.FromArray(n.baseColorFactor),a.geometryOpacity=n.baseColorFactor[3]):a.baseColor=t.Color3.White(),a.baseMetalness=null==n.metallicFactor?1:n.metallicFactor,a.specularRoughness=null==n.roughnessFactor?1:n.roughnessFactor,n.baseColorTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),n.baseColorTexture,function(e){e.name="".concat(r.name," (Base Color)"),a.baseColorTexture=e})),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),n.metallicRoughnessTexture,function(e){e.name="".concat(r.name," (Metallic Roughness)"),a.baseMetalnessTexture=e,a.specularRoughnessTexture=e})),a.useRoughnessFromMetallicTextureGreen=!0,a.useMetallicFromMetallicTextureBlue=!0)),Promise.all(o).then(function(){})},n.prototype._loadMaterialAsync=function(e,t,r,o,a){void 0===a&&(a=function(){});var i=this._extensionsLoadMaterialAsync(e,t,r,o,a);if(i)return i;t._data=t._data||{};var s=t._data[o];if(!s){this.logOpen("".concat(e," ").concat(t.name||""));var l=this.createMaterial(e,t,o);s={babylonMaterial:l,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(e,t,l)},t._data[o]=s,n.AddPointerMetadata(l,e),this._parent.onMaterialLoadedObservable.notifyObservers(l),this.logClose()}return r&&(s.babylonMeshes.push(r),r.onDisposeObservable.addOnce(function(){var e=s.babylonMeshes.indexOf(r);-1!==e&&s.babylonMeshes.splice(e,1)})),a(s.babylonMaterial),s.promise.then(function(){return s.babylonMaterial})},n.prototype._createDefaultMaterial=function(e,t){if(!this._pbrMaterialImpl)throw new Error("PBR Material class not loaded");this._babylonScene._blockEntityCollection=!!this._assetContainer;var n=new this._pbrMaterialImpl.materialClass(e,this._babylonScene);n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n.fillMode=t,n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE;var r=this._getOrCreateMaterialAdapter(n);return r.transparencyAsAlphaCoverage=this._parent.transparencyAsCoverage,r.baseMetalness=1,r.specularRoughness=1,n},n.prototype.createMaterial=function(e,t,n){var r=this._extensionsCreateMaterial(e,t,n);if(r)return r;var o=t.name||"material".concat(t.index);return this._createDefaultMaterial(o,n)},n.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this._extensionsLoadMaterialPropertiesAsync(e,t,n);if(r)return r;var o=new Array;return o.push(this.loadMaterialBasePropertiesAsync(e,t,n)),t.pbrMetallicRoughness&&o.push(this._loadMaterialMetallicRoughnessPropertiesAsync("".concat(e,"/pbrMetallicRoughness"),t.pbrMetallicRoughness,n)),this.loadMaterialAlphaProperties(e,t,n),Promise.all(o).then(function(){})},n.prototype.loadMaterialBasePropertiesAsync=function(e,n,r){var o,a=new Array,i=this._getOrCreateMaterialAdapter(r);i.emissionColor=n.emissiveFactor?t.Color3.FromArray(n.emissiveFactor):new t.Color3(0,0,0),n.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),n.normalTexture&&(n.normalTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),n.normalTexture,function(e){var t;e.name="".concat(r.name," (Normal)"),i.geometryNormalTexture=e,null!=(null===(t=n.normalTexture)||void 0===t?void 0:t.scale)&&(e.level=n.normalTexture.scale)})),i.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));var s,l=1;return n.occlusionTexture&&(n.occlusionTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),n.occlusionTexture,function(e){e.name="".concat(r.name," (Occlusion)"),o=e})),null!=n.occlusionTexture.strength&&(l=n.occlusionTexture.strength)),n.emissiveTexture&&a.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),n.emissiveTexture,function(e){e.name="".concat(r.name," (Emissive)"),s=e})),Promise.all(a).then(function(){o&&(i.ambientOcclusionTexture=o,i.ambientOcclusionTextureStrength=l),s&&(i.emissionColorTexture=s)})},n.prototype.loadMaterialAlphaProperties=function(e,t,n){if(!this._pbrMaterialImpl)throw new Error("".concat(e,": Material type not supported"));var r=this._getOrCreateMaterialAdapter(n),o=r.baseColorTexture;switch(t.alphaMode||"OPAQUE"){case"OPAQUE":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE,n.alpha=1;break;case"MASK":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHATEST,r.alphaCutOff=null==t.alphaCutoff?.5:t.alphaCutoff,o&&(o.hasAlpha=!0);break;case"BLEND":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHABLEND,o&&(o.hasAlpha=!0,r.useAlphaFromBaseColorTexture=!0);break;default:throw new Error("".concat(e,"/alphaMode: Invalid value (").concat(t.alphaMode,")"))}},n.prototype.loadTextureInfoAsync=function(e,t,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadTextureInfoAsync(e,t,r);if(a)return a;if(this.logOpen("".concat(e)),t.texCoord>=6)throw new Error("".concat(e,"/texCoord: Invalid value (").concat(t.texCoord,")"));var i=Re.Get("".concat(e,"/index"),this._gltf.textures,t.index);i._textureInfo=t;var s=this._loadTextureAsync("/textures/".concat(t.index),i,function(a){a.coordinatesIndex=t.texCoord||0,n.AddPointerMetadata(a,e),o._parent.onTextureLoadedObservable.notifyObservers(a),r(a)});return this.logClose(),s},n.prototype._loadTextureAsync=function(e,t,r){void 0===r&&(r=function(){});var o=this._extensionsLoadTextureAsync(e,t,r);if(o)return o;this.logOpen("".concat(e," ").concat(t.name||""));var a=null==t.sampler?n.DefaultSampler:Re.Get("".concat(e,"/sampler"),this._gltf.samplers,t.sampler),i=Re.Get("".concat(e,"/source"),this._gltf.images,t.source),s=this._createTextureAsync(e,a,i,r,void 0,!t._textureInfo.nonColorData);return this.logClose(),s},n.prototype._createTextureAsync=function(e,n,r,o,a,i){var s,l,u=this;void 0===o&&(o=function(){});var c=this._loadSampler("/samplers/".concat(n.index),n),f=new Array,h=new t.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var d={noMipmap:c.noMipMaps,invertY:!1,samplingMode:c.samplingMode,onLoad:function(){u._disposed||h.resolve()},onError:function(t,n){u._disposed||h.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:null!==(s=r.mimeType)&&void 0!==s?s:t.GetMimeType(null!==(l=r.uri)&&void 0!==l?l:""),loaderOptions:a,useSRGBBuffer:!!i&&this._parent.useSRGBBuffers},p=new t.Texture(null,this._babylonScene,d);p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,f.push(h.promise);var m=r.uri&&!t.IsBase64DataUrl(r.uri)?r.uri:void 0,_=null!=m?m:"".concat(this._fileName,"#image").concat(r.index);if(f.push(this.loadImageAsync("/images/".concat(r.index),r).then(function(e){var t="data:".concat(u._uniqueRootUrl).concat(_);p.updateURL(t,e);var n=p.getInternalTexture();n&&(n.label=r.name)})),p.wrapU=c.wrapU,p.wrapV=c.wrapV,o(p),this._parent.useGltfTextureNames){var g=r.name||m||"image".concat(r.index);p.name=g}return Promise.all(f).then(function(){return p})},n.prototype._loadSampler=function(e,t){return t._data||(t._data={noMipMaps:9728===t.minFilter||9729===t.minFilter,samplingMode:n._GetTextureSamplingMode(e,t),wrapU:n._GetTextureWrapMode("".concat(e,"/wrapS"),t.wrapS),wrapV:n._GetTextureWrapMode("".concat(e,"/wrapT"),t.wrapT)}),t._data},n.prototype.loadImageAsync=function(e,t){if(!t._data){if(this.logOpen("".concat(e," ").concat(t.name||"")),t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{var n=Re.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(n.index),n)}this.logClose()}return t._data},n.prototype.loadUriAsync=function(e,r,o){var a=this,i=this._extensionsLoadUriAsync(e,r,o);if(i)return i;if(!n._ValidateUri(o))throw new Error("".concat(e,": '").concat(o,"' is invalid"));if(t.IsBase64DataUrl(o)){var s=new Uint8Array(t.DecodeBase64UrlToBinary(o));return this.log("".concat(e,": Decoded ").concat(o.substring(0,64),"... (").concat(s.length," bytes)")),Promise.resolve(s)}return this.log("".concat(e,": Loading ").concat(o)),this._parent.preprocessUrlAsync(this._rootUrl+o).then(function(n){return new Promise(function(r,i){a._parent._loadFile(a._babylonScene,n,function(t){a._disposed||(a.log("".concat(e,": Loaded ").concat(o," (").concat(t.byteLength," bytes)")),r(new Uint8Array(t)))},!0,function(n){i(new t.LoadFileError("".concat(e,": Failed to load '").concat(o,"'").concat(n?": "+n.status+" "+n.statusText:""),n))})})})},n.AddPointerMetadata=function(e,t){e.metadata=e.metadata||{};var n=e._internalMetadata=e._internalMetadata||{},r=n.gltf=n.gltf||{};(r.pointers=r.pointers||[]).push(t)},n._GetTextureWrapMode=function(e,n){switch(n=null==n?10497:n){case 33071:return t.Texture.CLAMP_ADDRESSMODE;case 33648:return t.Texture.MIRROR_ADDRESSMODE;case 10497:return t.Texture.WRAP_ADDRESSMODE;default:return t.Logger.Warn("".concat(e,": Invalid value (").concat(n,")")),t.Texture.WRAP_ADDRESSMODE}},n._GetTextureSamplingMode=function(e,n){var r=null==n.magFilter?9729:n.magFilter,o=null==n.minFilter?9987:n.minFilter;if(9729===r)switch(o){case 9728:return t.Texture.LINEAR_NEAREST;case 9729:return t.Texture.LINEAR_LINEAR;case 9984:return t.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return t.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return t.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return t.Texture.LINEAR_LINEAR_MIPLINEAR;default:return t.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),t.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==r&&t.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(r,")")),o){case 9728:return t.Texture.NEAREST_NEAREST;case 9729:return t.Texture.NEAREST_LINEAR;case 9984:return t.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return t.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return t.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return t.Texture.NEAREST_LINEAR_MIPLINEAR;default:return t.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),t.Texture.NEAREST_NEAREST_MIPNEAREST}},n._GetTypedArrayConstructor=function(e,n){try{return t.GetTypedArrayConstructor(n)}catch(t){throw new Error("".concat(e,": ").concat(t.message),{cause:t})}},n._GetTypedArray=function(e,r,o,a,i){var s=o.buffer;a=o.byteOffset+(a||0);var l=n._GetTypedArrayConstructor("".concat(e,"/componentType"),r),u=t.VertexBufferGetTypeByteLength(r);return a%u!==0?(t.Logger.Warn("".concat(e,": Copying buffer as byte offset (").concat(a,") is not a multiple of component type byte length (").concat(u,")")),new l(s.slice(a,a+i*u),0)):new l(s,a,i)},n._GetNumComponents=function(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error("".concat(e,": Invalid type (").concat(t,")"))},n._ValidateUri=function(e){return t.Tools.IsBase64(e)||-1===e.indexOf("..")},n._GetDrawMode=function(e,n){switch(null==n&&(n=4),n){case 0:return t.Material.PointListDrawMode;case 1:return t.Material.LineListDrawMode;case 2:return t.Material.LineLoopDrawMode;case 3:return t.Material.LineStripDrawMode;case 4:return t.Material.TriangleFillMode;case 5:return t.Material.TriangleStripDrawMode;case 6:return t.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(n,")"))},n.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var n=0,r=this._gltf.materials;n<r.length;n++){var o=r[n];if(o._data)for(var a in o._data)for(var i=o._data[a],s=0,l=i.babylonMeshes;s<l.length;s++){var u=l[s];u.computeWorldMatrix(!0);var c=i.babylonMaterial;t.push(c.forceCompilationAsync(u)),t.push(c.forceCompilationAsync(u,{useInstances:!0})),this._parent.useClipPlane&&(t.push(c.forceCompilationAsync(u,{clipPlane:!0})),t.push(c.forceCompilationAsync(u,{clipPlane:!0,useInstances:!0})))}}return Promise.all(t).then(function(){e._parent._endPerformanceCounter("Compile materials")})},n.prototype._compileShadowGeneratorsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile shadow generators");for(var t=new Array,n=0,r=this._babylonScene.lights;n<r.length;n++){var o=r[n].getShadowGenerator();o&&t.push(o.forceCompilationAsync())}return Promise.all(t).then(function(){e._parent._endPerformanceCounter("Compile shadow generators")})},n.prototype._forEachExtensions=function(e){for(var t=0,n=this._extensions;t<n.length;t++){var r=n[t];r.enabled&&e(r)}},n.prototype._applyExtensions=function(e,t,n){for(var r=0,o=this._extensions;r<o.length;r++){var a=o[r];if(a.enabled){var i="".concat(a.name,".").concat(t),s=e;s._activeLoaderExtensionFunctions=s._activeLoaderExtensionFunctions||{};var l=s._activeLoaderExtensionFunctions;if(!l[i]){l[i]=!0;try{var u=n(a);if(u)return u}finally{delete l[i]}}}}return null},n.prototype._extensionsOnLoading=function(){this._forEachExtensions(function(e){return e.onLoading&&e.onLoading()})},n.prototype._extensionsOnReady=function(){this._forEachExtensions(function(e){return e.onReady&&e.onReady()})},n.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",function(n){return n.loadSceneAsync&&n.loadSceneAsync(e,t)})},n.prototype._extensionsLoadNodeAsync=function(e,t,n){return this._applyExtensions(t,"loadNode",function(r){return r.loadNodeAsync&&r.loadNodeAsync(e,t,n)})},n.prototype._extensionsLoadCameraAsync=function(e,t,n){return this._applyExtensions(t,"loadCamera",function(r){return r.loadCameraAsync&&r.loadCameraAsync(e,t,n)})},n.prototype._extensionsLoadVertexDataAsync=function(e,t,n){return this._applyExtensions(t,"loadVertexData",function(r){return r._loadVertexDataAsync&&r._loadVertexDataAsync(e,t,n)})},n.prototype._extensionsLoadMeshPrimitiveAsync=function(e,t,n,r,o,a){return this._applyExtensions(o,"loadMeshPrimitive",function(i){return i._loadMeshPrimitiveAsync&&i._loadMeshPrimitiveAsync(e,t,n,r,o,a)})},n.prototype._extensionsLoadMaterialAsync=function(e,t,n,r,o){return this._applyExtensions(t,"loadMaterial",function(a){return a._loadMaterialAsync&&a._loadMaterialAsync(e,t,n,r,o)})},n.prototype._extensionsCreateMaterial=function(e,t,n){return this._applyExtensions(t,"createMaterial",function(r){return r.createMaterial&&r.createMaterial(e,t,n)})},n.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,n){return this._applyExtensions(t,"loadMaterialProperties",function(r){return r.loadMaterialPropertiesAsync&&r.loadMaterialPropertiesAsync(e,t,n)})},n.prototype._extensionsLoadTextureInfoAsync=function(e,t,n){return this._applyExtensions(t,"loadTextureInfo",function(r){return r.loadTextureInfoAsync&&r.loadTextureInfoAsync(e,t,n)})},n.prototype._extensionsLoadTextureAsync=function(e,t,n){return this._applyExtensions(t,"loadTexture",function(r){return r._loadTextureAsync&&r._loadTextureAsync(e,t,n)})},n.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",function(n){return n.loadAnimationAsync&&n.loadAnimationAsync(e,t)})},n.prototype._extensionsLoadAnimationChannelAsync=function(e,t,n,r,o){return this._applyExtensions(n,"loadAnimationChannel",function(a){return a._loadAnimationChannelAsync&&a._loadAnimationChannelAsync(e,t,n,r,o)})},n.prototype._extensionsLoadSkinAsync=function(e,t,n){return this._applyExtensions(n,"loadSkin",function(r){return r._loadSkinAsync&&r._loadSkinAsync(e,t,n)})},n.prototype._extensionsLoadUriAsync=function(e,t,n){return this._applyExtensions(t,"loadUri",function(r){return r._loadUriAsync&&r._loadUriAsync(e,t,n)})},n.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",function(n){return n.loadBufferViewAsync&&n.loadBufferViewAsync(e,t)})},n.prototype._extensionsLoadBufferAsync=function(e,t,n,r){return this._applyExtensions(t,"loadBuffer",function(o){return o.loadBufferAsync&&o.loadBufferAsync(e,t,n,r)})},n.LoadExtensionAsync=function(e,t,n,r){if(!t.extensions)return null;var o=t.extensions[n];return o?r("".concat(e,"/extensions/").concat(n),o):null},n.LoadExtraAsync=function(e,t,n,r){if(!t.extras)return null;var o=t.extras[n];return o?r("".concat(e,"/extras/").concat(n),o):null},n.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},n.prototype.logOpen=function(e){this._parent._logOpen(e)},n.prototype.logClose=function(){this._parent._logClose()},n.prototype.log=function(e){this._parent._log(e)},n.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},n.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},n.DefaultSampler={index:-1},n}();T._CreateGLTF2Loader=function(e){return new Pe(e)};var Se="EXT_lights_image_based",Fe=function(){function e(e){this.name=Se,this._loader=e,this.enabled=this._loader.isExtensionUsed(Se)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Pe.LoadExtensionAsync(e,t,this.name,function(r,o){return a(n,void 0,void 0,function(){var n,a,s=this;return i(this,function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,(n=new Array).push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen("".concat(r)),a=Re.Get("".concat(r,"/light"),this._lights,o.light),n.push(this._loadLightAsync("/extensions/".concat(this.name,"/lights/").concat(o.light),a).then(function(e){s._loader.babylonScene.environmentTexture=e})),this._loader.logClose(),[4,Promise.all(n).then(function(){})];case 1:return[2,i.sent()]}})})})},e.prototype._loadLightAsync=function(e,n){var r=this;if(!n._loaded){var o=new Array;this._loader.logOpen("".concat(e));for(var s=new Array(n.specularImages.length),l=function(t){var r=n.specularImages[t];s[t]=new Array(r.length);for(var a=function(n){var a="".concat(e,"/specularImages/").concat(t,"/").concat(n);u._loader.logOpen("".concat(a));var i=r[n],l=Re.Get(a,u._loader.gltf.images,i);o.push(u._loader.loadImageAsync("/images/".concat(i),l).then(function(e){s[t][n]=e})),u._loader.logClose()},i=0;i<r.length;i++)a(i)},u=this,c=0;c<n.specularImages.length;c++)l(c);this._loader.logClose(),n._loaded=Promise.all(o).then(function(){return a(r,void 0,void 0,function(){var r,o,a,l,u;return i(this,function(i){switch(i.label){case 0:if((r=new t.RawCubeTexture(this._loader.babylonScene,null,n.specularImageSize)).name=n.name||"environment",n._babylonTexture=r,null!=n.intensity&&(r.level=n.intensity),n.rotation&&(o=t.Quaternion.FromArray(n.rotation),this._loader.babylonScene.useRightHandedSystem||(o=t.Quaternion.Inverse(o)),t.Matrix.FromQuaternionToRef(o,r.getReflectionTextureMatrix())),!n.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(a=t.SphericalHarmonics.FromArray(n.irradianceCoefficients)).scaleInPlace(n.intensity),a.convertIrradianceToLambertianRadiance(),l=t.SphericalPolynomial.FromHarmonics(a),u=(s.length-1)/Math.log2(n.specularImageSize),[4,r.updateRGBDAsync(s,l,u)];case 1:return[2,i.sent()]}})})})}return n._loaded.then(function(){return n._babylonTexture})},e}();we(Se),Oe(Se,!0,function(e){return new Fe(e)});var Ne="EXT_mesh_gpu_instancing",Ie=function(){function e(e){this.name=Ne,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ne)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(e,s){return a(o,void 0,void 0,function(){var o,l,u,c,f=this;return i(this,function(h){switch(h.label){case 0:return this._loader._disableInstancedMesh++,o=this._loader.loadNodeAsync("/nodes/".concat(n.index),n,r),this._loader._disableInstancedMesh--,n._primitiveBabylonMeshes?[3,2]:[4,o];case 1:case 3:return[2,h.sent()];case 2:return l=new Array,u=0,(c=function(t){if(null!=s.attributes[t]){var n=Re.Get("".concat(e,"/attributes/").concat(t),f._loader.gltf.accessors,s.attributes[t]);if(l.push(f._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===u)u=n.count;else if(u!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else l.push(Promise.resolve(null))})("TRANSLATION"),c("ROTATION"),c("SCALE"),c("_COLOR_0"),[4,o.then(function(e){return a(f,void 0,void 0,function(){var r,o,a,s,c,f,h,d,p,m;return i(this,function(i){switch(i.label){case 0:return[4,Promise.all(l)];case 1:for(r=i.sent(),o=r[0],a=r[1],s=r[2],c=r[3],f=new Float32Array(16*u),t.TmpVectors.Vector3[0].copyFromFloats(0,0,0),t.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),t.TmpVectors.Vector3[1].copyFromFloats(1,1,1),h=0;h<u;++h)o&&t.Vector3.FromArrayToRef(o,3*h,t.TmpVectors.Vector3[0]),a&&t.Quaternion.FromArrayToRef(a,4*h,t.TmpVectors.Quaternion[0]),s&&t.Vector3.FromArrayToRef(s,3*h,t.TmpVectors.Vector3[1]),t.Matrix.ComposeToRef(t.TmpVectors.Vector3[1],t.TmpVectors.Quaternion[0],t.TmpVectors.Vector3[0],t.TmpVectors.Matrix[0]),t.TmpVectors.Matrix[0].copyToArray(f,16*h);for(d=0,p=n._primitiveBabylonMeshes;d<p.length;d++)(m=p[d]).thinInstanceSetBuffer("matrix",f,16,!0),c&&(c.length===3*u?m.thinInstanceSetBuffer("color",c,3,!0):c.length===4*u?m.thinInstanceSetBuffer("color",c,4,!0):t.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+m.name));return[2,e]}})})})]}})})})},e}();we(Ne),Oe(Ne,!0,function(e){return new Ie(e)});var ke="EXT_meshopt_compression",Be=function(){function e(e){this.name=ke,this.enabled=e.isExtensionUsed(ke),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,n){var r=this;return Pe.LoadExtensionAsync(e,n,this.name,function(o,s){return a(r,void 0,void 0,function(){var r,o,l=this;return i(this,function(u){switch(u.label){case 0:return(r=n)._meshOptData?[4,r._meshOptData]:[3,2];case 1:case 3:return[2,u.sent()];case 2:return o=Re.Get("".concat(e,"/buffer"),this._loader.gltf.buffers,s.buffer),r._meshOptData=this._loader.loadBufferAsync("/buffers/".concat(o.index),o,s.byteOffset||0,s.byteLength).then(function(e){return a(l,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,t.MeshoptCompression.Default.decodeGltfBufferAsync(e,s.count,s.byteStride,s.mode,s.filter)];case 1:return[2,n.sent()]}})})}),[4,r._meshOptData]}})})})},e}();we(ke),Oe(ke,!0,function(e){return new Be(e)});var Ge="EXT_texture_webp",Ve=function(){function e(e){this.name=Ge,this._loader=e,this.enabled=e.isExtensionUsed(Ge)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r,a;return i(this,function(i){switch(i.label){case 0:return r=null==t.sampler?Pe.DefaultSampler:Re.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),a=Re.Get("".concat(o,"/source"),this._loader.gltf.images,s.source),[4,this._loader._createTextureAsync(e,r,a,function(e){n(e)},void 0,!t._textureInfo.nonColorData)];case 1:return[2,i.sent()]}})})})},e}();we(Ge),Oe(Ge,!0,function(e){return new Ve(e)});var De="EXT_texture_avif",He=function(){function e(e){this.name=De,this._loader=e,this.enabled=e.isExtensionUsed(De)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r,a;return i(this,function(i){switch(i.label){case 0:return r=null==t.sampler?Pe.DefaultSampler:Re.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),a=Re.Get("".concat(o,"/source"),this._loader.gltf.images,s.source),[4,this._loader._createTextureAsync(e,r,a,function(e){n(e)},void 0,!t._textureInfo.nonColorData)];case 1:return[2,i.sent()]}})})})},e}();we(De),Oe(De,!0,function(e){return new He(e)});var je="EXT_lights_ies",Ke=function(){function e(e){this.name=je,this._loader=e,this.enabled=this._loader.isExtensionUsed(je)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,Re.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(s,l){return a(o,void 0,void 0,function(){var o,a,u,c,f,h=this;return i(this,function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n=(a=Re.Get(s,h._lights,l.light)).name||e.name;h._loader.babylonScene._blockEntityCollection=!!h._loader._assetContainer,(o=new t.SpotLight(n,t.Vector3.Zero(),t.Vector3.Backward(),0,1,h._loader.babylonScene)).angle=Math.PI/2,o.innerAngle=0,o._parentContainer=h._loader._assetContainer,h._loader.babylonScene._blockEntityCollection=!1,a._babylonLight=o,o.falloffType=t.Light.FALLOFF_GLTF,o.diffuse=l.color?t.Color3.FromArray(l.color):t.Color3.White(),o.intensity=l.multiplier||1,o.range=Number.MAX_VALUE,o.parent=e,h._loader._babylonLights.push(o),Pe.AddPointerMetadata(o,s),r(e)})];case 1:return u=i.sent(),a.uri?[4,this._loader.loadUriAsync(e,a,a.uri)]:[3,3];case 2:return c=i.sent(),[3,5];case 3:return f=Re.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,a.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(f.index),f)];case 4:c=i.sent(),i.label=5;case 5:return o.iesProfileTexture=new t.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,c,!0,void 0,void 0,void 0,void 0,".ies"),[2,u]}})})})},e}();we(je),Oe(je,!0,function(e){return new Ke(e)});var We="KHR_draco_mesh_compression",Ue=function(){function e(e){this.name=We,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=t.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(We)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(s,l){return a(o,void 0,void 0,function(){var o,u,c,f,h=this;return i(this,function(d){switch(d.label){case 0:if(null!=n.mode&&4!==n.mode&&5!==n.mode)throw new Error("".concat(e,": Unsupported mode ").concat(n.mode));return o={},u={},(c=function(e,t){var a=l.attributes[e];if(null!=a&&(r._delayInfo=r._delayInfo||[],-1===r._delayInfo.indexOf(t)&&r._delayInfo.push(t),o[t]=a,h.useNormalizedFlagFromAccessor)){var i=Re.TryGet(h._loader.gltf.accessors,n.attributes[e]);i&&(u[t]=i.normalized||!1)}})("POSITION",t.VertexBuffer.PositionKind),c("NORMAL",t.VertexBuffer.NormalKind),c("TANGENT",t.VertexBuffer.TangentKind),c("TEXCOORD_0",t.VertexBuffer.UVKind),c("TEXCOORD_1",t.VertexBuffer.UV2Kind),c("TEXCOORD_2",t.VertexBuffer.UV3Kind),c("TEXCOORD_3",t.VertexBuffer.UV4Kind),c("TEXCOORD_4",t.VertexBuffer.UV5Kind),c("TEXCOORD_5",t.VertexBuffer.UV6Kind),c("JOINTS_0",t.VertexBuffer.MatricesIndicesKind),c("WEIGHTS_0",t.VertexBuffer.MatricesWeightsKind),c("COLOR_0",t.VertexBuffer.ColorKind),(f=Re.Get(s,this._loader.gltf.bufferViews,l.bufferView))._dracoBabylonGeometry||(f._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(f.index),f).then(function(s){return a(h,void 0,void 0,function(){var a,l,c;return i(this,function(i){switch(i.label){case 0:return a=this.dracoDecoder||t.DracoDecoder.Default,l=Re.TryGet(this._loader.gltf.accessors,n.attributes.POSITION),c=this._loader.parent.alwaysComputeBoundingBox||r.skeleton||!l?null:Le(l),[4,a._decodeMeshToGeometryForGltfAsync(r.name,this._loader.babylonScene,s,o,u,c).catch(function(t){throw new Error("".concat(e,": ").concat(t.message))})];case 1:return[2,i.sent()]}})})})),[4,f._dracoBabylonGeometry];case 1:return[2,d.sent()]}})})})},e}();we(We),Oe(We,!0,function(e){return new Ue(e)});var ze="KHR_lights_punctual",qe=function(){function e(e){this.name=ze,this._loader=e,this.enabled=this._loader.isExtensionUsed(ze)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,Re.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(s,l){return a(o,void 0,void 0,function(){var o=this;return i(this,function(a){switch(a.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n,a=Re.Get(s,o._lights,l.light),i=a.name||e.name;switch(o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer,a.type){case"directional":var u=new t.DirectionalLight(i,t.Vector3.Backward(),o._loader.babylonScene);u.position.setAll(0),n=u;break;case"point":n=new t.PointLight(i,t.Vector3.Zero(),o._loader.babylonScene);break;case"spot":var c=new t.SpotLight(i,t.Vector3.Zero(),t.Vector3.Backward(),0,1,o._loader.babylonScene);c.angle=2*(a.spot&&a.spot.outerConeAngle||Math.PI/4),c.innerAngle=2*(a.spot&&a.spot.innerConeAngle||0),n=c;break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(s,": Invalid light type (").concat(a.type,")"))}n._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,a._babylonLight=n,n.falloffType=t.Light.FALLOFF_GLTF,n.diffuse=a.color?t.Color3.FromArray(a.color):t.Color3.White(),n.intensity=null==a.intensity?1:a.intensity,n.range=null==a.range?Number.MAX_VALUE:a.range,n.parent=e,o._loader._babylonLights.push(n),Pe.AddPointerMetadata(n,s),r(e)})];case 1:return[2,a.sent()]}})})})},e}();we(ze),Oe(ze,!0,function(e){return new qe(e)});var Ye="EXT_lights_area",Xe=function(){function e(e){this.name=Ye,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ye)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,Re.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(s,l){return a(o,void 0,void 0,function(){var o=this;return i(this,function(a){switch(a.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n,a,i=Re.Get(s,o._lights,l.light),u=i.name||e.name;o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer;var c=void 0!==i.size?i.size:1;switch(i.type){case"rect":var f=void 0!==(null===(n=i.rect)||void 0===n?void 0:n.aspect)?i.rect.aspect*c:c,h=c;a=new t.RectAreaLight(u,t.Vector3.Zero(),f,h,o._loader.babylonScene);break;case"disk":var d=Math.sqrt(c*c*.25*Math.PI);a=new t.RectAreaLight(u,t.Vector3.Zero(),d,d,o._loader.babylonScene);break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(s,": Invalid area light type (").concat(i.type,")"))}a._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=a,a.falloffType=t.Light.FALLOFF_GLTF,a.diffuse=i.color?t.Color3.FromArray(i.color):t.Color3.White(),a.intensity=null==i.intensity?1:i.intensity;var p=new t.TransformNode("".concat(u,"_orientation"),o._loader.babylonScene);p.rotationQuaternion=t.Quaternion.RotationAxis(t.Vector3.Up(),Math.PI),p.parent=e,a.parent=p,o._loader._babylonLights.push(a),Pe.AddPointerMetadata(a,s),r(e)})];case 1:return[2,a.sent()]}})})})},e}();we(Ye),Oe(Ye,!0,function(e){return new Xe(e)});var Qe="KHR_materials_pbrSpecularGlossiness",Ze=function(){function e(e){this.name=Qe,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(Qe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialBasePropertiesAsync(e,t,n)),r.push(this._loadSpecularGlossinessPropertiesAsync(o,s,n)),this._loader.loadMaterialAlphaProperties(e,t,n),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadSpecularGlossinessPropertiesAsync=function(e,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;return o.configureSpecularGlossiness(),n.diffuseFactor?(o.baseColor=t.Color3.FromArray(n.diffuseFactor),r.alpha=n.diffuseFactor[3]):o.baseColor=t.Color3.White(),o.specularColor=n.specularFactor?t.Color3.FromArray(n.specularFactor):t.Color3.White(),o.glossiness=null==n.glossinessFactor?1:n.glossinessFactor,n.diffuseTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),n.diffuseTexture,function(e){e.name="".concat(r.name," (Diffuse)"),o.baseColorTexture=e})),n.specularGlossinessTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),n.specularGlossinessTexture,function(e){e.name="".concat(r.name," (Specular Glossiness)"),o.specularColorTexture=e})),Promise.all(a).then(function(){})},e}();we(Qe),Oe(Qe,!0,function(e){return new Ze(e)});var Je="KHR_materials_unlit",$e=function(){function e(e){this.name=Je,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(Je)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(){return a(r,void 0,void 0,function(){return i(this,function(r){switch(r.label){case 0:return[4,this._loadUnlitPropertiesAsync(e,t,n)];case 1:return[2,r.sent()]}})})})},e.prototype._loadUnlitPropertiesAsync=function(e,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array,i=n.pbrMetallicRoughness;return i&&(i.baseColorFactor&&(o.baseColor=t.Color3.FromArray(i.baseColorFactor),o.geometryOpacity=i.baseColorFactor[3]),i.baseColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),i.baseColorTexture,function(e){e.name="".concat(r.name," (Base Color)"),o.baseColorTexture=e}))),o.isUnlit=!0,n.doubleSided&&(o.backFaceCulling=!1,o.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,n,r),Promise.all(a).then(function(){})},e}();we(Je),Oe(Je,!0,function(e){return new $e(e)});var et="KHR_materials_clearcoat",tt=function(){function e(e){this.name=et,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(et)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadClearCoatPropertiesAsync(o,s,n)),[4,Promise.all(r)];case 1:return a.sent(),[2]}})})})},e.prototype._loadClearCoatPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;return r.configureCoat(),r.coatWeight=void 0!==t.clearcoatFactor?t.clearcoatFactor:0,r.coatRoughness=void 0!==t.clearcoatRoughnessFactor?t.clearcoatRoughnessFactor:0,t.clearcoatTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatTexture"),t.clearcoatTexture,function(e){e.name="".concat(n.name," (ClearCoat)"),r.coatWeightTexture=e})),t.clearcoatRoughnessTexture&&(t.clearcoatRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatRoughnessTexture"),t.clearcoatRoughnessTexture,function(e){e.name="".concat(n.name," (ClearCoat Roughness)"),r.coatRoughnessTexture=e}))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatNormalTexture"),t.clearcoatNormalTexture,function(e){var o;e.name="".concat(n.name," (ClearCoat Normal)"),r.geometryCoatNormalTexture=e,null!=(null===(o=t.clearcoatNormalTexture)||void 0===o?void 0:o.scale)&&(r.geometryCoatNormalTextureScale=t.clearcoatNormalTexture.scale)})),r.setNormalMapInversions(!n.getScene().useRightHandedSystem,n.getScene().useRightHandedSystem)),Promise.all(o).then(function(){})},e}();we(et),Oe(et,!0,function(e){return new tt(e)});var nt="KHR_materials_coat",rt=function(){function e(e){this.name=nt,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),t.extensions&&t.extensions.KHR_materials_openpbr&&(this.useOpenPBR=!0),r.push(this._loadCoatPropertiesAsync(o,s,n)),[4,Promise.all(r)];case 1:return a.sent(),[2]}})})})},e.prototype._loadCoatPropertiesAsync=function(e,n,r){var o,a,i=this._loader._getOrCreateMaterialAdapter(r),s=new Array;i.configureCoat(),i.coatWeight=void 0!==n.coatFactor?n.coatFactor:0,i.coatRoughness=void 0!==n.coatRoughnessFactor?n.coatRoughnessFactor:0,n.coatTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatTexture"),n.coatTexture,function(e){e.name="".concat(r.name," (Coat)"),i.coatWeightTexture=e})),n.coatRoughnessTexture&&(n.coatRoughnessTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatRoughnessTexture"),n.coatRoughnessTexture,function(e){e.name="".concat(r.name," (Coat Roughness)"),i.coatRoughnessTexture=e}))),n.coatNormalTexture&&(n.coatNormalTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatNormalTexture"),n.coatNormalTexture,function(e){var t;e.name="".concat(r.name," (Coat Normal)"),i.geometryCoatNormalTexture=e,null!=(null===(t=n.coatNormalTexture)||void 0===t?void 0:t.scale)&&(i.geometryCoatNormalTextureScale=n.coatNormalTexture.scale)})),i.setNormalMapInversions(!r.getScene().useRightHandedSystem,r.getScene().useRightHandedSystem)),i.coatDarkening=void 0!==n.coatDarkeningFactor?n.coatDarkeningFactor:1,i.coatIor=void 0!==n.coatIor?n.coatIor:1.5;var l=t.Color3.White();void 0!==n.coatColorFactor&&l.fromArray(n.coatColorFactor),i.coatColor=l,n.coatColorTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatColorTexture"),n.coatColorTexture,function(e){e.name="".concat(r.name," (Coat Color)"),i.coatColorTexture=e}));var u=null!==(o=n.coatAnisotropyStrength)&&void 0!==o?o:0,c=null!==(a=n.coatAnisotropyRotation)&&void 0!==a?a:0;return i.coatRoughnessAnisotropy=u,i.geometryCoatTangentAngle=c,this.useOpenPBR||i.configureGltfStyleAnisotropy(!0),n.coatAnisotropyTexture&&(n.coatAnisotropyTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatAnisotropyTexture"),n.coatAnisotropyTexture,function(e){e.name="".concat(r.name," (Coat Anisotropy)"),i.geometryCoatTangentTexture=e}))),Promise.all(s).then(function(){})},e}();we(nt),Oe(nt,!0,function(e){return new rt(e)});var ot="KHR_materials_iridescence",at=function(){function e(e){this.name=ot,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(ot)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIridescencePropertiesAsync(o,s,n)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadIridescencePropertiesAsync=function(e,t,n){var r,o,a,i,s,l=this._loader._getOrCreateMaterialAdapter(n),u=new Array;return l.thinFilmWeight=null!==(r=t.iridescenceFactor)&&void 0!==r?r:0,l.thinFilmIor=null!==(a=null!==(o=t.iridescenceIor)&&void 0!==o?o:t.iridescenceIOR)&&void 0!==a?a:1.3,l.thinFilmThicknessMinimum=null!==(i=t.iridescenceThicknessMinimum)&&void 0!==i?i:100,l.thinFilmThicknessMaximum=null!==(s=t.iridescenceThicknessMaximum)&&void 0!==s?s:400,t.iridescenceTexture&&u.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceTexture"),t.iridescenceTexture,function(e){e.name="".concat(n.name," (Iridescence)"),l.thinFilmWeightTexture=e})),t.iridescenceThicknessTexture&&u.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceThicknessTexture"),t.iridescenceThicknessTexture,function(e){e.name="".concat(n.name," (Iridescence Thickness)"),l.thinFilmThicknessTexture=e})),Promise.all(u).then(function(){})},e}();we(ot),Oe(ot,!0,function(e){return new at(e)});var it="KHR_materials_anisotropy",st=function(){function e(e){this.name=it,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(it)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadAnisotropyPropertiesAsync(o,s,n)),[4,Promise.all(r)];case 1:return a.sent(),[2]}})})})},e.prototype._loadAnisotropyPropertiesAsync=function(e,t,n){return a(this,void 0,void 0,function(){var r,o,a,s,l,u,c,f;return i(this,function(i){switch(i.label){case 0:return r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=null!==(u=t.anisotropyStrength)&&void 0!==u?u:0,s=null!==(c=t.anisotropyRotation)&&void 0!==c?c:0,r.specularRoughnessAnisotropy=a,r.geometryTangentAngle=s,(l=null!==(f=t.extensions)&&void 0!==f?f:{}).EXT_materials_anisotropy_openpbr&&l.EXT_materials_anisotropy_openpbr.openPbrAnisotropyEnabled||r.configureGltfStyleAnisotropy(!0),t.anisotropyTexture&&(t.anisotropyTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/anisotropyTexture"),t.anisotropyTexture,function(e){e.name="".concat(n.name," (Anisotropy Intensity)"),r.geometryTangentTexture=e}))),[4,Promise.all(o)];case 1:return i.sent(),[2]}})})},e}();we(it),Oe(it,!0,function(e){return new st(e)});var lt="KHR_materials_emissive_strength",ut=function(){function e(e){this.name=lt,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(lt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){return i(this,function(r){switch(r.label){case 0:return[4,this._loader.loadMaterialPropertiesAsync(e,t,n)];case 1:return r.sent(),this._loadEmissiveProperties(o,s,n),[4,Promise.resolve()];case 2:return[2,r.sent()]}})})})},e.prototype._loadEmissiveProperties=function(e,t,n){void 0!==t.emissiveStrength&&(this._loader._getOrCreateMaterialAdapter(n).emissionLuminance=t.emissiveStrength)},e}();we(lt),Oe(lt,!0,function(e){return new ut(e)});var ct="KHR_materials_sheen",ft=function(){function e(e){this.name=ct,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ct)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSheenPropertiesAsync(o,s,n)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadSheenPropertiesAsync=function(e,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;o.configureFuzz();var i=void 0!==n.sheenColorFactor?t.Color3.FromArray(n.sheenColorFactor):t.Color3.Black(),s=void 0!==n.sheenRoughnessFactor?n.sheenRoughnessFactor:0;return o.fuzzWeight=1,o.fuzzColor=i,o.fuzzRoughness=s,n.sheenColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),n.sheenColorTexture,function(e){e.name="".concat(r.name," (Sheen Color)"),o.fuzzColorTexture=e})),n.sheenRoughnessTexture&&(n.sheenRoughnessTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),n.sheenRoughnessTexture,function(e){e.name="".concat(r.name," (Sheen Roughness)"),o.fuzzRoughnessTexture=e}))),Promise.all(a).then(function(){})},e}();we(ct),Oe(ct,!0,function(e){return new ft(e)});var ht="KHR_materials_fuzz",dt=function(){function e(e){this.name=ht,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ht)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadFuzzPropertiesAsync(o,s,n)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadFuzzPropertiesAsync=function(e,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;return o.configureFuzz(),o.fuzzWeight=void 0!==n.fuzzFactor?n.fuzzFactor:0,o.fuzzColor=void 0!==n.fuzzColorFactor?t.Color3.FromArray(n.fuzzColorFactor):t.Color3.White(),o.fuzzRoughness=void 0!==n.fuzzRoughnessFactor?n.fuzzRoughnessFactor:.5,n.fuzzTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzTexture"),n.fuzzTexture,function(e){e.name="".concat(r.name," (Fuzz)"),o.fuzzWeightTexture=e})),n.fuzzColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzColorTexture"),n.fuzzColorTexture,function(e){e.name="".concat(r.name," (Fuzz Color)"),o.fuzzColorTexture=e})),n.fuzzRoughnessTexture&&(n.fuzzRoughnessTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzRoughnessTexture"),n.fuzzRoughnessTexture,function(e){e.name="".concat(r.name," (Fuzz Roughness)"),o.fuzzRoughnessTexture=e}))),Promise.all(a).then(function(){})},e}();we(ht),Oe(ht,!0,function(e){return new dt(e)});var pt="KHR_materials_specular",mt=function(){function e(e){this.name=pt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(pt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r,a;return i(this,function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSpecularPropertiesAsync(o,s,n)),a=this._loader._getOrCreateMaterialAdapter(n),s.extensions&&s.extensions.EXT_materials_specular_edge_color&&s.extensions.EXT_materials_specular_edge_color.specularEdgeColorEnabled&&a.enableSpecularEdgeColor(!0),[4,Promise.all(r).then(function(){})];case 1:return[2,i.sent()]}})})})},e.prototype._loadSpecularPropertiesAsync=function(e,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(r),i=new Array;return a.specularWeight=null!==(o=n.specularFactor)&&void 0!==o?o:1,a.specularColor=void 0!==n.specularColorFactor?t.Color3.FromArray(n.specularColorFactor):new t.Color3(1,1,1),n.specularTexture&&(n.specularTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),n.specularTexture,function(e){e.name="".concat(r.name," (Specular)"),a.specularWeightTexture=e}))),n.specularColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),n.specularColorTexture,function(e){e.name="".concat(r.name," (Specular Color)"),a.specularColorTexture=e})),Promise.all(i).then(function(){})},e}();we(pt),Oe(pt,!0,function(e){return new mt(e)});var _t="KHR_materials_ior",gt=function(){function e(e){this.name=_t,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(_t)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIorPropertiesAsync(o,s,n)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadIorPropertiesAsync=function(t,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=void 0!==n.ior?n.ior:e._DEFAULT_IOR;return o.specularIor=a,Promise.resolve()},e._DEFAULT_IOR=1.5,e}();we(_t),Oe(_t,!0,function(e){return new gt(e)});var yt="KHR_materials_variants",bt=function(){function e(e){this.name=yt,this._loader=e,this.enabled=this._loader.isExtensionUsed(yt)&&!this._loader.parent.skipMaterials}return e.prototype.dispose=function(){this._loader=null},e.GetAvailableVariants=function(e){var t=this._GetExtensionMetadata(e);return t?Object.keys(t.variants):[]},e.prototype.getAvailableVariants=function(t){return e.GetAvailableVariants(t)},e.SelectVariant=function(e,t){var n=this._GetExtensionMetadata(e);if(!n)throw new Error("Cannot select variant on a glTF mesh that does not have the ".concat(yt," extension"));var r=function(e){var t=n.variants[e];if(t)for(var r=0,o=t;r<o.length;r++){var a=o[r];a.mesh.material=a.material}};if(t instanceof Array)for(var o=0,a=t;o<a.length;o++)r(a[o]);else r(t);n.lastSelected=t},e.prototype.selectVariant=function(t,n){e.SelectVariant(t,n)},e.Reset=function(e){var t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot reset on a glTF mesh that does not have the ".concat(yt," extension"));for(var n=0,r=t.original;n<r.length;n++){var o=r[n];o.mesh.material=o.material}t.lastSelected=null},e.prototype.reset=function(t){e.Reset(t)},e.GetLastSelectedVariant=function(e){var t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot get the last selected variant on a glTF mesh that does not have the ".concat(yt," extension"));return t.lastSelected},e.prototype.getLastSelectedVariant=function(t){return e.GetLastSelectedVariant(t)},e._GetExtensionMetadata=function(e){var t,n;return(null===(n=null===(t=null==e?void 0:e._internalMetadata)||void 0===t?void 0:t.gltf)||void 0===n?void 0:n[yt])||null},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._variants=t.variants}},e.prototype.onReady=function(){var t,n=this._loader.rootBabylonMesh;if(n){var r=this._loader.parent.extensionOptions[yt];(null==r?void 0:r.defaultVariant)&&e.SelectVariant(n,r.defaultVariant),null===(t=null==r?void 0:r.onLoaded)||void 0===t||t.call(r,{get variants(){return e.GetAvailableVariants(n)},get selectedVariant(){var t=e.GetLastSelectedVariant(n);return t?Array.isArray(t)?t[0]:t:e.GetAvailableVariants(n)[0]},set selectedVariant(t){e.SelectVariant(n,t)}})}},e.prototype._loadMeshPrimitiveAsync=function(n,r,o,s,l,u){var c=this;return Pe.LoadExtensionAsync(n,l,this.name,function(f,h){return a(c,void 0,void 0,function(){var a,c=this;return i(this,function(i){switch(i.label){case 0:return(a=new Array).push(this._loader._loadMeshPrimitiveAsync(n,r,o,s,l,function(r){if(u(r),r instanceof t.Mesh){var o=Pe._GetDrawMode(n,l.mode),i=c._loader.rootBabylonMesh,s=i?i._internalMetadata=i._internalMetadata||{}:{},d=s.gltf=s.gltf||{},p=d[yt]=d[yt]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:r,material:r.material});for(var m=function(t){var n=h.mappings[t],s=Re.Get("".concat(f,"/mappings/").concat(t,"/material"),c._loader.gltf.materials,n.material);a.push(c._loader._loadMaterialAsync("#/materials/".concat(n.material),s,r,o,function(t){for(var o=function(o){var a=n.variants[o],s=Re.Get("/extensions/".concat(yt,"/variants/").concat(a),c._variants,a);p.variants[s.name]=p.variants[s.name]||[],p.variants[s.name].push({mesh:r,material:t}),r.onClonedObservable.add(function(t){var n,o=t,a=o;do{if(!(a=a.parent))return;n=e._GetExtensionMetadata(a)}while(null===n);if(i&&n===e._GetExtensionMetadata(i)){for(var l in a._internalMetadata={},i._internalMetadata)a._internalMetadata[l]=i._internalMetadata[l];for(var l in a._internalMetadata.gltf=[],i._internalMetadata.gltf)a._internalMetadata.gltf[l]=i._internalMetadata.gltf[l];a._internalMetadata.gltf[yt]={lastSelected:null,original:[],variants:{}};for(var u=0,c=n.original;u<c.length;u++){var f=c[u];a._internalMetadata.gltf[yt].original.push({mesh:f.mesh,material:f.material})}for(var l in n.variants)if(Object.prototype.hasOwnProperty.call(n.variants,l)){a._internalMetadata.gltf[yt].variants[l]=[];for(var h=0,d=n.variants[l];h<d.length;h++){var p=d[h];a._internalMetadata.gltf[yt].variants[l].push({mesh:p.mesh,material:p.material})}}n=a._internalMetadata.gltf[yt]}for(var m=0,_=n.original;m<_.length;m++)(b=_[m]).mesh===r&&(b.mesh=o);for(var g=0,y=n.variants[s.name];g<y.length;g++){var b;(b=y[g]).mesh===r&&(b.mesh=o)}})},a=0;a<n.variants.length;++a)o(a)}))},_=0;_<h.mappings.length;++_)m(_)}})),[4,Promise.all(a).then(function(e){return e[0]})];case 1:return[2,i.sent()]}})})})},e}();we(yt),Oe(yt,!0,function(e){return new bt(e)});var vt=function(){function e(n,r,a){var i=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._translucentMaterialIndices=new Map,this._opaqueOnlySubMeshes=new Map,this._savedSubMeshes=new Map,this._options=o(o({},e._GetDefaultOptions()),n),this._scene=r,this._scene._transmissionHelper=this,this._loader=a,this.onErrorObservable=new t.Observable,this._scene.onDisposeObservable.addOnce(function(){i.dispose()}),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:t.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},e.prototype.updateOptions=function(e){var t=this,n=Object.keys(e).filter(function(n){return t._options[n]!==e[n]});if(n.length){var r=o(o({},this._options),e),a=this._options;this._options=r,r.renderSize===a.renderSize&&r.renderTargetTextureType===a.renderTargetTextureType&&r.generateMipmaps===a.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=r.samples,this._opaqueRenderTarget.lodGenerationScale=r.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=r.lodGenerationOffset):this._setupRenderTargets()}},e.prototype.getOpaqueTarget=function(){return this._opaqueRenderTarget},e.prototype._classifyMeshMaterials=function(e){var n=e.material;if(!n)return"opaque";if(!(n instanceof t.MultiMaterial))return this._loader.isMatchingMaterialType(n)&&(s=this._loader._getOrCreateMaterialAdapter(n)).isTranslucent()?(s.refractionBackgroundTexture=this._opaqueRenderTarget,"transparent"):"opaque";for(var r=!1,o=!1,a=new Set,i=0;i<n.subMaterials.length;i++){var s,l=n.subMaterials[i];l&&this._loader.isMatchingMaterialType(l)&&(s=this._loader._getOrCreateMaterialAdapter(l)).isTranslucent()?(s.refractionBackgroundTexture=this._opaqueRenderTarget,r=!0,a.add(i)):o=!0}return r&&o?(this._translucentMaterialIndices.set(e,a),this._rebuildOpaqueOnlySubMeshes(e,a),"mixed"):(this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e),r?"transparent":"opaque")},e.prototype._rebuildOpaqueOnlySubMeshes=function(e,t){e.subMeshes&&this._opaqueOnlySubMeshes.set(e,e.subMeshes.filter(function(e){return!t.has(e.materialIndex)}))},e.prototype._addMesh=function(e){var n=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),t.Tools.SetImmediate(function(){e.material&&("transparent"===n._classifyMeshMaterials(e)?-1===n._transparentMeshesCache.indexOf(e)&&n._transparentMeshesCache.push(e):-1===n._opaqueMeshesCache.indexOf(e)&&n._opaqueMeshesCache.push(e))})},e.prototype._removeMesh=function(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];var t=this._transparentMeshesCache.indexOf(e);-1!==t&&this._transparentMeshesCache.splice(t,1),-1!==(t=this._opaqueMeshesCache.indexOf(e))&&this._opaqueMeshesCache.splice(t,1),this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e)},e.prototype._parseScene=function(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))},e.prototype._onMeshMaterialChanged=function(e){var t=this._transparentMeshesCache.indexOf(e),n=this._opaqueMeshesCache.indexOf(e);"transparent"===this._classifyMeshMaterials(e)?-1!==n?(this._opaqueMeshesCache.splice(n,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e):-1!==t?(this._transparentMeshesCache.splice(t,1),this._opaqueMeshesCache.push(e)):-1===n&&this._opaqueMeshesCache.push(e)},e.prototype._isRenderTargetValid=function(){var e;return null!==(null===(e=this._opaqueRenderTarget)||void 0===e?void 0:e.getInternalTexture())},e.prototype._setupRenderTargets=function(){var e,n,r,o=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new t.RenderTargetTexture("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=null!==(n=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==n?n:this._scene.clearColor.clone(),this._opaqueRenderTarget.clearColor.a=0,this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.renderSprites=!0,this._opaqueRenderTarget.renderParticles=!0,this._opaqueRenderTarget.disableImageProcessing=!0,this._opaqueRenderTarget.onBeforeBindObservable.add(function(e){r=o._scene.environmentIntensity,o._scene.environmentIntensity=1,o._options.clearColor?e.clearColor.copyFrom(o._options.clearColor):o._scene.clearColor.toLinearSpaceToRef(e.clearColor,o._scene.getEngine().useExactSrgbConversions),e.clearColor.a=0;for(var t=o._opaqueOnlySubMeshes.entries(),n=t.next();!n.done;n=t.next()){var a=n.value[0],i=n.value[1];a.subMeshes&&(o._savedSubMeshes.set(a,a.subMeshes),a.subMeshes=i)}}),this._opaqueRenderTarget.onAfterUnbindObservable.add(function(){o._scene.environmentIntensity=r;for(var e=o._savedSubMeshes.entries(),t=e.next();!t.done;t=e.next())t.value[0].subMeshes=t.value[1];o._savedSubMeshes.clear()});for(var a=0,i=this._transparentMeshesCache;a<i.length;a++)(u=i[a]).material&&this._classifyMeshMaterials(u);for(var s=this._translucentMaterialIndices.entries(),l=s.next();!l.done;l=s.next()){var u;(u=l.value[0]).material&&this._classifyMeshMaterials(u)}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[],this._translucentMaterialIndices.clear(),this._opaqueOnlySubMeshes.clear(),this._savedSubMeshes.clear()},e}(),Tt="KHR_materials_transmission",xt=function(){function e(e){this.name=Tt,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(Tt),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTransparentPropertiesAsync(o,t,n,s)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadTransparentPropertiesAsync=function(e,t,n,r){var o,a,i=this._loader._getOrCreateMaterialAdapter(n),s=void 0!==r.transmissionFactor?r.transmissionFactor:0;if(0===s||!i)return Promise.resolve();if(i.configureTransmission(),i.transmissionWeight=s,s>0&&!this._loader.parent.dontUseTransmissionHelper){var l=n.getScene();l._transmissionHelper?(null===(o=l._transmissionHelper)||void 0===o?void 0:o._isRenderTargetValid())||null===(a=l._transmissionHelper)||void 0===a||a._setupRenderTargets():new vt({},n.getScene(),this._loader)}var u=Promise.resolve(null);return r.transmissionTexture&&(r.transmissionTexture.nonColorData=!0,u=this._loader.loadTextureInfoAsync("".concat(e,"/transmissionTexture"),r.transmissionTexture,function(e){e.name="".concat(n.name," (Transmission)"),i.transmissionWeightTexture=e})),u.then(function(){})},e}();we(Tt),Oe(Tt,!0,function(e){return new xt(e)});var At="KHR_materials_diffuse_transmission",Ct=function(){function e(e){this.name=At,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(At),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTranslucentPropertiesAsync(o,t,n,s)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadTranslucentPropertiesAsync=function(e,n,r,o){var a,i=this._loader._getOrCreateMaterialAdapter(r);i.configureSubsurface(),i.subsurfaceWeight=null!==(a=o.diffuseTransmissionFactor)&&void 0!==a?a:0,i.diffuseTransmissionTint=void 0!==o.diffuseTransmissionColorFactor?t.Color3.FromArray(o.diffuseTransmissionColorFactor):t.Color3.White();var s=new Array;return o.diffuseTransmissionTexture&&(o.diffuseTransmissionTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),o.diffuseTransmissionTexture).then(function(e){e.name="".concat(r.name," (Diffuse Transmission)"),i.subsurfaceWeightTexture=e}))),o.diffuseTransmissionColorTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),o.diffuseTransmissionColorTexture).then(function(e){e.name="".concat(r.name," (Diffuse Transmission Color)"),i.diffuseTransmissionTintTexture=e})),Promise.all(s).then(function(){})},e}();we(At),Oe(At,!0,function(e){return new Ct(e)});var Ot="KHR_materials_volume",wt=function(){function e(e){this.name=Ot,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ot),this.enabled&&this._loader._disableInstancedMesh++}return e.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadVolumePropertiesAsync(o,t,n,s)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadVolumePropertiesAsync=function(e,n,r,o){var a,i=this._loader._getOrCreateMaterialAdapter(r);if(0===i.transmissionWeight&&0===i.subsurfaceWeight||!o.thicknessFactor)return Promise.resolve();i.geometryThinWalled=!1;var s=void 0!==o.attenuationDistance?o.attenuationDistance:Number.MAX_VALUE,l=void 0!==o.attenuationColor&&3==o.attenuationColor.length?t.Color3.FromArray(o.attenuationColor):t.Color3.White();i.configureVolume(),i.transmissionColor=l,i.transmissionDepth=s,i.volumeThickness=null!==(a=o.thicknessFactor)&&void 0!==a?a:0;var u=new Array;return o.thicknessTexture&&(o.thicknessTexture.nonColorData=!0,u.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),o.thicknessTexture,function(e){e.name="".concat(r.name," (Thickness)"),i.volumeThicknessTexture=e}))),Promise.all(u).then(function(){})},e}();we(Ot),Oe(Ot,!0,function(e){return new wt(e)});var Mt="KHR_materials_volume_scatter",Et=function(){function e(e){this.name=Mt,this.order=172,this._loader=e,this.enabled=this._loader.isExtensionUsed(Mt),this.enabled&&this._loader._disableInstancedMesh++}return e.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadVolumePropertiesAsync(o,t,n,s)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadVolumePropertiesAsync=function(e,n,r,o){var a=this._loader._getOrCreateMaterialAdapter(r);if(0===a.transmissionWeight&&0===a.subsurfaceWeight||a.geometryThinWalled)return Promise.resolve();var i=void 0!==o.multiscatterColorFactor&&3==o.multiscatterColorFactor.length?t.Color3.FromArray(o.multiscatterColorFactor):t.Color3.Black(),s=void 0!==o.scatterAnisotropy?o.scatterAnisotropy:0,l=Promise.resolve(null);o.multiscatterColorTexture&&(o.multiscatterColorTexture.nonColorData=!0,l=this._loader.loadTextureInfoAsync("".concat(e,"/multiscatterColorTexture"),o.multiscatterColorTexture,function(e){e.name="".concat(r.name," (Scatter Color)"),a.transmissionWeight>0&&(a.transmissionScatterTexture=e),a.subsurfaceWeight>0&&(a.subsurfaceColorTexture=e)}));var u=new t.Vector3(-Math.log(a.transmissionColor.r),-Math.log(a.transmissionColor.g),-Math.log(a.transmissionColor.b));if(u.scaleInPlace(1/Math.max(a.transmissionDepth,1e-6)),a.transmissionWeight>0){var c=function(e){var n=new t.Vector3(e.r,e.g,e.b),r=new t.Vector3(4.09712,4.09712,4.09712);r.addInPlace(new t.Vector3(4.20863,4.20863,4.20863).multiplyInPlace(n));var o=new t.Vector3(9.59217,9.59217,9.59217);return o.addInPlace(new t.Vector3(41.6808,41.6808,41.6808).multiplyInPlace(n)),o.addInPlace(new t.Vector3(17.7126,17.7126,17.7126).multiplyInPlace(n.multiply(n))),r.subtractInPlace(new t.Vector3(Math.sqrt(o.x),Math.sqrt(o.y),Math.sqrt(o.z))),new t.Vector3(1,1,1).subtract(r.multiply(r))}(i),f=u.multiply(c);f.scaleInPlace(a.transmissionDepth),a.transmissionScatter.set(f.x,f.y,f.z),a.transmissionScatterAnisotropy=s}if(a.subsurfaceWeight>0){a.subsurfaceScatterAnisotropy=s,a.subsurfaceColor=i;var h=new t.Vector3(0!==u.x?1/u.x:1,0!==u.y?1/u.y:1,0!==u.z?1/u.z:1);a.subsurfaceRadius=Math.max(h.x,h.y,h.z),a.subsurfaceRadiusScale=new t.Color3(h.x/a.subsurfaceRadius,h.y/a.subsurfaceRadius,h.z/a.subsurfaceRadius)}return l.then(function(){})},e}();we(Mt),Oe(Mt,!0,function(e){return new Et(e)});var Rt="KHR_materials_dispersion",Lt=function(){function e(e){this.name=Rt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Rt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDispersionPropertiesAsync(o,t,n,s)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadDispersionPropertiesAsync=function(e,t,n,r){var o=this._loader._getOrCreateMaterialAdapter(n);return 0!=o.transmissionWeight&&r.dispersion?(o.transmissionDispersionAbbeNumber=20,o.transmissionDispersionScale=r.dispersion,Promise.resolve()):Promise.resolve()},e}();we(Rt),Oe(Rt,!0,function(e){return new Lt(e)});var Pt="KHR_materials_diffuse_roughness",St=function(){function e(e){this.name=Pt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDiffuseRoughnessPropertiesAsync(o,s,n)),[4,Promise.all(r).then(function(){})];case 1:return[2,a.sent()]}})})})},e.prototype._loadDiffuseRoughnessPropertiesAsync=function(e,t,n){var r,o=this._loader._getOrCreateMaterialAdapter(n),a=new Array;return o.baseDiffuseRoughness=null!==(r=t.diffuseRoughnessFactor)&&void 0!==r?r:0,t.diffuseRoughnessTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseRoughnessTexture"),t.diffuseRoughnessTexture,function(e){e.name="".concat(n.name," (Diffuse Roughness)"),o.baseDiffuseRoughnessTexture=e})),Promise.all(a).then(function(){})},e}();we(Pt),Oe(Pt,!0,function(e){return new St(e)});var Ft="KHR_mesh_quantization",Nt=function(){function e(e){this.name=Ft,this.enabled=e.isExtensionUsed(Ft)}return e.prototype.dispose=function(){},e}();we(Ft),Oe(Ft,!0,function(e){return new Nt(e)});var It="KHR_texture_basisu",kt=function(){function e(e){this.name=It,this._loader=e,this.enabled=e.isExtensionUsed(It)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Pe.LoadExtensionAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r,a;return i(this,function(i){switch(i.label){case 0:return r=null==t.sampler?Pe.DefaultSampler:Re.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),a=Re.Get("".concat(o,"/source"),this._loader.gltf.images,s.source),[4,this._loader._createTextureAsync(e,r,a,function(e){n(e)},t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)];case 1:return[2,i.sent()]}})})})},e}();we(It),Oe(It,!0,function(e){return new kt(e)});var Bt="KHR_texture_transform",Gt=function(){function e(e){this.name=Bt,this._loader=e,this.enabled=this._loader.isExtensionUsed(Bt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(s,l){return a(o,void 0,void 0,function(){return i(this,function(o){switch(o.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,n,function(e){if(!(e instanceof t.Texture))throw new Error("".concat(s,": Texture type not supported"));l.offset&&(e.uOffset=l.offset[0],e.vOffset=l.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,l.rotation&&(e.wAng=-l.rotation),l.scale&&(e.uScale=l.scale[0],e.vScale=l.scale[1]),null!=l.texCoord&&(e.coordinatesIndex=l.texCoord),r(e)})];case 1:return[2,o.sent()]}})})})},e}();we(Bt),Oe(Bt,!0,function(e){return new Gt(e)});var Vt="KHR_xmp_json_ld",Dt=function(){function e(e){this.name=Vt,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Vt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.onLoading=function(){var e,t,n;if(null!==this._loader.rootBabylonMesh){var r=null===(e=this._loader.gltf.extensions)||void 0===e?void 0:e.KHR_xmp_json_ld,o=null===(n=null===(t=this._loader.gltf.asset)||void 0===t?void 0:t.extensions)||void 0===n?void 0:n.KHR_xmp_json_ld;if(r&&o){var a=+o.packet;r.packets&&a<r.packets.length&&(this._loader.rootBabylonMesh.metadata=this._loader.rootBabylonMesh.metadata||{},this._loader.rootBabylonMesh.metadata.xmp=r.packets[a])}}},e}();function Ht(e,n,r,o){return t.Vector3.FromArray(n,r).scaleInPlace(o)}function jt(e,n,r,o){return t.Quaternion.FromArray(n,r).scaleInPlace(o)}function Kt(e,t,n,r){for(var o=new Array(e._numMorphTargets),a=0;a<o.length;a++)o[a]=t[n++]*r;return o}we(Vt),Oe(Vt,!0,function(e){return new Dt(e)});var Wt=function(){function e(e,t,n,r){this.type=e,this.name=t,this.getValue=n,this.getStride=r}return e.prototype._buildAnimation=function(e,n,r){var o=new t.Animation(e,this.name,n,this.type);return o.setKeys(r,!0),o},e}(),Ut=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=[];return o.push({babylonAnimatable:e._babylonTransformNode,babylonAnimation:this._buildAnimation(t,n,r)}),o},t}(Wt),zt=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return r(n,e),n.prototype.buildAnimations=function(e,n,r,o){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new t.Animation("".concat(n,"_").concat(i),s.name,r,s.type);if(l.setKeys(o.map(function(e){return{frame:e.frame,inTangent:e.inTangent?e.inTangent[i]:void 0,value:e.value[i],outTangent:e.outTangent?e.outTangent[i]:void 0,interpolation:e.interpolation}}),!0),e._primitiveBabylonMeshes)for(var u=0,c=e._primitiveBabylonMeshes;u<c.length;u++){var f=c[u];if(f.morphTargetManager){var h=f.morphTargetManager.getTarget(i),d=l.clone();h.animations.push(d),a.push({babylonAnimatable:h,babylonAnimation:d})}}},s=this,l=0;l<e._numMorphTargets;l++)i(l);return a},n}(Wt);Te("/nodes/{}/translation",[new Ut(t.Animation.ANIMATIONTYPE_VECTOR3,"position",Ht,function(){return 3})]),Te("/nodes/{}/rotation",[new Ut(t.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",jt,function(){return 4})]),Te("/nodes/{}/scale",[new Ut(t.Animation.ANIMATIONTYPE_VECTOR3,"scaling",Ht,function(){return 3})]),Te("/nodes/{}/weights",[new zt(t.Animation.ANIMATIONTYPE_FLOAT,"influence",Kt,function(e){return e._numMorphTargets})]);var qt={__proto__:null,AnimationPropertyInfo:Wt,TransformNodeAnimationPropertyInfo:Ut,WeightAnimationPropertyInfo:zt,getQuaternion:jt,getVector3:Ht,getWeights:Kt};function Yt(e,n,r,o){return t.Color3.FromArray(n,r).scale(o)}function Xt(e,t,n,r){return t[n]*r}function Qt(e,t,n,r){return-t[n]*r}function Zt(e,t,n,r){return t[n+1]*r}function Jt(e,t,n,r){return t[n]*r*2}function $t(e){return{scale:[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Xt,function(){return 2}),new tn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),Zt,function(){return 2})],offset:[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Xt,function(){return 2}),new tn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),Zt,function(){return 2})],rotation:[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),Qt,function(){return 1})]}}var en=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Wt),tn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=[];for(var a in e._data)o.push({babylonAnimatable:e._data[a].babylonMaterial,babylonAnimation:this._buildAnimation(t,n,r)});return o},t}(Wt),nn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Wt),rn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=this;return e._primitiveBabylonMeshes?e._primitiveBabylonMeshes.map(function(e){return{babylonAnimatable:e,babylonAnimation:o._buildAnimation(t,n,r)}}):[]},t}(Wt);Te("/cameras/{}/orthographic/xmag",[new en(t.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",Qt,function(){return 1}),new en(t.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",Zt,function(){return 1})]),Te("/cameras/{}/orthographic/ymag",[new en(t.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",Qt,function(){return 1}),new en(t.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",Zt,function(){return 1})]),Te("/cameras/{}/orthographic/zfar",[new en(t.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Xt,function(){return 1})]),Te("/cameras/{}/orthographic/znear",[new en(t.Animation.ANIMATIONTYPE_FLOAT,"minZ",Xt,function(){return 1})]),Te("/cameras/{}/perspective/yfov",[new en(t.Animation.ANIMATIONTYPE_FLOAT,"fov",Xt,function(){return 1})]),Te("/cameras/{}/perspective/zfar",[new en(t.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Xt,function(){return 1})]),Te("/cameras/{}/perspective/znear",[new en(t.Animation.ANIMATIONTYPE_FLOAT,"minZ",Xt,function(){return 1})]),Te("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new tn(t.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",Yt,function(){return 4}),new tn(t.Animation.ANIMATIONTYPE_FLOAT,"alpha",function(e,t,n,r){return t[n+3]*r},function(){return 4})]),Te("/materials/{}/pbrMetallicRoughness/metallicFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"metallic",Xt,function(){return 1})]),Te("/materials/{}/pbrMetallicRoughness/metallicFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"roughness",Xt,function(){return 1})]);var on=$t("albedoTexture");Te("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",on.scale),Te("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",on.offset),Te("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",on.rotation);var an=$t("metallicTexture");Te("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",an.scale),Te("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",an.offset),Te("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",an.rotation),Te("/materials/{}/emissiveFactor",[new tn(t.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",Yt,function(){return 3})]);var sn=$t("bumpTexture");Te("/materials/{}/normalTexture/scale",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Xt,function(){return 1})]),Te("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",sn.scale),Te("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",sn.offset),Te("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",sn.rotation),Te("/materials/{}/occlusionTexture/strength",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Xt,function(){return 1})]);var ln=$t("ambientTexture");Te("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",ln.scale),Te("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",ln.offset),Te("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",ln.rotation);var un=$t("emissiveTexture");Te("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",un.scale),Te("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",un.offset),Te("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",un.rotation),Te("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Xt,function(){return 1})]);var cn=$t("anisotropy.texture");Te("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",cn.scale),Te("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",cn.offset),Te("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",cn.rotation),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Xt,function(){return 1})]);var fn=$t("clearCoat.texture");Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",fn.scale),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",fn.offset),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",fn.rotation);var hn=$t("clearCoat.bumpTexture");Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",hn.scale),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",hn.offset),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",hn.rotation);var dn=$t("clearCoat.textureRoughness");Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",dn.scale),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",dn.offset),Te("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",dn.rotation),Te("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_ior/ior",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Xt,function(){return 1})]);var pn=$t("iridescence.texture");Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",pn.scale),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",pn.offset),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",pn.rotation);var mn=$t("iridescence.thicknessTexture");Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",mn.scale),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",mn.offset),Te("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",mn.rotation),Te("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new tn(t.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",Yt,function(){return 3})]),Te("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Xt,function(){return 1})]);var _n=$t("sheen.texture");Te("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",_n.scale),Te("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",_n.offset),Te("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",_n.rotation);var gn=$t("sheen.textureRoughness");Te("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",gn.scale),Te("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",gn.offset),Te("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",gn.rotation),Te("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new tn(t.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Yt,function(){return 3})]);var yn=$t("metallicReflectanceTexture");Te("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",yn.scale),Te("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",yn.offset),Te("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",yn.rotation);var bn=$t("reflectanceTexture");Te("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",bn.scale),Te("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",bn.offset),Te("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",bn.rotation),Te("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Xt,function(){return 1})]);var vn=$t("subSurface.refractionIntensityTexture");Te("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",vn.scale),Te("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",vn.offset),Te("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",vn.rotation),Te("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new tn(t.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Yt,function(){return 3})]),Te("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Xt,function(){return 1})]),Te("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Xt,function(){return 1})]);var Tn=$t("subSurface.thicknessTexture");Te("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",Tn.scale),Te("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",Tn.offset),Te("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",Tn.rotation),Te("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new tn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Xt,function(){return 1})]);var xn=$t("subSurface.translucencyIntensityTexture");Te("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",xn.scale),Te("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",xn.offset),Te("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",xn.rotation),Te("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new tn(t.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",Yt,function(){return 3})]);var An=$t("subSurface.translucencyColorTexture");Te("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",An.scale),Te("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",An.offset),Te("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",An.rotation),Te("/extensions/KHR_lights_punctual/lights/{}/color",[new nn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Yt,function(){return 3})]),Te("/extensions/KHR_lights_punctual/lights/{}/intensity",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Xt,function(){return 1})]),Te("/extensions/KHR_lights_punctual/lights/{}/range",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"range",Xt,function(){return 1})]),Te("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",Jt,function(){return 1})]),Te("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"angle",Jt,function(){return 1})]),Te("/extensions/EXT_lights_area/lights/{}/color",[new nn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Yt,function(){return 3})]),Te("/extensions/EXT_lights_area/lights/{}/intensity",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Xt,function(){return 1})]),Te("/extensions/EXT_lights_area/lights/{}/size",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"radius",Xt,function(){return 1})]),Te("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"radius",Xt,function(){return 1})]),Te("/nodes/{}/extensions/EXT_lights_ies/color",[new nn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Yt,function(){return 3})]),Te("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new nn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Xt,function(){return 1})]),Te("/nodes/{}/extensions/KHR_node_visibility/visible",[new rn(t.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Xt,function(){return 1})]);var Cn="KHR_animation_pointer",On=function(){function e(e){this.name=Cn,this._loader=e,this._pathToObjectConverter=be(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(Cn)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,n,r,o,a){var i,s=null===(i=o.target.extensions)||void 0===i?void 0:i.KHR_animation_pointer;if(!s||!this._pathToObjectConverter)return null;"pointer"!==o.target.path&&t.Logger.Warn("".concat(e,"/target/path: Value (").concat(o.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=o.target.node&&t.Logger.Warn("".concat(e,"/target/node: Value (").concat(o.target.node,") must not be present when using the ").concat(this.name," extension"));var l="".concat(e,"/extensions/").concat(this.name),u=s.pointer;if(!u)throw new Error("".concat(l,": Pointer is missing"));try{var c=this._pathToObjectConverter.convert(u);if(!c.info.interpolation)throw new Error("".concat(l,"/pointer: Interpolation is missing"));return this._loader._loadAnimationChannelFromTargetInfoAsync(e,n,r,o,{object:c.object,info:c.info.interpolation},a)}catch(e){return t.Logger.Warn("".concat(l,"/pointer: Invalid pointer (").concat(u,") skipped")),null}},e}();we(Cn),Oe(Cn,!0,function(e){return new On(e)});var wn="MSFT_audio_emitter",Mn=function(){function e(e){this.name=wn,this._loader=e,this.enabled=this._loader.isExtensionUsed(wn)}return e.prototype.dispose=function(){this._loader=null,this._clips=null,this._emitters=null},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._clips=t.clips,this._emitters=t.emitters,Re.Assign(this._clips),Re.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Pe.LoadExtensionAsync(e,t,this.name,function(r,o){return a(n,void 0,void 0,function(){var n,a,s,l,u;return i(this,function(i){switch(i.label){case 0:for((n=new Array).push(this._loader.loadSceneAsync(e,t)),a=0,s=o.emitters;a<s.length;a++){if(l=s[a],null!=(u=Re.Get("".concat(r,"/emitters"),this._emitters,l)).refDistance||null!=u.maxDistance||null!=u.rolloffFactor||null!=u.distanceModel||null!=u.innerAngle||null!=u.outerAngle)throw new Error("".concat(r,": Direction or Distance properties are not allowed on emitters attached to a scene"));n.push(this._loadEmitterAsync("".concat(r,"/emitters/").concat(u.index),u))}return[4,Promise.all(n)];case 1:return i.sent(),[2]}})})})},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(e,s){return a(o,void 0,void 0,function(){var o,a,l=this;return i(this,function(i){switch(i.label){case 0:return o=new Array,[4,this._loader.loadNodeAsync(e,n,function(n){for(var a=function(r){var a=Re.Get("".concat(e,"/emitters"),l._emitters,r);o.push(l._loadEmitterAsync("".concat(e,"/emitters/").concat(a.index),a).then(function(){for(var e=0,r=a._babylonSounds;e<r.length;e++){var o=r[e];o.attachToMesh(n),null==a.innerAngle&&null==a.outerAngle||(o.setLocalDirectionToMesh(t.Vector3.Forward()),o.setDirectionalCone(2*t.Tools.ToDegrees(null==a.innerAngle?Math.PI:a.innerAngle),2*t.Tools.ToDegrees(null==a.outerAngle?Math.PI:a.outerAngle),0))}}))},i=0,u=s.emitters;i<u.length;i++)a(u[i]);r(n)})];case 1:return a=i.sent(),[4,Promise.all(o)];case 2:return i.sent(),[2,a]}})})})},e.prototype.loadAnimationAsync=function(e,t){var n=this;return Pe.LoadExtensionAsync(e,t,this.name,function(r,o){return a(n,void 0,void 0,function(){var n,a,s,l,u;return i(this,function(i){switch(i.label){case 0:return[4,this._loader.loadAnimationAsync(e,t)];case 1:for(n=i.sent(),a=new Array,Re.Assign(o.events),s=0,l=o.events;s<l.length;s++)u=l[s],a.push(this._loadAnimationEventAsync("".concat(r,"/events/").concat(u.index),e,t,u,n));return[4,Promise.all(a)];case 2:return i.sent(),[2,n]}})})})},e.prototype._loadClipAsync=function(e,n){if(n._objectURL)return n._objectURL;var r;if(n.uri)r=this._loader.loadUriAsync(e,n,n.uri);else{var o=Re.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,n.bufferView);r=this._loader.loadBufferViewAsync("/bufferViews/".concat(o.index),o)}return n._objectURL=r.then(function(e){var r=t.GetBlobBufferSource(e);return URL.createObjectURL(new Blob([r],{type:n.mimeType}))}),n._objectURL},e.prototype._loadEmitterAsync=function(e,n){var r=this;if(n._babylonSounds=n._babylonSounds||[],!n._babylonData){for(var o=new Array,a=n.name||"emitter".concat(n.index),i={loop:!1,autoplay:!1,volume:null==n.volume?1:n.volume},s=function(e){var s="/extensions/".concat(l.name,"/clips"),u=Re.Get(s,l._clips,n.clips[e].clip);o.push(l._loadClipAsync("".concat(s,"/").concat(n.clips[e].clip),u).then(function(o){var s=n._babylonSounds[e]=new t.Sound(a,o,r._loader.babylonScene,null,i);s.refDistance=n.refDistance||1,s.maxDistance=n.maxDistance||256,s.rolloffFactor=n.rolloffFactor||1,s.distanceModel=n.distanceModel||"exponential"}))},l=this,u=0;u<n.clips.length;u++)s(u);var c=Promise.all(o).then(function(){var e=n.clips.map(function(e){return e.weight||1}),r=new t.WeightedSound(n.loop||!1,n._babylonSounds,e);n.innerAngle&&(r.directionalConeInnerAngle=2*t.Tools.ToDegrees(n.innerAngle)),n.outerAngle&&(r.directionalConeOuterAngle=2*t.Tools.ToDegrees(n.outerAngle)),n.volume&&(r.volume=n.volume),n._babylonData.sound=r});n._babylonData={loaded:c}}return n._babylonData.loaded},e.prototype._getEventAction=function(e,t,n,r,o){switch(n){case"play":return function(e){var n=(o||0)+(e-r);t.play(n)};case"stop":return function(){t.stop()};case"pause":return function(){t.pause()};default:throw new Error("".concat(e,": Unsupported action ").concat(n))}},e.prototype._loadAnimationEventAsync=function(e,n,r,o,a){var i=this;if(0==a.targetedAnimations.length)return Promise.resolve();var s=a.targetedAnimations[0],l=o.emitter,u=Re.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,l);return this._loadEmitterAsync(e,u).then(function(){var n=u._babylonData.sound;if(n){var r=new t.AnimationEvent(o.time,i._getEventAction(e,n,o.action,o.time,o.startOffset));s.animation.addEvent(r),a.onAnimationGroupEndObservable.add(function(){n.stop()}),a.onAnimationGroupPauseObservable.add(function(){n.pause()})}})},e}();we(wn),Oe(wn,!0,function(e){return new Mn(e)});var En="MSFT_lod",Rn=function(){function e(e){var n,r;this.name=En,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new t.Observable,this.onMaterialLODsLoadedObservable=new t.Observable,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.maxLODsToLoad=null!==(r=null===(n=this._loader.parent.extensionOptions[En])||void 0===n?void 0:n.maxLODsToLoad)&&void 0!==r?r:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(En)}return e.prototype.dispose=function(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()},e.prototype.onReady=function(){for(var e=this,t=function(t){var r=Promise.all(n._nodePromiseLODs[t]).then(function(){0!==t&&(e._loader.endPerformanceCounter("Node LOD ".concat(t)),e._loader.log("Loaded node LOD ".concat(t))),e.onNodeLODsLoadedObservable.notifyObservers(t),t!==e._nodePromiseLODs.length-1&&(e._loader.startPerformanceCounter("Node LOD ".concat(t+1)),e._loadBufferLOD(e._nodeBufferLODs,t+1),e._nodeSignalLODs[t]&&e._nodeSignalLODs[t].resolve())});n._loader._completePromises.push(r)},n=this,r=0;r<this._nodePromiseLODs.length;r++)t(r);var o=function(t){var n=Promise.all(a._materialPromiseLODs[t]).then(function(){0!==t&&(e._loader.endPerformanceCounter("Material LOD ".concat(t)),e._loader.log("Loaded material LOD ".concat(t))),e.onMaterialLODsLoadedObservable.notifyObservers(t),t!==e._materialPromiseLODs.length-1&&(e._loader.startPerformanceCounter("Material LOD ".concat(t+1)),e._loadBufferLOD(e._materialBufferLODs,t+1),e._materialSignalLODs[t]&&e._materialSignalLODs[t].resolve())});a._loader._completePromises.push(n)},a=this;for(r=0;r<this._materialPromiseLODs.length;r++)o(r)},e.prototype.loadSceneAsync=function(e,t){var n=this._loader.loadSceneAsync(e,t);return this._loadBufferLOD(this._bufferLODs,0),n},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return Pe.LoadExtensionAsync(e,n,this.name,function(e,s){return a(o,void 0,void 0,function(){var o,a,l,u,c,f=this;return i(this,function(i){switch(i.label){case 0:for(a=this._getLODs(e,n,this._loader.gltf.nodes,s.ids),this._loader.logOpen("".concat(e)),l=function(e){var n=a[e];0!==e&&(u._nodeIndexLOD=e,u._nodeSignalLODs[e]=u._nodeSignalLODs[e]||new t.Deferred);var i=u._loader.loadNodeAsync("/nodes/".concat(n.index),n,function(e){r(e),e.setEnabled(!1)}).then(function(t){if(0!==e){var n=a[e-1];n._babylonTransformNode&&(f._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t});u._nodePromiseLODs[e]=u._nodePromiseLODs[e]||[],0===e?o=i:(u._nodeIndexLOD=null,u._nodePromiseLODs[e].push(i))},u=this,c=0;c<a.length;c++)l(c);return this._loader.logClose(),[4,o];case 1:return[2,i.sent()]}})})})},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var s=this;return this._nodeIndexLOD?null:Pe.LoadExtensionAsync(e,t,this.name,function(e,l){return a(s,void 0,void 0,function(){var a,s,u,c,f,h=this;return i(this,function(i){switch(i.label){case 0:for(s=this._getLODs(e,t,this._loader.gltf.materials,l.ids),this._loader.logOpen("".concat(e)),u=function(e){var t=s[e];0!==e&&(c._materialIndexLOD=e);var i=c._loader._loadMaterialAsync("/materials/".concat(t.index),t,n,r,function(t){0===e&&o(t)}).then(function(t){if(0!==e){o(t);var n=s[e-1]._data;n[r]&&(h._disposeMaterials([n[r].babylonMaterial]),delete n[r])}return t});c._materialPromiseLODs[e]=c._materialPromiseLODs[e]||[],0===e?a=i:(c._materialIndexLOD=null,c._materialPromiseLODs[e].push(i))},c=this,f=0;f<s.length;f++)u(f);return this._loader.logClose(),[4,a];case 1:return[2,i.sent()]}})})})},e.prototype._loadUriAsync=function(e,n,r){var o=this;if(null!==this._nodeIndexLOD){this._loader.log("deferred");var s=this._nodeIndexLOD-1;return this._nodeSignalLODs[s]=this._nodeSignalLODs[s]||new t.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then(function(){return a(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,this._loader.loadUriAsync(e,n,r)];case 1:return[2,t.sent()]}})})})}return null!==this._materialIndexLOD?(this._loader.log("deferred"),s=this._materialIndexLOD-1,this._materialSignalLODs[s]=this._materialSignalLODs[s]||new t.Deferred,this._materialSignalLODs[s].promise.then(function(){return a(o,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,this._loader.loadUriAsync(e,n,r)];case 1:return[2,t.sent()]}})})})):null},e.prototype.loadBufferAsync=function(e,n,r,o){var s=this;if(this._loader.parent.useRangeRequests&&!n.uri){if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));var l=function(e,n){return a(s,void 0,void 0,function(){var a,s,l;return i(this,function(i){switch(i.label){case 0:return s=(a=r)+o-1,(l=e[n])?(l.start=Math.min(l.start,a),l.end=Math.max(l.end,s)):(l={start:a,end:s,loaded:new t.Deferred},e[n]=l),[4,l.loaded.promise.then(function(e){return new Uint8Array(e.buffer,e.byteOffset+r-l.start,o)})];case 1:return[2,i.sent()]}})})};return this._loader.log("deferred"),null!==this._nodeIndexLOD?l(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?l(this._materialBufferLODs,this._materialIndexLOD):l(this._bufferLODs,0)}return null},e.prototype._loadBufferLOD=function(e,t){var n=e[t];n&&(this._loader.log("Loading buffer range [".concat(n.start,"-").concat(n.end,"]")),this._loader.bin.readAsync(n.start,n.end-n.start+1).then(function(e){n.loaded.resolve(e)},function(e){n.loaded.reject(e)}))},e.prototype._getLODs=function(e,t,n,r){if(this.maxLODsToLoad<=0)throw new Error("maxLODsToLoad must be greater than zero");for(var o=[],a=r.length-1;a>=0;a--)if(o.push(Re.Get("".concat(e,"/ids/").concat(r[a]),n,r[a])),o.length===this.maxLODsToLoad)return o;return o.push(t),o},e.prototype._disposeTransformNode=function(e){var t=this,n=[],r=e.material;r&&n.push(r);for(var o=0,a=e.getChildMeshes();o<a.length;o++){var i=a[o];i.material&&n.push(i.material)}e.dispose();var s=n.filter(function(e){return t._loader.babylonScene.meshes.every(function(t){return t.material!=e})});this._disposeMaterials(s)},e.prototype._disposeMaterials=function(e){for(var t={},n=0,r=e;n<r.length;n++){for(var o=0,a=(c=r[n]).getActiveTextures();o<a.length;o++){var i=a[o];t[i.uniqueId]=i}c.dispose()}for(var s in t)for(var l=0,u=this._loader.babylonScene.materials;l<u.length;l++){var c;(c=u[l]).hasTexture(t[s])&&delete t[s]}for(var s in t)t[s].dispose()},e}();we(En),Oe(En,!0,function(e){return new Rn(e)});var Ln="MSFT_minecraftMesh",Pn=function(){function e(e){this.name=Ln,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ln)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtraAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r;return i(this,function(a){switch(a.label){case 0:if(!s)return[3,2];if(!this._loader._pbrMaterialImpl)throw new Error("".concat(o,": Material type not supported"));return r=this._loader.loadMaterialPropertiesAsync(e,t,n),n.needAlphaBlending()&&(n.forceDepthWrite=!0,n.separateCullingPass=!0),n.backFaceCulling=n.forceDepthWrite,n.twoSidedLighting=!0,[4,r];case 1:return[2,a.sent()];case 2:return[2]}})})})},e}();we(Ln),Oe(Ln,!0,function(e){return new Pn(e)});var Sn="MSFT_sRGBFactors",Fn=function(){function e(e){this.name=Sn,this._loader=e,this.enabled=this._loader.isExtensionUsed(Sn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Pe.LoadExtraAsync(e,t,this.name,function(o,s){return a(r,void 0,void 0,function(){var r,o,a;return i(this,function(i){switch(i.label){case 0:return s?(r=this._loader._getOrCreateMaterialAdapter(n),o=this._loader.loadMaterialPropertiesAsync(e,t,n),a=n.getScene().getEngine().useExactSrgbConversions,r.baseColorTexture||r.baseColor.toLinearSpaceToRef(r.baseColor,a),r.specularColorTexture||r.specularColor.toLinearSpaceToRef(r.specularColor,a),[4,o]):[3,2];case 1:return[2,i.sent()];case 2:return[2]}})})})},e}();function Nn(e){var t=e.split(":");return In({op:t[0],extension:t[1]})}function In(e,n){var r;void 0===n&&(n=!0);var o=e.extension?null===(r=Bn[e.extension])||void 0===r?void 0:r[e.op]:Gn[e.op];if(!o&&(t.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),n)){var a={},i={flows:{}};if(e.inputValueSockets)for(var s in a.values={},e.inputValueSockets)a.values[s]={name:s};return e.outputValueSockets&&(i.values={},Object.keys(e.outputValueSockets).forEach(function(e){i.values[e]={name:e}})),{blocks:[],inputs:a,outputs:i}}return o}function kn(e,t,n){Bn[t]||(Bn[t]={}),Bn[t][e]=n}we(Sn),Oe(Sn,!0,function(e){return new Fn(e)});var Bn={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},Gn={"event/onStart":{blocks:["FlowGraphSceneReadyEventBlock"],outputs:{flows:{out:{name:"done"}}}},"event/onTick":{blocks:["FlowGraphSceneTickEventBlock"],inputs:{},outputs:{values:{timeSinceLastTick:{name:"deltaTime",gltfType:"number"}},flows:{out:{name:"done"}}}},"event/send":{blocks:["FlowGraphSendCustomEventBlock"],extraProcessor:function(e,t,n,r,o){var a;if("event/send"!==t.op||!e.configuration||1!==Object.keys(e.configuration).length)throw new Error("Receive event should have a single configuration object, the event itself");var i=null===(a=e.configuration.event.value)||void 0===a?void 0:a[0];if("number"!=typeof i)throw new Error("Event id should be a number");var s=r.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=s.eventId,l.config.eventData=s.eventData,o}},"event/receive":{blocks:["FlowGraphReceiveCustomEventBlock"],outputs:{flows:{out:{name:"done"}}},validation:function(e,n){var r,o;if(!e.configuration)return t.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};var a=e.configuration.event;if(!a)return t.Logger.Error("Receive event should have a single configuration object, the event itself"),{valid:!1,error:"Receive event should have a single configuration object, the event itself"};var i=null===(r=a.value)||void 0===r?void 0:r[0];return"number"!=typeof i?(t.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):(null===(o=n.events)||void 0===o?void 0:o[i])?{valid:!0}:(t.Logger.Error("Event with id ".concat(i," not found")),{valid:!1,error:"Event with id ".concat(i," not found")})},extraProcessor:function(e,t,n,r,o){var a;if("event/receive"!==t.op||!e.configuration||1!==Object.keys(e.configuration).length)throw new Error("Receive event should have a single configuration object, the event itself");var i=null===(a=e.configuration.event.value)||void 0===a?void 0:a[0];if("number"!=typeof i)throw new Error("Event id should be a number");var s=r.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=s.eventId,l.config.eventData=s.eventData,o}},"math/E":Vn("FlowGraphEBlock"),"math/Pi":Vn("FlowGraphPIBlock"),"math/Inf":Vn("FlowGraphInfBlock"),"math/NaN":Vn("FlowGraphNaNBlock"),"math/abs":Vn("FlowGraphAbsBlock"),"math/sign":Vn("FlowGraphSignBlock"),"math/trunc":Vn("FlowGraphTruncBlock"),"math/floor":Vn("FlowGraphFloorBlock"),"math/ceil":Vn("FlowGraphCeilBlock"),"math/round":{blocks:["FlowGraphRoundBlock"],configuration:{},inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.roundHalfAwayFromZero=!0,o}},"math/fract":Vn("FlowGraphFractBlock"),"math/neg":Vn("FlowGraphNegationBlock"),"math/add":Vn("FlowGraphAddBlock",["a","b"],!0),"math/sub":Vn("FlowGraphSubtractBlock",["a","b"],!0),"math/mul":{blocks:["FlowGraphMultiplyBlock"],extraProcessor:function(e,t,n,r,o){var a;(a=o[0]).config||(a.config={}),o[0].config.useMatrixPerComponent=!0,o[0].config.preventIntegerFloatArithmetic=!0;var i=-1;return Object.keys(e.values||{}).find(function(t){var n;return void 0!==(null===(n=e.values)||void 0===n?void 0:n[t].type)&&(i=e.values[t].type,!0)}),-1!==i&&(o[0].config.type=r.arrays.types[i].flowGraphType),o},validation:function(e){return e.values?Dn(e):{valid:!0}}},"math/div":Vn("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Vn("FlowGraphModuloBlock",["a","b"]),"math/min":Vn("FlowGraphMinBlock",["a","b"]),"math/max":Vn("FlowGraphMaxBlock",["a","b"]),"math/clamp":Vn("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Vn("FlowGraphSaturateBlock"),"math/mix":Vn("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Vn("FlowGraphEqualityBlock",["a","b"]),"math/lt":Vn("FlowGraphLessThanBlock",["a","b"]),"math/le":Vn("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Vn("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Vn("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":Vn("FlowGraphIsNaNBlock"),"math/isInf":Vn("FlowGraphIsInfBlock"),"math/select":{blocks:["FlowGraphConditionalBlock"],inputs:{values:{condition:{name:"condition"},a:{name:"onTrue"},b:{name:"onFalse"}}},outputs:{values:{value:{name:"output"}}}},"math/random":{blocks:["FlowGraphRandomBlock"],outputs:{values:{value:{name:"value"}}}},"math/sin":Vn("FlowGraphSinBlock"),"math/cos":Vn("FlowGraphCosBlock"),"math/tan":Vn("FlowGraphTanBlock"),"math/asin":Vn("FlowGraphASinBlock"),"math/acos":Vn("FlowGraphACosBlock"),"math/atan":Vn("FlowGraphATanBlock"),"math/atan2":Vn("FlowGraphATan2Block",["a","b"]),"math/sinh":Vn("FlowGraphSinhBlock"),"math/cosh":Vn("FlowGraphCoshBlock"),"math/tanh":Vn("FlowGraphTanhBlock"),"math/asinh":Vn("FlowGraphASinhBlock"),"math/acosh":Vn("FlowGraphACoshBlock"),"math/atanh":Vn("FlowGraphATanhBlock"),"math/exp":Vn("FlowGraphExponentialBlock"),"math/log":Vn("FlowGraphLogBlock"),"math/log2":Vn("FlowGraphLog2Block"),"math/log10":Vn("FlowGraphLog10Block"),"math/sqrt":Vn("FlowGraphSquareRootBlock"),"math/cbrt":Vn("FlowGraphCubeRootBlock"),"math/pow":Vn("FlowGraphPowerBlock",["a","b"]),"math/length":Vn("FlowGraphLengthBlock"),"math/normalize":Vn("FlowGraphNormalizeBlock"),"math/dot":Vn("FlowGraphDotBlock",["a","b"]),"math/cross":Vn("FlowGraphCrossBlock",["a","b"]),"math/rotate2D":{blocks:["FlowGraphRotate2DBlock"],inputs:{values:{a:{name:"a"},angle:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/rotate3D":{blocks:["FlowGraphRotate3DBlock"],inputs:{values:{a:{name:"a"},rotation:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/transform":{blocks:["FlowGraphTransformVectorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/combine2":{blocks:["FlowGraphCombineVector2Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine3":{blocks:["FlowGraphCombineVector3Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine4":{blocks:["FlowGraphCombineVector4Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/extract2":{blocks:["FlowGraphExtractVector2Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"}}}},"math/extract3":{blocks:["FlowGraphExtractVector3Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"}}}},"math/extract4":{blocks:["FlowGraphExtractVector4Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/transpose":Vn("FlowGraphTransposeBlock"),"math/determinant":Vn("FlowGraphDeterminantBlock"),"math/inverse":Vn("FlowGraphInvertMatrixBlock"),"math/matMul":Vn("FlowGraphMatrixMultiplicationBlock",["a","b"]),"math/matCompose":{blocks:["FlowGraphMatrixCompose"],inputs:{values:{translation:{name:"position",gltfType:"float3"},rotation:{name:"rotationQuaternion",gltfType:"float4"},scale:{name:"scaling",gltfType:"float3"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i=o[0].dataInputs.find(function(e){return"rotationQuaternion"===e.name});if(!i)throw new Error("Rotation quaternion input not found");return a._connectionValues[i.uniqueId]&&(a._connectionValues[i.uniqueId].type="Quaternion"),o}},"math/matDecompose":{blocks:["FlowGraphMatrixDecompose"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{translation:{name:"position"},rotation:{name:"rotationQuaternion"},scale:{name:"scaling"}}}},"math/quatConjugate":Vn("FlowGraphConjugateBlock",["a"]),"math/quatMul":{blocks:["FlowGraphMultiplyBlock"],inputs:{values:{a:{name:"a",gltfType:"vector4"},b:{name:"b",gltfType:"vector4"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.type="Quaternion",o}},"math/quatAngleBetween":Vn("FlowGraphAngleBetweenBlock",["a","b"]),"math/quatFromAxisAngle":{blocks:["FlowGraphQuaternionFromAxisAngleBlock"],inputs:{values:{axis:{name:"a",gltfType:"float3"},angle:{name:"b",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/quatToAxisAngle":Vn("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":Vn("FlowGraphQuaternionFromDirectionsBlock",["a","b"]),"math/combine2x2":{blocks:["FlowGraphCombineMatrix2DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"math/extract2x2":{blocks:["FlowGraphExtractMatrix2DBlock"],inputs:{values:{a:{name:"input",gltfType:"float2x2"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/combine3x3":{blocks:["FlowGraphCombineMatrix3DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"math/extract3x3":{blocks:["FlowGraphExtractMatrix3DBlock"],inputs:{values:{a:{name:"input",gltfType:"float3x3"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"}}}},"math/combine4x4":{blocks:["FlowGraphCombineMatrixBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"},j:{name:"input_9",gltfType:"number"},k:{name:"input_10",gltfType:"number"},l:{name:"input_11",gltfType:"number"},m:{name:"input_12",gltfType:"number"},n:{name:"input_13",gltfType:"number"},o:{name:"input_14",gltfType:"number"},p:{name:"input_15",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"math/extract4x4":{blocks:["FlowGraphExtractMatrixBlock"],configuration:{},inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"},9:{name:"output_9"},10:{name:"output_10"},11:{name:"output_11"},12:{name:"output_12"},13:{name:"output_13"},14:{name:"output_14"},15:{name:"output_15"}}}},"math/not":{blocks:["FlowGraphBitwiseNotBlock"],inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l;(l=o[0]).config||(l.config={});var u=o[0].dataInputs[0];return o[0].config.valueType=null!==(s=null===(i=a._connectionValues[u.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:"FlowGraphInteger",o}},"math/and":{blocks:["FlowGraphBitwiseAndBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],h=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:null===(l=a._connectionValues[h.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",o}},"math/or":{blocks:["FlowGraphBitwiseOrBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],h=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:null===(l=a._connectionValues[h.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",o}},"math/xor":{blocks:["FlowGraphBitwiseXorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],h=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:null===(l=a._connectionValues[h.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",o}},"math/asr":Vn("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Vn("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Vn("FlowGraphLeadingZerosBlock"),"math/ctz":Vn("FlowGraphTrailingZerosBlock"),"math/popcnt":Vn("FlowGraphOneBitsCounterBlock"),"math/rad":Vn("FlowGraphDegToRadBlock"),"math/deg":Vn("FlowGraphRadToDegBlock"),"type/boolToInt":Vn("FlowGraphBooleanToInt"),"type/boolToFloat":Vn("FlowGraphBooleanToFloat"),"type/intToBool":Vn("FlowGraphIntToBoolean"),"type/intToFloat":Vn("FlowGraphIntToFloat"),"type/floatToInt":Vn("FlowGraphFloatToInt"),"type/floatToBool":Vn("FlowGraphFloatToBoolean"),"flow/sequence":{blocks:["FlowGraphSequenceBlock"],extraProcessor:function(e,t,n,r,o){var a=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows||[]).length,a.signalOutputs.forEach(function(e,t){e.name="out_"+t}),o}},"flow/branch":{blocks:["FlowGraphBranchBlock"],outputs:{flows:{true:{name:"onTrue"},false:{name:"onFalse"}}}},"flow/switch":{blocks:["FlowGraphSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"},default:{name:"default"}}},validation:function(e){var n,r=null===(n=e.configuration)||void 0===n?void 0:n.cases;if(r&&r.value){if(!r.value.every(function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())}))return t.Logger.Warn("Switch cases should be integers. Using empty array instead."),r.value=[],{valid:!0};var o=new Set(r.value);r.value=Array.from(o)}return{valid:!0}},extraProcessor:function(e,t,n,r,o){if("flow/switch"!==t.op||!e.flows||0===Object.keys(e.flows).length)throw new Error("Switch should have a single configuration object, the cases array");return o[0].signalOutputs.forEach(function(e){"default"!==e.name&&(e.name="out_"+e.name)}),o}},"flow/while":{blocks:["FlowGraphWhileLoopBlock"],outputs:{flows:{loopBody:{name:"executionFlow"}}}},"flow/for":{blocks:["FlowGraphForLoopBlock"],configuration:{initialIndex:{name:"initialIndex",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{values:{startIndex:{name:"startIndex",gltfType:"number"},endIndex:{name:"endIndex",gltfType:"number"}}},outputs:{values:{index:{name:"index"}},flows:{loopBody:{name:"executionFlow"}}},extraProcessor:function(e,t,n,r,o){var a=o[0];return a.config||(a.config={}),a.config.incrementIndexWhenLoopDone=!0,o}},"flow/doN":{blocks:["FlowGraphDoNBlock"],configuration:{},inputs:{values:{n:{name:"maxExecutions",gltfType:"number"}}},outputs:{values:{currentCount:{name:"executionCount"}}}},"flow/multiGate":{blocks:["FlowGraphMultiGateBlock"],configuration:{isRandom:{name:"isRandom",gltfType:"boolean",inOptions:!0,defaultValue:!1},isLoop:{name:"isLoop",gltfType:"boolean",inOptions:!0,defaultValue:!1}},extraProcessor:function(e,t,n,r,o){if("flow/multiGate"!==t.op||!e.flows||0===Object.keys(e.flows).length)throw new Error("MultiGate should have a single configuration object, the number of output flows");var a=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows).length,a.signalOutputs.forEach(function(e,t){e.name="out_"+t}),o}},"flow/waitAll":{blocks:["FlowGraphWaitAllBlock"],configuration:{inputFlows:{name:"inputSignalCount",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{flows:{reset:{name:"reset"},"[segment]":{name:"in_$1"}}},validation:function(e){var t,n,r;return"number"!=typeof(null===(r=null===(n=null===(t=e.configuration)||void 0===t?void 0:t.inputFlows)||void 0===n?void 0:n.value)||void 0===r?void 0:r[0])&&(e.configuration=e.configuration||{inputFlows:{value:[0]}},e.configuration.inputFlows.value=[0]),{valid:!0}}},"flow/throttle":{blocks:["FlowGraphThrottleBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/setDelay":{blocks:["FlowGraphSetDelayBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/cancelDelay":{blocks:["FlowGraphCancelDelayBlock"]},"variable/get":{blocks:["FlowGraphGetVariableBlock"],validation:function(e){var n,r;return(null===(r=null===(n=e.configuration)||void 0===n?void 0:n.variable)||void 0===r?void 0:r.value)?{valid:!0}:(t.Logger.Error("Variable get block should have a variable configuration"),{valid:!1,error:"Variable get block should have a variable configuration"})},configuration:{variable:{name:"variable",gltfType:"number",flowGraphType:"string",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return t.getVariableName(e)}}}},"variable/set":{blocks:["FlowGraphSetVariableBlock"],configuration:{variables:{name:"variables",gltfType:"number",flowGraphType:"string",inOptions:!0,isArray:!0,dataTransformer:function(e,t){return e.map(function(e){return t.getVariableName(e)})}}},extraProcessor:function(e,t,n,r,o){return o[0].dataInputs.forEach(function(e){e.name=r.getVariableName(+e.name)}),o}},"variable/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphContextBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing","FlowGraphGetVariableBlock"],configuration:{variable:{name:"propertyName",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return t.getVariableName(e)}},useSlerp:{name:"animationType",inOptions:!0,defaultValue:!1,dataTransformer:function(e){return!0===e?"Quaternion":void 0}}},inputs:{values:{value:{name:"value_1"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphBezierCurveEasing"},p2:{name:"controlPoint2",toBlock:"FlowGraphBezierCurveEasing"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"userVariables",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:4,isVariable:!0}],extraProcessor:function(e,n,r,o,a){var i,s,l,u,c,f,h=a[0],d=null===(s=null===(i=e.configuration)||void 0===i?void 0:i.variable.value)||void 0===s?void 0:s[0];if("number"!=typeof d)throw t.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var p=o.arrays.staticVariables[d];void 0===(null===(u=null===(l=h.config)||void 0===l?void 0:l.animationType)||void 0===u?void 0:u.value)&&(h.config||(h.config={}),(c=h.config).animationType||(c.animationType={}),h.config.animationType.value=t.getAnimationTypeByFlowGraphType(p.type));var m=a[4];return m.config||(m.config={}),(f=m.config).variable||(f.variable={}),m.config.variable.value=o.getVariableName(d),a}},"pointer/get":{blocks:["FlowGraphGetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customGetFunction",output:"getFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:function(e,t,n,r,o){return o.forEach(function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)}),o}},"pointer/set":{blocks:["FlowGraphSetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customSetFunction",output:"setFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:function(e,t,n,r,o){return o.forEach(function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)}),o}},"pointer/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphJsonPointerParserBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value_1"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphBezierCurveEasing"},p2:{name:"controlPoint2",toBlock:"FlowGraphBezierCurveEasing"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customBuildAnimation",output:"generateAnimationsFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:function(e,t,n,r,o){return o.forEach(function(t){"FlowGraphJsonPointerParserBlock"===t.className?(t.config||(t.config={}),t.config.outputValue=!0):"FlowGraphInterpolationBlock"===t.className&&(t.config||(t.config={}),Object.keys(e.values||[]).forEach(function(n){var o,a=null===(o=e.values)||void 0===o?void 0:o[n];if("value"===n&&a){var i=a.type;void 0!==i&&(t.config.animationType=r.arrays.types[i].flowGraphType)}}))}),o}},"animation/start":{blocks:["FlowGraphPlayAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},speed:{name:"speed",gltfType:"number"},startTime:{name:"from",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._animationTargetFps]}},endTime:{name:"to",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._animationTargetFps]}}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor:function(e,t,n,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"animation/stop":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor:function(e,t,n,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"animation/stopAt":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{},inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},stopTime:{name:"stopAtFrame",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._animationTargetFps]}}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor:function(e,t,n,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"math/switch":{blocks:["FlowGraphDataSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"}}},validation:function(e){var n,r=null===(n=e.configuration)||void 0===n?void 0:n.cases;if(r&&r.value){if(!r.value.every(function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())}))return t.Logger.Warn("Switch cases should be integers. Using empty array instead."),r.value=[],{valid:!0};var o=new Set(r.value);r.value=Array.from(o)}return{valid:!0}},extraProcessor:function(e,t,n,r,o){var a=o[0];return a.dataInputs.forEach(function(e){"default"!==e.name&&"case"!==e.name&&(e.name="in_"+e.name)}),a.config||(a.config={}),a.config.treatCasesAsIntegers=!0,o}},"debug/log":{blocks:["FlowGraphConsoleLogBlock"],configuration:{message:{name:"messageTemplate",inOptions:!0}}}};function Vn(e,t,n){return void 0===t&&(t=["a"]),{blocks:[e],inputs:{values:t.reduce(function(e,t){return e[t]={name:t},e},{})},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,r,o,a){var i;if(n){(i=a[0]).config||(i.config={}),a[0].config.preventIntegerFloatArithmetic=!0;var s=-1;Object.keys(e.values||{}).find(function(t){var n;return void 0!==(null===(n=e.values)||void 0===n?void 0:n[t].type)&&(s=e.values[t].type,!0)}),-1!==s&&(a[0].config.type=o.arrays.types[s].flowGraphType)}return a},validation:function(e){return n?Dn(e):{valid:!0}}}}function Dn(e){if(e.values){var t=Object.keys(e.values).map(function(t){return e.values[t].type}).filter(function(e){return void 0!==e});if(!t.every(function(e){return e===t[0]}))return{valid:!1,error:"All inputs must be of the same type"}}return{valid:!0}}function Hn(){return Object.keys(Gn)}var jn={float:{length:1,flowGraphType:"number",elementType:"number"},bool:{length:1,flowGraphType:"boolean",elementType:"boolean"},float2:{length:2,flowGraphType:"Vector2",elementType:"number"},float3:{length:3,flowGraphType:"Vector3",elementType:"number"},float4:{length:4,flowGraphType:"Vector4",elementType:"number"},float4x4:{length:16,flowGraphType:"Matrix",elementType:"number"},float2x2:{length:4,flowGraphType:"Matrix2D",elementType:"number"},float3x3:{length:9,flowGraphType:"Matrix3D",elementType:"number"},int:{length:1,flowGraphType:"FlowGraphInteger",elementType:"number"}},Kn=function(){function e(e,t,n){void 0===n&&(n=60),this._interactivityGraph=e,this._gltf=t,this._animationTargetFps=n,this._types=[],this._mappings=[],this._staticVariables=[],this._events=[],this._internalEventsCounter=0,this._nodes=[],this._parseTypes(),this._parseDeclarations(),this._parseVariables(),this._parseEvents(),this._parseNodes()}return Object.defineProperty(e.prototype,"arrays",{get:function(){return{types:this._types,mappings:this._mappings,staticVariables:this._staticVariables,events:this._events,nodes:this._nodes}},enumerable:!1,configurable:!0}),e.prototype._parseTypes=function(){if(this._interactivityGraph.types)for(var e=0,t=this._interactivityGraph.types;e<t.length;e++){var n=t[e];this._types.push(jn[n.signature])}},e.prototype._parseDeclarations=function(){if(this._interactivityGraph.declarations)for(var e=0,n=this._interactivityGraph.declarations;e<n.length;e++){var r=n[e],o=In(r);if(!o)throw t.Logger.Error(["No mapping found for declaration",r]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:o,fullOperationName:r.extension?r.op+":"+r.extension:r.op})}},e.prototype._parseVariables=function(){if(this._interactivityGraph.variables)for(var e=0,t=this._interactivityGraph.variables;e<t.length;e++){var n=t[e],r=this._parseVariable(n);this._staticVariables.push(r)}},e.prototype._parseVariable=function(e,n){var r=this._types[e.type];if(!r)throw t.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==r.length)throw t.Logger.Error(["Invalid value length for variable",e,r]),new Error("Error parsing variables");var o=e.value||[];if(!o.length)switch(r.flowGraphType){case"boolean":o.push(!1);break;case"FlowGraphInteger":o.push(0);break;case"number":o.push(NaN);break;case"Vector2":o.push(NaN,NaN);break;case"Vector3":o.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":o.fill(NaN,0,4);break;case"Matrix":o.fill(NaN,0,16);break;case"Matrix3D":o.fill(NaN,0,9)}return"number"===r.elementType&&"string"==typeof o[0]&&(o[0]=parseFloat(o[0])),{type:r.flowGraphType,value:n?n(o,this):o}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var n=function(n){var o={eventId:n.id||"internalEvent_"+r._internalEventsCounter++};n.values&&(o.eventData=Object.keys(n.values).map(function(r){var o,a=null===(o=n.values)||void 0===o?void 0:o[r];if(!a)throw t.Logger.Error(["No value found for event key",r]),new Error("Error parsing events");var i=e._types[a.type];if(!i)throw t.Logger.Error(["No type found for event value",a]),new Error("Error parsing events");var s=void 0!==a.value?e._parseVariable(a):void 0;return{id:r,type:i.flowGraphType,eventData:!0,value:s}})),r._events.push(o)},r=this,o=0,a=this._interactivityGraph.events;o<a.length;o++)n(a[o])},e.prototype._parseNodes=function(){var e;if(this._interactivityGraph.nodes)for(var n=0,r=this._interactivityGraph.nodes;n<r.length;n++){var o=r[n];if("number"!=typeof o.declaration)throw t.Logger.Error(["No declaration found for node",o]),new Error("Error parsing nodes");var a=this._mappings[o.declaration];if(!a)throw t.Logger.Error(["No mapping found for node",o]),new Error("Error parsing nodes");if(a.flowGraphMapping.validation){var i=a.flowGraphMapping.validation(o,this._interactivityGraph,this._gltf);if(!i.valid)throw new Error("Error validating interactivity node ".concat(null===(e=this._interactivityGraph.declarations)||void 0===e?void 0:e[o.declaration].op," - ").concat(i.error))}for(var s=[],l=0,u=a.flowGraphMapping.blocks;l<u.length;l++){var c=u[l],f=this._getEmptyBlock(c,a.fullOperationName);this._parseNodeConfiguration(o,f,a.flowGraphMapping,c),s.push(f)}this._nodes.push({blocks:s,fullOperationName:a.fullOperationName})}},e.prototype._getEmptyBlock=function(e,n){return{uniqueId:t.RandomGUID(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:n,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,n,r,o){var a,i=e.configuration;if(i)for(var s in i){var l=i[s];if(!l)throw new Error("Error parsing node configuration");var u=null===(a=r.configuration)||void 0===a?void 0:a[s];if(u&&u.toBlock?u.toBlock===o:0===r.blocks.indexOf(o)){var c=null==u?void 0:u.defaultValue;(null==l?void 0:l.value)&&(c=l.value),(null==u?void 0:u.isArray)||(1!==c.length&&t.Logger.Warn("Invalid non-array value length: ".concat(c.length)),c=c[0]),(null==u?void 0:u.dataTransformer)&&(c=u.dataTransformer(c,this)),void 0!==c&&(n.config[(null==u?void 0:u.name)||s]={value:c})}}},e.prototype._parseNodeConnections=function(e){for(var n,r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,y,b,v,T=0;T<this._nodes.length;T++){var x=null===(n=this._interactivityGraph.nodes)||void 0===n?void 0:n[T];if(!x)throw t.Logger.Error(["No node found for interactivity node",this._nodes[T]]),new Error("Error parsing node connections");var A=this._nodes[T],C=this._mappings[x.declaration];if(!C)throw t.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var O=x.flows||{},w=Object.keys(O).sort(),M=function(e){var n=O[e],c=null===(o=null===(r=C.flowGraphMapping.outputs)||void 0===r?void 0:r.flows)||void 0===o?void 0:o[e],f=(null==c?void 0:c.name)||e,h=E._createNewSocketConnection(f,!0);(c&&c.toBlock&&A.blocks.find(function(e){return e.className===c.toBlock})||A.blocks[0]).signalOutputs.push(h);var d=n.node,p=E._nodes[d];if(!p)throw t.Logger.Error(["No node found for input node id",d]),new Error("Error parsing node connections");var m=Nn(p.fullOperationName);if(!m)throw t.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var _=null===(i=null===(a=m.inputs)||void 0===a?void 0:a.flows)||void 0===i?void 0:i[n.socket||"in"],g=!1;if(!_)for(var y in null===(s=m.inputs)||void 0===s?void 0:s.flows)y.startsWith("[")&&y.endsWith("]")&&(g=!0,_=null===(u=null===(l=m.inputs)||void 0===l?void 0:l.flows)||void 0===u?void 0:u[y]);var b=_?g?_.name.replace("$1",n.socket||""):_.name:n.socket||"in",v=_&&_.toBlock&&p.blocks.find(function(e){return e.className===_.toBlock})||p.blocks[0],T=v.signalInputs.find(function(e){return e.name===b});T||(T=E._createNewSocketConnection(b),v.signalInputs.push(T)),T.connectedPointIds.push(h.uniqueId),h.connectedPointIds.push(T.uniqueId)},E=this,R=0,L=w;R<L.length;R++)M(L[R]);for(var P=x.values||{},S=Object.keys(P),F=function(n){var r=P[n],o=null===(f=null===(c=C.flowGraphMapping.inputs)||void 0===c?void 0:c.values)||void 0===f?void 0:f[n],a=!1;if(!o)for(var i in null===(h=C.flowGraphMapping.inputs)||void 0===h?void 0:h.values)i.startsWith("[")&&i.endsWith("]")&&(a=!0,o=null===(p=null===(d=C.flowGraphMapping.inputs)||void 0===d?void 0:d.values)||void 0===p?void 0:p[i]);var s=o?a?o.name.replace("$1",n):o.name:n,l=N._createNewSocketConnection(s);if((o&&o.toBlock&&A.blocks.find(function(e){return e.className===o.toBlock})||A.blocks[0]).dataInputs.push(l),void 0!==r.value){var u=N._parseVariable(r,o&&o.dataTransformer);e._connectionValues[l.uniqueId]=u}else{if(void 0===r.node)throw t.Logger.Error(["Invalid value for value connection",r]),new Error("Error parsing node connections");var v=r.node,T=r.socket||"value",x=N._nodes[v];if(!x)throw t.Logger.Error(["No node found for output socket reference",r]),new Error("Error parsing node connections");var O=Nn(x.fullOperationName);if(!O)throw t.Logger.Error(["No mapping found for output socket reference",r]),new Error("Error parsing node connections");var w=null===(_=null===(m=O.outputs)||void 0===m?void 0:m.values)||void 0===_?void 0:_[T],M=!1;if(!w)for(var i in null===(g=O.outputs)||void 0===g?void 0:g.values)i.startsWith("[")&&i.endsWith("]")&&(M=!0,w=null===(b=null===(y=O.outputs)||void 0===y?void 0:y.values)||void 0===b?void 0:b[i]);var E=w?M?w.name.replace("$1",T):null==w?void 0:w.name:T,R=w&&w.toBlock&&x.blocks.find(function(e){return e.className===w.toBlock})||x.blocks[0],L=R.dataOutputs.find(function(e){return e.name===E});L||(L=N._createNewSocketConnection(E,!0),R.dataOutputs.push(L)),l.connectedPointIds.push(L.uniqueId),L.connectedPointIds.push(l.uniqueId)}},N=this,I=0,k=S;I<k.length;I++)F(k[I]);if(C.flowGraphMapping.interBlockConnectors)for(var B=0,G=C.flowGraphMapping.interBlockConnectors;B<G.length;B++){var V=G[B],D=V.input,H=V.output,j=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],j)}if(C.flowGraphMapping.extraProcessor){var K=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!K)throw t.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=C.flowGraphMapping.extraProcessor(x,K,C.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,n){return{uniqueId:t.RandomGUID(),name:e,_connectionType:n?1:0,connectedPointIds:[]}},e.prototype._connectFlowGraphNodes=function(e,t,n,r,o){var a=o?n.dataInputs:n.signalInputs,i=o?r.dataOutputs:r.signalOutputs,s=a.find(function(t){return t.name===e})||this._createNewSocketConnection(e),l=i.find(function(e){return e.name===t})||this._createNewSocketConnection(t,!0);a.find(function(t){return t.name===e})||a.push(s),i.find(function(e){return e.name===t})||i.push(l),s.connectedPointIds.push(l.uniqueId),l.connectedPointIds.push(s.uniqueId)},e.prototype.getVariableName=function(e){return"staticVariable_"+e},e.prototype.serializeToFlowGraph=function(){var e={uniqueId:t.RandomGUID(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var n=0;n<this._staticVariables.length;n++){var r=this._staticVariables[n];e._userVariables[this.getVariableName(n)]=r}return{rightHanded:!0,allBlocks:this._nodes.reduce(function(e,t){return e.concat(t.blocks)},[]),executionContexts:[e]}},e}(),Wn="KHR_interactivity",Un=function(){function e(e){this._loader=e,this.name=Wn,this.enabled=this._loader.isExtensionUsed(Wn),this._pathConverter=be(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&zn(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return a(this,void 0,void 0,function(){var e,n,r,o,s,l=this;return i(this,function(u){switch(u.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(n=null===(s=this._loader.gltf.extensions)||void 0===s?void 0:s.KHR_interactivity)?((r=new t.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,o=n.graphs.map(function(e){return new Kn(e,l._loader.gltf,l._loader.parent.targetFps).serializeToFlowGraph()}),[4,Promise.all(o.map(function(e){return a(l,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,t.ParseFlowGraphAsync(e,{coordinator:r,pathConverter:this._pathConverter})];case 1:return[2,n.sent()]}})})}))]):[2]):[2];case 1:return u.sent(),r.start(),[2]}})})},e}();function zn(e){xe("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new t.Quaternion(NaN,NaN,NaN,NaN);var n=t.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(n.w*=-1,n.x*=-1),n},type:"Quaternion",getTarget:function(){return e.activeCamera}}),xe("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new t.Vector3(NaN,NaN,NaN);var n=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(n.x*=-1),n},type:"Vector3",getTarget:function(){return e.activeCamera}}),xe("/animations/{}/extensions/KHR_interactivity/isPlaying",{get:function(e){var t,n;return null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.isPlaying)&&void 0!==n&&n},type:"boolean",getTarget:function(e){return e._babylonAnimationGroup}}),xe("/animations/{}/extensions/KHR_interactivity/minTime",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.from)&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}}),xe("/animations/{}/extensions/KHR_interactivity/maxTime",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.to)&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}}),xe("/animations/{}/extensions/KHR_interactivity/playhead",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.getCurrentFrame())&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}}),xe("/animations/{}/extensions/KHR_interactivity/virtualPlayhead",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.getCurrentFrame())&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}})}t.addToBlockFactory(Wn,"FlowGraphGLTFDataProvider",function(){return a(void 0,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ir})];case 1:return[2,e.sent().FlowGraphGLTFDataProvider]}})})}),we(Wn),Oe(Wn,!0,function(e){return new Un(e)});var qn="KHR_node_visibility";xe("/nodes/{}/extensions/KHR_node_visibility/visible",{get:function(e){var t=e._babylonTransformNode;return!t||void 0===t.isVisible||t.isVisible},set:function(e,t){var n,r;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach(function(e){e.inheritVisibility=!0}),t._babylonTransformNode&&(t._babylonTransformNode.isVisible=e),null===(r=t._primitiveBabylonMeshes)||void 0===r||r.forEach(function(t){t.isVisible=e})},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"isVisible"}],type:"boolean"});var Yn=function(){function e(e){this.name=qn,this._loader=e,this.enabled=e.isExtensionUsed(qn)}return e.prototype.onReady=function(){if(this._loader){var e=this._loader.gltf.nodes;if(e)for(var t=0,n=e;t<n.length;t++){var r=n[t],o=r._babylonTransformNode;o&&(o.inheritVisibility=!0,r.extensions&&r.extensions.KHR_node_visibility&&!1===r.extensions.KHR_node_visibility.visible&&(o.isVisible=!1))}}},e.prototype.dispose=function(){delete this._loader},e}();we(qn),Oe(qn,!0,function(e){return new Yn(e)});var Xn="KHR_node_selectability";kn("event/onSelect",Xn,{blocks:["FlowGraphMeshPickEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return"pickedMesh_"+e}}},outputs:{values:{selectedNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"},selectionPoint:{name:"pickedPoint"},selectionRayOrigin:{name:"pickOrigin"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"asset",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"pickedMesh",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor:function(e,t,n,r,o,a,i){var s,l,u,c,f,h,d,p=o[o.length-1];p.config=p.config||{},p.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _="pickedMesh_"+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(d=null===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),xe("/nodes/{}/extensions/KHR_node_selectability/selectable",{get:function(e){var t=e._babylonTransformNode;return!t||void 0===t.isPickable||t.isPickable},set:function(e,t){var n;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach(function(t){t.isPickable=e})},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"isPickable"}],type:"boolean"});var Qn=function(){function e(e){this.name=Xn,this._loader=e,this.enabled=e.isExtensionUsed(Xn)}return e.prototype.onReady=function(){return a(this,void 0,void 0,function(){var e;return i(this,function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach(function(e){var t,n,r;(null===(t=e.extensions)||void 0===t?void 0:t.KHR_node_selectability)&&!1===(null===(n=e.extensions)||void 0===n?void 0:n.KHR_node_selectability.selectable)&&(null===(r=e._babylonTransformNode)||void 0===r||r.getChildMeshes().forEach(function(e){e.isPickable=!1}))}),[2]})})},e.prototype.dispose=function(){this._loader=null},e}();we(Xn),Oe(Xn,!0,function(e){return new Qn(e)});var Zn="KHR_node_hoverability",Jn="targetMeshPointerOver_";kn("event/onHoverIn",Zn,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return Jn+e}}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshUnderPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor:function(e,t,n,r,o,a,i){var s,l,u,c,f,h,d,p=o[o.length-1];p.config=p.config||{},p.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _=Jn+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(d=null===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}});var $n="targetMeshPointerOut_";kn("event/onHoverOut",Zn,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return $n+e}}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshOutOfPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor:function(e,t,n,r,o,a,i){var s,l,u,c,f,h,d,p=o[o.length-1];p.config=p.config||{},p.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _=$n+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(d=null===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),xe("/nodes/{}/extensions/KHR_node_hoverability/hoverable",{get:function(e){var t=e._babylonTransformNode;return!t||void 0===t.pointerOverDisableMeshTesting||t.pointerOverDisableMeshTesting},set:function(e,t){var n;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach(function(t){t.pointerOverDisableMeshTesting=!e})},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"pointerOverDisableMeshTesting"}],type:"boolean"});var er=function(){function e(e){this.name=Zn,this._loader=e,this.enabled=e.isExtensionUsed(Zn)}return e.prototype.onReady=function(){return a(this,void 0,void 0,function(){var e;return i(this,function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach(function(e){var t,n,r;(null===(t=e.extensions)||void 0===t?void 0:t.KHR_node_hoverability)&&!1===(null===(n=e.extensions)||void 0===n?void 0:n.KHR_node_hoverability.hoverable)&&(null===(r=e._babylonTransformNode)||void 0===r||r.getChildMeshes().forEach(function(e){e.pointerOverDisableMeshTesting=!0}))}),[2]})})},e.prototype.dispose=function(){this._loader=null},e}();we(Zn),Oe(Zn,!0,function(e){return new er(e)});var tr="ExtrasAsMetadata",nr=function(){function e(e){this.name=tr,this.enabled=!0,this._loader=e}return e.prototype._assignExtras=function(e,t){if(t.extras&&Object.keys(t.extras).length>0){var n=e.metadata=e.metadata||{};(n.gltf=n.gltf||{}).extras=t.extras}},e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return this._loader.loadNodeAsync(e,t,function(e){r._assignExtras(e,t),n(e)})},e.prototype.loadCameraAsync=function(e,t,n){var r=this;return this._loader.loadCameraAsync(e,t,function(e){r._assignExtras(e,t),n(e)})},e.prototype.createMaterial=function(e,t,n){var r=this._loader.createMaterial(e,t,n);return this._assignExtras(r,t),r},e.prototype.loadAnimationAsync=function(e,t){var n=this;return this._loader.loadAnimationAsync(e,t).then(function(e){return n._assignExtras(e,t),e})},e}();we(tr),Oe(tr,!1,function(e){return new nr(e)});var rr,or,ar=function(e){function n(n){var r,o,a=e.call(this,n)||this,i=n.glTF,s=(null===(r=null==i?void 0:i.animations)||void 0===r?void 0:r.map(function(e){return e._babylonAnimationGroup}))||[];a.animationGroups=a.registerDataOutput("animationGroups",t.RichTypeAny,s);var l=(null===(o=null==i?void 0:i.nodes)||void 0===o?void 0:o.map(function(e){return e._babylonTransformNode}))||[];return a.nodes=a.registerDataOutput("nodes",t.RichTypeAny,l),a}return r(n,e),n.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},n}(t.FlowGraphBlock),ir={__proto__:null,FlowGraphGLTFDataProvider:ar},sr={__proto__:null,AddObjectAccessorToKey:xe,EXT_lights_area:Xe,EXT_lights_ies:Ke,EXT_lights_image_based:Fe,EXT_mesh_gpu_instancing:Ie,EXT_meshopt_compression:Be,EXT_texture_avif:He,EXT_texture_webp:Ve,ExtrasAsMetadata:nr,FlowGraphGLTFDataProvider:ar,GetMappingForKey:ve,GetPathToObjectConverter:be,InteractivityGraphToFlowGraphParser:Kn,KHR_animation_pointer:On,KHR_draco_mesh_compression:Ue,KHR_interactivity:Un,KHR_lights:qe,KHR_materials_anisotropy:st,KHR_materials_clearcoat:tt,KHR_materials_coat:rt,KHR_materials_diffuse_roughness:St,KHR_materials_diffuse_transmission:Ct,KHR_materials_dispersion:Lt,KHR_materials_emissive_strength:ut,KHR_materials_fuzz:dt,KHR_materials_ior:gt,KHR_materials_iridescence:at,KHR_materials_pbrSpecularGlossiness:Ze,KHR_materials_sheen:ft,KHR_materials_specular:mt,KHR_materials_transmission:xt,KHR_materials_unlit:$e,KHR_materials_variants:bt,KHR_materials_volume:wt,KHR_materials_volume_scatter:Et,KHR_mesh_quantization:Nt,KHR_node_hoverability:er,KHR_node_selectability:Qn,KHR_node_visibility:Yn,KHR_texture_basisu:kt,KHR_texture_transform:Gt,KHR_xmp_json_ld:Dt,MSFT_audio_emitter:Mn,MSFT_lod:Rn,MSFT_minecraftMesh:Pn,MSFT_sRGBFactors:Fn,SetInterpolationForKey:Te,_AddInteractivityObjectModel:zn,addNewInteractivityFlowGraphMapping:kn,getAllSupportedNativeNodeTypes:Hn,getMappingForDeclaration:In,getMappingForFullOperationName:Nn,gltfTypeToBabylonType:jn},lr=function(){function e(e){this._specWorkflow=!1,this._diffuseTransmissionTint=t.Color3.White(),this._diffuseTransmissionTintTexture=null,this._material=e}return Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUnlit",{get:function(){return this._material.unlit},set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._material.backFaceCulling},set:function(e){this._material.backFaceCulling=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"twoSidedLighting",{get:function(){return this._material.twoSidedLighting},set:function(e){this._material.twoSidedLighting=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaCutOff",{get:function(){return.5},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useAlphaFromBaseColorTexture",{get:function(){return!1},set:function(e){this._material._useAlphaFromBaseColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparencyAsAlphaCoverage",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColor",{get:function(){return this._material.baseColor},set:function(e){this._material.baseColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColorTexture",{get:function(){return this._material.baseColorTexture},set:function(e){this._material.baseColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughness",{get:function(){return this._material.baseDiffuseRoughness},set:function(e){this._material.baseDiffuseRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughnessTexture",{get:function(){return this._material.baseDiffuseRoughnessTexture},set:function(e){this._material.baseDiffuseRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalness",{get:function(){return this._material.baseMetalness},set:function(e){this._material.baseMetalness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalnessTexture",{get:function(){return this._material.baseMetalnessTexture},set:function(e){this._material.baseMetalnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useRoughnessFromMetallicTextureGreen",{set:function(e){this._material._useRoughnessFromMetallicTextureGreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useMetallicFromMetallicTextureBlue",{set:function(e){this._material._useMetallicFromMetallicTextureBlue=e},enumerable:!1,configurable:!0}),e.prototype.enableSpecularEdgeColor=function(e){void 0===e&&(e=!1)},e.prototype.configureSpecularGlossiness=function(){this._specWorkflow=!0},Object.defineProperty(e.prototype,"specularWeight",{get:function(){return this._material.specularWeight},set:function(e){this._material.specularWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularWeightTexture",{get:function(){return this._material.specularWeightTexture},set:function(e){this._material.specularColorTexture===e?(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0):this._material.specularWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColor",{get:function(){return this._material.specularColor},set:function(e){this._material.specularColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._material.specularColorTexture},set:function(e){this._material.specularColorTexture=e,this._material.specularWeightTexture===this._material.specularColorTexture&&(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughness",{get:function(){return this._material.specularRoughness},set:function(e){this._material.specularRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessTexture",{get:function(){return this._material.specularRoughnessTexture},set:function(e){this._material.specularRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularIor",{get:function(){return this._material.specularIor},set:function(e){this._material.specularIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"glossiness",{get:function(){return 1-this._material.specularRoughness},set:function(e){this._material.specularRoughness=Math.max(1-e,0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColor",{get:function(){return this._material.emissionColor},set:function(e){this._material.emissionColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionLuminance",{get:function(){return this._material.emissionLuminance},set:function(e){this._material.emissionLuminance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColorTexture",{get:function(){return this._material.emissionColorTexture},set:function(e){this._material.emissionColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTexture",{get:function(){return this._material.ambientOcclusionTexture},set:function(e){this._material.ambientOcclusionTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTextureStrength",{get:function(){var e,t=this._material.ambientOcclusionTexture;return null!==(e=null==t?void 0:t.level)&&void 0!==e?e:1},set:function(e){var t=this._material.ambientOcclusionTexture;t&&(t.level=e)},enumerable:!1,configurable:!0}),e.prototype.configureCoat=function(){},Object.defineProperty(e.prototype,"coatWeight",{get:function(){return this._material.coatWeight},set:function(e){this._material.coatWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatWeightTexture",{get:function(){return this._material.coatWeightTexture},set:function(e){this._material.coatWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColor",{get:function(){return this._material.coatColor},set:function(e){this._material.coatColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColorTexture",{set:function(e){this._material.coatColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughness",{get:function(){return this._material.coatRoughness},set:function(e){this._material.coatRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessTexture",{get:function(){return this._material.coatRoughnessTexture},set:function(e){this._material.coatRoughnessTexture=e,e&&(this._material._useCoatRoughnessFromGreenChannel=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatIor",{get:function(){return this._material.coatIor},set:function(e){this._material.coatIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkening",{get:function(){return this._material.coatDarkening},set:function(e){this._material.coatDarkening=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkeningTexture",{set:function(e){this._material.coatDarkeningTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessAnisotropy",{get:function(){return this._material.coatRoughnessAnisotropy},set:function(e){this._material.coatRoughnessAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentAngle",{set:function(e){this._material.geometryCoatTangentAngle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentTexture",{get:function(){return this._material.geometryCoatTangentTexture},set:function(e){this._material.geometryCoatTangentTexture=e,e&&(this._material._useCoatRoughnessAnisotropyFromTangentTexture=!0)},enumerable:!1,configurable:!0}),e.prototype.configureTransmission=function(){this._material.geometryThinWalled=1,this._material.transmissionDepth=0},Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.transmissionWeight},set:function(e){this._material.transmissionWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{get:function(){return this._material.transmissionWeightTexture},set:function(e){this._material.transmissionWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatter",{get:function(){return this._material.transmissionScatter},set:function(e){this._material.transmissionScatter=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatterTexture",{get:function(){return this._material.transmissionScatterTexture},set:function(e){this._material.transmissionScatterTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatterAnisotropy",{set:function(e){this._material.transmissionScatterAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){this._material.transmissionDispersionAbbeNumber=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionScale",{set:function(e){this._material.transmissionDispersionScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDepth",{get:function(){return this._material.transmissionDepth},set:function(e){e!==Number.MAX_VALUE||0!==this._material.transmissionDepth?this._material.transmissionDepth=e:this._material.transmissionDepth=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{get:function(){return this._material.transmissionColor},set:function(e){e.equals(t.Color3.White())||(this._material.transmissionColor=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refractionBackgroundTexture",{get:function(){return this._material.backgroundRefractionTexture},set:function(e){this._material.backgroundRefractionTexture=e},enumerable:!1,configurable:!0}),e.prototype.configureVolume=function(){this._material.geometryThinWalled=0},Object.defineProperty(e.prototype,"geometryThinWalled",{get:function(){return!!this._material.geometryThinWalled},set:function(e){this._material.geometryThinWalled=e?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){this._material.geometryThicknessTexture=e,this._material._useGeometryThicknessFromGreenChannel=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){this._material.geometryThickness=e},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){this._material.geometryThinWalled=1,this._material.subsurfaceScatterAnisotropy=1},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return this._material.subsurfaceWeight},set:function(e){this._material.subsurfaceWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{get:function(){return this._material.subsurfaceWeightTexture},set:function(e){this._material.subsurfaceWeightTexture=e,this._material._useSubsurfaceWeightFromTextureAlpha=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){this._material.subsurfaceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){this._material.subsurfaceColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTint",{get:function(){return this._diffuseTransmissionTint},set:function(e){this._diffuseTransmissionTint=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTintTexture",{set:function(e){this._diffuseTransmissionTintTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadius",{get:function(){return this._material.subsurfaceRadius},set:function(e){this._material.subsurfaceRadius=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadiusScale",{get:function(){return this._material.subsurfaceRadiusScale},set:function(e){this._material.subsurfaceRadiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceScatterAnisotropy",{set:function(e){this._material.subsurfaceScatterAnisotropy=e},enumerable:!1,configurable:!0}),e.prototype.isTranslucent=function(){return this.transmissionWeight>0||this.subsurfaceWeight>0},e.prototype.configureFuzz=function(){},Object.defineProperty(e.prototype,"fuzzWeight",{set:function(e){this._material.fuzzWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzWeightTexture",{set:function(e){this._material.fuzzWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColor",{set:function(e){this._material.fuzzColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColorTexture",{set:function(e){this._material.fuzzColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughness",{set:function(e){this._material.fuzzRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughnessTexture",{set:function(e){this._material.fuzzRoughnessTexture=e,this._material._useFuzzRoughnessFromTextureAlpha=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessAnisotropy",{get:function(){return this._material.specularRoughnessAnisotropy},set:function(e){this._material.specularRoughnessAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentAngle",{set:function(e){this._material.geometryTangentAngle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentTexture",{get:function(){return this._material.geometryTangentTexture},set:function(e){this._material.geometryTangentTexture=e,this._material._useSpecularRoughnessAnisotropyFromTangentTexture=!0},enumerable:!1,configurable:!0}),e.prototype.configureGltfStyleAnisotropy=function(e){void 0===e&&(e=!0),this._material._useGltfStyleAnisotropy=e},Object.defineProperty(e.prototype,"thinFilmWeight",{set:function(e){this._material.thinFilmWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmIor",{set:function(e){this._material.thinFilmIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMinimum",{set:function(e){this._material.thinFilmThicknessMin=e/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMaximum",{set:function(e){this._material.thinFilmThickness=e/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmWeightTexture",{set:function(e){this._material.thinFilmWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessTexture",{set:function(e){this._material.thinFilmThicknessTexture=e,this._material._useThinFilmThicknessFromTextureGreen=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unlit",{set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryOpacity",{get:function(){return this._material.geometryOpacity},set:function(e){this._material.geometryOpacity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryNormalTexture",{get:function(){return this._material.geometryNormalTexture},set:function(e){this._material.geometryNormalTexture=e},enumerable:!1,configurable:!0}),e.prototype.setNormalMapInversions=function(e,t){},Object.defineProperty(e.prototype,"geometryCoatNormalTexture",{get:function(){return this._material.geometryCoatNormalTexture},set:function(e){this._material.geometryCoatNormalTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatNormalTextureScale",{set:function(e){this._material.geometryCoatNormalTexture&&(this._material.geometryCoatNormalTexture.level=e)},enumerable:!1,configurable:!0}),e.prototype.finalizeAsync=function(e){return a(this,void 0,void 0,function(){var n,r,a,s,l,u,c,f,h,d;return i(this,function(i){switch(i.label){case 0:return this._diffuseTransmissionTint&&!this._diffuseTransmissionTint.equals(t.Color3.White())||this._diffuseTransmissionTintTexture?this._material.geometryThinWalled?(this.subsurfaceColor=this._diffuseTransmissionTint,this.subsurfaceColorTexture=this._diffuseTransmissionTintTexture,[3,3]):[3,1]:[3,3];case 1:return[4,this.copySurfaceToCoatAsync(e,this.subsurfaceWeight,this.subsurfaceWeightTexture,t.TextureChannel.A,this._diffuseTransmissionTint,this._diffuseTransmissionTintTexture,!0)];case 2:if(i.sent(),e._disposed)return[2];i.label=3;case 3:return this.transmissionWeight>0?this._material.geometryThinWalled||0===this._material.transmissionDepth?(this._material.transmissionColor=this._material.baseColor,this._material.transmissionColorTexture=this._material.baseColorTexture,[3,6]):[3,4]:[3,6];case 4:return this.baseColor.equals(t.Color3.White())&&null===this.baseColorTexture?[3,6]:[4,this.copySurfaceToCoatAsync(e,this.transmissionWeight,this.transmissionWeightTexture,t.TextureChannel.R,this.baseColor,this.baseColorTexture,!1)];case 5:if(i.sent(),e._disposed)return[2];i.label=6;case 6:return this._specWorkflow?(r=t.InvertTextureAsync,a=["newRoughnessTexture ("+this._material.name+")"],[4,t.ExtractChannelAsync("glossiness ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularColorTexture,new t.Color4(this.specularColor.r,this.specularColor.g,this.specularColor.b,this.glossiness),t.TextureChannel.A,t.TextureColorSpace.Linear),t.TextureChannel.A,this._material.getScene(),t.TextureColorSpace.Linear,t.ChannelMask.R)]):[3,11];case 7:return[4,r.apply(void 0,a.concat([i.sent(),this._material.getScene(),t.ChannelMask.R,t.TextureColorSpace.Linear,t.ChannelMask.R]))];case 8:return n=i.sent(),e._disposed?(null===(f=n.texture)||void 0===f||f.dispose(),[2]):(this.specularRoughnessTexture=n.texture,this.specularRoughness=n.factor?n.factor.r:1,[4,t.ExtractMaxChannelAsync("metallicTexture ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularColorTexture,this.specularColor.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.Linear),this._material.getScene(),!1,t.TextureColorSpace.SRGB,t.ChannelMask.RGB)]);case 9:return s=i.sent(),e._disposed?(null===(h=s.texture)||void 0===h||h.dispose(),[2]):(this.baseMetalnessTexture=s.texture,this.baseMetalness=s.factor?s.factor.r:1,[4,t.LerpTexturesAsync("newBaseColor ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.baseColorTexture,this.baseColor.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.Linear),t.CreateTextureWithFactorOperand(this.specularColorTexture,this.specularColor.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.Linear),o(o({},s),{dispose:void 0,colorSpace:t.TextureColorSpace.Linear}),this._material.getScene(),t.TextureColorSpace.SRGB,t.ChannelMask.RGB)]);case 10:if(l=i.sent(),e._disposed)return null===(d=l.texture)||void 0===d||d.dispose(),[2];null==(u=this.baseColorTexture)||u.dispose(),this.baseColorTexture=l.texture,this.baseColor=l.factor?new t.Color3(l.factor.r,l.factor.g,l.factor.b):t.Color3.White(),null==(c=this.specularColorTexture)||c.dispose(),this.specularColorTexture=null,i.label=11;case 11:return[2]}})})},e.prototype.copySurfaceToCoatAsync=function(e,n,r,o,s,l){return a(this,arguments,void 0,function(e,n,r,o,a,s,l){var u,c,f,h,d,p,m,_,g,y,b,v,T,x,A,C,O,w,M,E,R,L,P,S,F,N,I,k,B,G;return void 0===l&&(l=!1),i(this,function(i){switch(i.label){case 0:return u=this._material.coatWeight,c=this._material.coatWeightTexture,f=this._material.coatColor.clone(),h=this._material.coatColorTexture,d=this._material.geometryCoatNormalTexture,p=new t.Color4(u,u,u,u),m=new t.Color4(n,n,n,n),this.coatWeightTexture=null,this.coatWeight=1,[4,Promise.allSettled([t.LerpTexturesAsync("lerpExistingCoat",t.CreateTextureWithFactorOperand(null,new t.Color4(1,1,1,1)),t.CreateTextureWithFactorOperand(h,f.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.SRGB),t.CreateTextureWithFactorOperand(c,p,t.TextureChannel.R),this._material.getScene(),t.TextureColorSpace.SRGB),t.LerpTexturesAsync("lerpSurfaceColor",t.CreateTextureWithFactorOperand(null,new t.Color4(1,1,1,1)),t.CreateTextureWithFactorOperand(s,a.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.SRGB),t.CreateTextureWithFactorOperand(r,m,o),this._material.getScene(),t.TextureColorSpace.SRGB)])];case 1:if(_=i.sent(),g=_.find(function(e){return"rejected"===e.status}),g){for(y=0,b=_;y<b.length;y++)"fulfilled"===(v=b[y]).status&&(null===(L=v.value.texture)||void 0===L||L.dispose());throw g.reason}return T=_.map(function(e){return e.value}),x=T[0],A=T[1],e._disposed?(null===(P=x.texture)||void 0===P||P.dispose(),null===(S=A.texture)||void 0===S||S.dispose(),[2]):[4,t.MultiplyTexturesAsync("newCoatColor ("+this._material.name+")",x,A,this._material.getScene(),t.TextureColorSpace.SRGB)];case 2:return C=i.sent(),e._disposed?(null===(F=C.texture)||void 0===F||F.dispose(),[2]):(C.texture?(this.coatColorTexture=C.texture,this.coatColor=t.Color3.White()):C.factor&&(this.coatColorTexture=null,this.coatColor.fromArray([C.factor.r,C.factor.g,C.factor.b])),[4,t.LerpTexturesAsync("newCoatIor ("+this._material.name+")",t.CreateTextureWithFactorOperand(null,new t.Color4(this._material.specularIor,this._material.specularIor,this._material.specularIor,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(null,new t.Color4(this.coatIor,this.coatIor,this.coatIor,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(c,p,t.TextureChannel.R),this._material.getScene())]);case 3:return O=i.sent(),e._disposed?(null===(N=O.texture)||void 0===N||N.dispose(),[2]):(this.coatIor=O.factor?O.factor.r:this.coatIor,[4,t.LerpTexturesAsync("newCoatRoughness ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularRoughnessTexture,new t.Color4(this.specularRoughness,this.specularRoughness,this.specularRoughness,1),t.TextureChannel.G),t.CreateTextureWithFactorOperand(this.coatRoughnessTexture,new t.Color4(this.coatRoughness,this.coatRoughness,this.coatRoughness,1),t.TextureChannel.G),t.CreateTextureWithFactorOperand(c,p,t.TextureChannel.R),this._material.getScene())]);case 4:return w=i.sent(),e._disposed?(null===(I=w.texture)||void 0===I||I.dispose(),[2]):(this.coatRoughness=w.factor?w.factor.r:1,this.coatRoughnessTexture=w.texture,[4,t.LerpTexturesAsync("newCoatDarkening ("+this._material.name+")",t.CreateTextureWithFactorOperand(null,new t.Color4(0,0,0,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(null,new t.Color4(this.coatDarkening,this.coatDarkening,this.coatDarkening,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(c,p,t.TextureChannel.R),this._material.getScene())]);case 5:return M=i.sent(),e._disposed?(null===(k=M.texture)||void 0===k||k.dispose(),[2]):(this.coatDarkening=M.factor?M.factor.r:this.coatDarkening,l?[4,t.LerpTexturesAsync("newSpecularRoughness ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularRoughnessTexture,new t.Color4(this._material.specularRoughness,this._material.specularRoughness,this._material.specularRoughness,1),t.TextureChannel.G),t.CreateTextureWithFactorOperand(null,new t.Color4(1,1,1,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(r,m,o),this._material.getScene())]:[3,7]);case 6:if(E=i.sent(),e._disposed)return null===(B=E.texture)||void 0===B||B.dispose(),[2];this.specularRoughness=E.factor?E.factor.r:1,this.specularRoughnessTexture=E.texture,i.label=7;case 7:return d||this.geometryNormalTexture?[4,t.LerpTexturesAsync("newCoatNormal ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.geometryNormalTexture,this.geometryNormalTexture?new t.Color4(1,1,1,1):new t.Color4(.5,.5,1,1),t.TextureChannel.RGBA),t.CreateTextureWithFactorOperand(d,d?new t.Color4(1,1,1,1):new t.Color4(.5,.5,1,1),t.TextureChannel.RGBA),t.CreateTextureWithFactorOperand(c,p,t.TextureChannel.R),this._material.getScene())]:[3,9];case 8:if(R=i.sent(),e._disposed)return null===(G=R.texture)||void 0===G||G.dispose(),[2];R.texture&&(this.geometryCoatNormalTexture=R.texture),i.label=9;case 9:return[2]}})})},e}(),ur={__proto__:null,OpenPBRMaterialLoadingAdapter:lr},cr=function(){function e(e){this._specWorkflow=!1,this._material=e,this._material.enableSpecularAntiAliasing=!0}return Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),e.prototype.finalizeAsync=function(e){return a(this,void 0,void 0,function(){return i(this,function(e){return[2]})})},Object.defineProperty(e.prototype,"isUnlit",{get:function(){return this._material.unlit},set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._material.backFaceCulling},set:function(e){this._material.backFaceCulling=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"twoSidedLighting",{get:function(){return this._material.twoSidedLighting},set:function(e){this._material.twoSidedLighting=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaCutOff",{get:function(){return this._material.alphaCutOff},set:function(e){this._material.alphaCutOff=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useAlphaFromBaseColorTexture",{get:function(){return this._material.useAlphaFromAlbedoTexture},set:function(e){this._material.useAlphaFromAlbedoTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparencyAsAlphaCoverage",{get:function(){return this._material.useRadianceOverAlpha||this._material.useSpecularOverAlpha},set:function(e){this._material.useRadianceOverAlpha=!e,this._material.useSpecularOverAlpha=!e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColor",{get:function(){return this._material.albedoColor},set:function(e){this._material.albedoColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColorTexture",{get:function(){return this._material.albedoTexture},set:function(e){this._material.albedoTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughness",{get:function(){var e;return null!==(e=this._material.baseDiffuseRoughness)&&void 0!==e?e:0},set:function(e){this._material.baseDiffuseRoughness=e,e>0&&(this._material.brdf.baseDiffuseModel=t.Constants.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughnessTexture",{get:function(){return this._material.baseDiffuseRoughnessTexture},set:function(e){this._material.baseDiffuseRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalness",{get:function(){var e;return null!==(e=this._material.metallic)&&void 0!==e?e:1},set:function(e){this._material.metallic=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalnessTexture",{get:function(){return this._material.metallicTexture},set:function(e){this._material.metallicTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useRoughnessFromMetallicTextureGreen",{set:function(e){this._material.useRoughnessFromMetallicTextureGreen=e,this._material.useRoughnessFromMetallicTextureAlpha=!e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useMetallicFromMetallicTextureBlue",{set:function(e){this._material.useMetallnessFromMetallicTextureBlue=e},enumerable:!1,configurable:!0}),e.prototype.enableSpecularEdgeColor=function(e){void 0===e&&(e=!1),e&&(this._material.brdf.dielectricSpecularModel=t.Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=t.Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR)},e.prototype.configureSpecularGlossiness=function(){this._specWorkflow=!0,this._material.metallic=null,this._material.roughness=null,this._material.useMicroSurfaceFromReflectivityMapAlpha=!0},Object.defineProperty(e.prototype,"specularWeight",{get:function(){var e;return null!==(e=this._material.metallicF0Factor)&&void 0!==e?e:1},set:function(e){this._material.metallicF0Factor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularWeightTexture",{get:function(){return this._material.metallicReflectanceTexture},set:function(e){e?(this._material.metallicReflectanceTexture=e,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!0):(this._material.metallicReflectanceTexture=null,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColor",{get:function(){return this._specWorkflow?this._material.reflectivityColor:this._material.metallicReflectanceColor},set:function(e){this._specWorkflow?this._material.reflectivityColor=e:this._material.metallicReflectanceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._specWorkflow?this._material.reflectivityTexture:this._material.reflectanceTexture},set:function(e){this._specWorkflow?(this._material.reflectivityTexture=e,this._material.reflectivityTexture&&(this._material.reflectivityTexture.hasAlpha=!0)):this._material.reflectanceTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughness",{get:function(){var e;return null!==(e=this._material.roughness)&&void 0!==e?e:1},set:function(e){this._material.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessTexture",{get:function(){return this._material.metallicTexture},set:function(e){this.baseMetalnessTexture||(this._material.metallicTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularIor",{get:function(){return this._material.indexOfRefraction},set:function(e){this._material.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"glossiness",{get:function(){var e;return null!==(e=this._material.microSurface)&&void 0!==e?e:1},set:function(e){this._material.microSurface=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColor",{get:function(){return this._material.emissiveColor},set:function(e){this._material.emissiveColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionLuminance",{get:function(){return this._material.emissiveIntensity},set:function(e){this._material.emissiveIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColorTexture",{get:function(){return this._material.emissiveTexture},set:function(e){this._material.emissiveTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTexture",{get:function(){return this._material.ambientTexture},set:function(e){this._material.ambientTexture=e,e&&(this._material.useAmbientInGrayScale=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTextureStrength",{get:function(){var e;return null!==(e=this._material.ambientTextureStrength)&&void 0!==e?e:1},set:function(e){this._material.ambientTextureStrength=e},enumerable:!1,configurable:!0}),e.prototype.configureCoat=function(){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.remapF0OnInterfaceChange=!1},Object.defineProperty(e.prototype,"coatWeight",{get:function(){return this._material.clearCoat.intensity},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatWeightTexture",{get:function(){return this._material.clearCoat.texture},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColor",{set:function(e){this._material.clearCoat.isTintEnabled=e!=t.Color3.White(),this._material.clearCoat.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColorTexture",{set:function(e){this._material.clearCoat.tintTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughness",{get:function(){var e;return null!==(e=this._material.clearCoat.roughness)&&void 0!==e?e:0},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessTexture",{get:function(){return this._material.clearCoat.textureRoughness},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.textureRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatIor",{set:function(e){this._material.clearCoat.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkening",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkeningTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessAnisotropy",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentAngle",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentTexture",{get:function(){return null},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.subSurface.isRefractionEnabled?this._material.subSurface.refractionIntensity:0},set:function(e){this._material.subSurface.isRefractionEnabled=e>0,this._material.subSurface.refractionIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{set:function(e){this._material.subSurface.isRefractionEnabled=!0,this._material.subSurface.refractionIntensityTexture=e,this._material.subSurface.useGltfStyleTextures=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDepth",{get:function(){return this.transmissionWeight>0?this._material.subSurface.tintColorAtDistance:0},set:function(e){this.transmissionWeight>0?this._material.subSurface.tintColorAtDistance=e:this.subsurfaceWeight>0&&this._material.subSurface.diffusionDistance.multiplyInPlace(new t.Color3(e,e,e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{get:function(){return this.transmissionWeight>0?this._material.subSurface.tintColor:this.subsurfaceWeight>0?this._material.subSurface.diffusionDistance:new t.Color3(0,0,0)},set:function(e){this.transmissionWeight>0?this._material.subSurface.tintColor=e:this.subsurfaceWeight>0&&this._material.subSurface.diffusionDistance.multiplyInPlace(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatter",{get:function(){return this._material.subSurface.diffusionDistance},set:function(e){this._material.subSurface.diffusionDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatterTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatterAnisotropy",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionScale",{set:function(e){e>0?(this._material.subSurface.isDispersionEnabled=!0,this._material.subSurface.dispersion=20/e):(this._material.subSurface.isDispersionEnabled=!1,this._material.subSurface.dispersion=0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refractionBackgroundTexture",{get:function(){return this._material.subSurface.refractionTexture},set:function(e){this._material.subSurface.refractionTexture=e},enumerable:!1,configurable:!0}),e.prototype.configureTransmission=function(){this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.useAlbedoToTintRefraction=!0,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0},e.prototype.configureVolume=function(){},Object.defineProperty(e.prototype,"geometryThinWalled",{get:function(){return 0===this._material.subSurface.maximumThickness},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){this._material.subSurface.thicknessTexture=e,this._material.subSurface.useGltfStyleTextures=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=e,this._material.subSurface.useThicknessAsDepth=!0,e>0&&(this._material.subSurface.volumeIndexOfRefraction=this._material.indexOfRefraction)},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){this._material.subSurface.useGltfStyleTextures=!0,this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0,this._material.subSurface.useAlbedoToTintTranslucency=!1},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return this._material.subSurface.isTranslucencyEnabled?this._material.subSurface.translucencyIntensity:0},set:function(e){this._material.subSurface.isTranslucencyEnabled=e>0,this._material.subSurface.translucencyIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){this._material.subSurface.translucencyIntensityTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){var n=new t.Vector3(-Math.log(this.transmissionColor.r),-Math.log(this.transmissionColor.g),-Math.log(this.transmissionColor.b));n.scaleInPlace(1/Math.max(this.transmissionDepth,.001));var r=n,o=Math.max(r.x,Math.max(r.y,r.z)),a=o>0?1/o:1;this._material.subSurface.diffusionDistance=new t.Color3(Math.exp(-r.x*a),Math.exp(-r.y*a),Math.exp(-r.z*a))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTint",{get:function(){return this._material.subSurface.tintColor},set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTintTexture",{set:function(e){this._material.subSurface.translucencyColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadius",{get:function(){return 1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadiusScale",{get:function(){var e;return null!==(e=this._material.subSurface.scatteringDiffusionProfile)&&void 0!==e?e:t.Color3.White()},set:function(e){this._material.subSurface.scatteringDiffusionProfile=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceScatterAnisotropy",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.isTranslucent=function(){return this.transmissionWeight>0||this.subsurfaceWeight>0},e.prototype.configureFuzz=function(){this._material.sheen.isEnabled=!0,this._material.sheen.useRoughnessFromMainTexture=!1,this._material.sheen.albedoScaling=!0},Object.defineProperty(e.prototype,"fuzzWeight",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzWeightTexture",{set:function(e){this._material.sheen.texture||(this._material.sheen.texture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColor",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.color=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColorTexture",{set:function(e){this._material.sheen.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughness",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughnessTexture",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.textureRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessAnisotropy",{get:function(){return this._material.anisotropy.intensity},set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentAngle",{set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.angle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentTexture",{get:function(){return this._material.anisotropy.texture},set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.texture=e},enumerable:!1,configurable:!0}),e.prototype.configureGltfStyleAnisotropy=function(e){void 0===e&&(e=!0)},Object.defineProperty(e.prototype,"thinFilmWeight",{set:function(e){this._material.iridescence.isEnabled=e>0,this._material.iridescence.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmIor",{set:function(e){this._material.iridescence.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMinimum",{set:function(e){this._material.iridescence.minimumThickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMaximum",{set:function(e){this._material.iridescence.maximumThickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmWeightTexture",{set:function(e){this._material.iridescence.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessTexture",{set:function(e){this._material.iridescence.thicknessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unlit",{set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryOpacity",{get:function(){return this._material.alpha},set:function(e){this._material.alpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryNormalTexture",{get:function(){return this._material.bumpTexture},set:function(e){this._material.bumpTexture=e,this._material.forceIrradianceInFragment=!0},enumerable:!1,configurable:!0}),e.prototype.setNormalMapInversions=function(e,t){this._material.invertNormalMapX=e,this._material.invertNormalMapY=t},Object.defineProperty(e.prototype,"geometryCoatNormalTexture",{get:function(){return this._material.clearCoat.bumpTexture},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.bumpTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatNormalTextureScale",{set:function(e){this._material.clearCoat.bumpTexture&&(this._material.clearCoat.bumpTexture.level=e)},enumerable:!1,configurable:!0}),e}(),fr={__proto__:null,PBRMaterialLoadingAdapter:cr},hr={__proto__:null,AddObjectAccessorToKey:xe,AnimationPropertyInfo:Wt,ArrayItem:Re,EXT_lights_area:Xe,EXT_lights_ies:Ke,EXT_lights_image_based:Fe,EXT_mesh_gpu_instancing:Ie,EXT_meshopt_compression:Be,EXT_texture_avif:He,EXT_texture_webp:Ve,ExtrasAsMetadata:nr,FlowGraphGLTFDataProvider:ar,GLTFFileLoader:T,GLTFLoader:Pe,GetMappingForKey:ve,GetPathToObjectConverter:be,InteractivityGraphToFlowGraphParser:Kn,KHR_animation_pointer:On,KHR_draco_mesh_compression:Ue,KHR_interactivity:Un,KHR_lights:qe,KHR_materials_anisotropy:st,KHR_materials_clearcoat:tt,KHR_materials_coat:rt,KHR_materials_diffuse_roughness:St,KHR_materials_diffuse_transmission:Ct,KHR_materials_dispersion:Lt,KHR_materials_emissive_strength:ut,KHR_materials_fuzz:dt,KHR_materials_ior:gt,KHR_materials_iridescence:at,KHR_materials_pbrSpecularGlossiness:Ze,KHR_materials_sheen:ft,KHR_materials_specular:mt,KHR_materials_transmission:xt,KHR_materials_unlit:$e,KHR_materials_variants:bt,KHR_materials_volume:wt,KHR_materials_volume_scatter:Et,KHR_mesh_quantization:Nt,KHR_node_hoverability:er,KHR_node_selectability:Qn,KHR_node_visibility:Yn,KHR_texture_basisu:kt,KHR_texture_transform:Gt,KHR_xmp_json_ld:Dt,LoadBoundingInfoFromPositionAccessor:Le,MSFT_audio_emitter:Mn,MSFT_lod:Rn,MSFT_minecraftMesh:Pn,MSFT_sRGBFactors:Fn,OpenPBRMaterialLoadingAdapter:lr,PBRMaterialLoadingAdapter:cr,SetInterpolationForKey:Te,TransformNodeAnimationPropertyInfo:Ut,WeightAnimationPropertyInfo:zt,_AddInteractivityObjectModel:zn,addNewInteractivityFlowGraphMapping:kn,getAllSupportedNativeNodeTypes:Hn,getMappingForDeclaration:In,getMappingForFullOperationName:Nn,getQuaternion:jt,getVector3:Ht,getWeights:Kt,gltfTypeToBabylonType:jn,registerGLTFExtension:Oe,registeredGLTFExtensions:Ce,unregisterGLTFExtension:we},dr=o({},sr),pr=o(o({},{__proto__:null}),((rr={}).Extensions=dr,rr)),mr=o(o({},hr),((or={}).Loader=pr,or)),_r="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==_r){_r.BABYLON=_r.BABYLON||{};var gr=_r.BABYLON;gr.GLTF2=gr.GLTF2||{},gr.GLTF2.Loader=gr.GLTF2.Loader||{},gr.GLTF2.Loader.Extensions=gr.GLTF2.Loader.Extensions||{};var yr=["Loader"];for(var br in dr)gr.GLTF2.Loader.Extensions[br]=dr[br],yr.push(br);for(var br in pr)"Extensions"!==br&&(gr.GLTF2.Loader[br]=pr[br],yr.push(br));for(var br in mr)yr.indexOf(br)>-1||(gr.GLTF2[br]=mr[br])}e.GLTF1=ie,e.GLTF2=mr,e.GLTFFileLoader=T,e.GLTFLoaderDefaultOptions=b,e.GLTFValidation=h});
2
+ //# sourceMappingURL=babylon.glTFFileLoader.min.js.map