babylonjs-loaders 8.46.2 → 8.47.1
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.
- package/babylon.glTF1FileLoader.js +1 -1
- package/babylon.glTF1FileLoader.min.js +1 -1
- package/babylon.glTF1FileLoader.min.js.map +1 -1
- package/babylon.glTF2FileLoader.js +1 -1
- package/babylon.glTF2FileLoader.min.js +1 -1
- package/babylon.glTF2FileLoader.min.js.map +1 -1
- package/babylon.glTFFileLoader.js +1 -1
- package/babylon.glTFFileLoader.min.js +1 -1
- package/babylon.glTFFileLoader.min.js.map +1 -1
- package/babylonjs.loaders.d.ts +290 -28
- package/babylonjs.loaders.js +1 -1
- package/babylonjs.loaders.min.js +1 -1
- package/babylonjs.loaders.min.js.map +1 -1
- package/babylonjs.loaders.module.d.ts +587 -56
- package/package.json +4 -4
package/babylonjs.loaders.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t,n,r={274:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphGLTFDataProvider:()=>a});var r=n(322),o=n(597),a=function(e){function t(t){var n,r,a=e.call(this)||this,i=t.glTF,s=(null===(n=i.animations)||void 0===n?void 0:n.map((function(e){return e._babylonAnimationGroup})))||[];a.animationGroups=a.registerDataOutput("animationGroups",o.RichTypeAny,s);var l=(null===(r=i.nodes)||void 0===r?void 0:r.map((function(e){return e._babylonTransformNode})))||[];return a.nodes=a.registerDataOutput("nodes",o.RichTypeAny,l),a}return(0,r.C6)(t,e),t.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},t}(o.FlowGraphBlock)},322:(e,t,n)=>{n.d(t,{C6:()=>o,Cl:()=>a,YH:()=>s,fX:()=>l,sH:()=>i});var r=function(e,t){return r=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])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=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},a.apply(this,arguments)};function i(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 s(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 l(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError},561:(e,t,n)=>{n.r(t),n.d(t,{PBRMaterialLoadingAdapter:()=>o});var r=n(597),o=function(){function e(e){this._material=e,this._material.enableSpecularAntiAliasing=!0}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 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=r.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=r.Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=r.Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR)},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._material.metallicReflectanceColor},set:function(e){this._material.metallicReflectanceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._material.reflectanceTexture},set:function(e){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,"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!=r.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.refractionIntensity},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",{set:function(e){this._material.subSurface.tintColorAtDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{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}),e.prototype.configureTransmission=function(){this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.useAlbedoToTintRefraction=!0,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=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){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){this._material.subSurface.translucencyColorTexture=e},enumerable:!1,configurable:!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,"transmissionDispersion",{set:function(e){this._material._dispersion=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}()},597:t=>{t.exports=e},698:(e,t,n)=>{n.d(t,{oR:()=>d,tQ:()=>f,Wt:()=>c,ZU:()=>h});var r=n(597),o=[{regex:new RegExp("^/nodes/\\d+/extensions/")}],a=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 a=e.split("/");if(a.shift(),a[a.length-1].includes(".length")){var i=a[a.length-1].split(".");a.pop(),a.push.apply(a,i)}for(var s=!1,l=0,u=a;l<u.length;l++){var c=u[l],f="length"===c;if(f&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(s=!0),n.__array__&&!f)n=n.__array__;else if(!(n=n[c]))throw new Error("Path ".concat(e," is invalid"));if(!s)if(void 0===t){if(!o.find((function(t){return t.regex.test(e)})))throw new Error("Path ".concat(e," is invalid"))}else f||(t=null==t?void 0:t[c]);(n.__target__||f)&&(r=t)}return{object:r,info:n}},e}();function i(e,t,n,r){var o=s(e);return r?o[n][r]:o[n]}function s(e,t,n){var o,a,i;return null===(i=null===(o=e._data)||void 0===o?void 0:o[null!==(a=null==n?void 0:n.fillMode)&&void 0!==a?a:r.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function l(e,t){return{offset:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uOffset,null==s?void 0:s.vOffset)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uOffset=n.x,s.vOffset=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uOffset")},function(){return"".concat(e).concat(t?"."+t:"",".vOffset")}]},rotation:{type:"number",get:function(n,r,o){var a;return null===(a=i(n,0,e,t))||void 0===a?void 0:a.wAng},getTarget:s,set:function(n,r,o,a){return i(r,0,e,t).wAng=n},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uScale,null==s?void 0:s.vScale)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uScale=n.x,s.vScale=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uScale")},function(){return"".concat(e).concat(t?"."+t:"",".vScale")}]}}}var u={cameras:{__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var t,n,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoLeft)&&void 0!==n?n: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 t,n,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoBottom)&&void 0!==n?n: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"}]}}}},nodes:{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 t,n,o;return r.Matrix.Compose(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.scaling,null===(n=e._babylonTransformNode)||void 0===n?void 0:n.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 t,n,o,a,i,s,l,u=r.Matrix.Identity(),c=e.parent;c&&c.parent;)c=c.parent;var f=(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.position._isDirty)||(null===(o=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.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 t,n;return null===(n=null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0])||void 0===n?void 0:n.intensity},getTarget:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0];n&&(n.intensity=e)}}},color:{type:"Color3",get:function(e){var t,n;return null===(n=null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0])||void 0===n?void 0:n.diffuse},getTarget:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0];n&&(n.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}))}}}}}},materials:{__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).emissiveColor},set:function(e,t,n,r){return s(t,0,r).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:l("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=i(e,0,"bumpTexture"))||void 0===r?void 0:r.level},set:function(e,t,n,r){var o=i(t,0,"bumpTexture");o&&(o.level=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:l("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return s(e,0,n).ambientTextureStrength},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.ambientTextureStrength=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:l("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,t,n){var o=s(e,0,n);return r.Color4.FromColor3(o.albedoColor,o.alpha)},set:function(e,t,n,r){var o=s(t,0,r);o.albedoColor.set(e.r,e.g,e.b),o.alpha=e.a},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:l("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallic},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.metallic=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).roughness},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.roughness=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:l("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.intensity},set:function(e,t,n,r){s(t,0,r).anisotropy.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.angle},set:function(e,t,n,r){s(t,0,r).anisotropy.angle=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:l("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.intensity},set:function(e,t,n,r){s(t,0,r).clearCoat.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.roughness},set:function(e,t,n,r){s(t,0,r).clearCoat.roughness=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:l("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=s(e,0,n).clearCoat.bumpTexture)||void 0===r?void 0:r.level},getTarget:s,set:function(e,t,n,r){return s(t,0,r).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:l("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:l("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.dispersion},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return s(e,0,n).emissiveIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return s(e,0,n).indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:l("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.minimumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:l("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).sheen.color},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:l("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).sheen.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:l("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallicF0Factor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).metallicReflectanceColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:l("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:l("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.refractionIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.translucencyIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.translucencyColor},getTarget:s,set:function(e,t,n,r){var o;return e&&(null===(o=s(t,0,r).subSurface.translucencyColor)||void 0===o?void 0:o.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.tintColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.tintColorAtDistance},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:l("subSurface","thicknessTexture")}}}}}},extensions:{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 t;return e._babylonTexture&&r.Quaternion.FromRotationMatrix(null===(t=e._babylonTexture)||void 0===t?void 0:t.getReflectionTextureMatrix())},set:function(e,t){var n;t._babylonTexture&&((null===(n=t._babylonTexture.getScene())||void 0===n?void 0:n.useRightHandedSystem)||(e=r.Quaternion.Inverse(e)),r.Matrix.FromQuaternionToRef(e,t._babylonTexture.getReflectionTextureMatrix()))},getTarget:function(e){return e._babylonTexture}}}}}},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 c(e){return new a(e,u)}function f(e){for(var t=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),n=u,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 h(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),r=u,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 d(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),r=u,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)}},727:(e,t,n)=>{n.r(t),n.d(t,{AnimationPropertyInfo:()=>u,TransformNodeAnimationPropertyInfo:()=>c,WeightAnimationPropertyInfo:()=>f,getQuaternion:()=>s,getVector3:()=>i,getWeights:()=>l});var r=n(322),o=n(597),a=n(698);function i(e,t,n,r){return o.Vector3.FromArray(t,n).scaleInPlace(r)}function s(e,t,n,r){return o.Quaternion.FromArray(t,n).scaleInPlace(r)}function l(e,t,n,r){for(var o=new Array(e._numMorphTargets),a=0;a<o.length;a++)o[a]=t[n++]*r;return o}var u=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,t,n){var r=new o.Animation(e,this.name,t,this.type);return r.setKeys(n,!0),r},e}(),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(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}(u),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new o.Animation("".concat(t,"_").concat(i),s.name,n,s.type);if(l.setKeys(r.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},t}(u);(0,a.ZU)("/nodes/{}/translation",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"position",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/rotation",[new c(o.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",s,(function(){return 4}))]),(0,a.ZU)("/nodes/{}/scale",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"scaling",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/weights",[new f(o.Animation.ANIMATIONTYPE_FLOAT,"influence",l,(function(e){return e._numMorphTargets}))])},833:(e,t,n)=>{n.r(t),n.d(t,{OpenPBRMaterialLoadingAdapter:()=>r});var r=function(){function e(e){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)},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,"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",{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",{set:function(e){this._material.coatIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"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}),Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureTransmission=function(){},Object.defineProperty(e.prototype,"transmissionDepth",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!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}()}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,a),n.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);a.r(o);var i={};t=t||[null,n({}),n([]),n(n)];for(var s=2&r&&e;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,a.d(o,i),o},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.d(i,{default:()=>Pr});var s={};a.r(s),a.d(s,{BVHFileLoader:()=>I,ReadBvh:()=>P});var l={};a.r(l),a.d(l,{GLTFValidation:()=>D});var u={};a.r(u),a.d(u,{GLTFFileLoader:()=>te,GLTFLoaderAnimationStartMode:()=>G,GLTFLoaderCoordinateSystemMode:()=>k,GLTFLoaderDefaultOptions:()=>ee,GLTFLoaderState:()=>V});var c={};a.r(c),a.d(c,{EBlendingFunction:()=>J,EComponentType:()=>W,ECullingType:()=>Q,EParameterType:()=>z,EShaderType:()=>Y,ETextureFilterType:()=>q,ETextureFormat:()=>X,ETextureWrapMode:()=>Z,GLTFBinaryExtension:()=>Ee,GLTFLoader:()=>Oe,GLTFLoaderBase:()=>we,GLTFLoaderExtension:()=>Ce,GLTFMaterialsCommonExtension:()=>Me,GLTFUtils:()=>re});var f={};a.r(f);var h={};a.r(h),a.d(h,{AddObjectAccessorToKey:()=>Ne.oR,EXT_lights_area:()=>at,EXT_lights_ies:()=>$e,EXT_lights_image_based:()=>je,EXT_mesh_gpu_instancing:()=>We,EXT_meshopt_compression:()=>ze,EXT_texture_avif:()=>Qe,EXT_texture_webp:()=>qe,ExtrasAsMetadata:()=>rr,FlowGraphGLTFDataProvider:()=>or.FlowGraphGLTFDataProvider,GetMappingForKey:()=>Ne.tQ,GetPathToObjectConverter:()=>Ne.Wt,InteractivityGraphToFlowGraphParser:()=>Kn,KHR_animation_pointer:()=>Cn,KHR_draco_mesh_compression:()=>tt,KHR_interactivity:()=>Yn,KHR_lights:()=>rt,KHR_materials_anisotropy:()=>gt,KHR_materials_clearcoat:()=>ft,KHR_materials_coat:()=>dt,KHR_materials_diffuse_roughness:()=>Dt,KHR_materials_diffuse_transmission:()=>It,KHR_materials_dispersion:()=>Gt,KHR_materials_emissive_strength:()=>bt,KHR_materials_fuzz:()=>At,KHR_materials_ior:()=>Et,KHR_materials_iridescence:()=>mt,KHR_materials_pbrSpecularGlossiness:()=>st,KHR_materials_sheen:()=>Tt,KHR_materials_specular:()=>Ot,KHR_materials_transmission:()=>Lt,KHR_materials_unlit:()=>ut,KHR_materials_variants:()=>Ft,KHR_materials_volume:()=>Bt,KHR_mesh_quantization:()=>Ut,KHR_node_hoverability:()=>tr,KHR_node_selectability:()=>Qn,KHR_node_visibility:()=>qn,KHR_texture_basisu:()=>Kt,KHR_texture_transform:()=>Yt,KHR_xmp_json_ld:()=>Zt,MSFT_audio_emitter:()=>Mn,MSFT_lod:()=>Rn,MSFT_minecraftMesh:()=>Ln,MSFT_sRGBFactors:()=>In,SetInterpolationForKey:()=>Ne.ZU,_AddInteractivityObjectModel:()=>zn,addNewInteractivityFlowGraphMapping:()=>kn,getAllSupportedNativeNodeTypes:()=>Un,getMappingForDeclaration:()=>Bn,getMappingForFullOperationName:()=>Sn,gltfTypeToBabylonType:()=>jn});var d={};a.r(d),a.d(d,{AddObjectAccessorToKey:()=>Ne.oR,AnimationPropertyInfo:()=>Ve.AnimationPropertyInfo,ArrayItem:()=>Be,EXT_lights_area:()=>at,EXT_lights_ies:()=>$e,EXT_lights_image_based:()=>je,EXT_mesh_gpu_instancing:()=>We,EXT_meshopt_compression:()=>ze,EXT_texture_avif:()=>Qe,EXT_texture_webp:()=>qe,ExtrasAsMetadata:()=>rr,FlowGraphGLTFDataProvider:()=>or.FlowGraphGLTFDataProvider,GLTFFileLoader:()=>te,GLTFLoader:()=>Ge,GetMappingForKey:()=>Ne.tQ,GetPathToObjectConverter:()=>Ne.Wt,InteractivityGraphToFlowGraphParser:()=>Kn,KHR_animation_pointer:()=>Cn,KHR_draco_mesh_compression:()=>tt,KHR_interactivity:()=>Yn,KHR_lights:()=>rt,KHR_materials_anisotropy:()=>gt,KHR_materials_clearcoat:()=>ft,KHR_materials_coat:()=>dt,KHR_materials_diffuse_roughness:()=>Dt,KHR_materials_diffuse_transmission:()=>It,KHR_materials_dispersion:()=>Gt,KHR_materials_emissive_strength:()=>bt,KHR_materials_fuzz:()=>At,KHR_materials_ior:()=>Et,KHR_materials_iridescence:()=>mt,KHR_materials_pbrSpecularGlossiness:()=>st,KHR_materials_sheen:()=>Tt,KHR_materials_specular:()=>Ot,KHR_materials_transmission:()=>Lt,KHR_materials_unlit:()=>ut,KHR_materials_variants:()=>Ft,KHR_materials_volume:()=>Bt,KHR_mesh_quantization:()=>Ut,KHR_node_hoverability:()=>tr,KHR_node_selectability:()=>Qn,KHR_node_visibility:()=>qn,KHR_texture_basisu:()=>Kt,KHR_texture_transform:()=>Yt,KHR_xmp_json_ld:()=>Zt,LoadBoundingInfoFromPositionAccessor:()=>ke,MSFT_audio_emitter:()=>Mn,MSFT_lod:()=>Rn,MSFT_minecraftMesh:()=>Ln,MSFT_sRGBFactors:()=>In,OpenPBRMaterialLoadingAdapter:()=>De.OpenPBRMaterialLoadingAdapter,PBRMaterialLoadingAdapter:()=>He.PBRMaterialLoadingAdapter,SetInterpolationForKey:()=>Ne.ZU,TransformNodeAnimationPropertyInfo:()=>Ve.TransformNodeAnimationPropertyInfo,WeightAnimationPropertyInfo:()=>Ve.WeightAnimationPropertyInfo,_AddInteractivityObjectModel:()=>zn,addNewInteractivityFlowGraphMapping:()=>kn,getAllSupportedNativeNodeTypes:()=>Un,getMappingForDeclaration:()=>Bn,getMappingForFullOperationName:()=>Sn,getQuaternion:()=>Ve.getQuaternion,getVector3:()=>Ve.getVector3,getWeights:()=>Ve.getWeights,gltfTypeToBabylonType:()=>jn,registerGLTFExtension:()=>Pe,registeredGLTFExtensions:()=>Re,unregisterGLTFExtension:()=>Le});var p={};a.r(p),a.d(p,{MTLFileLoader:()=>ar,OBJFileLoader:()=>sr,SolidParser:()=>ir});var m={};a.r(m),a.d(m,{STLFileLoader:()=>ur});var _={};a.r(_),a.d(_,{BVHFileLoader:()=>I,GLTF1:()=>c,GLTF2:()=>d,GLTFFileLoader:()=>te,GLTFLoaderAnimationStartMode:()=>G,GLTFLoaderCoordinateSystemMode:()=>k,GLTFLoaderDefaultOptions:()=>ee,GLTFLoaderState:()=>V,GLTFValidation:()=>D,MTLFileLoader:()=>ar,OBJFileLoader:()=>sr,ReadBvh:()=>P,SPLATFileLoader:()=>_r,STLFileLoader:()=>ur,SolidParser:()=>ir});var g=a(597),y="Xposition",b="Yposition",v="Zposition",T="Xrotation",x="Yrotation",A="Zrotation",w="HIERARCHY",O="MOTION",C=function(e){this.loopMode=g.Animation.ANIMATIONLOOPMODE_CYCLE,this.list=[],this.root=E(),this.numFrames=0,this.frameRate=0,this.skeleton=e};function E(){return{name:"",type:"",offset:new g.Vector3,channels:[],children:[],frames:[],parent:null}}function M(e,t,n){for(var r=function(e){var t=e.offset.x,n=e.offset.y,r=e.offset.z;return g.Matrix.Translation(t,n,r)}(e),o=new g.Bone(e.name,n.skeleton,t,r),a=function(e,t){if(0===e.frames.length)return[];for(var n=[],r=e.channels.some((function(e){return e===y||e===b||e===v})),o=e.channels.some((function(e){return e===T||e===x||e===A})),a=new g.Animation("".concat(e.name,"_pos"),"position",t.frameRate,g.Animation.ANIMATIONTYPE_VECTOR3,t.loopMode),i=new g.Animation("".concat(e.name,"_rot"),"rotationQuaternion",t.frameRate,g.Animation.ANIMATIONTYPE_QUATERNION,t.loopMode),s=[],l=[],u=0;u<e.frames.length;u++){var c=e.frames[u];r&&c.position&&s.push({frame:c.frame,value:c.position.clone()}),o&&l.push({frame:c.frame,value:c.rotation.clone()})}return s.length>0&&(a.setKeys(s),n.push(a)),l.length>0&&(i.setKeys(l),n.push(i)),n}(e,n),i=0,s=a;i<s.length;i++){var l=s[i];l.getKeys()&&l.getKeys().length>0&&o.animations.push(l)}for(var u=0,c=e.children;u<c.length;u++)M(c[u],o,n)}function F(e,t,n,r){if("ENDSITE"!==n.type){var o={frame:0,position:new g.Vector3,rotation:new g.Quaternion};o.frame=t,o.position=new g.Vector3,o.rotation=new g.Quaternion,n.frames.push(o);for(var a=g.Matrix.Identity(),i=0;i<n.channels.length;++i){var s=n.channels[i],l=e[r.i++];if(l){var u=parseFloat(l.trim());if(s.endsWith("position"))switch(s){case y:o.position.x=u;break;case b:o.position.y=u;break;case v:o.position.z=u}else if(s.endsWith("rotation")){var c=g.Tools.ToRadians(u),f=void 0;switch(s){case T:f=g.Matrix.RotationX(c);break;case x:f=g.Matrix.RotationY(c);break;case A:f=g.Matrix.RotationZ(c)}a=f.multiply(a)}}}g.Quaternion.FromRotationMatrixToRef(a,o.rotation);for(var h=0,d=n.children;h<d.length;h++)F(e,t,d[h],r)}}function R(e,t,n,r){var o,a,i,s,l=E();l.parent=n,r.list.push(l);var u=t.trim().split(/\s+/);if("END"===u[0].toUpperCase()&&"SITE"===u[1].toUpperCase()?(l.type="ENDSITE",l.name="ENDSITE"):(l.name=u[1],l.type=u[0].toUpperCase()),"{"!=(null===(o=e.shift())||void 0===o?void 0:o.trim()))throw new Error("Expected opening { after type & name");var c=null===(a=e.shift())||void 0===a?void 0:a.trim().split(/\s+/);if(!c)throw new Error("Unexpected end of file: missing OFFSET");if("OFFSET"!=(u=c)[0].toUpperCase())throw new Error("Expected OFFSET, but got: "+u[0]);if(4!=u.length)throw new Error("OFFSET: Invalid number of values");var f=new g.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));if(isNaN(f.x)||isNaN(f.y)||isNaN(f.z))throw new Error("OFFSET: Invalid values");if(l.offset=f,"ENDSITE"!=l.type){if(!(u=null===(i=e.shift())||void 0===i?void 0:i.trim().split(/\s+/)))throw new Error("Unexpected end of file: missing CHANNELS");if("CHANNELS"!=u[0].toUpperCase())throw new Error("Expected CHANNELS definition");var h=parseInt(u[1]);l.channels=u.splice(2,h),l.children=[]}for(;e.length>0;){var d=null===(s=e.shift())||void 0===s?void 0:s.trim();if("}"===d)return l;d&&l.children.push(R(e,d,l,r))}throw new Error("Unexpected end of file: missing closing brace")}function P(e,t,n,r){var o=e.split("\n"),a=r.loopMode;t._blockEntityCollection=!!n;var i=new g.Skeleton("","",t);i._parentContainer=n,t._blockEntityCollection=!1;var s=new C(i);s.loopMode=a;var l=o.shift();if(!l||l.trim().toUpperCase()!==w)throw new Error("HIERARCHY expected");var u=o.shift();if(!u)throw new Error("Unexpected end of file after HIERARCHY");var c=R(o,u.trim(),null,s),f=o.shift();if(!f||f.trim().toUpperCase()!==O)throw new Error("MOTION expected");var h=o.shift();if(!h)throw new Error("Unexpected end of file before frame count");var d=h.trim().split(/[\s]+/);if(d.length<2)throw new Error("Invalid frame count line");var p=parseInt(d[1]);if(isNaN(p))throw new Error("Failed to read number of frames.");s.numFrames=p;var m=o.shift();if(!m)throw new Error("Unexpected end of file before frame time");var _=m.trim().split(/[\s]+/);if(_.length<3)throw new Error("Invalid frame time line");var y=parseFloat(_[2]);if(isNaN(y))throw new Error("Failed to read frame time.");if(y<=0)throw new Error("Failed to read frame time. Invalid value "+y);s.frameRate=1/y;for(var b=0;b<p;++b){var v=o.shift();v&&F(v.trim().split(/[\s]+/)||[],b,c,{i:0})}return s.root=c,M(s.root,null,s),s.skeleton.returnToRest(),s.skeleton}var L=a(322),N={".bvh":{isBinary:!1}},I=function(){function e(t){this.name="bvh",this.extensions=N,this._loadingOptions=(0,L.Cl)((0,L.Cl)({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{loopMode:g.Animation.ANIMATIONLOOPMODE_CYCLE}},enumerable:!1,configurable:!0}),e.prototype.createPlugin=function(t){return new e(t.bvh)},e.prototype.canDirectLoad=function(e){return this.isBvhHeader(e)},e.prototype.isBvhHeader=function(e){return"HIERARCHY"==e.split("\n")[0]},e.prototype.isNotBvhHeader=function(e){return!this.isBvhHeader(e)},e.prototype.importMeshAsync=function(e,t,n){if("string"!=typeof n)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(n))return Promise.reject("BVH loader expects HIERARCHY header.");try{var r=P(n,t,null,this._loadingOptions);return Promise.resolve({meshes:[],particleSystems:[],skeletons:[r],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]})}catch(e){return Promise.reject(e)}},e.prototype.loadAsync=function(e,t){return"string"!=typeof t?Promise.reject("BVH loader expects string data."):this.isNotBvhHeader(t)?Promise.reject("BVH loader expects HIERARCHY header."):this.importMeshAsync(null,e,t).then((function(){}))},e.prototype.loadAssetContainerAsync=function(e,t){if("string"!=typeof t)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(t))return Promise.reject("BVH loader expects HIERARCHY header.");var n=new g.AssetContainer(e);try{var r=P(t,e,n,this._loadingOptions);return n.skeletons.push(r),Promise.resolve(n)}catch(e){return Promise.reject(e)}},e}();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 B(){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)}}}(0,g.RegisterSceneLoaderPlugin)(new I);var k,G,V,D=function(){function e(){}return e.ValidateAsync=function(e,t,n,r){var o=this;return"function"==typeof Worker?new Promise((function(a,i){var s="".concat(S,"(").concat(B,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),u=new Worker(l),c=function(e){u.removeEventListener("error",c),u.removeEventListener("message",f),i(e)},f=function(e){var t=e.data;switch(t.id){case"getExternalResource":r(t.uri).then((function(e){u.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e.buffer])}),(function(e){u.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})}));break;case"validate.resolve":u.removeEventListener("error",c),u.removeEventListener("message",f),a(t.value),u.terminate();break;case"validate.reject":u.removeEventListener("error",c),u.removeEventListener("message",f),i(t.reason),u.terminate()}};if(u.addEventListener("error",c),u.addEventListener("message",f),u.postMessage({id:"init",url:g.Tools.GetBabylonScriptURL(o.Configuration.url)}),ArrayBuffer.isView(e)){var h=e.slice();u.postMessage({id:"validate",data:h,rootUrl:t,fileName:n},[h.buffer])}else u.postMessage({id:"validate",data:e,rootUrl:t,fileName:n})})):(this._LoadScriptPromise||(this._LoadScriptPromise=g.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return S(e,t,n,r)})))},e.Configuration={url:"".concat(g.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),H="Z2xURg",U="gltf",j={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};function K(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(k||(k={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(G||(G={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(V||(V={}));var W,Y,z,Z,q,X,Q,J,$=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=G.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=k.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},ee=new $,te=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new g.Observable,n.onMeshLoadedObservable=new g.Observable,n.onSkinLoadedObservable=new g.Observable,n.onTextureLoadedObservable=new g.Observable,n.onMaterialLoadedObservable=new g.Observable,n.onCameraLoadedObservable=new g.Observable,n.onCompleteObservable=new g.Observable,n.onErrorObservable=new g.Observable,n.onDisposeObservable=new g.Observable,n.onExtensionLoadedObservable=new g.Observable,n.onValidatedObservable=new g.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=U,n.extensions=j,n.onLoaderStateChangedObservable=new g.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(Object.assign((0,L.Cl)({},ee),t)),n}return(0,L.C6)(t,e),Object.defineProperty(t.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(t.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(t.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(t.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(t.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(t.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(t.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loggingEnabled",{get:function(){return this._loggingEnabled},set:function(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"capturePerformanceCounters",{get:function(){return this._capturePerformanceCounters},set:function(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},t.prototype.loadFile=function(e,t,n,r,o,a,i,s){var l=this;if(ArrayBuffer.isView(t))return this._loadBinary(e,t,n,r,i,s),null;this._progressCallback=o;var u=t.name||g.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&g.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new g.Observable},f={readAsync:function(n,r){return new Promise((function(o,a){l._loadFile(e,t,(function(e){o(new Uint8Array(e))}),!0,(function(e){a(e)}),(function(e){e.setRequestHeader("Range","bytes=".concat(n,"-").concat(n+r-1))}))}))},byteLength:0};return this._unpackBinaryAsync(new g.DataReader(f)).then((function(e){c.onCompleteObservable.notifyObservers(c),r(e)}),i?function(e){return i(void 0,e)}:void 0),c}return this._loadFile(e,t,(function(t){l._validate(e,new Uint8Array(t,0,t.byteLength),n,u),l._unpackBinaryAsync(new g.DataReader({readAsync:function(e,n){return K(t,e,n)},byteLength:t.byteLength})).then((function(e){r(e)}),i?function(e){return i(void 0,e)}:void 0)}),!0,i)}return this._loadFile(e,t,(function(t){try{l._validate(e,t,n,u),r({json:l._parseJson(t)})}catch(e){i&&i()}}),!1,i)},t.prototype._loadBinary=function(e,t,n,r,o,a){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n,a),this._unpackBinaryAsync(new g.DataReader({readAsync:function(e,n){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)}}(t,e,n)},byteLength:t.byteLength})).then((function(e){r(e)}),o?function(e){return o(void 0,e)}:void 0)},t.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)}))},t.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)}))},t.prototype.loadAssetContainerAsync=function(e,t,n,r,o){var a=this;return Promise.resolve().then((function(){a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t);var i=new g.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var u=[];a.onCameraLoadedObservable.add((function(e){u.push(e)}));var c=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&c.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,n,r,o).then((function(e){return Array.prototype.push.apply(i.geometries,e.geometries),Array.prototype.push.apply(i.meshes,e.meshes),Array.prototype.push.apply(i.particleSystems,e.particleSystems),Array.prototype.push.apply(i.skeletons,e.skeletons),Array.prototype.push.apply(i.animationGroups,e.animationGroups),Array.prototype.push.apply(i.materials,s),Array.prototype.push.apply(i.textures,l),Array.prototype.push.apply(i.lights,e.lights),Array.prototype.push.apply(i.transformNodes,e.transformNodes),Array.prototype.push.apply(i.cameras,u),Array.prototype.push.apply(i.morphTargetManagers,c),i}))}))},t.prototype.canDirectLoad=function(e){return function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+H)||e.startsWith("data:;base64,"+H)||e.startsWith("data:application/octet-stream;base64,"+H)||e.startsWith("data:model/gltf-binary;base64,"+H)}(e)},t.prototype.directLoad=function(e,t){if(t.startsWith("base64,"+H)||t.startsWith(";base64,"+H)||t.startsWith("application/octet-stream;base64,"+H)||t.startsWith("model/gltf-binary;base64,"+H)){var n=(0,g.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new g.DataReader({readAsync:function(e,t){return K(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})},t.prototype.createPlugin=function(e){return new t(e[U])},Object.defineProperty(t.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,n){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){n(e)}))}))},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(V[this._state]))},t.prototype._loadFile=function(e,t,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},t.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})}},t.prototype._validate=function(e,t,n,r){var o=this;void 0===n&&(n=""),void 0===r&&(r=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),D.ValidateAsync(t,n,r,(function(t){return o.preprocessUrlAsync(n+t).then((function(t){return e._loadFileAsync(t,void 0,!0,!0).then((function(e){return new Uint8Array(e,0,e.byteLength)}))}))})).then((function(e){o._endPerformanceCounter("Validate JSON"),o.onValidatedObservable.notifyObservers(e),o.onValidatedObservable.clear()}),(function(e){o._endPerformanceCounter("Validate JSON"),g.Tools.Warn("Failed to validate: ".concat(e.message)),o.onValidatedObservable.clear()})))},t.prototype._getLoader=function(e){var n=e.json.asset||{};this._log("Asset version: ".concat(n.version)),n.minVersion&&this._log("Asset minimum version: ".concat(n.minVersion)),n.generator&&this._log("Asset generator: ".concat(n.generator));var r=t._parseVersion(n.version);if(!r)throw new Error("Invalid version: "+n.version);if(void 0!==n.minVersion){var o=t._parseVersion(n.minVersion);if(!o)throw new Error("Invalid minimum version: "+n.minVersion);if(t._compareVersion(o,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+n.minVersion)}var a={1:t._CreateGLTF1Loader,2:t._CreateGLTF2Loader}[r.major];if(!a)throw new Error("Unsupported version: "+n.version);return a(this)},t.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: ".concat(e.length));var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},t.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var n=e.readUint32();if(1179937895!==n)throw new g.RuntimeError("Unexpected magic: "+n,g.ErrorCodes.GLTFLoaderUnexpectedMagicError);var r=e.readUint32();t.loggingEnabled&&t._log("Binary version: ".concat(r));var o,a=e.readUint32();switch(t.useRangeRequests||a===e.buffer.byteLength||g.Logger.Warn("Length in header does not match actual data length: ".concat(a," != ").concat(e.buffer.byteLength)),r){case 1:o=t._unpackBinaryV1Async(e,a);break;case 2:o=t._unpackBinaryV2Async(e,a);break;default:throw new Error("Unsupported version: "+r)}return t._endPerformanceCounter("Unpack Binary"),o}))},t.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)},t.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()}))},t._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},t._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},t.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},t.prototype._logClose=function(){--this._logIndentLevel},t.prototype._logEnabled=function(e){var n=t._logSpaces.substring(0,2*this._logIndentLevel);g.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){g.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){g.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(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(0,L.C6)(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,w,O,C;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!==(w=e.useSRGBBuffers)&&void 0!==w?w:this.useSRGBBuffers,this.validate=null!==(O=e.validate)&&void 0!==O?O:this.validate,this.dontUseTransmissionHelper=null!==(C=e.dontUseTransmissionHelper)&&void 0!==C?C:this.dontUseTransmissionHelper)},t}($));(0,g.RegisterSceneLoaderPlugin)(new te),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"}(W||(W={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(Y||(Y={})),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"}(z||(z={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(Z||(Z={})),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"}(q||(q={})),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"}(X||(X={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(Q||(Q={})),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"}(J||(J={}));var ne,re=function(){function e(){}return e.SetMatrix=function(e,t,n,r,o){var a=null;if("MODEL"===n.semantic?a=t.getWorldMatrix():"PROJECTION"===n.semantic?a=e.getProjectionMatrix():"VIEW"===n.semantic?a=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===n.semantic?a=g.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===n.semantic?a=t.getWorldMatrix().invert():"VIEWINVERSE"===n.semantic?a=e.getViewMatrix().invert():"PROJECTIONINVERSE"===n.semantic?a=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===n.semantic&&(a=g.Matrix.Transpose(t.getWorldMatrix().invert())),a)switch(n.type){case z.FLOAT_MAT2:o.setMatrix2x2(r,g.Matrix.GetAsMatrix2x2(a));break;case z.FLOAT_MAT3:o.setMatrix3x3(r,g.Matrix.GetAsMatrix3x3(a));break;case z.FLOAT_MAT4:o.setMatrix(r,a)}},e.SetUniform=function(e,t,n,r){switch(r){case z.FLOAT:return e.setFloat(t,n),!0;case z.FLOAT_VEC2:return e.setVector2(t,g.Vector2.FromArray(n)),!0;case z.FLOAT_VEC3:return e.setVector3(t,g.Vector3.FromArray(n)),!0;case z.FLOAT_VEC4:return e.setVector4(t,g.Vector4.FromArray(n)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case Z.CLAMP_TO_EDGE:return g.Texture.CLAMP_ADDRESSMODE;case Z.MIRRORED_REPEAT:return g.Texture.MIRROR_ADDRESSMODE;case Z.REPEAT:default:return g.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 q.LINEAR:case q.LINEAR_MIPMAP_NEAREST:case q.LINEAR_MIPMAP_LINEAR:return g.Texture.TRILINEAR_SAMPLINGMODE;case q.NEAREST:case q.NEAREST_MIPMAP_NEAREST:return g.Texture.NEAREST_SAMPLINGMODE;default:return g.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 W.BYTE:return new Int8Array(i,n,r);case W.UNSIGNED_BYTE:return new Uint8Array(i,n,r);case W.SHORT:return new Int16Array(i,n,r);case W.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(t){if(!e._DefaultMaterial){g.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"),g.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var n={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new g.ShaderMaterial("GLTFDefaultMaterial",t,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},n),e._DefaultMaterial.setColor4("u_emission",new g.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"}(ne||(ne={}));var oe=function(){function e(e){this._pos=0,this.currentToken=ne.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 ne.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=ne.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=ne.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}(),ae=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],ie=["world","view","projection","worldView","worldViewProjection","mBones"],se=["translation","rotation","scale"],le=["position","rotationQuaternion","scaling"],ue=function(e,t,n){for(var r in e){var o=e[r];n[t][r]=o}},ce=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},fe=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},he=function(e){var t=null;if(e.translation||e.rotation||e.scale){var n=g.Vector3.FromArray(e.scale||[1,1,1]),r=g.Quaternion.FromArray(e.rotation||[0,0,0,1]),o=g.Vector3.FromArray(e.translation||[0,0,0]);t=g.Matrix.Compose(n,r,o)}else t=g.Matrix.FromArray(e.matrix);return t},de=function(e,t,n,r){for(var o=0;o<r.bones.length;o++)if(r.bones[o].name===n)return r.bones[o];var a=e.nodes;for(var i in a){var s=a[i];if(s.jointName){var l=s.children;for(o=0;o<l.length;o++){var u=e.nodes[l[o]];if(u.jointName&&u.jointName===n){var c=he(s),f=new g.Bone(s.name||"",r,de(e,t,s.jointName,r),c);return f.id=i,f}}}}return null},pe=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},me=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},_e=function(e,t){for(var n=0;n<e.jointNames.length;n++)if(e.jointNames[n]===t)return!0;return!1},ge=function(e,t,n,r,o){if(o||(e.scene._blockEntityCollection=!!e.assetContainer,(o=new g.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,o.id=r),!t.babylonNode)return o;for(var a,i=[],s=null,l=[],u=[],c=[],f=[],h=0;h<n.length;h++){var d=n[h];if(F=e.meshes[d])for(var p=0;p<F.primitives.length;p++){var m=new g.VertexData,_=F.primitives[p];_.mode;var y=_.attributes,b=null,v=null;for(var T in y)if(b=e.accessors[y[T]],v=re.GetBufferFromAccessor(e,b),"NORMAL"===T)m.normals=new Float32Array(v.length),m.normals.set(v);else if("POSITION"===T){if(te.HomogeneousCoordinates){m.positions=new Float32Array(v.length-v.length/4);for(var x=0;x<v.length;x+=4)m.positions[x]=v[x],m.positions[x+1]=v[x+1],m.positions[x+2]=v[x+2]}else m.positions=new Float32Array(v.length),m.positions.set(v);u.push(m.positions.length)}else if(-1!==T.indexOf("TEXCOORD_")){var A=Number(T.split("_")[1]),w=g.VertexBuffer.UVKind+(0===A?"":A+1),O=new Float32Array(v.length);O.set(v),ce(O),m.set(O,w)}else"JOINT"===T?(m.matricesIndices=new Float32Array(v.length),m.matricesIndices.set(v)):"WEIGHT"===T?(m.matricesWeights=new Float32Array(v.length),m.matricesWeights.set(v)):"COLOR"===T&&(m.colors=new Float32Array(v.length),m.colors.set(v));if(b=e.accessors[_.indices])v=re.GetBufferFromAccessor(e,b),m.indices=new Int32Array(v.length),m.indices.set(v),f.push(m.indices.length);else{var C=[];for(x=0;x<m.positions.length/3;x++)C.push(x);m.indices=new Int32Array(C),f.push(m.indices.length)}s?s.merge(m):s=m;var E=e.scene.getMaterialById(_.material);i.push(null===E?re.GetDefaultMaterial(e.scene):E),l.push(0===l.length?0:l[l.length-1]+u[u.length-2]),c.push(0===c.length?0:c[c.length-1]+f[f.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,i.length>1?(a=new g.MultiMaterial("multimat"+r,e.scene)).subMaterials=i:a=new g.StandardMaterial("multimat"+r,e.scene),1===i.length&&(a=i[0]),a._parentContainer=e.assetContainer,o.material||(o.material=a),new g.Geometry(r,e.scene,s,!1,o),o.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,o.subMeshes=[];var M=0;for(h=0;h<n.length;h++){var F;if(d=n[h],F=e.meshes[d])for(p=0;p<F.primitives.length;p++)F.primitives[p].mode,g.SubMesh.AddToMesh(M,l[M],u[M],c[M],f[M],o,o,!0),M++}return o},ye=function(e,t,n,r){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=n),e.scaling&&(e.scaling=r)},be=function(e,t,n){var r=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(a=ge(e,t,t.meshes,n,t.babylonNode)).skeleton=e.scene.getLastSkeletonById(t.skin),null===a.skeleton&&(a.skeleton=function(e,t,n,r){if(r||(r=new g.Skeleton(t.name||"","",e.scene)),!t.babylonSkeleton)return r;var o=[],a=[];!function(e,t,n,r){for(var o in e.nodes){var a=e.nodes[o],i=o;if(a.jointName&&!_e(n,a.jointName)){var s=he(a),l=new g.Bone(a.name||"",t,null,s);l.id=i,r.push({bone:l,node:a,id:i})}}for(var u=0;u<r.length;u++)for(var c=r[u],f=c.node.children,h=0;h<f.length;h++){for(var d=null,p=0;p<r.length;p++)if(r[p].id===f[h]){d=r[p];break}d&&(d.bone._parent=c.bone,c.bone.children.push(d.bone))}}(e,r,t,o),r.bones=[];for(var i=0;i<t.jointNames.length;i++)if(v=me(e,t.jointNames[i])){var s=v.node;if(s){var l=v.id,u=e.scene.getBoneById(l);if(u)r.bones.push(u);else{for(var c=!1,f=null,h=0;h<i;h++){var d=me(e,t.jointNames[h]);if(d){var p=d.node;if(p){var m=p.children;if(m){c=!1;for(var _=0;_<m.length;_++)if(m[_]===l){f=de(e,t,t.jointNames[h],r),c=!0;break}if(c)break}}else g.Tools.Warn("Joint named "+t.jointNames[h]+" does not exist when looking for parent")}}var y=he(s);!f&&o.length>0&&(f=pe(o,l))&&-1===a.indexOf(f)&&a.push(f),new g.Bone(s.jointName||"",r,f,y).id=l}}else g.Tools.Warn("Joint named "+t.jointNames[i]+" does not exist")}var b=r.bones;for(r.bones=[],i=0;i<t.jointNames.length;i++){var v;if(v=me(e,t.jointNames[i]))for(h=0;h<b.length;h++)if(b[h].id===v.id){r.bones.push(b[h]);break}}for(r.prepare(),i=0;i<a.length;i++)r.bones.push(a[i]);return r}(e,o,0,o.babylonSkeleton),o.babylonSkeleton||(o.babylonSkeleton=a.skeleton)),r=a}}else if(t.meshes){var a;r=a=ge(e,t,t.mesh?[t.mesh]:t.meshes,n,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var i=e.cameras[t.camera];if(i){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===i.type){var s=new g.FreeCamera(t.camera,g.Vector3.Zero(),e.scene,!1);s.name=t.name||"",s.mode=g.Camera.ORTHOGRAPHIC_CAMERA,s.attachControl(),r=s,s._parentContainer=e.assetContainer}else if("perspective"===i.type){var l=i[i.type],u=new g.FreeCamera(t.camera,g.Vector3.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),l.aspectRatio||(l.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),l.znear&&l.zfar&&(u.maxZ=l.zfar,u.minZ=l.znear),r=u,u._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var c=e.lights[t.light];if(c)if("ambient"===c.type){var f=c[c.type],h=new g.HemisphericLight(t.light,g.Vector3.Zero(),e.scene);h.name=t.name||"",f.color&&(h.diffuse=g.Color3.FromArray(f.color)),r=h}else if("directional"===c.type){var d=c[c.type],p=new g.DirectionalLight(t.light,g.Vector3.Zero(),e.scene);p.name=t.name||"",d.color&&(p.diffuse=g.Color3.FromArray(d.color)),r=p}else if("point"===c.type){var m=c[c.type],_=new g.PointLight(t.light,g.Vector3.Zero(),e.scene);_.name=t.name||"",m.color&&(_.diffuse=g.Color3.FromArray(m.color)),r=_}else if("spot"===c.type){var y=c[c.type],b=new g.SpotLight(t.light,g.Vector3.Zero(),g.Vector3.Zero(),0,0,e.scene);b.name=t.name||"",y.color&&(b.diffuse=g.Color3.FromArray(y.color)),y.fallOfAngle&&(b.angle=y.fallOfAngle),y.fallOffExponent&&(b.exponent=y.fallOffExponent),r=b}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===r){e.scene._blockEntityCollection=!!e.assetContainer;var v=new g.Mesh(t.name||"",e.scene);v._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,t.babylonNode=v,r=v}}if(null!==r){if(t.matrix&&r instanceof g.Mesh)!function(e,t){if(t.matrix){var n=new g.Vector3(0,0,0),r=new g.Quaternion,o=new g.Vector3(0,0,0);g.Matrix.FromArray(t.matrix).decompose(o,r,n),ye(e,n,r,o)}else t.translation&&t.rotation&&t.scale&&ye(e,g.Vector3.FromArray(t.translation),g.Quaternion.FromArray(t.rotation),g.Vector3.FromArray(t.scale));e.computeWorldMatrix(!0)}(r,t);else{var T=t.translation||[0,0,0],x=t.rotation||[0,0,0,1],A=t.scale||[1,1,1];ye(r,g.Vector3.FromArray(T),g.Quaternion.FromArray(x),g.Vector3.FromArray(A))}r.updateCache(!0),t.babylonNode=r}return r},ve=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=be(e,o,t))&&(a.id=t,a.parent=n),o.children)for(var i=0;i<o.children.length;i++)ve(e,o.children[i],a,r)},Te=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null);for(function(e){for(var t in e.animations){var n=e.animations[t];if(n.channels&&n.samplers)for(var r=null,o=0;o<n.channels.length;o++){var a=n.channels[o],i=n.samplers[a.sampler];if(i){var s=null,l=null;n.parameters?(s=n.parameters[i.input],l=n.parameters[i.output]):(s=i.input,l=i.output);var u=re.GetBufferFromAccessor(e,e.accessors[s]),c=re.GetBufferFromAccessor(e,e.accessors[l]),f=a.target.id,h=e.scene.getNodeById(f);if(null===h&&(h=e.scene.getNodeByName(f)),null!==h){var d=h instanceof g.Bone,p=a.target.path,m=se.indexOf(p);-1!==m&&(p=le[m]);var _=g.Animation.ANIMATIONTYPE_MATRIX;d||("rotationQuaternion"===p?(_=g.Animation.ANIMATIONTYPE_QUATERNION,h.rotationQuaternion=new g.Quaternion):_=g.Animation.ANIMATIONTYPE_VECTOR3);var y=null,b=[],v=0,T=!1;d&&r&&r.getKeys().length===u.length&&(y=r,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,y=new g.Animation(t,d?"_matrix":p,1,_,g.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var x=0;x<u.length;x++){var A=null;if("rotationQuaternion"===p?(A=g.Quaternion.FromArray([c[v],c[v+1],c[v+2],c[v+3]]),v+=4):(A=g.Vector3.FromArray([c[v],c[v+1],c[v+2]]),v+=3),d){var w=h,O=g.Vector3.Zero(),C=new g.Quaternion,E=g.Vector3.Zero(),M=w.getBaseMatrix();T&&r&&(M=r.getKeys()[x].value),M.decompose(E,C,O),"position"===p?O=A:"rotationQuaternion"===p?C=A:E=A,A=g.Matrix.Compose(E,C,O)}T?r&&(r.getKeys()[x].value=A):b.push({frame:u[x],value:A})}!T&&y&&(y.setKeys(b),h.animations.push(y)),r=y,e.scene.stopAnimation(h),e.scene.beginAnimation(h,0,u[u.length-1],!0,1)}else g.Tools.Warn("Creating animation named "+t+". But cannot find node named "+f+" to attach to")}}}}(e),n=0;n<e.scene.skeletons.length;n++){var o=e.scene.skeletons[n];e.scene.beginAnimation(o,0,Number.MAX_VALUE,!0,1)}},xe=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=ae.indexOf(a.semantic);if(-1!==i)return delete n[r],ie[i]}}return e.currentIdentifier},Ae=function(e){for(var t in e.materials)Ce.LoadMaterialAsync(e,t,(function(){}),(function(){}))},we=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&&ue(e.extensions,"extensions",r),e.extensionsUsed&&ue(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&&ue(e.bufferViews,"bufferViews",r),e.accessors&&ue(e.accessors,"accessors",r),e.meshes&&ue(e.meshes,"meshes",r),e.lights&&ue(e.lights,"lights",r),e.cameras&&ue(e.cameras,"cameras",r),e.nodes&&ue(e.nodes,"nodes",r),e.images&&ue(e.images,"images",r),e.textures&&ue(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&&ue(e.programs,"programs",r),e.samplers&&ue(e.samplers,"samplers",r),e.techniques&&ue(e.techniques,"techniques",r),e.materials&&ue(e.materials,"materials",r),e.animations&&ue(e.animations,"animations",r),e.skins&&ue(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,t,n,r,o){var a=e.buffers[t];g.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(g.Tools.DecodeBase64(a.uri)))})):g.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),o,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))},e.LoadTextureBufferAsync=function(e,t,n,r){var o=e.textures[t];if(o&&o.source)if(o.babylonTexture)n(null);else{var a=e.images[o.source];g.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(g.Tools.DecodeBase64(a.uri)))})):g.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))}else r("")},e.CreateTextureAsync=function(e,t,n,r){var o=e.textures[t];if(o.babylonTexture)r(o.babylonTexture);else{var a=e.samplers[o.sampler],i=a.minFilter===q.NEAREST_MIPMAP_NEAREST||a.minFilter===q.NEAREST_MIPMAP_LINEAR||a.minFilter===q.LINEAR_MIPMAP_NEAREST||a.minFilter===q.LINEAR_MIPMAP_LINEAR,s=g.Texture.BILINEAR_SAMPLINGMODE,l=null==n?new Blob:new Blob([n]),u=URL.createObjectURL(l),c=function(){return URL.revokeObjectURL(u)},f=new g.Texture(u,e.scene,!i,!0,s,c,c);void 0!==a.wrapS&&(f.wrapU=re.GetWrapMode(a.wrapS)),void 0!==a.wrapT&&(f.wrapV=re.GetWrapMode(a.wrapT)),f.name=t,o.babylonTexture=f,r(f)}},e.LoadShaderStringAsync=function(e,t,n,r){var o=e.shaders[t];if(g.Tools.IsBase64(o.uri)){var a=atob(o.uri.split(",")[1]);n&&n(a)}else g.Tools.LoadFile(e.rootUrl+o.uri,n,void 0,void 0,!1,(function(e){e&&r&&r(e.status+" "+e.statusText)}))},e.LoadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(o.technique){var a=e.techniques[o.technique];if(!a){e.scene._blockEntityCollection=!!e.assetContainer;var i=new g.StandardMaterial(t,e.scene);return i._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,i.diffuseColor=new g.Color3(.5,.5,.5),i.sideOrientation=g.Material.CounterClockWiseSideOrientation,void n(i)}var s=e.programs[a.program],l=a.states,u=g.Effect.ShadersStore[s.vertexShader+"VertexShader"],c=g.Effect.ShadersStore[s.fragmentShader+"PixelShader"],f="",h="",d=new oe(u),p=new oe(c),m={},_=[],y=[],b=[];for(var v in a.uniforms){var T=a.uniforms[v],x=a.parameters[T];if(m[v]=x,!x.semantic||x.node||x.source)x.type===z.SAMPLER_2D?b.push(v):_.push(v);else{var A=ae.indexOf(x.semantic);-1!==A?(_.push(ie[A]),delete m[v]):_.push(v)}}for(var w in a.attributes){var O=a.attributes[w];if((M=a.parameters[O]).semantic){var C=fe(M);C&&y.push(C)}}for(;!d.isEnd()&&d.getNextToken();)if(d.currentToken===ne.IDENTIFIER){var E=!1;for(var w in a.attributes){O=a.attributes[w];var M=a.parameters[O];if(d.currentIdentifier===w&&M.semantic){f+=fe(M),E=!0;break}}E||(f+=xe(d,a,m))}else f+=d.currentString;for(;!p.isEnd()&&p.getNextToken();)p.currentToken===ne.IDENTIFIER?h+=xe(p,a,m):h+=p.currentString;var F={vertex:s.vertexShader+t,fragment:s.fragmentShader+t},R={attributes:y,uniforms:_,samplers:b,needAlphaBlending:l&&l.enable&&-1!==l.enable.indexOf(3042)};g.Effect.ShadersStore[s.vertexShader+t+"VertexShader"]=f,g.Effect.ShadersStore[s.fragmentShader+t+"PixelShader"]=h;var P=new g.ShaderMaterial(t,e.scene,F,R);if(P.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")}}(s,P,r),P.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===z.SAMPLER_2D?Ce.LoadTextureAsync(e,r.values?u:s.value,c(n),(function(){return c(null)})):s.value&&re.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===z.FLOAT_MAT2||c===z.FLOAT_MAT3||c===z.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;re.SetMatrix(t.scene,f,u,l,r.getEffect())}}else re.SetMatrix(t.scene,e,u,l,r.getEffect());else{var h=s[o.uniforms[l]];if(!h)continue;if(c===z.SAMPLER_2D){var d=t.textures[a.values?h:u.value].babylonTexture;if(null==d)continue;r.getEffect().setTexture(l,d)}else re.SetUniform(r.getEffect(),l,h,c)}}i(r)}(i,e,o,t,n,r,a)}}}(e,P,a,o,m,n),P.sideOrientation=g.Material.CounterClockWiseSideOrientation,l&&l.functions){var L=l.functions;L.cullFace&&L.cullFace[0]!==Q.BACK&&(P.backFaceCulling=!1);var N=L.blendFuncSeparate;N&&(N[0]===J.SRC_ALPHA&&N[1]===J.ONE_MINUS_SRC_ALPHA&&N[2]===J.ONE&&N[3]===J.ONE?P.alphaMode=g.Constants.ALPHA_COMBINE:N[0]===J.ONE&&N[1]===J.ONE&&N[2]===J.ZERO&&N[3]===J.ONE?P.alphaMode=g.Constants.ALPHA_ONEONE:N[0]===J.SRC_ALPHA&&N[1]===J.ONE&&N[2]===J.ZERO&&N[3]===J.ONE?P.alphaMode=g.Constants.ALPHA_ADD:N[0]===J.ZERO&&N[1]===J.ONE_MINUS_SRC_COLOR&&N[2]===J.ONE&&N[3]===J.ONE?P.alphaMode=g.Constants.ALPHA_SUBTRACT:N[0]===J.DST_COLOR&&N[1]===J.ZERO&&N[2]===J.ONE&&N[3]===J.ONE?P.alphaMode=g.Constants.ALPHA_MULTIPLY:N[0]===J.SRC_ALPHA&&N[1]===J.ONE_MINUS_SRC_COLOR&&N[2]===J.ONE&&N[3]===J.ONE&&(P.alphaMode=g.Constants.ALPHA_MAXIMIZED))}}else r&&r("No technique found.")},e}(),Oe=function(){function e(){}return e.RegisterExtension=function(t){e.Extensions[t.name]?g.Tools.Error('Tool with the same name "'+t.name+'" already exists'):e.Extensions[t.name]=t},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,t,n,r,o,a,i,s){var l=this;return t.useRightHandedSystem=!0,Ce.LoadRuntimeAsync(t,n,r,(function(t){t.assetContainer=o,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],g.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],l._createNodes(t);var n=[],r=[];for(var i in t.nodes){var s=t.nodes[i];s.babylonNode instanceof g.AbstractMesh&&n.push(s.babylonNode)}for(var u in t.skins){var c=t.skins[u];c.babylonSkeleton instanceof g.Skeleton&&r.push(c.babylonSkeleton)}l._loadBuffersAsync(t,(function(){l._loadShadersAsync(t,(function(){Ae(t),Te(t),!te.IncrementalLoading&&a&&a(n,r)}))})),te.IncrementalLoading&&a&&a(n,r)}),s),!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,Ce.LoadRuntimeAsync(e,t,n,(function(e){Ce.LoadRuntimeExtensionsAsync(e,(function(){i._createNodes(e),i._loadBuffersAsync(e,(function(){i._loadShadersAsync(e,(function(){Ae(e),Te(e),te.IncrementalLoading||r()}))})),te.IncrementalLoading&&r()}),a)}),a)},e.prototype.loadAsync=function(e,t,n,r){return(0,L.sH)(this,void 0,void 0,(function(){var o=this;return(0,L.YH)(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,t){var n=!1,r=function(n,r){Ce.LoadShaderStringAsync(e,n,(function(o){o instanceof ArrayBuffer||(e.loadedShaderCount++,o&&(g.Effect.ShadersStore[n+(r.type===Y.VERTEX?"VertexShader":"PixelShader")]=o),e.loadedShaderCount===e.shaderscount&&t())}),(function(){g.Tools.Error("Error when loading shader program named "+n+" located at "+r.uri)}))};for(var o in e.shaders){n=!0;var a=e.shaders[o];a?r.bind(this,o,a)():g.Tools.Error("No shader named: "+o)}n||t()},e.prototype._loadBuffersAsync=function(e,t){var n=!1,r=function(n,r){Ce.LoadBufferAsync(e,n,(function(o){e.loadedBufferCount++,o&&(o.byteLength!=e.buffers[n].byteLength&&g.Tools.Error("Buffer named "+n+" is length "+o.byteLength+". Expected: "+r.byteLength),e.loadedBufferViews[n]=o),e.loadedBufferCount===e.buffersCount&&t()}),(function(){g.Tools.Error("Error when loading buffer named "+n+" located at "+r.uri)}))};for(var o in e.buffers){n=!0;var a=e.buffers[o];a?r.bind(this,o,a)():g.Tools.Error("No buffer named: "+o)}n||t()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null)},e.Extensions={},e}(),Ce=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(we.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(){we.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(){we.LoadShaderStringAsync(t,n,r,o)}))},e.LoadMaterialAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadMaterialAsync(t,n,r,o)}),(function(){we.LoadMaterialAsync(t,n,r,o)}))},e._LoadTextureBufferAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadTextureBufferAsync(t,n,r,o)}),(function(){we.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(){we.CreateTextureAsync(t,n,r,o)}))},e._ApplyExtensions=function(e,t){for(var n in Oe.Extensions)if(e(Oe.Extensions[n]))return;t()},e}();te._CreateGLTF1Loader=function(){return new Oe};var Ee=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return(0,L.C6)(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(we.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(re.GetBufferFromBufferView(e,i,0,i.byteLength,W.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=re.GetBufferFromBufferView(e,a,0,a.byteLength,W.UNSIGNED_BYTE);return setTimeout((function(){var e=re.DecodeBufferToText(i);n(e)})),!0},t}(Ce);Oe.RegisterExtension(new Ee);var Me=function(e){function t(){return e.call(this,"KHR_materials_common")||this}return(0,L.C6)(t,e),t.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var t=e.extensions[this.name];if(!t)return!1;var n=t.lights;if(n)for(var r in n){var o=n[r];switch(o.type){case"ambient":var a=new g.HemisphericLight(o.name,new g.Vector3(0,1,0),e.scene),i=o.ambient;i&&(a.diffuse=g.Color3.FromArray(i.color||[1,1,1]));break;case"point":var s=new g.PointLight(o.name,new g.Vector3(10,10,10),e.scene),l=o.point;l&&(s.diffuse=g.Color3.FromArray(l.color||[1,1,1]));break;case"directional":var u=new g.DirectionalLight(o.name,new g.Vector3(0,-1,0),e.scene),c=o.directional;c&&(u.diffuse=g.Color3.FromArray(c.color||[1,1,1]));break;case"spot":var f=o.spot;f&&(new g.SpotLight(o.name,new g.Vector3(0,10,0),new g.Vector3(0,-1,0),f.fallOffAngle||Math.PI,f.fallOffExponent||0,e.scene).diffuse=g.Color3.FromArray(f.color||[1,1,1]));break;default:g.Tools.Warn('GLTF Material Common extension: light type "'+o.type+"” not supported")}}return!1},t.prototype.loadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(!o||!o.extensions)return!1;var a=o.extensions[this.name];if(!a)return!1;var i=new g.StandardMaterial(t,e.scene);return i.sideOrientation=g.Material.CounterClockWiseSideOrientation,"CONSTANT"===a.technique&&(i.disableLighting=!0),i.backFaceCulling=void 0!==a.doubleSided&&!a.doubleSided,i.alpha=void 0===a.values.transparency?1:a.values.transparency,i.specularPower=void 0===a.values.shininess?0:a.values.shininess,"string"==typeof a.values.ambient?this._loadTexture(e,a.values.ambient,i,"ambientTexture",r):i.ambientColor=g.Color3.FromArray(a.values.ambient||[0,0,0]),"string"==typeof a.values.diffuse?this._loadTexture(e,a.values.diffuse,i,"diffuseTexture",r):i.diffuseColor=g.Color3.FromArray(a.values.diffuse||[0,0,0]),"string"==typeof a.values.emission?this._loadTexture(e,a.values.emission,i,"emissiveTexture",r):i.emissiveColor=g.Color3.FromArray(a.values.emission||[0,0,0]),"string"==typeof a.values.specular?this._loadTexture(e,a.values.specular,i,"specularTexture",r):i.specularColor=g.Color3.FromArray(a.values.specular||[0,0,0]),!0},t.prototype._loadTexture=function(e,t,n,r,o){we.LoadTextureBufferAsync(e,t,(function(o){we.CreateTextureAsync(e,t,o,(function(e){return n[r]=e}))}),o)},t}(Ce);Oe.RegisterExtension(new Me);var Fe=new Map,Re=Fe;function Pe(e,t,n){Le(e)&&g.Logger.Warn("Extension with the name '".concat(e,"' already exists")),Fe.set(e,{isGLTFExtension:t,factory:n})}function Le(e){return Fe.delete(e)}var Ne=a(698),Ie=new g.Lazy((function(){return Promise.resolve().then(a.t.bind(a,597,23))})),Se=new g.Lazy((function(){return Promise.resolve().then(a.bind(a,727))})),Be=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 ke(e){if(e.min&&e.max){var t=e.min,n=e.max,r=g.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=g.TmpVectors.Vector3[1].copyFromFloats(n[0],n[1],n[2]);if(e.normalized&&5126!==e.componentType){var a=1;switch(e.componentType){case 5120:a=127;break;case 5121:a=255;break;case 5122:a=32767;break;case 5123:a=65535}var i=1/a;r.scaleInPlace(i),o.scaleInPlace(i)}return new g.BoundingInfo(r,o)}return null}var Ge=function(){function e(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._pbrMaterialImpl=null,this._parent=e}return e.RegisterExtension=function(e,t){Pe(e,!1,t)},e.UnregisterExtension=function(e){return Le(e)},Object.defineProperty(e.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootUrl",{get:function(){return this._rootUrl},enumerable:!1,configurable:!0}),e.prototype._getOrCreateMaterialAdapter=function(e){var t=this._materialAdapterCache.get(e);if(!t){if(!this._pbrMaterialImpl)throw new Error("Appropriate material adapter class not found");t=new this._pbrMaterialImpl.adapterClass(e),this._materialAdapterCache.set(e,t)}return t},e.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._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())},e.prototype.importMeshAsync=function(e,t,n,r,o,a){return(0,L.sH)(this,arguments,void 0,(function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),(0,L.YH)(this,(function(a){switch(a.label){case 0:return[4,Promise.resolve().then((function(){return(0,L.sH)(s,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,L.YH)(this,(function(h){switch(h.label){case 0:if(this._babylonScene=t,this._assetContainer=n,this._loadData(r),a=null,e){if(s={},this._gltf.nodes)for(l=0,u=this._gltf.nodes;l<u.length;l++)(c=u[l]).name&&(s[c.name]=c.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,i,a,(function(){return{meshes:f._getMeshes(),particleSystems:[],skeletons:f._getSkeletons(),animationGroups:f._getAnimationGroups(),lights:f._babylonLights,transformNodes:f._getTransformNodes(),geometries:f._getGeometries(),spriteManagers:[]}}))];case 1:return[2,h.sent()]}}))}))}))];case 1:return[2,a.sent()]}}))}))},e.prototype.loadAsync=function(e,t,n,r){return(0,L.sH)(this,arguments,void 0,(function(e,t,n,r,o){return void 0===o&&(o=""),(0,L.YH)(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()]}}))}))},e.prototype._loadAsync=function(e,t,n,r){return(0,L.sH)(this,void 0,void 0,(function(){var o=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return(0,L.sH)(o,void 0,void 0,(function(){var o,i,s,l,u,c,f,h,d,p,m,_,y,b,v=this;return(0,L.YH)(this,(function(T){switch(T.label){case 0:return this._rootUrl=e,this._uniqueRootUrl=!e.startsWith("file:")&&t?e:"".concat(e).concat(Date.now(),"/"),this._fileName=t,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:return T.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(o=this,y={},[4,Promise.resolve().then(a.t.bind(a,597,23))]):[3,4];case 2:return y.materialClass=T.sent().OpenPBRMaterial,[4,Promise.resolve().then(a.bind(a,833))];case 3:return o._pbrMaterialImpl=(y.adapterClass=T.sent().OpenPBRMaterialLoadingAdapter,y),[3,7];case 4:return i=this,b={},[4,Promise.resolve().then(a.t.bind(a,597,23))];case 5:return b.materialClass=T.sent().PBRMaterial,[4,Promise.resolve().then(a.bind(a,561))];case 6:i._pbrMaterialImpl=(b.adapterClass=T.sent().PBRMaterialLoadingAdapter,b),T.label=7;case 7:if(s="".concat(V[V.LOADING]," => ").concat(V[V.READY]),l="".concat(V[V.LOADING]," => ").concat(V[V.COMPLETE]),this._parent._startPerformanceCounter(s),this._parent._startPerformanceCounter(l),this._parent._setState(V.LOADING),this._extensionsOnLoading(),u=new Array,c=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(n?u.push(this.loadSceneAsync("/nodes",{nodes:n,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(f=Be.Get("/scene",this._gltf.scenes,this._gltf.scene||0),u.push(this.loadSceneAsync("/scenes/".concat(f.index),f)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(h=0;h<this._gltf.materials.length;++h)d=this._gltf.materials[h],p="/materials/"+h,m=g.Material.TriangleFillMode,u.push(this._loadMaterialAsync(p,d,null,m,(function(){})));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=c:this._babylonScene._forceBlockMaterialDirtyMechanism(c),this._parent.compileMaterials&&u.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&u.push(this._compileShadowGeneratorsAsync()),_=Promise.all(u).then((function(){v._rootBabylonMesh&&v._rootBabylonMesh!==v._parent.customRootNode&&v._rootBabylonMesh.setEnabled(!0);for(var e=0,t=v._babylonScene.materials;e<t.length;e++){var n=t[e];void 0!==n.maxSimultaneousLights&&(n.maxSimultaneousLights=Math.max(n.maxSimultaneousLights,v._babylonScene.lights.length))}return v._extensionsOnReady(),v._parent._setState(V.READY),v._skipStartAnimationStep||v._startAnimations(),r()})),[4,_.then((function(e){return v._parent._endPerformanceCounter(s),g.Tools.SetImmediate((function(){v._disposed||Promise.all(v._completePromises).then((function(){v._parent._endPerformanceCounter(l),v._parent._setState(V.COMPLETE),v._parent.onCompleteObservable.notifyObservers(void 0),v._parent.onCompleteObservable.clear(),v.dispose()}),(function(e){v._parent.onErrorObservable.notifyObservers(e),v._parent.onErrorObservable.clear(),v.dispose()}))})),e}))];case 8:return[2,T.sent()]}}))}))})).catch((function(e){throw o._disposed||(o._parent.onErrorObservable.notifyObservers(e),o._parent.onErrorObservable.clear(),o.dispose()),e}))];case 1:return[2,i.sent()]}}))}))},e.prototype._loadData=function(e){if(this._gltf=e.json,this._setupData(),e.bin){var t=this._gltf.buffers;if(t&&t[0]&&!t[0].uri){var n=t[0];(n.byteLength<e.bin.byteLength-3||n.byteLength>e.bin.byteLength)&&g.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else g.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(Be.Assign(this._gltf.accessors),Be.Assign(this._gltf.animations),Be.Assign(this._gltf.buffers),Be.Assign(this._gltf.bufferViews),Be.Assign(this._gltf.cameras),Be.Assign(this._gltf.images),Be.Assign(this._gltf.materials),Be.Assign(this._gltf.meshes),Be.Assign(this._gltf.nodes),Be.Assign(this._gltf.samplers),Be.Assign(this._gltf.scenes),Be.Assign(this._gltf.skins),Be.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]}}},e.prototype._loadExtensionsAsync=function(){return(0,L.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a,i,s,l,u,c,f=this;return(0,L.YH)(this,(function(h){switch(h.label){case 0:return e=[],Re.forEach((function(t,n){var r;!1===(null===(r=f.parent.extensionOptions[n])||void 0===r?void 0:r.enabled)?t.isGLTFExtension&&f.isExtensionUsed(n)&&g.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!f.isExtensionUsed(n)||e.push((0,L.sH)(f,void 0,void 0,(function(){var e;return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,t.factory(this)];case 1:return(e=r.sent()).name!==n&&g.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(n)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}}))})))})),n=(t=(u=this._extensions).push).apply,r=[u],[4,Promise.all(e)];case 1:if(n.apply(t,r.concat([h.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(o=function(e){if(!a._extensions.some((function(t){return t.name===e&&t.enabled}))){if(!1===(null===(c=a.parent.extensionOptions[e])||void 0===c?void 0:c.enabled))throw new Error("Required extension ".concat(e," is disabled"));throw new Error("Required extension ".concat(e," is not available"))}},a=this,i=0,s=this._gltf.extensionsRequired;i<s.length;i++)l=s[i],o(l);return[2]}}))}))},e.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 t=new g.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=t,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var n={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case k.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case k.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(t),n},e.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=Be.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(){}))},e.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var n=0,r=e._primitiveBabylonMeshes;n<r.length;n++)t(r[n])},e.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},e.prototype._getMeshes=function(){var e=[];this._rootBabylonMesh instanceof g.AbstractMesh&&e.push(this._rootBabylonMesh);var 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){e.push(t)}))}return e},e.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},e.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},e.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},e.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case G.NONE:break;case G.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case G.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void g.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},e.prototype.loadNodeAsync=function(t,n,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadNodeAsync(t,n,r);if(a)return a;if(n._babylonTransformNode)throw new Error("".concat(t,": Invalid recursive node hierarchy"));var i=new Array;this.logOpen("".concat(t," ").concat(n.name||""));var s=function(a){if(e.AddPointerMetadata(a,t),e._LoadTransform(n,a),null!=n.camera){var s=Be.Get("".concat(t,"/camera"),o._gltf.cameras,n.camera);i.push(o.loadCameraAsync("/cameras/".concat(s.index),s,(function(e){e.parent=a,o._babylonScene.useRightHandedSystem||(a.scaling.x=-1)})))}if(n.children)for(var l=0,u=n.children;l<u.length;l++){var c=u[l],f=Be.Get("".concat(t,"/children/").concat(c),o._gltf.nodes,c);i.push(o.loadNodeAsync("/nodes/".concat(f.index),f,(function(e){e.parent=a})))}r(a)},l=null!=n.mesh,u=this._parent.loadSkins&&null!=n.skin;if(!l||u){var c=n.name||"node".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var f=new g.TransformNode(c,this._babylonScene);f._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==n.mesh?n._babylonTransformNode=f:n._babylonTransformNodeForSkin=f,s(f)}if(l)if(u){var h=Be.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh);i.push(this._loadMeshAsync("/meshes/".concat(h.index),n,h,(function(e){var r=n._babylonTransformNodeForSkin;e.metadata=(0,g.deepMerge)(r.metadata,e.metadata||{});var a=Be.Get("".concat(t,"/skin"),o._gltf.skins,n.skin);i.push(o._loadSkinAsync("/skins/".concat(a.index),n,a,(function(t){o._forEachPrimitive(n,(function(e){e.skeleton=t})),o._postSceneLoadActions.push((function(){if(null!=a.skeleton){var t=Be.Get("/skins/".concat(a.index,"/skeleton"),o._gltf.nodes,a.skeleton).parent;n.index===t.index?e.parent=r.parent:e.parent=t._babylonTransformNode}else e.parent=o._rootBabylonMesh;o._parent.onSkinLoadedObservable.notifyObservers({node:r,skinnedNode:e})}))})))})))}else h=Be.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh),i.push(this._loadMeshAsync("/meshes/".concat(h.index),n,h,s));return this.logClose(),Promise.all(i).then((function(){return o._forEachPrimitive(n,(function(e){var t=e;!t.isAnInstance&&t.geometry&&t.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)})),n._babylonTransformNode}))},e.prototype._loadMeshAsync=function(e,t,n,r){var o=n.primitives;if(!o||!o.length)throw new Error("".concat(e,": Primitives are missing"));null==o[0].index&&Be.Assign(o);var a=new Array;this.logOpen("".concat(e," ").concat(n.name||""));var i=t.name||"node".concat(t.index);if(1===o.length){var s=n.primitives[0];a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),i,t,n,s,(function(e){t._babylonTransformNode=e,t._primitiveBabylonMeshes=[e]})))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new g.TransformNode(i,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(var l=0,u=o;l<u.length;l++)s=u[l],a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),"".concat(i,"_primitive").concat(s.index),t,n,s,(function(e){e.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(e)})))}return r(t._babylonTransformNode),this.logClose(),Promise.all(a).then((function(){return t._babylonTransformNode}))},e.prototype._loadMeshPrimitiveAsync=function(t,n,r,o,a,i){var s=this,l=this._extensionsLoadMeshPrimitiveAsync(t,n,r,o,a,i);if(l)return l;this.logOpen("".concat(t));var u,c,f=0===this._disableInstancedMesh&&this._parent.createInstances&&null==r.skin&&!o.primitives[0].targets;if(f&&a._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(u=a._instanceData.babylonSourceMesh.createInstance(n))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c=a._instanceData.promise;else{var h=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var d=new g.Mesh(n,this._babylonScene);if(d._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,d.sideOrientation=this._babylonScene.useRightHandedSystem?g.Material.CounterClockWiseSideOrientation:g.Material.ClockWiseSideOrientation,this._createMorphTargets(t,r,o,a,d),h.push(this._loadVertexDataAsync(t,a,d).then((function(e){return(0,L.sH)(s,void 0,void 0,(function(){var n=this;return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(t,a,d,e).then((function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,e.applyToMesh(d),e._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1)}))];case 1:return[2,r.sent()]}}))}))}))),!this.parent.skipMaterials){var p=e._GetDrawMode(t,a.mode);if(null==a.material){var m=this._defaultBabylonMaterialData[p];m||(m=this._createDefaultMaterial("__GLTFLoader._default",p),this._parent.onMaterialLoadedObservable.notifyObservers(m),this._defaultBabylonMaterialData[p]=m),d.material=m}else{var _=Be.Get("".concat(t,"/material"),this._gltf.materials,a.material);h.push(this._loadMaterialAsync("/materials/".concat(_.index),_,d,p,(function(e){d.material=e})))}}c=Promise.all(h),f&&(a._instanceData={babylonSourceMesh:d,promise:c}),u=d}return e.AddPointerMetadata(u,t),this._parent.onMeshLoadedObservable.notifyObservers(u),i(u),this.logClose(),c.then((function(){return u}))},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this,o=this._extensionsLoadVertexDataAsync(e,t,n);if(o)return o;var a=t.attributes;if(!a)throw new Error("".concat(e,": Attributes are missing"));var i=new Array,s=new g.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=Be.Get("".concat(e,"/indices"),this._gltf.accessors,t.indices);i.push(this._loadIndicesAccessorAsync("/accessors/".concat(l.index),l).then((function(e){s.setIndices(e)})))}var u=function(t,o,l){if(null!=a[t]){n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o);var u=Be.Get("".concat(e,"/attributes/").concat(t),r._gltf.accessors,a[t]);i.push(r._loadVertexAccessorAsync("/accessors/".concat(u.index),u,o).then((function(e){if(e.getKind()===g.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=ke(u);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,u.count)}))),o==g.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(u)}};return u("POSITION",g.VertexBuffer.PositionKind),u("NORMAL",g.VertexBuffer.NormalKind),u("TANGENT",g.VertexBuffer.TangentKind),u("TEXCOORD_0",g.VertexBuffer.UVKind),u("TEXCOORD_1",g.VertexBuffer.UV2Kind),u("TEXCOORD_2",g.VertexBuffer.UV3Kind),u("TEXCOORD_3",g.VertexBuffer.UV4Kind),u("TEXCOORD_4",g.VertexBuffer.UV5Kind),u("TEXCOORD_5",g.VertexBuffer.UV6Kind),u("JOINTS_0",g.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",g.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",g.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",g.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",g.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(n.hasVertexAlpha=!0)})),Promise.all(i).then((function(){return s}))},e.prototype._createMorphTargets=function(e,t,n,r,o){if(r.targets&&this._parent.loadMorphTargets){if(null==t._numMorphTargets)t._numMorphTargets=r.targets.length;else if(r.targets.length!==t._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var a=n.extras?n.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,o.morphTargetManager=new g.MorphTargetManager(this._babylonScene),o.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,o.morphTargetManager.areUpdatesFrozen=!0;for(var i=0;i<r.targets.length;i++){var s=t.weights?t.weights[i]:n.weights?n.weights[i]:0,l=a?a[i]:"morphTarget".concat(i);o.morphTargetManager.addTarget(new g.MorphTarget(l,s,o.getScene()))}}},e.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}))},e.prototype._loadMorphTargetVertexDataAsync=function(e,t,n,r){return(0,L.sH)(this,void 0,void 0,(function(){var o,a,i=this;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return o=new Array,(a=function(r,a,s){if(null!=n[r]){var l=t.getVertexBuffer(a);if(l){var u=Be.Get("".concat(e,"/").concat(r),i._gltf.accessors,n[r]);o.push(i._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then((function(e){s(l,e)})))}}})("POSITION",g.VertexBuffer.PositionKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setPositions(n)})),a("NORMAL",g.VertexBuffer.NormalKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(n.length,(function(e,r){n[r]=t[r]+e})),r.setNormals(n)})),a("TANGENT",g.VertexBuffer.TangentKind,(function(e,t){var n=new Float32Array(t.length/3*4),o=0;e.forEach(t.length/3*4,(function(e,r){(r+1)%4!=0&&(n[o]=t[o]+e,o++)})),r.setTangents(n)})),a("TEXCOORD_0",g.VertexBuffer.UVKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setUVs(n)})),a("TEXCOORD_1",g.VertexBuffer.UV2Kind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setUV2s(n)})),a("COLOR_0",g.VertexBuffer.ColorKind,(function(t,n){var o=null,a=t.getSize();if(3===a){o=new Float32Array(n.length/3*4),t.forEach(n.length,(function(e,t){var r=Math.floor(t/3),a=t%3;o[4*r+a]=n[3*r+a]+e}));for(var i=0;i<n.length/3;++i)o[4*i+3]=1}else{if(4!==a)throw new Error("".concat(e,": Invalid number of components (").concat(a,") for COLOR_0 attribute"));o=new Float32Array(n.length),t.forEach(n.length,(function(e,t){o[t]=n[t]+e}))}r.setColors(o)})),[4,Promise.all(o).then((function(){}))];case 1:return[2,s.sent()]}}))}))},e._LoadTransform=function(e,t){if(null==e.skin){var n=g.Vector3.Zero(),r=g.Quaternion.Identity(),o=g.Vector3.One();e.matrix?g.Matrix.FromArray(e.matrix).decompose(o,r,n):(e.translation&&(n=g.Vector3.FromArray(e.translation)),e.rotation&&(r=g.Quaternion.FromArray(e.rotation)),e.scale&&(o=g.Vector3.FromArray(e.scale))),t.position=n,t.rotationQuaternion=r,t.scaling=o}},e.prototype._loadSkinAsync=function(e,t,n,r){var o=this;if(!this._parent.loadSkins)return Promise.resolve();var a=this._extensionsLoadSkinAsync(e,t,n);if(a)return a;if(n._data)return r(n._data.babylonSkeleton),n._data.promise;var i="skeleton".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var s=new g.Skeleton(n.name||i,i,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,n,s);var l=this._loadSkinInverseBindMatricesDataAsync(e,n).then((function(e){o._updateBoneMatrices(s,e)}));return n._data={babylonSkeleton:s,promise:l},r(s),l},e.prototype._loadBones=function(e,t,n){if(null==t.skeleton||this._parent.alwaysComputeSkeletonRootNode){var r=this._findSkeletonRootNode("".concat(e,"/joints"),t.joints);if(r)if(void 0===t.skeleton)t.skeleton=r.index;else{var o=Be.Get("".concat(e,"/skeleton"),this._gltf.nodes,t.skeleton);o===r||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1}(o,r)||(g.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index)}else g.Logger.Warn("".concat(e,": Failed to find common root"))}for(var a={},i=0,s=t.joints;i<s.length;i++){var l=s[i],u=Be.Get("".concat(e,"/joints/").concat(l),this._gltf.nodes,l);this._loadBone(u,t,n,a)}},e.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=Be.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}},e.prototype._loadBone=function(e,t,n,r){e._isJoint=!0;var o=r[e.index];if(o)return o;var a=null;e.index!==t.skeleton&&(e.parent&&-1!==e.parent.index?a=this._loadBone(e.parent,t,n,r):void 0!==t.skeleton&&g.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return o=new g.Bone(e.name||"joint".concat(e.index),n,a,this._getNodeMatrix(e),null,null,i),r[e.index]=o,this._postSceneLoadActions.push((function(){o.linkTransformNode(e._babylonTransformNode)})),o},e.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);var n=Be.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("/accessors/".concat(n.index),n)},e.prototype._updateBoneMatrices=function(e,t){for(var n=0,r=e.bones;n<r.length;n++){var o=r[n],a=g.Matrix.Identity(),i=o._index;t&&-1!==i&&(g.Matrix.FromArrayToRef(t,16*i,a),a.invertToRef(a));var s=o.getParent();s&&a.multiplyToRef(s.getAbsoluteInverseBindMatrix(),a),o.updateMatrix(a,!1,!1),o._updateAbsoluteBindMatrices(void 0,!1)}},e.prototype._getNodeMatrix=function(e){return e.matrix?g.Matrix.FromArray(e.matrix):g.Matrix.Compose(e.scale?g.Vector3.FromArray(e.scale):g.Vector3.One(),e.rotation?g.Quaternion.FromArray(e.rotation):g.Quaternion.Identity(),e.translation?g.Vector3.FromArray(e.translation):g.Vector3.Zero())},e.prototype.loadCameraAsync=function(t,n,r){void 0===r&&(r=function(){});var o=this._extensionsLoadCameraAsync(t,n,r);if(o)return o;var a=new Array;this.logOpen("".concat(t," ").concat(n.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var i=new g.FreeCamera(n.name||"camera".concat(n.index),g.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._babylonCamera=i,i.setTarget(new g.Vector3(0,0,-1)),n.type){case"perspective":var s=n.perspective;if(!s)throw new Error("".concat(t,": Camera perspective properties are missing"));i.fov=s.yfov,i.minZ=s.znear,i.maxZ=s.zfar||0;break;case"orthographic":if(!n.orthographic)throw new Error("".concat(t,": Camera orthographic properties are missing"));i.mode=g.Camera.ORTHOGRAPHIC_CAMERA,i.orthoLeft=-n.orthographic.xmag,i.orthoRight=n.orthographic.xmag,i.orthoBottom=-n.orthographic.ymag,i.orthoTop=n.orthographic.ymag,i.minZ=n.orthographic.znear,i.maxZ=n.orthographic.zfar;break;default:throw new Error("".concat(t,": Invalid camera type (").concat(n.type,")"))}return e.AddPointerMetadata(i,t),this._parent.onCameraLoadedObservable.notifyObservers(i),r(i),this.logClose(),Promise.all(a).then((function(){return i}))},e.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")}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return this._parent._startPerformanceCounter("Load animation"),this._extensionsLoadAnimationAsync(e,t)||Ie.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;Be.Assign(t.channels),Be.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}))}))},e.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=Be.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?Se.value.then((function(){var i,u,c,f,h;switch(l){case"translation":h=null===(i=(0,Ne.tQ)("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":h=null===(u=(0,Ne.tQ)("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":h=null===(c=(0,Ne.tQ)("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":h=null===(f=(0,Ne.tQ)("/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()},e.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=Be.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 w=A[x];t++,a(w.babylonAnimatable,w.babylonAnimation)}}}))},e.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=Be.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=Be.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},e.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))}}))},e.prototype.loadBufferViewAsync=function(e,t){var n=this._extensionsLoadBufferViewAsync(e,t);if(n)return n;if(t._data)return t._data;var r=Be.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},e.prototype._loadAccessorAsync=function(t,n,r){var o=this;if(n._data)return n._data;var a=e._GetNumComponents(t,n.type),i=a*g.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new r(s));else{var l=Be.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){if(5126!==n.componentType||n.normalized||l.byteStride&&l.byteStride!==i){var u=new r(s);return g.VertexBuffer.ForEach(o,n.byteOffset||0,l.byteStride||i,a,n.componentType,u.length,n.normalized||!1,(function(e,t){u[t]=e})),u}return e._GetTypedArray(t,n.componentType,o,n.byteOffset,s)}))}if(n.sparse){var u=n.sparse;n._data=n._data.then((function(s){var l=s,c=Be.Get("".concat(t,"/sparse/indices/bufferView"),o._gltf.bufferViews,u.indices.bufferView),f=Be.Get("".concat(t,"/sparse/values/bufferView"),o._gltf.bufferViews,u.values.bufferView);return Promise.all([o.loadBufferViewAsync("/bufferViews/".concat(c.index),c),o.loadBufferViewAsync("/bufferViews/".concat(f.index),f)]).then((function(o){var s,c=o[0],f=o[1],h=e._GetTypedArray("".concat(t,"/sparse/indices"),u.indices.componentType,c,u.indices.byteOffset,u.count),d=a*u.count;if(5126!==n.componentType||n.normalized){var p=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,d);s=new r(d),g.VertexBuffer.ForEach(p,0,i,a,n.componentType,s.length,n.normalized||!1,(function(e,t){s[t]=e}))}else s=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,d);for(var m=0,_=0;_<h.length;_++)for(var y=h[_]*a,b=0;b<a;b++)l[y++]=s[m++];return l}))}))}return n._data},e.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},e.prototype._loadIndicesAccessorAsync=function(t,n){if("SCALAR"!==n.type)throw new Error("".concat(t,"/type: Invalid value ").concat(n.type));if(5121!==n.componentType&&5123!==n.componentType&&5125!==n.componentType)throw new Error("".concat(t,"/componentType: Invalid value ").concat(n.componentType));if(n._data)return n._data;if(n.sparse){var r=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n.componentType);n._data=this._loadAccessorAsync(t,n,r)}else{var o=Be.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(o.index),o).then((function(r){return e._GetTypedArray(t,n.componentType,r,n.byteOffset,n.count)}))}return n._data},e.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then((function(e){return new g.Buffer(t,e,!1)})),e._babylonBuffer},e.prototype._loadVertexAccessorAsync=function(t,n,r){var o;if(null===(o=n._babylonVertexBuffer)||void 0===o?void 0:o[r])return n._babylonVertexBuffer[r];n._babylonVertexBuffer||(n._babylonVertexBuffer={});var a=this._babylonScene.getEngine();if(n.sparse||null==n.bufferView)n._babylonVertexBuffer[r]=this._loadFloatAccessorAsync(t,n).then((function(e){return new g.VertexBuffer(a,e,r,!1)}));else{var i=Be.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._babylonVertexBuffer[r]=this._loadVertexBufferViewAsync(i).then((function(o){var s=e._GetNumComponents(t,n.type);return new g.VertexBuffer(a,o,r,!1,void 0,i.byteStride,void 0,n.byteOffset,s,n.componentType,n.normalized,!0,void 0,!0)}))}return n._babylonVertexBuffer[r]},e.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,t,n){var r=new Array,o=this._getOrCreateMaterialAdapter(n);return t&&(t.baseColorFactor?(o.baseColor=g.Color3.FromArray(t.baseColorFactor),o.geometryOpacity=t.baseColorFactor[3]):o.baseColor=g.Color3.White(),o.baseMetalness=null==t.metallicFactor?1:t.metallicFactor,o.specularRoughness=null==t.roughnessFactor?1:t.roughnessFactor,t.baseColorTexture&&r.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),t.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),o.baseColorTexture=e}))),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),t.metallicRoughnessTexture,(function(e){e.name="".concat(n.name," (Metallic Roughness)"),o.baseMetalnessTexture=e,o.specularRoughnessTexture=e}))),o.useRoughnessFromMetallicTextureGreen=!0,o.useMetallicFromMetallicTextureBlue=!0)),Promise.all(r).then((function(){}))},e.prototype._loadMaterialAsync=function(t,n,r,o,a){void 0===a&&(a=function(){});var i=this._extensionsLoadMaterialAsync(t,n,r,o,a);if(i)return i;n._data=n._data||{};var s=n._data[o];if(!s){this.logOpen("".concat(t," ").concat(n.name||""));var l=this.createMaterial(t,n,o);s={babylonMaterial:l,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(t,n,l)},n._data[o]=s,e.AddPointerMetadata(l,t),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}))},e.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},e.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)},e.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(){}))},e.prototype.loadMaterialBasePropertiesAsync=function(e,t,n){var r,o=new Array,a=this._getOrCreateMaterialAdapter(n);a.emissionColor=t.emissiveFactor?g.Color3.FromArray(t.emissiveFactor):new g.Color3(0,0,0),t.doubleSided&&(a.backFaceCulling=!1,a.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),t.normalTexture,(function(e){var r;e.name="".concat(n.name," (Normal)"),a.geometryNormalTexture=e,null!=(null===(r=t.normalTexture)||void 0===r?void 0:r.scale)&&(e.level=t.normalTexture.scale)}))),a.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));var i,s=1;return t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),t.occlusionTexture,(function(e){e.name="".concat(n.name," (Occlusion)"),r=e}))),null!=t.occlusionTexture.strength&&(s=t.occlusionTexture.strength)),t.emissiveTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),t.emissiveTexture,(function(e){e.name="".concat(n.name," (Emissive)"),i=e}))),Promise.all(o).then((function(){r&&(a.ambientOcclusionTexture=r,a.ambientOcclusionTextureStrength=s),i&&(a.emissionColorTexture=i)}))},e.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,")"))}},e.prototype.loadTextureInfoAsync=function(t,n,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadTextureInfoAsync(t,n,r);if(a)return a;if(this.logOpen("".concat(t)),n.texCoord>=6)throw new Error("".concat(t,"/texCoord: Invalid value (").concat(n.texCoord,")"));var i=Be.Get("".concat(t,"/index"),this._gltf.textures,n.index);i._textureInfo=n;var s=this._loadTextureAsync("/textures/".concat(n.index),i,(function(a){a.coordinatesIndex=n.texCoord||0,e.AddPointerMetadata(a,t),o._parent.onTextureLoadedObservable.notifyObservers(a),r(a)}));return this.logClose(),s},e.prototype._loadTextureAsync=function(t,n,r){void 0===r&&(r=function(){});var o=this._extensionsLoadTextureAsync(t,n,r);if(o)return o;this.logOpen("".concat(t," ").concat(n.name||""));var a=null==n.sampler?e.DefaultSampler:Be.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=Be.Get("".concat(t,"/source"),this._gltf.images,n.source),s=this._createTextureAsync(t,a,i,r,void 0,!n._textureInfo.nonColorData);return this.logClose(),s},e.prototype._createTextureAsync=function(e,t,n,r,o,a){var i,s,l=this;void 0===r&&(r=function(){});var u=this._loadSampler("/samplers/".concat(t.index),t),c=new Array,f=new g.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var h={noMipmap:u.noMipMaps,invertY:!1,samplingMode:u.samplingMode,onLoad:function(){l._disposed||f.resolve()},onError:function(t,n){l._disposed||f.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:null!==(i=n.mimeType)&&void 0!==i?i:(0,g.GetMimeType)(null!==(s=n.uri)&&void 0!==s?s:""),loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},d=new g.Texture(null,this._babylonScene,h);return d._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c.push(f.promise),c.push(this.loadImageAsync("/images/".concat(n.index),n).then((function(e){var t=n.uri||"".concat(l._fileName,"#image").concat(n.index),r="data:".concat(l._uniqueRootUrl).concat(t);d.updateURL(r,e);var o=d.getInternalTexture();o&&(o.label=n.name)}))),d.wrapU=u.wrapU,d.wrapV=u.wrapV,r(d),this._parent.useGltfTextureNames&&(d.name=n.name||n.uri||"image".concat(n.index)),Promise.all(c).then((function(){return d}))},e.prototype._loadSampler=function(t,n){return n._data||(n._data={noMipMaps:9728===n.minFilter||9729===n.minFilter,samplingMode:e._GetTextureSamplingMode(t,n),wrapU:e._GetTextureWrapMode("".concat(t,"/wrapS"),n.wrapS),wrapV:e._GetTextureWrapMode("".concat(t,"/wrapT"),n.wrapT)}),n._data},e.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=Be.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(n.index),n)}this.logClose()}return t._data},e.prototype.loadUriAsync=function(t,n,r){var o=this,a=this._extensionsLoadUriAsync(t,n,r);if(a)return a;if(!e._ValidateUri(r))throw new Error("".concat(t,": '").concat(r,"' is invalid"));if((0,g.IsBase64DataUrl)(r)){var i=new Uint8Array((0,g.DecodeBase64UrlToBinary)(r));return this.log("".concat(t,": Decoded ").concat(r.substring(0,64),"... (").concat(i.length," bytes)")),Promise.resolve(i)}return this.log("".concat(t,": Loading ").concat(r)),this._parent.preprocessUrlAsync(this._rootUrl+r).then((function(e){return new Promise((function(n,a){o._parent._loadFile(o._babylonScene,e,(function(e){o._disposed||(o.log("".concat(t,": Loaded ").concat(r," (").concat(e.byteLength," bytes)")),n(new Uint8Array(e)))}),!0,(function(e){a(new g.LoadFileError("".concat(t,": Failed to load '").concat(r,"'").concat(e?": "+e.status+" "+e.statusText:""),e))}))}))}))},e.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)},e._GetTextureWrapMode=function(e,t){switch(t=null==t?10497:t){case 33071:return g.Texture.CLAMP_ADDRESSMODE;case 33648:return g.Texture.MIRROR_ADDRESSMODE;case 10497:return g.Texture.WRAP_ADDRESSMODE;default:return g.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),g.Texture.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var n=null==t.magFilter?9729:t.magFilter,r=null==t.minFilter?9987:t.minFilter;if(9729===n)switch(r){case 9728:return g.Texture.LINEAR_NEAREST;case 9729:return g.Texture.LINEAR_LINEAR;case 9984:return g.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return g.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return g.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return g.Texture.LINEAR_LINEAR_MIPLINEAR;default:return g.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),g.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&g.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),r){case 9728:return g.Texture.NEAREST_NEAREST;case 9729:return g.Texture.NEAREST_LINEAR;case 9984:return g.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return g.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return g.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return g.Texture.NEAREST_LINEAR_MIPLINEAR;default:return g.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),g.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,g.GetTypedArrayConstructor)(t)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}},e._GetTypedArray=function(t,n,r,o,a){var i=r.buffer;o=r.byteOffset+(o||0);var s=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n),l=g.VertexBuffer.GetTypeByteLength(n);return o%l!==0?(g.Logger.Warn("".concat(t,": Copying buffer as byte offset (").concat(o,") is not a multiple of component type byte length (").concat(l,")")),new s(i.slice(o,o+a*l),0)):new s(i,o,a)},e._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,")"))},e._ValidateUri=function(e){return g.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return g.Material.PointListDrawMode;case 1:return g.Material.LineListDrawMode;case 2:return g.Material.LineLoopDrawMode;case 3:return g.Material.LineStripDrawMode;case 4:return g.Material.TriangleFillMode;case 5:return g.Material.TriangleStripDrawMode;case 6:return g.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(t,")"))},e.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")}))},e.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")}))},e.prototype._forEachExtensions=function(e){for(var t=0,n=this._extensions;t<n.length;t++){var r=n[t];r.enabled&&e(r)}},e.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},e.prototype._extensionsOnLoading=function(){this._forEachExtensions((function(e){return e.onLoading&&e.onLoading()}))},e.prototype._extensionsOnReady=function(){this._forEachExtensions((function(e){return e.onReady&&e.onReady()}))},e.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",(function(n){return n.loadSceneAsync&&n.loadSceneAsync(e,t)}))},e.prototype._extensionsLoadNodeAsync=function(e,t,n){return this._applyExtensions(t,"loadNode",(function(r){return r.loadNodeAsync&&r.loadNodeAsync(e,t,n)}))},e.prototype._extensionsLoadCameraAsync=function(e,t,n){return this._applyExtensions(t,"loadCamera",(function(r){return r.loadCameraAsync&&r.loadCameraAsync(e,t,n)}))},e.prototype._extensionsLoadVertexDataAsync=function(e,t,n){return this._applyExtensions(t,"loadVertexData",(function(r){return r._loadVertexDataAsync&&r._loadVertexDataAsync(e,t,n)}))},e.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)}))},e.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)}))},e.prototype._extensionsCreateMaterial=function(e,t,n){return this._applyExtensions(t,"createMaterial",(function(r){return r.createMaterial&&r.createMaterial(e,t,n)}))},e.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,n){return this._applyExtensions(t,"loadMaterialProperties",(function(r){return r.loadMaterialPropertiesAsync&&r.loadMaterialPropertiesAsync(e,t,n)}))},e.prototype._extensionsLoadTextureInfoAsync=function(e,t,n){return this._applyExtensions(t,"loadTextureInfo",(function(r){return r.loadTextureInfoAsync&&r.loadTextureInfoAsync(e,t,n)}))},e.prototype._extensionsLoadTextureAsync=function(e,t,n){return this._applyExtensions(t,"loadTexture",(function(r){return r._loadTextureAsync&&r._loadTextureAsync(e,t,n)}))},e.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",(function(n){return n.loadAnimationAsync&&n.loadAnimationAsync(e,t)}))},e.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)}))},e.prototype._extensionsLoadSkinAsync=function(e,t,n){return this._applyExtensions(n,"loadSkin",(function(r){return r._loadSkinAsync&&r._loadSkinAsync(e,t,n)}))},e.prototype._extensionsLoadUriAsync=function(e,t,n){return this._applyExtensions(t,"loadUri",(function(r){return r._loadUriAsync&&r._loadUriAsync(e,t,n)}))},e.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",(function(n){return n.loadBufferViewAsync&&n.loadBufferViewAsync(e,t)}))},e.prototype._extensionsLoadBufferAsync=function(e,t,n,r){return this._applyExtensions(t,"loadBuffer",(function(o){return o.loadBufferAsync&&o.loadBufferAsync(e,t,n,r)}))},e.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},e.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},e.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},e.prototype.logOpen=function(e){this._parent._logOpen(e)},e.prototype.logClose=function(){this._parent._logClose()},e.prototype.log=function(e){this._parent._log(e)},e.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},e.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},e.DefaultSampler={index:-1},e}();te._CreateGLTF2Loader=function(e){return new Ge(e)};var Ve=a(727),De=a(833),He=a(561),Ue="EXT_lights_image_based",je=function(){function e(e){this.name=Ue,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ue)}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 Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,a,i=this;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,(n=new Array).push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen("".concat(r)),a=Be.Get("".concat(r,"/light"),this._lights,o.light),n.push(this._loadLightAsync("/extensions/".concat(this.name,"/lights/").concat(o.light),a).then((function(e){i._loader.babylonScene.environmentTexture=e}))),this._loader.logClose(),[4,Promise.all(n).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},e.prototype._loadLightAsync=function(e,t){var n=this;if(!t._loaded){var r=new Array;this._loader.logOpen("".concat(e));for(var o=new Array(t.specularImages.length),a=function(n){var a=t.specularImages[n];o[n]=new Array(a.length);for(var s=function(t){var s="".concat(e,"/specularImages/").concat(n,"/").concat(t);i._loader.logOpen("".concat(s));var l=a[t],u=Be.Get(s,i._loader.gltf.images,l);r.push(i._loader.loadImageAsync("/images/".concat(l),u).then((function(e){o[n][t]=e}))),i._loader.logClose()},l=0;l<a.length;l++)s(l)},i=this,s=0;s<t.specularImages.length;s++)a(s);this._loader.logClose(),t._loaded=Promise.all(r).then((function(){return(0,L.sH)(n,void 0,void 0,(function(){var n,r,a,i,s;return(0,L.YH)(this,(function(l){switch(l.label){case 0:if((n=new g.RawCubeTexture(this._loader.babylonScene,null,t.specularImageSize)).name=t.name||"environment",t._babylonTexture=n,null!=t.intensity&&(n.level=t.intensity),t.rotation&&(r=g.Quaternion.FromArray(t.rotation),this._loader.babylonScene.useRightHandedSystem||(r=g.Quaternion.Inverse(r)),g.Matrix.FromQuaternionToRef(r,n.getReflectionTextureMatrix())),!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(a=g.SphericalHarmonics.FromArray(t.irradianceCoefficients)).scaleInPlace(t.intensity),a.convertIrradianceToLambertianRadiance(),i=g.SphericalPolynomial.FromHarmonics(a),s=(o.length-1)/Math.log2(t.specularImageSize),[4,n.updateRGBDAsync(o,i,s)];case 1:return[2,l.sent()]}}))}))}))}return t._loaded.then((function(){return t._babylonTexture}))},e}();Le(Ue),Pe(Ue,!0,(function(e){return new je(e)}));var Ke="EXT_mesh_gpu_instancing",We=function(){function e(e){this.name=Ke,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ke)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,L.sH)(r,void 0,void 0,(function(){var r,a,i,s,l=this;return(0,L.YH)(this,(function(u){switch(u.label){case 0:return this._loader._disableInstancedMesh++,r=this._loader.loadNodeAsync("/nodes/".concat(t.index),t,n),this._loader._disableInstancedMesh--,t._primitiveBabylonMeshes?[3,2]:[4,r];case 1:case 3:return[2,u.sent()];case 2:return a=new Array,i=0,(s=function(t){if(null!=o.attributes[t]){var n=Be.Get("".concat(e,"/attributes/").concat(t),l._loader.gltf.accessors,o.attributes[t]);if(a.push(l._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===i)i=n.count;else if(i!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else a.push(Promise.resolve(null))})("TRANSLATION"),s("ROTATION"),s("SCALE"),s("_COLOR_0"),[4,r.then((function(e){return(0,L.sH)(l,void 0,void 0,(function(){var n,r,o,s,l,u,c,f,h,d;return(0,L.YH)(this,(function(p){switch(p.label){case 0:return[4,Promise.all(a)];case 1:for(n=p.sent(),r=n[0],o=n[1],s=n[2],l=n[3],u=new Float32Array(16*i),g.TmpVectors.Vector3[0].copyFromFloats(0,0,0),g.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),g.TmpVectors.Vector3[1].copyFromFloats(1,1,1),c=0;c<i;++c)r&&g.Vector3.FromArrayToRef(r,3*c,g.TmpVectors.Vector3[0]),o&&g.Quaternion.FromArrayToRef(o,4*c,g.TmpVectors.Quaternion[0]),s&&g.Vector3.FromArrayToRef(s,3*c,g.TmpVectors.Vector3[1]),g.Matrix.ComposeToRef(g.TmpVectors.Vector3[1],g.TmpVectors.Quaternion[0],g.TmpVectors.Vector3[0],g.TmpVectors.Matrix[0]),g.TmpVectors.Matrix[0].copyToArray(u,16*c);for(f=0,h=t._primitiveBabylonMeshes;f<h.length;f++)(d=h[f]).thinInstanceSetBuffer("matrix",u,16,!0),l&&(l.length===3*i?d.thinInstanceSetBuffer("color",l,3,!0):l.length===4*i?d.thinInstanceSetBuffer("color",l,4,!0):g.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+d.name));return[2,e]}}))}))}))]}}))}))}))},e}();Le(Ke),Pe(Ke,!0,(function(e){return new We(e)}));var Ye="EXT_meshopt_compression",ze=function(){function e(e){this.name=Ye,this.enabled=e.isExtensionUsed(Ye),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,r,a=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(n=t)._meshOptData?[4,n._meshOptData]:[3,2];case 1:case 3:return[2,i.sent()];case 2:return r=Be.Get("".concat(e,"/buffer"),this._loader.gltf.buffers,o.buffer),n._meshOptData=this._loader.loadBufferAsync("/buffers/".concat(r.index),r,o.byteOffset||0,o.byteLength).then((function(e){return(0,L.sH)(a,void 0,void 0,(function(){return(0,L.YH)(this,(function(t){switch(t.label){case 0:return[4,g.MeshoptCompression.Default.decodeGltfBufferAsync(e,o.count,o.byteStride,o.mode,o.filter)];case 1:return[2,t.sent()]}}))}))})),[4,n._meshOptData]}}))}))}))},e}();Le(Ye),Pe(Ye,!0,(function(e){return new ze(e)}));var Ze="EXT_texture_webp",qe=function(){function e(e){this.name=Ze,this._loader=e,this.enabled=e.isExtensionUsed(Ze)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ge.DefaultSampler:Be.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Be.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();Le(Ze),Pe(Ze,!0,(function(e){return new qe(e)}));var Xe="EXT_texture_avif",Qe=function(){function e(e){this.name=Xe,this._loader=e,this.enabled=e.isExtensionUsed(Xe)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ge.DefaultSampler:Be.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Be.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();Le(Xe),Pe(Xe,!0,(function(e){return new Qe(e)}));var Je="EXT_lights_ies",$e=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,Be.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i,s,l,u,c=this;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t=(i=Be.Get(o,c._lights,a.light)).name||e.name;c._loader.babylonScene._blockEntityCollection=!!c._loader._assetContainer,(r=new g.SpotLight(t,g.Vector3.Zero(),g.Vector3.Backward(),0,1,c._loader.babylonScene)).angle=Math.PI/2,r.innerAngle=0,r._parentContainer=c._loader._assetContainer,c._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=r,r.falloffType=g.Light.FALLOFF_GLTF,r.diffuse=a.color?g.Color3.FromArray(a.color):g.Color3.White(),r.intensity=a.multiplier||1,r.range=Number.MAX_VALUE,r.parent=e,c._loader._babylonLights.push(r),Ge.AddPointerMetadata(r,o),n(e)}))];case 1:return s=f.sent(),i.uri?[4,this._loader.loadUriAsync(e,i,i.uri)]:[3,3];case 2:return l=f.sent(),[3,5];case 3:return u=Be.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,i.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u)];case 4:l=f.sent(),f.label=5;case 5:return r.iesProfileTexture=new g.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,l,!0,void 0,void 0,void 0,void 0,".ies"),[2,s]}}))}))}))},e}();Le(Je),Pe(Je,!0,(function(e){return new $e(e)}));var et="KHR_draco_mesh_compression",tt=function(){function e(e){this.name=et,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=g.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(et)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i,s,l,u=this;return(0,L.YH)(this,(function(c){switch(c.label){case 0:if(null!=t.mode&&4!==t.mode&&5!==t.mode)throw new Error("".concat(e,": Unsupported mode ").concat(t.mode));return r={},i={},(s=function(e,o){var s=a.attributes[e];if(null!=s&&(n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o),r[o]=s,u.useNormalizedFlagFromAccessor)){var l=Be.TryGet(u._loader.gltf.accessors,t.attributes[e]);l&&(i[o]=l.normalized||!1)}})("POSITION",g.VertexBuffer.PositionKind),s("NORMAL",g.VertexBuffer.NormalKind),s("TANGENT",g.VertexBuffer.TangentKind),s("TEXCOORD_0",g.VertexBuffer.UVKind),s("TEXCOORD_1",g.VertexBuffer.UV2Kind),s("TEXCOORD_2",g.VertexBuffer.UV3Kind),s("TEXCOORD_3",g.VertexBuffer.UV4Kind),s("TEXCOORD_4",g.VertexBuffer.UV5Kind),s("TEXCOORD_5",g.VertexBuffer.UV6Kind),s("JOINTS_0",g.VertexBuffer.MatricesIndicesKind),s("WEIGHTS_0",g.VertexBuffer.MatricesWeightsKind),s("COLOR_0",g.VertexBuffer.ColorKind),(l=Be.Get(o,this._loader.gltf.bufferViews,a.bufferView))._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){return(0,L.sH)(u,void 0,void 0,(function(){var a,s,l;return(0,L.YH)(this,(function(u){switch(u.label){case 0:return a=this.dracoDecoder||g.DracoDecoder.Default,s=Be.TryGet(this._loader.gltf.accessors,t.attributes.POSITION),l=this._loader.parent.alwaysComputeBoundingBox||n.skeleton||!s?null:ke(s),[4,a._decodeMeshToGeometryForGltfAsync(n.name,this._loader.babylonScene,o,r,i,l).catch((function(t){throw new Error("".concat(e,": ").concat(t.message))}))];case 1:return[2,u.sent()]}}))}))}))),[4,l._dracoBabylonGeometry];case 1:return[2,c.sent()]}}))}))}))},e}();Le(et),Pe(et,!0,(function(e){return new tt(e)}));var nt="KHR_lights_punctual",rt=function(){function e(e){this.name=nt,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}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,Be.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i=Be.Get(o,r._lights,a.light),s=i.name||e.name;switch(r._loader.babylonScene._blockEntityCollection=!!r._loader._assetContainer,i.type){case"directional":var l=new g.DirectionalLight(s,g.Vector3.Backward(),r._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new g.PointLight(s,g.Vector3.Zero(),r._loader.babylonScene);break;case"spot":var u=new g.SpotLight(s,g.Vector3.Zero(),g.Vector3.Backward(),0,1,r._loader.babylonScene);u.angle=2*(i.spot&&i.spot.outerConeAngle||Math.PI/4),u.innerAngle=2*(i.spot&&i.spot.innerConeAngle||0),t=u;break;default:throw r._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(o,": Invalid light type (").concat(i.type,")"))}t._parentContainer=r._loader._assetContainer,r._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=t,t.falloffType=g.Light.FALLOFF_GLTF,t.diffuse=i.color?g.Color3.FromArray(i.color):g.Color3.White(),t.intensity=null==i.intensity?1:i.intensity,t.range=null==i.range?Number.MAX_VALUE:i.range,t.parent=e,r._loader._babylonLights.push(t),Ge.AddPointerMetadata(t,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();Le(nt),Pe(nt,!0,(function(e){return new rt(e)}));var ot="EXT_lights_area",at=function(){function e(e){this.name=ot,this._loader=e,this.enabled=this._loader.isExtensionUsed(ot)}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,Be.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i,s=Be.Get(o,r._lights,a.light),l=s.name||e.name;r._loader.babylonScene._blockEntityCollection=!!r._loader._assetContainer;var u=void 0!==s.size?s.size:1;switch(s.type){case"rect":var c=void 0!==(null===(t=s.rect)||void 0===t?void 0:t.aspect)?s.rect.aspect*u:u,f=u;i=new g.RectAreaLight(l,g.Vector3.Zero(),c,f,r._loader.babylonScene);break;case"disk":var h=Math.sqrt(u*u*.25*Math.PI);i=new g.RectAreaLight(l,g.Vector3.Zero(),h,h,r._loader.babylonScene);break;default:throw r._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(o,": Invalid area light type (").concat(s.type,")"))}i._parentContainer=r._loader._assetContainer,r._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=i,i.falloffType=g.Light.FALLOFF_GLTF,i.diffuse=s.color?g.Color3.FromArray(s.color):g.Color3.White(),i.intensity=null==s.intensity?1:s.intensity;var d=new g.TransformNode("".concat(l,"_orientation"),r._loader.babylonScene);d.rotationQuaternion=g.Quaternion.RotationAxis(g.Vector3.Up(),Math.PI),d.parent=e,i.parent=d,r._loader._babylonLights.push(i),Ge.AddPointerMetadata(i,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();Le(ot),Pe(ot,!0,(function(e){return new at(e)}));var it="KHR_materials_pbrSpecularGlossiness",st=function(){function e(e){this.name=it,this.order=200,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialBasePropertiesAsync(e,t,n)),r.push(this._loadSpecularGlossinessPropertiesAsync(o,a,n)),this._loader.loadMaterialAlphaProperties(e,t,n),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSpecularGlossinessPropertiesAsync=function(e,t,n){if(!(n instanceof g.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return n.metallic=null,n.roughness=null,t.diffuseFactor?(n.albedoColor=g.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=g.Color3.White(),n.reflectivityColor=t.specularFactor?g.Color3.FromArray(t.specularFactor):g.Color3.White(),n.microSurface=null==t.glossinessFactor?1:t.glossinessFactor,t.diffuseTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),t.diffuseTexture,(function(e){e.name="".concat(n.name," (Diffuse)"),n.albedoTexture=e}))),t.specularGlossinessTexture&&(r.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),t.specularGlossinessTexture,(function(e){e.name="".concat(n.name," (Specular Glossiness)"),n.reflectivityTexture=e,n.reflectivityTexture.hasAlpha=!0}))),n.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(r).then((function(){}))},e}();Le(it),Pe(it,!0,(function(e){return new st(e)}));var lt="KHR_materials_unlit",ut=function(){function e(e){this.name=lt,this.order=210,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 Ge.LoadExtensionAsync(e,t,this.name,(function(){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(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,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=t.pbrMetallicRoughness;return a&&(a.baseColorFactor&&(r.baseColor=g.Color3.FromArray(a.baseColorFactor),r.geometryOpacity=a.baseColorFactor[3]),a.baseColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),a.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),r.baseColorTexture=e})))),r.isUnlit=!0,t.doubleSided&&(r.backFaceCulling=!1,r.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(o).then((function(){}))},e}();Le(lt),Pe(lt,!0,(function(e){return new ut(e)}));var ct="KHR_materials_clearcoat",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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadClearCoatPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.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}();Le(ct),Pe(ct,!0,(function(e){return new ft(e)}));var ht="KHR_materials_coat",dt=function(){function e(e){this.name=ht,this.order=191,this.useOpenPBR=!1,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.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,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadCoatPropertiesAsync=function(e,t,n){var r,o,a=this._loader._getOrCreateMaterialAdapter(n),i=new Array;a.configureCoat(),a.coatWeight=void 0!==t.coatFactor?t.coatFactor:0,a.coatRoughness=void 0!==t.coatRoughnessFactor?t.coatRoughnessFactor:0,t.coatTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatTexture"),t.coatTexture,(function(e){e.name="".concat(n.name," (Coat)"),a.coatWeightTexture=e}))),t.coatRoughnessTexture&&(t.coatRoughnessTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatRoughnessTexture"),t.coatRoughnessTexture,(function(e){e.name="".concat(n.name," (Coat Roughness)"),a.coatRoughnessTexture=e})))),t.coatNormalTexture&&(t.coatNormalTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatNormalTexture"),t.coatNormalTexture,(function(e){var r;e.name="".concat(n.name," (Coat Normal)"),a.geometryCoatNormalTexture=e,null!=(null===(r=t.coatNormalTexture)||void 0===r?void 0:r.scale)&&(a.geometryCoatNormalTextureScale=t.coatNormalTexture.scale)}))),a.setNormalMapInversions(!n.getScene().useRightHandedSystem,n.getScene().useRightHandedSystem)),a.coatDarkening=void 0!==t.coatDarkeningFactor?t.coatDarkeningFactor:1,a.coatIor=void 0!==t.coatIor?t.coatIor:1.5;var s=g.Color3.White();void 0!==t.coatColorFactor&&s.fromArray(t.coatColorFactor),a.coatColor=s,t.coatColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatColorTexture"),t.coatColorTexture,(function(e){e.name="".concat(n.name," (Coat Color)"),a.coatColorTexture=e})));var l=null!==(r=t.coatAnisotropyStrength)&&void 0!==r?r:0,u=null!==(o=t.coatAnisotropyRotation)&&void 0!==o?o:0;return a.coatRoughnessAnisotropy=l,a.geometryCoatTangentAngle=u,this.useOpenPBR||a.configureGltfStyleAnisotropy(!0),t.coatAnisotropyTexture&&(t.coatAnisotropyTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatAnisotropyTexture"),t.coatAnisotropyTexture,(function(e){e.name="".concat(n.name," (Coat Anisotropy)"),a.geometryCoatTangentTexture=e})))),Promise.all(i).then((function(){}))},e}();Le(ht),Pe(ht,!0,(function(e){return new dt(e)}));var pt="KHR_materials_iridescence",mt=function(){function e(e){this.name=pt,this.order=195,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIridescencePropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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}();Le(pt),Pe(pt,!0,(function(e){return new mt(e)}));var _t="KHR_materials_anisotropy",gt=function(){function e(e){this.name=_t,this.order=195,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadAnisotropyPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadAnisotropyPropertiesAsync=function(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=null!==(l=t.anisotropyStrength)&&void 0!==l?l:0,i=null!==(u=t.anisotropyRotation)&&void 0!==u?u:0,r.specularRoughnessAnisotropy=a,r.geometryTangentAngle=i,(s=null!==(c=t.extensions)&&void 0!==c?c:{}).EXT_materials_anisotropy_openpbr&&s.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 f.sent(),[2]}}))}))},e}();Le(_t),Pe(_t,!0,(function(e){return new gt(e)}));var yt="KHR_materials_emissive_strength",bt=function(){function e(e){this.name=yt,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(yt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadMaterialPropertiesAsync(e,t,n)];case 1:return r.sent(),this._loadEmissiveProperties(o,a,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}();Le(yt),Pe(yt,!0,(function(e){return new bt(e)}));var vt="KHR_materials_sheen",Tt=function(){function e(e){this.name=vt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(vt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSheenPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSheenPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;r.configureFuzz();var a=void 0!==t.sheenColorFactor?g.Color3.FromArray(t.sheenColorFactor):g.Color3.Black(),i=void 0!==t.sheenRoughnessFactor?t.sheenRoughnessFactor:0;return r.fuzzWeight=1,r.fuzzColor=a,r.fuzzRoughness=i,t.sheenColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),t.sheenColorTexture,(function(e){e.name="".concat(n.name," (Sheen Color)"),r.fuzzColorTexture=e}))),t.sheenRoughnessTexture&&(t.sheenRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),t.sheenRoughnessTexture,(function(e){e.name="".concat(n.name," (Sheen Roughness)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();Le(vt),Pe(vt,!0,(function(e){return new Tt(e)}));var xt="KHR_materials_fuzz",At=function(){function e(e){this.name=xt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(xt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadFuzzPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadFuzzPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;return r.configureFuzz(),r.fuzzWeight=void 0!==t.fuzzFactor?t.fuzzFactor:0,r.fuzzColor=void 0!==t.fuzzColorFactor?g.Color3.FromArray(t.fuzzColorFactor):g.Color3.White(),r.fuzzRoughness=void 0!==t.fuzzRoughnessFactor?t.fuzzRoughnessFactor:.5,t.fuzzTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzTexture"),t.fuzzTexture,(function(e){e.name="".concat(n.name," (Fuzz)"),r.fuzzWeightTexture=e}))),t.fuzzColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzColorTexture"),t.fuzzColorTexture,(function(e){e.name="".concat(n.name," (Fuzz Color)"),r.fuzzColorTexture=e}))),t.fuzzRoughnessTexture&&(t.fuzzRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzRoughnessTexture"),t.fuzzRoughnessTexture,(function(e){e.name="".concat(n.name," (Fuzz Roughness)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();Le(xt),Pe(xt,!0,(function(e){return new At(e)}));var wt="KHR_materials_specular",Ot=function(){function e(e){this.name=wt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(wt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSpecularPropertiesAsync(o,a,n)),i=this._loader._getOrCreateMaterialAdapter(n),a.extensions&&a.extensions.EXT_materials_specular_edge_color&&a.extensions.EXT_materials_specular_edge_color.specularEdgeColorEnabled&&i.enableSpecularEdgeColor(!0),[4,Promise.all(r).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},e.prototype._loadSpecularPropertiesAsync=function(e,t,n){var r,o=this._loader._getOrCreateMaterialAdapter(n),a=new Array;return o.specularWeight=null!==(r=t.specularFactor)&&void 0!==r?r:1,o.specularColor=void 0!==t.specularColorFactor?g.Color3.FromArray(t.specularColorFactor):new g.Color3(1,1,1),t.specularTexture&&(t.specularTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),t.specularTexture,(function(e){e.name="".concat(n.name," (Specular)"),o.specularWeightTexture=e})))),t.specularColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),t.specularColorTexture,(function(e){e.name="".concat(n.name," (Specular Color)"),o.specularColorTexture=e}))),Promise.all(a).then((function(){}))},e}();Le(wt),Pe(wt,!0,(function(e){return new Ot(e)}));var Ct="KHR_materials_ior",Et=function(){function e(e){this.name=Ct,this.order=180,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIorPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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}();Le(Ct),Pe(Ct,!0,(function(e){return new Et(e)}));var Mt="KHR_materials_variants",Ft=function(){function e(e){this.name=Mt,this._loader=e,this.enabled=this._loader.isExtensionUsed(Mt)&&!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(Mt," 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(Mt," 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(Mt," 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[Mt])||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[Mt];(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(t,n,r,o,a,i){var s=this;return Ge.LoadExtensionAsync(t,a,this.name,(function(l,u){return(0,L.sH)(s,void 0,void 0,(function(){var s,c=this;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return(s=new Array).push(this._loader._loadMeshPrimitiveAsync(t,n,r,o,a,(function(n){if(i(n),n instanceof g.Mesh){var r=Ge._GetDrawMode(t,a.mode),o=c._loader.rootBabylonMesh,f=o?o._internalMetadata=o._internalMetadata||{}:{},h=f.gltf=f.gltf||{},d=h[Mt]=h[Mt]||{lastSelected:null,original:[],variants:{}};d.original.push({mesh:n,material:n.material});for(var p=function(t){var a=u.mappings[t],i=Be.Get("".concat(l,"/mappings/").concat(t,"/material"),c._loader.gltf.materials,a.material);s.push(c._loader._loadMaterialAsync("#/materials/".concat(a.material),i,n,r,(function(t){for(var r=function(r){var i=a.variants[r],s=Be.Get("/extensions/".concat(Mt,"/variants/").concat(i),c._variants,i);d.variants[s.name]=d.variants[s.name]||[],d.variants[s.name].push({mesh:n,material:t}),n.onClonedObservable.add((function(t){var r=t,a=null,i=r;do{if(!(i=i.parent))return;a=e._GetExtensionMetadata(i)}while(null===a);if(o&&a===e._GetExtensionMetadata(o)){for(var l in i._internalMetadata={},o._internalMetadata)i._internalMetadata[l]=o._internalMetadata[l];for(var l in i._internalMetadata.gltf=[],o._internalMetadata.gltf)i._internalMetadata.gltf[l]=o._internalMetadata.gltf[l];i._internalMetadata.gltf[Mt]={lastSelected:null,original:[],variants:{}};for(var u=0,c=a.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[Mt].original.push({mesh:f.mesh,material:f.material})}for(var l in a.variants)if(Object.prototype.hasOwnProperty.call(a.variants,l)){i._internalMetadata.gltf[Mt].variants[l]=[];for(var h=0,d=a.variants[l];h<d.length;h++){var p=d[h];i._internalMetadata.gltf[Mt].variants[l].push({mesh:p.mesh,material:p.material})}}a=i._internalMetadata.gltf[Mt]}for(var m=0,_=a.original;m<_.length;m++)(b=_[m]).mesh===n&&(b.mesh=r);for(var g=0,y=a.variants[s.name];g<y.length;g++){var b;(b=y[g]).mesh===n&&(b.mesh=r)}}))},i=0;i<a.variants.length;++i)r(i)})))},m=0;m<u.mappings.length;++m)p(m)}}))),[4,Promise.all(s).then((function(e){return e[0]}))];case 1:return[2,f.sent()]}}))}))}))},e}();Le(Mt),Pe(Mt,!0,(function(e){return new Ft(e)}));var Rt=function(){function e(t,n){var r=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,L.Cl)((0,L.Cl)({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this.onErrorObservable=new g.Observable,this._scene.onDisposeObservable.addOnce((function(){r.dispose()})),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:g.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=(0,L.Cl)((0,L.Cl)({},this._options),e),o=this._options;this._options=r,r.renderSize===o.renderSize&&r.renderTargetTextureType===o.renderTargetTextureType&&r.generateMipmaps===o.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._shouldRenderAsTransmission=function(e){var t;return!!(null===(t=null==e?void 0:e.subSurface)||void 0===t?void 0:t.isRefractionEnabled)},e.prototype._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),g.Tools.SetImmediate((function(){t._shouldRenderAsTransmission(e.material)?(e.material.refractionTexture=t._opaqueRenderTarget,-1===t._transparentMeshesCache.indexOf(e)&&t._transparentMeshesCache.push(e)):-1===t._opaqueMeshesCache.indexOf(e)&&t._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)},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);if(this._shouldRenderAsTransmission(e.material)){if(e.material){var r=e.material.subSurface;r&&(r.refractionTexture=this._opaqueRenderTarget)}-1!==n?(this._opaqueMeshesCache.splice(n,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)}else-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,t,n,r=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new g.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!==(t=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==t?t:this._scene.clearColor.clone(),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){n=r._scene.environmentIntensity,r._scene.environmentIntensity=1,r._options.clearColor?e.clearColor.copyFrom(r._options.clearColor):r._scene.clearColor.toLinearSpaceToRef(e.clearColor,r._scene.getEngine().useExactSrgbConversions)})),this._opaqueRenderTarget.onAfterUnbindObservable.add((function(){r._scene.environmentIntensity=n}));for(var o=0,a=this._transparentMeshesCache;o<a.length;o++){var i=a[o];this._shouldRenderAsTransmission(i.material)&&(i.material.refractionTexture=this._opaqueRenderTarget)}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},e}(),Pt="KHR_materials_transmission",Lt=function(){function e(e){this.name=Pt,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pt),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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTransparentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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)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 Rt({},n.getScene())}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}();Le(Pt),Pe(Pt,!0,(function(e){return new Lt(e)}));var Nt="KHR_materials_diffuse_transmission",It=function(){function e(e){this.name=Nt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Nt),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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTranslucentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadTranslucentPropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);a.configureSubsurface(),a.subsurfaceWeight=null!==(o=r.diffuseTransmissionFactor)&&void 0!==o?o:0,a.subsurfaceColor=void 0!==r.diffuseTransmissionColorFactor?g.Color3.FromArray(r.diffuseTransmissionColorFactor):g.Color3.White();var i=new Array;return r.diffuseTransmissionTexture&&(r.diffuseTransmissionTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),r.diffuseTransmissionTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission)"),a.subsurfaceWeightTexture=e})))),r.diffuseTransmissionColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),r.diffuseTransmissionColorTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission Color)"),a.subsurfaceColorTexture=e}))),Promise.all(i).then((function(){}))},e}();Le(Nt),Pe(Nt,!0,(function(e){return new It(e)}));var St="KHR_materials_volume",Bt=function(){function e(e){this.name=St,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(St),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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadVolumePropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadVolumePropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);if(0===a.transmissionWeight&&0===a.subsurfaceWeight||!r.thicknessFactor)return Promise.resolve();a.transmissionDepth=void 0!==r.attenuationDistance?r.attenuationDistance:Number.MAX_VALUE,a.transmissionColor=void 0!==r.attenuationColor&&3==r.attenuationColor.length?g.Color3.FromArray(r.attenuationColor):g.Color3.White(),a.volumeThickness=null!==(o=r.thicknessFactor)&&void 0!==o?o:0;var i=new Array;return r.thicknessTexture&&(r.thicknessTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),r.thicknessTexture,(function(e){e.name="".concat(n.name," (Thickness)"),a.volumeThicknessTexture=e})))),Promise.all(i).then((function(){}))},e}();Le(St),Pe(St,!0,(function(e){return new Bt(e)}));var kt="KHR_materials_dispersion",Gt=function(){function e(e){this.name=kt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(kt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDispersionPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadDispersionPropertiesAsync=function(e,t,n,r){var o=this._loader._getOrCreateMaterialAdapter(n);return o.transmissionWeight>0||!r.dispersion||(o.transmissionDispersionAbbeNumber=20/r.dispersion),Promise.resolve()},e}();Le(kt),Pe(kt,!0,(function(e){return new Gt(e)}));var Vt="KHR_materials_diffuse_roughness",Dt=function(){function e(e){this.name=Vt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Vt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDiffuseRoughnessPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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}();Le(Vt),Pe(Vt,!0,(function(e){return new Dt(e)}));var Ht="KHR_mesh_quantization",Ut=function(){function e(e){this.name=Ht,this.enabled=e.isExtensionUsed(Ht)}return e.prototype.dispose=function(){},e}();Le(Ht),Pe(Ht,!0,(function(e){return new Ut(e)}));var jt="KHR_texture_basisu",Kt=function(){function e(e){this.name=jt,this._loader=e,this.enabled=e.isExtensionUsed(jt)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ge.DefaultSampler:Be.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Be.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();Le(jt),Pe(jt,!0,(function(e){return new Kt(e)}));var Wt="KHR_texture_transform",Yt=function(){function e(e){this.name=Wt,this._loader=e,this.enabled=this._loader.isExtensionUsed(Wt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof g.Texture))throw new Error("".concat(o,": Texture type not supported"));a.offset&&(e.uOffset=a.offset[0],e.vOffset=a.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,a.rotation&&(e.wAng=-a.rotation),a.scale&&(e.uScale=a.scale[0],e.vScale=a.scale[1]),null!=a.texCoord&&(e.coordinatesIndex=a.texCoord),n(e)}))];case 1:return[2,r.sent()]}}))}))}))},e}();Le(Wt),Pe(Wt,!0,(function(e){return new Yt(e)}));var zt="KHR_xmp_json_ld",Zt=function(){function e(e){this.name=zt,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(zt)}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 qt(e,t,n,r){return g.Color3.FromArray(t,n).scale(r)}function Xt(e,t,n,r){return t[n]*r}function Qt(e,t,n,r){return-t[n]*r}function Jt(e,t,n,r){return t[n+1]*r}function $t(e,t,n,r){return t[n]*r*2}function en(e){return{scale:[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Xt,(function(){return 2})),new nn(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),Jt,(function(){return 2}))],offset:[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Xt,(function(){return 2})),new nn(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),Jt,(function(){return 2}))],rotation:[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),Qt,(function(){return 1}))]}}Le(zt),Pe(zt,!0,(function(e){return new Zt(e)}));var tn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ve.AnimationPropertyInfo),nn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(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}(Ve.AnimationPropertyInfo),rn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ve.AnimationPropertyInfo),on=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(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}(Ve.AnimationPropertyInfo);(0,Ne.ZU)("/cameras/{}/orthographic/xmag",[new tn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",Qt,(function(){return 1})),new tn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",Jt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/orthographic/ymag",[new tn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",Qt,(function(){return 1})),new tn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",Jt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/orthographic/zfar",[new tn(g.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Xt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/orthographic/znear",[new tn(g.Animation.ANIMATIONTYPE_FLOAT,"minZ",Xt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/perspective/yfov",[new tn(g.Animation.ANIMATIONTYPE_FLOAT,"fov",Xt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/perspective/zfar",[new tn(g.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Xt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/perspective/znear",[new tn(g.Animation.ANIMATIONTYPE_FLOAT,"minZ",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new nn(g.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",qt,(function(){return 4})),new nn(g.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,r){return t[n+3]*r}),(function(){return 4}))]),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"metallic",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"roughness",Xt,(function(){return 1}))]);var an=en("albedoTexture");(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",an.scale),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",an.offset),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",an.rotation);var sn=en("metallicTexture");(0,Ne.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",sn.scale),(0,Ne.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",sn.offset),(0,Ne.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",sn.rotation),(0,Ne.ZU)("/materials/{}/emissiveFactor",[new nn(g.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",qt,(function(){return 3}))]);var ln=en("bumpTexture");(0,Ne.ZU)("/materials/{}/normalTexture/scale",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",ln.scale),(0,Ne.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",ln.offset),(0,Ne.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",ln.rotation),(0,Ne.ZU)("/materials/{}/occlusionTexture/strength",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Xt,(function(){return 1}))]);var un=en("ambientTexture");(0,Ne.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",un.scale),(0,Ne.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",un.offset),(0,Ne.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",un.rotation);var cn=en("emissiveTexture");(0,Ne.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",cn.scale),(0,Ne.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",cn.offset),(0,Ne.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",cn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Xt,(function(){return 1}))]);var fn=en("anisotropy.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",fn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",fn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",fn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Xt,(function(){return 1}))]);var hn=en("clearCoat.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",hn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",hn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",hn.rotation);var dn=en("clearCoat.bumpTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",dn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",dn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",dn.rotation);var pn=en("clearCoat.textureRoughness");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",pn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",pn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",pn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_ior/ior",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Xt,(function(){return 1}))]);var mn=en("iridescence.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",mn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",mn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",mn.rotation);var _n=en("iridescence.thicknessTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",_n.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",_n.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",_n.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new nn(g.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",qt,(function(){return 3}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Xt,(function(){return 1}))]);var gn=en("sheen.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",gn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",gn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",gn.rotation);var yn=en("sheen.textureRoughness");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",yn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",yn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",yn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new nn(g.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",qt,(function(){return 3}))]);var bn=en("metallicReflectanceTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",bn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",bn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",bn.rotation);var vn=en("reflectanceTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",vn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",vn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",vn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Xt,(function(){return 1}))]);var Tn=en("subSurface.refractionIntensityTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",Tn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",Tn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",Tn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new nn(g.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",qt,(function(){return 3}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Xt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Xt,(function(){return 1}))]);var xn=en("subSurface.thicknessTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",xn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",xn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",xn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new nn(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Xt,(function(){return 1}))]);var An=en("subSurface.translucencyIntensityTexture");(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",An.scale),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",An.offset),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",An.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new nn(g.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",qt,(function(){return 3}))]);var wn=en("subSurface.translucencyColorTexture");(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",wn.scale),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",wn.offset),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",wn.rotation),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/color",[new rn(g.Animation.ANIMATIONTYPE_COLOR3,"diffuse",qt,(function(){return 3}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"intensity",Xt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/range",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"range",Xt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",$t,(function(){return 1}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"angle",$t,(function(){return 1}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/color",[new rn(g.Animation.ANIMATIONTYPE_COLOR3,"diffuse",qt,(function(){return 3}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/intensity",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"intensity",Xt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/size",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"radius",Xt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"radius",Xt,(function(){return 1}))]),(0,Ne.ZU)("/nodes/{}/extensions/EXT_lights_ies/color",[new rn(g.Animation.ANIMATIONTYPE_COLOR3,"diffuse",qt,(function(){return 3}))]),(0,Ne.ZU)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"intensity",Xt,(function(){return 1}))]),(0,Ne.ZU)("/nodes/{}/extensions/KHR_node_visibility/visible",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Xt,(function(){return 1}))]);var On="KHR_animation_pointer",Cn=function(){function e(e){this.name=On,this._loader=e,this._pathToObjectConverter=(0,Ne.Wt)(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(On)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,t,n,r,o){var a,i=null===(a=r.target.extensions)||void 0===a?void 0:a.KHR_animation_pointer;if(!i||!this._pathToObjectConverter)return null;"pointer"!==r.target.path&&g.Logger.Warn("".concat(e,"/target/path: Value (").concat(r.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=r.target.node&&g.Logger.Warn("".concat(e,"/target/node: Value (").concat(r.target.node,") must not be present when using the ").concat(this.name," extension"));var s="".concat(e,"/extensions/").concat(this.name),l=i.pointer;if(!l)throw new Error("".concat(s,": Pointer is missing"));try{var u=this._pathToObjectConverter.convert(l);if(!u.info.interpolation)throw new Error("".concat(s,"/pointer: Interpolation is missing"));return this._loader._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,{object:u.object,info:u.info.interpolation},o)}catch(e){return g.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();Le(On),Pe(On,!0,(function(e){return new Cn(e)}));var En="MSFT_audio_emitter",Mn=function(){function e(e){this.name=En,this._loader=e,this.enabled=this._loader.isExtensionUsed(En)}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,Be.Assign(this._clips),Be.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,L.YH)(this,(function(u){switch(u.label){case 0:for((n=new Array).push(this._loader.loadSceneAsync(e,t)),a=0,i=o.emitters;a<i.length;a++){if(s=i[a],null!=(l=Be.Get("".concat(r,"/emitters"),this._emitters,s)).refDistance||null!=l.maxDistance||null!=l.rolloffFactor||null!=l.distanceModel||null!=l.innerAngle||null!=l.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(l.index),l))}return[4,Promise.all(n)];case 1:return u.sent(),[2]}}))}))}))},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,L.sH)(r,void 0,void 0,(function(){var r,a,i=this;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=new Array,[4,this._loader.loadNodeAsync(e,t,(function(t){for(var a=function(n){var o=Be.Get("".concat(e,"/emitters"),i._emitters,n);r.push(i._loadEmitterAsync("".concat(e,"/emitters/").concat(o.index),o).then((function(){for(var e=0,n=o._babylonSounds;e<n.length;e++){var r=n[e];r.attachToMesh(t),null==o.innerAngle&&null==o.outerAngle||(r.setLocalDirectionToMesh(g.Vector3.Forward()),r.setDirectionalCone(2*g.Tools.ToDegrees(null==o.innerAngle?Math.PI:o.innerAngle),2*g.Tools.ToDegrees(null==o.outerAngle?Math.PI:o.outerAngle),0))}})))},s=0,l=o.emitters;s<l.length;s++)a(l[s]);n(t)}))];case 1:return a=s.sent(),[4,Promise.all(r)];case 2:return s.sent(),[2,a]}}))}))}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,L.YH)(this,(function(u){switch(u.label){case 0:return[4,this._loader.loadAnimationAsync(e,t)];case 1:for(n=u.sent(),a=new Array,Be.Assign(o.events),i=0,s=o.events;i<s.length;i++)l=s[i],a.push(this._loadAnimationEventAsync("".concat(r,"/events/").concat(l.index),e,t,l,n));return[4,Promise.all(a)];case 2:return u.sent(),[2,n]}}))}))}))},e.prototype._loadClipAsync=function(e,t){if(t._objectURL)return t._objectURL;var n;if(t.uri)n=this._loader.loadUriAsync(e,t,t.uri);else{var r=Be.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,t.bufferView);n=this._loader.loadBufferViewAsync("/bufferViews/".concat(r.index),r)}return t._objectURL=n.then((function(e){return URL.createObjectURL(new Blob([e],{type:t.mimeType}))})),t._objectURL},e.prototype._loadEmitterAsync=function(e,t){var n=this;if(t._babylonSounds=t._babylonSounds||[],!t._babylonData){for(var r=new Array,o=t.name||"emitter".concat(t.index),a={loop:!1,autoplay:!1,volume:null==t.volume?1:t.volume},i=function(e){var i="/extensions/".concat(s.name,"/clips"),l=Be.Get(i,s._clips,t.clips[e].clip);r.push(s._loadClipAsync("".concat(i,"/").concat(t.clips[e].clip),l).then((function(r){var i=t._babylonSounds[e]=new g.Sound(o,r,n._loader.babylonScene,null,a);i.refDistance=t.refDistance||1,i.maxDistance=t.maxDistance||256,i.rolloffFactor=t.rolloffFactor||1,i.distanceModel=t.distanceModel||"exponential"})))},s=this,l=0;l<t.clips.length;l++)i(l);var u=Promise.all(r).then((function(){var e=t.clips.map((function(e){return e.weight||1})),n=new g.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*g.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*g.Tools.ToDegrees(t.outerAngle)),t.volume&&(n.volume=t.volume),t._babylonData.sound=n}));t._babylonData={loaded:u}}return t._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,t,n,r,o){var a=this;if(0==o.targetedAnimations.length)return Promise.resolve();var i=o.targetedAnimations[0],s=r.emitter,l=Be.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,s);return this._loadEmitterAsync(e,l).then((function(){var t=l._babylonData.sound;if(t){var n=new g.AnimationEvent(r.time,a._getEventAction(e,t,r.action,r.time,r.startOffset));i.animation.addEvent(n),o.onAnimationGroupEndObservable.add((function(){t.stop()})),o.onAnimationGroupPauseObservable.add((function(){t.pause()}))}}))},e}();Le(En),Pe(En,!0,(function(e){return new Mn(e)}));var Fn="MSFT_lod",Rn=function(){function e(e){var t,n;this.name=Fn,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new g.Observable,this.onMaterialLODsLoadedObservable=new g.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!==(n=null===(t=this._loader.parent.extensionOptions[Fn])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(Fn)}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,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,L.sH)(r,void 0,void 0,(function(){var r,a,i,s,l,u=this;return(0,L.YH)(this,(function(c){switch(c.label){case 0:for(a=this._getLODs(e,t,this._loader.gltf.nodes,o.ids),this._loader.logOpen("".concat(e)),i=function(e){var t=a[e];0!==e&&(s._nodeIndexLOD=e,s._nodeSignalLODs[e]=s._nodeSignalLODs[e]||new g.Deferred);var o=s._loader.loadNodeAsync("/nodes/".concat(t.index),t,(function(e){n(e),e.setEnabled(!1)})).then((function(t){if(0!==e){var n=a[e-1];n._babylonTransformNode&&(u._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t}));s._nodePromiseLODs[e]=s._nodePromiseLODs[e]||[],0===e?r=o:(s._nodeIndexLOD=null,s._nodePromiseLODs[e].push(o))},s=this,l=0;l<a.length;l++)i(l);return this._loader.logClose(),[4,r];case 1:return[2,c.sent()]}}))}))}))},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var a=this;return this._nodeIndexLOD?null:Ge.LoadExtensionAsync(e,t,this.name,(function(e,i){return(0,L.sH)(a,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,L.YH)(this,(function(h){switch(h.label){case 0:for(s=this._getLODs(e,t,this._loader.gltf.materials,i.ids),this._loader.logOpen("".concat(e)),l=function(e){var t=s[e];0!==e&&(u._materialIndexLOD=e);var i=u._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]&&(f._disposeMaterials([n[r].babylonMaterial]),delete n[r])}return t}));u._materialPromiseLODs[e]=u._materialPromiseLODs[e]||[],0===e?a=i:(u._materialIndexLOD=null,u._materialPromiseLODs[e].push(i))},u=this,c=0;c<s.length;c++)l(c);return this._loader.logClose(),[4,a];case 1:return[2,h.sent()]}}))}))}))},e.prototype._loadUriAsync=function(e,t,n){var r=this;if(null!==this._nodeIndexLOD){this._loader.log("deferred");var o=this._nodeIndexLOD-1;return this._nodeSignalLODs[o]=this._nodeSignalLODs[o]||new g.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))}return null!==this._materialIndexLOD?(this._loader.log("deferred"),o=this._materialIndexLOD-1,this._materialSignalLODs[o]=this._materialSignalLODs[o]||new g.Deferred,this._materialSignalLODs[o].promise.then((function(){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))):null},e.prototype.loadBufferAsync=function(e,t,n,r){var o=this;if(this._loader.parent.useRangeRequests&&!t.uri){if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));var a=function(e,t){return(0,L.sH)(o,void 0,void 0,(function(){var o,a,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return a=(o=n)+r-1,(i=e[t])?(i.start=Math.min(i.start,o),i.end=Math.max(i.end,a)):(i={start:o,end:a,loaded:new g.Deferred},e[t]=i),[4,i.loaded.promise.then((function(e){return new Uint8Array(e.buffer,e.byteOffset+n-i.start,r)}))];case 1:return[2,s.sent()]}}))}))};return this._loader.log("deferred"),null!==this._nodeIndexLOD?a(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?a(this._materialBufferLODs,this._materialIndexLOD):a(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(Be.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}();Le(Fn),Pe(Fn,!0,(function(e){return new Rn(e)}));var Pn="MSFT_minecraftMesh",Ln=function(){function e(e){this.name=Pn,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:if(!a)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,i.sent()];case 2:return[2]}}))}))}))},e}();Le(Pn),Pe(Pn,!0,(function(e){return new Ln(e)}));var Nn="MSFT_sRGBFactors",In=function(){function e(e){this.name=Nn,this._loader=e,this.enabled=this._loader.isExtensionUsed(Nn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,o,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return a?(r=this._loader._getOrCreateMaterialAdapter(n),o=this._loader.loadMaterialPropertiesAsync(e,t,n),i=n.getScene().getEngine().useExactSrgbConversions,r.baseColorTexture||r.baseColor.toLinearSpaceToRef(r.baseColor,i),r.specularColorTexture||r.specularColor.toLinearSpaceToRef(r.specularColor,i),[4,o]):[3,2];case 1:return[2,s.sent()];case 2:return[2]}}))}))}))},e}();function Sn(e){var t=e.split(":");return Bn({op:t[0],extension:t[1]})}function Bn(e,t){var n;void 0===t&&(t=!0);var r=e.extension?null===(n=Gn[e.extension])||void 0===n?void 0:n[e.op]:Vn[e.op];if(!r&&(g.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),t)){var o={},a={flows:{}};if(e.inputValueSockets)for(var i in o.values={},e.inputValueSockets)o.values[i]={name:i};return e.outputValueSockets&&(a.values={},Object.keys(e.outputValueSockets).forEach((function(e){a.values[e]={name:e}}))),{blocks:[],inputs:o,outputs:a}}return r}function kn(e,t,n){Gn[t]||(Gn[t]={}),Gn[t][e]=n}Le(Nn),Pe(Nn,!0,(function(e){return new In(e)}));var Gn={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},Vn={"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,t){var n,r;if(!e.configuration)return g.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};var o=e.configuration.event;if(!o)return g.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 a=null===(n=o.value)||void 0===n?void 0:n[0];return"number"!=typeof a?(g.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):(null===(r=t.events)||void 0===r?void 0:r[a])?{valid:!0}:(g.Logger.Error("Event with id ".concat(a," not found")),{valid:!1,error:"Event with id ".concat(a," 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":Dn("FlowGraphEBlock"),"math/Pi":Dn("FlowGraphPIBlock"),"math/Inf":Dn("FlowGraphInfBlock"),"math/NaN":Dn("FlowGraphNaNBlock"),"math/abs":Dn("FlowGraphAbsBlock"),"math/sign":Dn("FlowGraphSignBlock"),"math/trunc":Dn("FlowGraphTruncBlock"),"math/floor":Dn("FlowGraphFloorBlock"),"math/ceil":Dn("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":Dn("FlowGraphFractBlock"),"math/neg":Dn("FlowGraphNegationBlock"),"math/add":Dn("FlowGraphAddBlock",["a","b"],!0),"math/sub":Dn("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?Hn(e):{valid:!0}}},"math/div":Dn("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Dn("FlowGraphModuloBlock",["a","b"]),"math/min":Dn("FlowGraphMinBlock",["a","b"]),"math/max":Dn("FlowGraphMaxBlock",["a","b"]),"math/clamp":Dn("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Dn("FlowGraphSaturateBlock"),"math/mix":Dn("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Dn("FlowGraphEqualityBlock",["a","b"]),"math/lt":Dn("FlowGraphLessThanBlock",["a","b"]),"math/le":Dn("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Dn("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Dn("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":Dn("FlowGraphIsNaNBlock"),"math/isInf":Dn("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":Dn("FlowGraphSinBlock"),"math/cos":Dn("FlowGraphCosBlock"),"math/tan":Dn("FlowGraphTanBlock"),"math/asin":Dn("FlowGraphASinBlock"),"math/acos":Dn("FlowGraphACosBlock"),"math/atan":Dn("FlowGraphATanBlock"),"math/atan2":Dn("FlowGraphATan2Block",["a","b"]),"math/sinh":Dn("FlowGraphSinhBlock"),"math/cosh":Dn("FlowGraphCoshBlock"),"math/tanh":Dn("FlowGraphTanhBlock"),"math/asinh":Dn("FlowGraphASinhBlock"),"math/acosh":Dn("FlowGraphACoshBlock"),"math/atanh":Dn("FlowGraphATanhBlock"),"math/exp":Dn("FlowGraphExponentialBlock"),"math/log":Dn("FlowGraphLogBlock"),"math/log2":Dn("FlowGraphLog2Block"),"math/log10":Dn("FlowGraphLog10Block"),"math/sqrt":Dn("FlowGraphSquareRootBlock"),"math/cbrt":Dn("FlowGraphCubeRootBlock"),"math/pow":Dn("FlowGraphPowerBlock",["a","b"]),"math/length":Dn("FlowGraphLengthBlock"),"math/normalize":Dn("FlowGraphNormalizeBlock"),"math/dot":Dn("FlowGraphDotBlock",["a","b"]),"math/cross":Dn("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":Dn("FlowGraphTransposeBlock"),"math/determinant":Dn("FlowGraphDeterminantBlock"),"math/inverse":Dn("FlowGraphInvertMatrixBlock"),"math/matMul":Dn("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":Dn("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":Dn("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":Dn("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":Dn("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":Dn("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Dn("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Dn("FlowGraphLeadingZerosBlock"),"math/ctz":Dn("FlowGraphTrailingZerosBlock"),"math/popcnt":Dn("FlowGraphOneBitsCounterBlock"),"math/rad":Dn("FlowGraphDegToRadBlock"),"math/deg":Dn("FlowGraphRadToDegBlock"),"type/boolToInt":Dn("FlowGraphBooleanToInt"),"type/boolToFloat":Dn("FlowGraphBooleanToFloat"),"type/intToBool":Dn("FlowGraphIntToBoolean"),"type/intToFloat":Dn("FlowGraphIntToFloat"),"type/floatToInt":Dn("FlowGraphFloatToInt"),"type/floatToBool":Dn("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 t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return g.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}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 t,n;return(null===(n=null===(t=e.configuration)||void 0===t?void 0:t.variable)||void 0===n?void 0:n.value)?{valid:!0}:(g.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,t,n,r,o){var a,i,s,l,u,c,f=o[0],h=null===(i=null===(a=e.configuration)||void 0===a?void 0:a.variable.value)||void 0===i?void 0:i[0];if("number"!=typeof h)throw g.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var d=r.arrays.staticVariables[h];void 0===(null===(l=null===(s=f.config)||void 0===s?void 0:s.animationType)||void 0===l?void 0:l.value)&&(f.config||(f.config={}),(u=f.config).animationType||(u.animationType={}),f.config.animationType.value=(0,g.getAnimationTypeByFlowGraphType)(d.type));var p=o[4];return p.config||(p.config={}),(c=p.config).variable||(c.variable={}),p.config.variable.value=r.getVariableName(h),o}},"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 t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return g.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}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 Dn(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?Hn(e):{valid:!0}}}}function Hn(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 Un(){return Object.keys(Vn)}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,t=this._interactivityGraph.declarations;e<t.length;e++){var n=t[e],r=Bn(n);if(!r)throw g.Logger.Error(["No mapping found for declaration",n]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:r,fullOperationName:n.extension?n.op+":"+n.extension:n.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,t){var n=this._types[e.type];if(!n)throw g.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==n.length)throw g.Logger.Error(["Invalid value length for variable",e,n]),new Error("Error parsing variables");var r=e.value||[];if(!r.length)switch(n.flowGraphType){case"boolean":r.push(!1);break;case"FlowGraphInteger":r.push(0);break;case"number":r.push(NaN);break;case"Vector2":r.push(NaN,NaN);break;case"Vector3":r.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":r.fill(NaN,0,4);break;case"Matrix":r.fill(NaN,0,16);break;case"Matrix3D":r.fill(NaN,0,9)}return"number"===n.elementType&&"string"==typeof r[0]&&(r[0]=parseFloat(r[0])),{type:n.flowGraphType,value:t?t(r,this):r}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var t=function(t){var r={eventId:t.id||"internalEvent_"+n._internalEventsCounter++};t.values&&(r.eventData=Object.keys(t.values).map((function(n){var r,o=null===(r=t.values)||void 0===r?void 0:r[n];if(!o)throw g.Logger.Error(["No value found for event key",n]),new Error("Error parsing events");var a=e._types[o.type];if(!a)throw g.Logger.Error(["No type found for event value",o]),new Error("Error parsing events");var i=void 0!==o.value?e._parseVariable(o):void 0;return{id:n,type:a.flowGraphType,eventData:!0,value:i}}))),n._events.push(r)},n=this,r=0,o=this._interactivityGraph.events;r<o.length;r++)t(o[r])},e.prototype._parseNodes=function(){var e;if(this._interactivityGraph.nodes)for(var t=0,n=this._interactivityGraph.nodes;t<n.length;t++){var r=n[t];if("number"!=typeof r.declaration)throw g.Logger.Error(["No declaration found for node",r]),new Error("Error parsing nodes");var o=this._mappings[r.declaration];if(!o)throw g.Logger.Error(["No mapping found for node",r]),new Error("Error parsing nodes");if(o.flowGraphMapping.validation){var a=o.flowGraphMapping.validation(r,this._interactivityGraph,this._gltf);if(!a.valid)throw new Error("Error validating interactivity node ".concat(null===(e=this._interactivityGraph.declarations)||void 0===e?void 0:e[r.declaration].op," - ").concat(a.error))}for(var i=[],s=0,l=o.flowGraphMapping.blocks;s<l.length;s++){var u=l[s],c=this._getEmptyBlock(u,o.fullOperationName);this._parseNodeConfiguration(r,c,o.flowGraphMapping,u),i.push(c)}this._nodes.push({blocks:i,fullOperationName:o.fullOperationName})}},e.prototype._getEmptyBlock=function(e,t){return{uniqueId:(0,g.RandomGUID)(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,t,n,r){var o,a=e.configuration;if(a)for(var i in a){var s=a[i];if(!s)throw new Error("Error parsing node configuration");var l=null===(o=n.configuration)||void 0===o?void 0:o[i];if(l&&l.toBlock?l.toBlock===r:0===n.blocks.indexOf(r)){var u=null==l?void 0:l.defaultValue;(null==s?void 0:s.value)&&(u=s.value),(null==l?void 0:l.isArray)||(1!==u.length&&g.Logger.Warn("Invalid non-array value length: ".concat(u.length)),u=u[0]),(null==l?void 0:l.dataTransformer)&&(u=l.dataTransformer(u,this)),void 0!==u&&(t.config[(null==l?void 0:l.name)||i]={value:u})}}},e.prototype._parseNodeConnections=function(e){for(var t,n,r,o,a,i,s,l,u,c,f,h,d,p,m,_,y,b,v,T=0;T<this._nodes.length;T++){var x=null===(t=this._interactivityGraph.nodes)||void 0===t?void 0:t[T];if(!x)throw g.Logger.Error(["No node found for interactivity node",this._nodes[T]]),new Error("Error parsing node connections");var A=this._nodes[T],w=this._mappings[x.declaration];if(!w)throw g.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var O=x.flows||{},C=Object.keys(O).sort(),E=function(e){var t=O[e],u=null===(r=null===(n=w.flowGraphMapping.outputs)||void 0===n?void 0:n.flows)||void 0===r?void 0:r[e],c=(null==u?void 0:u.name)||e,f=M._createNewSocketConnection(c,!0);(u&&u.toBlock&&A.blocks.find((function(e){return e.className===u.toBlock}))||A.blocks[0]).signalOutputs.push(f);var h=t.node,d=M._nodes[h];if(!d)throw g.Logger.Error(["No node found for input node id",h]),new Error("Error parsing node connections");var p=Sn(d.fullOperationName);if(!p)throw g.Logger.Error(["No mapping found for input node",d]),new Error("Error parsing node connections");var m=null===(a=null===(o=p.inputs)||void 0===o?void 0:o.flows)||void 0===a?void 0:a[t.socket||"in"],_=!1;if(!m)for(var y in null===(i=p.inputs)||void 0===i?void 0:i.flows)y.startsWith("[")&&y.endsWith("]")&&(_=!0,m=null===(l=null===(s=p.inputs)||void 0===s?void 0:s.flows)||void 0===l?void 0:l[y]);var b=m?_?m.name.replace("$1",t.socket||""):m.name:t.socket||"in",v=m&&m.toBlock&&d.blocks.find((function(e){return e.className===m.toBlock}))||d.blocks[0],T=v.signalInputs.find((function(e){return e.name===b}));T||(T=M._createNewSocketConnection(b),v.signalInputs.push(T)),T.connectedPointIds.push(f.uniqueId),f.connectedPointIds.push(T.uniqueId)},M=this,F=0,R=C;F<R.length;F++)E(R[F]);for(var P=x.values||{},L=Object.keys(P),N=function(t){var n=P[t],r=null===(c=null===(u=w.flowGraphMapping.inputs)||void 0===u?void 0:u.values)||void 0===c?void 0:c[t],o=!1;if(!r)for(var a in null===(f=w.flowGraphMapping.inputs)||void 0===f?void 0:f.values)a.startsWith("[")&&a.endsWith("]")&&(o=!0,r=null===(d=null===(h=w.flowGraphMapping.inputs)||void 0===h?void 0:h.values)||void 0===d?void 0:d[a]);var i=r?o?r.name.replace("$1",t):r.name:t,s=I._createNewSocketConnection(i);if((r&&r.toBlock&&A.blocks.find((function(e){return e.className===r.toBlock}))||A.blocks[0]).dataInputs.push(s),void 0!==n.value){var l=I._parseVariable(n,r&&r.dataTransformer);e._connectionValues[s.uniqueId]=l}else{if(void 0===n.node)throw g.Logger.Error(["Invalid value for value connection",n]),new Error("Error parsing node connections");var v=n.node,T=n.socket||"value",x=I._nodes[v];if(!x)throw g.Logger.Error(["No node found for output socket reference",n]),new Error("Error parsing node connections");var O=Sn(x.fullOperationName);if(!O)throw g.Logger.Error(["No mapping found for output socket reference",n]),new Error("Error parsing node connections");var C=null===(m=null===(p=O.outputs)||void 0===p?void 0:p.values)||void 0===m?void 0:m[T],E=!1;if(!C)for(var a in null===(_=O.outputs)||void 0===_?void 0:_.values)a.startsWith("[")&&a.endsWith("]")&&(E=!0,C=null===(b=null===(y=O.outputs)||void 0===y?void 0:y.values)||void 0===b?void 0:b[a]);var M=C?E?C.name.replace("$1",T):null==C?void 0:C.name:T,F=C&&C.toBlock&&x.blocks.find((function(e){return e.className===C.toBlock}))||x.blocks[0],R=F.dataOutputs.find((function(e){return e.name===M}));R||(R=I._createNewSocketConnection(M,!0),F.dataOutputs.push(R)),s.connectedPointIds.push(R.uniqueId),R.connectedPointIds.push(s.uniqueId)}},I=this,S=0,B=L;S<B.length;S++)N(B[S]);if(w.flowGraphMapping.interBlockConnectors)for(var k=0,G=w.flowGraphMapping.interBlockConnectors;k<G.length;k++){var V=G[k],D=V.input,H=V.output,U=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],U)}if(w.flowGraphMapping.extraProcessor){var j=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!j)throw g.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=w.flowGraphMapping.extraProcessor(x,j,w.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,t){return{uniqueId:(0,g.RandomGUID)(),name:e,_connectionType:t?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:(0,g.RandomGUID)(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var t=0;t<this._staticVariables.length;t++){var n=this._staticVariables[t];e._userVariables[this.getVariableName(t)]=n}return{rightHanded:!0,allBlocks:this._nodes.reduce((function(e,t){return e.concat(t.blocks)}),[]),executionContexts:[e]}},e}(),Wn="KHR_interactivity",Yn=function(){function e(e){this._loader=e,this.name=Wn,this.enabled=this._loader.isExtensionUsed(Wn),this._pathConverter=(0,Ne.Wt)(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(0,L.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(t=null===(o=this._loader.gltf.extensions)||void 0===o?void 0:o.KHR_interactivity)?((n=new g.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,r=t.graphs.map((function(e){return new Kn(e,a._loader.gltf,a._loader.parent.targetFps).serializeToFlowGraph()})),[4,Promise.all(r.map((function(e){return(0,L.sH)(a,void 0,void 0,(function(){return(0,L.YH)(this,(function(t){switch(t.label){case 0:return[4,(0,g.ParseFlowGraphAsync)(e,{coordinator:n,pathConverter:this._pathConverter})];case 1:return[2,t.sent()]}}))}))})))]):[2]):[2];case 1:return i.sent(),n.start(),[2]}}))}))},e}();function zn(e){(0,Ne.oR)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new g.Quaternion(NaN,NaN,NaN,NaN);var t=g.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:function(){return e.activeCamera}}),(0,Ne.oR)("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new g.Vector3(NaN,NaN,NaN);var t=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(t.x*=-1),t},type:"Vector3",getTarget:function(){return e.activeCamera}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}})}(0,g.addToBlockFactory)(Wn,"FlowGraphGLTFDataProvider",(function(){return(0,L.sH)(void 0,void 0,void 0,(function(){return(0,L.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(a.bind(a,274))];case 1:return[2,e.sent().FlowGraphGLTFDataProvider]}}))}))})),Le(Wn),Pe(Wn,!0,(function(e){return new Yn(e)}));var Zn="KHR_node_visibility";(0,Ne.oR)("/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 qn=function(){function e(e){this.name=Zn,this._loader=e,this.enabled=e.isExtensionUsed(Zn)}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}();Le(Zn),Pe(Zn,!0,(function(e){return new qn(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}}),(0,Ne.oR)("/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(0,L.sH)(this,void 0,void 0,(function(){var e;return(0,L.YH)(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}();Le(Xn),Pe(Xn,!0,(function(e){return new Qn(e)}));var Jn="KHR_node_hoverability",$n="targetMeshPointerOver_";kn("event/onHoverIn",Jn,{blocks:["FlowGraphPointerOverEventBlock","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:"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 _=$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}});var er="targetMeshPointerOut_";kn("event/onHoverOut",Jn,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return er+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 _=er+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}}),(0,Ne.oR)("/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 tr=function(){function e(e){this.name=Jn,this._loader=e,this.enabled=e.isExtensionUsed(Jn)}return e.prototype.onReady=function(){return(0,L.sH)(this,void 0,void 0,(function(){var e;return(0,L.YH)(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}();Le(Jn),Pe(Jn,!0,(function(e){return new tr(e)}));var nr="ExtrasAsMetadata",rr=function(){function e(e){this.name=nr,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}();Le(nr),Pe(nr,!1,(function(e){return new rr(e)}));var or=a(274),ar=function(){function e(){this.materials=[]}return e.prototype.parseMTL=function(t,n,r,o){if(!(n instanceof ArrayBuffer)){for(var a,i=n.split("\n"),s=/\s+/,l=null,u=0;u<i.length;u++){var c=i[u].trim();if(0!==c.length&&"#"!==c.charAt(0)){var f=c.indexOf(" "),h=f>=0?c.substring(0,f):c;h=h.toLowerCase();var d=f>=0?c.substring(f+1).trim():"";if("newmtl"===h)l&&this.materials.push(l),t._blockEntityCollection=!!o,(l=new g.StandardMaterial(d,t))._parentContainer=o,t._blockEntityCollection=!1;else if("kd"===h&&l)a=d.split(s,3).map(parseFloat),l.diffuseColor=g.Color3.FromArray(a);else if("ka"===h&&l)a=d.split(s,3).map(parseFloat),l.ambientColor=g.Color3.FromArray(a);else if("ks"===h&&l)a=d.split(s,3).map(parseFloat),l.specularColor=g.Color3.FromArray(a);else if("ke"===h&&l)a=d.split(s,3).map(parseFloat),l.emissiveColor=g.Color3.FromArray(a);else if("ns"===h&&l)l.specularPower=parseFloat(d);else if("d"===h&&l)l.alpha=parseFloat(d);else if("map_ka"===h&&l)l.ambientTexture=e._GetTexture(r,d,t);else if("map_kd"===h&&l)l.diffuseTexture=e._GetTexture(r,d,t);else if("map_ks"===h&&l)l.specularTexture=e._GetTexture(r,d,t);else if("map_ns"===h);else if("map_bump"===h&&l){var p=d.split(s),m=p.indexOf("-bm"),_=null;m>=0&&(_=p[m+1],p.splice(m,2)),l.bumpTexture=e._GetTexture(r,p.join(" "),t),l.bumpTexture&&null!==_&&(l.bumpTexture.level=parseFloat(_))}else"map_d"===h&&l&&(l.opacityTexture=e._GetTexture(r,d,t))}}l&&this.materials.push(l)}},e._GetTexture=function(t,n,r){if(!n)return null;var o=t;if("file:"===t){var a=n.lastIndexOf("\\");-1===a&&(a=n.lastIndexOf("/")),o+=a>-1?n.substring(a+1):n}else o+=n;return new g.Texture(o,r,!1,e.INVERT_TEXTURE_Y)},e.INVERT_TEXTURE_Y=!0,e}(),ir=function(){function e(e,t,n){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._extColors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new g.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=e,this._babylonMeshesArray=t,this._loadingOptions=n}return e.prototype._isInArray=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[]});var n=e[t[0]].normals.indexOf(t[1]);return-1===n?-1:e[t[0]].idx[n]},e.prototype._isInArrayUV=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[],uv:[]});var n=e[t[0]].normals.indexOf(t[1]);return 1!=n&&t[2]===e[t[0]].uv[n]?e[t[0]].idx[n]:-1},e.prototype._setData=function(e){var t,n,r;null!==(t=e.indiceUvsFromObj)&&void 0!==t||(e.indiceUvsFromObj=-1),null!==(n=e.indiceNormalFromObj)&&void 0!==n||(e.indiceNormalFromObj=-1),-1===(r=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj,e.indiceUvsFromObj]):this._isInArray(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(e.positionVectorFromOBJ),void 0!==e.textureVectorFromOBJ&&this._wrappedUvsForBabylon.push(e.textureVectorFromOBJ),void 0!==e.normalsVectorFromOBJ&&this._wrappedNormalsForBabylon.push(e.normalsVectorFromOBJ),void 0!==e.positionColorsFromOBJ&&this._wrappedColorsForBabylon.push(e.positionColorsFromOBJ),this._tuplePosNorm[e.indicePositionFromObj].normals.push(e.indiceNormalFromObj),this._tuplePosNorm[e.indicePositionFromObj].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[e.indicePositionFromObj].uv.push(e.indiceUvsFromObj)):this._indicesForBabylon.push(r)},e.prototype._unwrapData=function(){try{for(var e=0;e<this._wrappedPositionForBabylon.length;e++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[e].x*this._handednessSign,this._wrappedPositionForBabylon[e].y,this._wrappedPositionForBabylon[e].z),this._wrappedNormalsForBabylon.length&&this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[e].x*this._handednessSign,this._wrappedNormalsForBabylon[e].y,this._wrappedNormalsForBabylon[e].z),this._wrappedUvsForBabylon.length&&this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[e].x,this._wrappedUvsForBabylon[e].y),this._unwrappedColorsForBabylon.length&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[e].r,this._wrappedColorsForBabylon[e].g,this._wrappedColorsForBabylon[e].b,this._wrappedColorsForBabylon[e].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0}catch(e){throw new Error("Unable to unwrap data while parsing OBJ data.")}},e.prototype._getTriangles=function(e,t){for(var n=t;n<e.length-1;n++)this._pushTriangle(e,n)},e.prototype._getColor=function(e){var t;return this._loadingOptions.importVertexColors?null!==(t=this._extColors[e])&&void 0!==t?t:this._colors[e]:void 0},e.prototype._setDataForCurrentFaceWithPattern1=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=parseInt(this._triangles[n])-1;this._setData({indicePositionFromObj:r,positionVectorFromOBJ:this._positions[r],positionColorsFromOBJ:this._getColor(r)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern2=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern3=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1,i=parseInt(r[2])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i]})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern4=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("//"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceNormalFromObj:a,positionVectorFromOBJ:this._positions[o],normalsVectorFromOBJ:this._normals[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern5=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=this._positions.length+parseInt(r[0]),a=this._uvs.length+parseInt(r[1]),i=this._normals.length+parseInt(r[2]);this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice()),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon.slice()),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._handledMesh.hasLines=this._hasLineData,this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},e.prototype._optimizeNormals=function(e){var t=e.getVerticesData(g.VertexBuffer.PositionKind),n=e.getVerticesData(g.VertexBuffer.NormalKind),r={};if(t&&n){for(var o=0;o<t.length/3;o++)(s=r[i=t[3*o+0]+"_"+t[3*o+1]+"_"+t[3*o+2]])||(s=[],r[i]=s),s.push(o);var a=new g.Vector3;for(var i in r){var s;if(!((s=r[i]).length<2)){var l=s[0];for(o=1;o<s.length;++o){var u=s[o];n[3*l+0]+=n[3*u+0],n[3*l+1]+=n[3*u+1],n[3*l+2]+=n[3*u+2]}for(a.copyFromFloats(n[3*l+0],n[3*l+1],n[3*l+2]),a.normalize(),o=0;o<s.length;++o)n[3*(u=s[o])+0]=a.x,n[3*u+1]=a.y,n[3*u+2]=a.z}}e.setVerticesData(g.VertexBuffer.NormalKind,n)}},e._IsLineElement=function(e){return e.startsWith("l")},e._IsObjectElement=function(e){return e.startsWith("o")},e._IsGroupElement=function(e){return e.startsWith("g")},e._GetZbrushMRGB=function(e,t){if(!e.startsWith("mrgb"))return null;if(e=e.replace("mrgb","").trim(),t)return[];var n=e.match(/[a-z0-9]/g);if(!n||n.length%8!=0)return[];for(var r=[],o=0;o<n.length/8;o++){var a=n[8*o+2]+n[8*o+3],i=n[8*o+4]+n[8*o+5],s=n[8*o+6]+n[8*o+7];r.push(new g.Color4(parseInt(a,16)/255,parseInt(i,16)/255,parseInt(s,16)/255,1))}return r},e.prototype.parse=function(t,n,r,o,a){var i,s,l=this;n=(n=n.replace(/#MRGB/g,"mrgb")).replace(/#.*$/gm,"").trim(),this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(e,t){return l._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=1):r.useRightHandedSystem?(this._pushTriangle=function(e,t){return l._triangles.push(e[0],e[t+1],e[t])},this._handednessSign=1):(this._pushTriangle=function(e,t){return l._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=-1);var u=n.split("\n"),c=[],f=[];c.push(f);for(var h=0;h<u.length;h++)if(0!==(_=u[h].trim().replace(/\s\s/g," ")).length&&"#"!==_.charAt(0))if((e._IsGroupElement(_)||e._IsObjectElement(_))&&(f=[],c.push(f)),e._IsLineElement(_))for(var d=_.split(" "),p=1;p<d.length-1;p++)f.push("l ".concat(d[p]," ").concat(d[p+1]));else f.push(_);var m=c.flat();for(h=0;h<m.length;h++){var _,y=void 0;if(0!==(_=m[h].trim().replace(/\s\s/g," ")).length&&"#"!==_.charAt(0))if(e.VertexPattern.test(_)){if(y=_.match(/[^ ]+/g),this._positions.push(new g.Vector3(parseFloat(y[1]),parseFloat(y[2]),parseFloat(y[3]))),this._loadingOptions.importVertexColors)if(y.length>=7){var b=parseFloat(y[4]),v=parseFloat(y[5]),T=parseFloat(y[6]);this._colors.push(new g.Color4(b>1?b/255:b,v>1?v/255:v,T>1?T/255:T,7===y.length||void 0===y[7]?1:parseFloat(y[7])))}else this._colors.push(this._grayColor)}else if(null!==(y=e.NormalPattern.exec(_)))this._normals.push(new g.Vector3(parseFloat(y[1]),parseFloat(y[2]),parseFloat(y[3])));else if(null!==(y=e.UVPattern.exec(_)))this._uvs.push(new g.Vector2(parseFloat(y[1])*this._loadingOptions.UVScaling.x,parseFloat(y[2])*this._loadingOptions.UVScaling.y));else if(null!==(y=e.FacePattern3.exec(_)))this._setDataForCurrentFaceWithPattern3(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern4.exec(_)))this._setDataForCurrentFaceWithPattern4(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern5.exec(_)))this._setDataForCurrentFaceWithPattern5(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern2.exec(_)))this._setDataForCurrentFaceWithPattern2(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern1.exec(_)))this._setDataForCurrentFaceWithPattern1(y[1].trim().split(" "),1);else if(null!==(y=e.LinePattern1.exec(_)))this._setDataForCurrentFaceWithPattern1(y[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(y=e.LinePattern2.exec(_)))this._setDataForCurrentFaceWithPattern2(y[1].trim().split(" "),0),this._hasLineData=!0;else if(y=e._GetZbrushMRGB(_,!this._loadingOptions.importVertexColors))for(var x=0,A=y;x<A.length;x++){var w=A[x];this._extColors.push(w)}else if(null!==(y=e.LinePattern3.exec(_)))this._setDataForCurrentFaceWithPattern3(y[1].trim().split(" "),0),this._hasLineData=!0;else if(e.GroupDescriptor.test(_)||e.ObjectDescriptor.test(_)){var O={name:_.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:e.ObjectDescriptor.test(_)};this._addPreviousObjMesh(),this._meshesFromObj.push(O),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else e.UseMtlDescriptor.test(_)?(this._materialNameFromObj=_.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),O={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(O),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):e.MtlLibGroupDescriptor.test(_)?a(_.substring(7).trim()):e.SmoothDescriptor.test(_)||g.Logger.Log("Unhandled expression at line : "+_)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon),this._handledMesh.hasLines=this._hasLineData),!this._hasMeshes){var C=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var E=0,M=this._positions;E<M.length;E++){var F=M[E];this._unwrappedPositionsForBabylon.push(F.x,F.y,F.z)}if(this._normals.length)for(var R=0,P=this._normals;R<P.length;R++){var L=P[R];this._unwrappedNormalsForBabylon.push(L.x,L.y,L.z)}if(this._uvs.length)for(var N=0,I=this._uvs;N<I.length;N++){var S=I[N];this._unwrappedUVForBabylon.push(S.x,S.y)}if(this._extColors.length)for(var B=0,k=this._extColors;B<k.length;B++){var G=k[B];this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a)}else if(this._colors.length)for(var V=0,D=this._colors;V<D.length;V++)G=D[V],this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a);this._materialNameFromObj||((C=new g.StandardMaterial(g.Geometry.RandomId(),r)).pointsCloud=!0,this._materialNameFromObj=C.name,this._normals.length||(C.disableLighting=!0,C.emissiveColor=g.Color3.White()))}this._meshesFromObj.push({name:g.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:C,isObject:!0,hasLines:this._hasLineData})}for(var H=0;H<this._meshesFromObj.length;H++){if(t&&this._meshesFromObj[H].name)if(t instanceof Array){if(-1===t.indexOf(this._meshesFromObj[H].name))continue}else if(this._meshesFromObj[H].name!==t)continue;this._handledMesh=this._meshesFromObj[H],r._blockEntityCollection=!!o;var U=new g.Mesh(this._meshesFromObj[H].name,r);if(U._parentContainer=o,r._blockEntityCollection=!1,this._handledMesh._babylonMesh=U,!this._handledMesh.isObject)for(var j=H-1;j>=0;--j)if(this._meshesFromObj[j].isObject&&this._meshesFromObj[j]._babylonMesh){U.parent=this._meshesFromObj[j]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[H].materialName),this._handledMesh.hasLines&&(null!==(i=U._internalMetadata)&&void 0!==i||(U._internalMetadata={}),U._internalMetadata._isLine=!0),0!==(null===(s=this._handledMesh.positions)||void 0===s?void 0:s.length)){var K=new g.VertexData;if(K.indices=this._handledMesh.indices,K.positions=this._handledMesh.positions,this._loadingOptions.computeNormals||!this._handledMesh.normals){var W=new Array;g.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,W),K.normals=W}else K.normals=this._handledMesh.normals;this._handledMesh.uvs&&(K.uvs=this._handledMesh.uvs),this._handledMesh.colors&&(K.colors=this._handledMesh.colors),K.applyToMesh(U),this._loadingOptions.invertY&&(U.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(U),this._babylonMeshesArray.push(U),this._handledMesh.directMaterial&&(U.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(U)}},e.ObjectDescriptor=/^o/,e.GroupDescriptor=/^g/,e.MtlLibGroupDescriptor=/^mtllib /,e.UseMtlDescriptor=/^usemtl /,e.SmoothDescriptor=/^s /,e.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,e.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,e.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,e.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,e.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e}(),sr=function(){function e(t){this.name="obj",this.extensions=".obj",this._assetContainer=null,this._loadingOptions=(0,L.Cl)((0,L.Cl)({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"INVERT_TEXTURE_Y",{get:function(){return ar.INVERT_TEXTURE_Y},set:function(e){ar.INVERT_TEXTURE_Y=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{computeNormals:e.COMPUTE_NORMALS,optimizeNormals:e.OPTIMIZE_NORMALS,importVertexColors:e.IMPORT_VERTEX_COLORS,invertY:e.INVERT_Y,invertTextureY:e.INVERT_TEXTURE_Y,UVScaling:e.UV_SCALING,materialLoadingFailsSilently:e.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:e.OPTIMIZE_WITH_UV,skipMaterials:e.SKIP_MATERIALS,useLegacyBehavior:e.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),e.prototype._loadMTL=function(e,t,n,r){var o=t+e;g.Tools.LoadFile(o,n,void 0,void 0,!1,(function(e,t){r(o,t)}))},e.prototype.createPlugin=function(t){return new e(t.obj)},e.prototype.canDirectLoad=function(){return!1},e.prototype.importMeshAsync=function(e,t,n,r){return this._parseSolidAsync(e,t,n,r).then((function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then((function(){}))},e.prototype.loadAssetContainerAsync=function(e,t,n){var r=this,o=new g.AssetContainer(e);return this._assetContainer=o,this.importMeshAsync(null,e,t,n).then((function(e){return e.meshes.forEach((function(e){return o.meshes.push(e)})),e.meshes.forEach((function(e){var t=e.material;t&&-1==o.materials.indexOf(t)&&(o.materials.push(t),t.getActiveTextures().forEach((function(e){-1==o.textures.indexOf(e)&&o.textures.push(e)})))})),r._assetContainer=null,o})).catch((function(e){throw r._assetContainer=null,e}))},e.prototype._parseSolidAsync=function(e,t,n,r){var o=this,a="",i=new ar,s=[],l=[];n=n.replace(/#.*$/gm,"").trim(),new ir(s,l,this._loadingOptions).parse(e,n,t,this._assetContainer,(function(e){a=e}));var u=[];return""===a||this._loadingOptions.skipMaterials||u.push(new Promise((function(e,n){o._loadMTL(a,r,(function(u){try{i.parseMTL(t,u,r,o._assetContainer);for(var c=0;c<i.materials.length;c++){for(var f=0,h=[],d=void 0;(d=s.indexOf(i.materials[c].name,f))>-1;)h.push(d),f=d+1;if(-1===d&&0===h.length)i.materials[c].dispose();else for(var p=0;p<h.length;p++){var m=l[h[p]],_=i.materials[c];m.material=_,m.getTotalIndices()||(_.pointsCloud=!0)}}e()}catch(t){g.Tools.Warn("Error processing MTL file: '".concat(a,"'")),o._loadingOptions.materialLoadingFailsSilently?e():n(t)}}),(function(t,r){g.Tools.Warn("Error downloading MTL file: '".concat(a,"'")),o._loadingOptions.materialLoadingFailsSilently?e():n(r)}))}))),Promise.all(u).then((function(){var e=function(e){var t,n;return Boolean(null!==(n=null===(t=e._internalMetadata)||void 0===t?void 0:t._isLine)&&void 0!==n&&n)};return l.forEach((function(n){var r,o;if(e(n)){var a=null!==(r=n.material)&&void 0!==r?r:new g.StandardMaterial(n.name+"_line",t);a.getBindedMeshes().filter((function(t){return!e(t)})).length>0&&(a=null!==(o=a.clone(a.name+"_line"))&&void 0!==o?o:a),a.wireframe=!0,n.material=a,n._internalMetadata&&(n._internalMetadata._isLine=void 0)}})),l}))},e.OPTIMIZE_WITH_UV=!0,e.INVERT_Y=!1,e.IMPORT_VERTEX_COLORS=!1,e.COMPUTE_NORMALS=!1,e.OPTIMIZE_NORMALS=!1,e.UV_SCALING=new g.Vector2(1,1),e.SKIP_MATERIALS=!1,e.MATERIAL_LOADING_FAILS_SILENTLY=!0,e.USE_LEGACY_BEHAVIOR=!1,e}();(0,g.RegisterSceneLoaderPlugin)(new sr);var lr={".stl":{isBinary:!0}},ur=function(){function e(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name="stl",this.extensions=lr}return e.prototype.importMesh=function(e,t,n,r,o){var a;if("string"!=typeof n){if(this._isBinary(n)){var i=new g.Mesh("stlmesh",t);return this._parseBinary(i,n),o&&o.push(i),!0}n=(new TextDecoder).decode(new Uint8Array(n))}for(;a=this.solidPattern.exec(n);){var s=a[1],l=a[3];if(l&&s!=l)return g.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(e&&s)if(e instanceof Array){if(!e.indexOf(s))continue}else if(s!==e)continue;s=s||"stlmesh",i=new g.Mesh(s,t),this._parseASCII(i,a[2]),o&&o.push(i)}return!0},e.prototype.load=function(e,t,n){return this.importMesh(null,e,t,n,null)},e.prototype.loadAssetContainer=function(e,t,n){var r=new g.AssetContainer(e);return e._blockEntityCollection=!0,this.importMesh(null,e,t,n,r.meshes),e._blockEntityCollection=!1,r},e.prototype._isBinary=function(e){var t=new DataView(e);if(t.byteLength<=80)return!1;if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var n=[115,111,108,105,100],r=0;r<5;r++)if(t.getUint8(r)!==n[r])return!0;return!1},e.prototype._parseBinary=function(t,n){for(var r=new DataView(n),o=r.getUint32(80,!0),a=0,i=new Float32Array(3*o*3),s=new Float32Array(3*o*3),l=new Uint32Array(3*o),u=0,c=0;c<o;c++){for(var f=84+50*c,h=r.getFloat32(f,!0),d=r.getFloat32(f+4,!0),p=r.getFloat32(f+8,!0),m=1;m<=3;m++){var _=f+12*m;i[a]=r.getFloat32(_,!0),s[a]=h,e.DO_NOT_ALTER_FILE_COORDINATES?(i[a+1]=r.getFloat32(_+4,!0),i[a+2]=r.getFloat32(_+8,!0),s[a+1]=d,s[a+2]=p):(i[a+2]=r.getFloat32(_+4,!0),i[a+1]=r.getFloat32(_+8,!0),s[a+2]=d,s[a+1]=p),a+=3}e.DO_NOT_ALTER_FILE_COORDINATES?(l[u]=u,l[u+1]=u+2,l[u+2]=u+1,u+=3):(l[u]=u++,l[u]=u++,l[u]=u++)}t.setVerticesData(g.VertexBuffer.PositionKind,i),t.setVerticesData(g.VertexBuffer.NormalKind,s),t.setIndices(l),t.computeWorldMatrix(!0)},e.prototype._parseASCII=function(t,n){for(var r,o=[],a=[],i=[],s=0;r=this.facetsPattern.exec(n);){var l=r[1],u=this.normalPattern.exec(l);if(this.normalPattern.lastIndex=0,u){for(var c=[Number(u[1]),Number(u[5]),Number(u[3])],f=void 0;f=this.vertexPattern.exec(l);)e.DO_NOT_ALTER_FILE_COORDINATES?(o.push(Number(f[1]),Number(f[3]),Number(f[5])),a.push(c[0],c[2],c[1])):(o.push(Number(f[1]),Number(f[5]),Number(f[3])),a.push(c[0],c[1],c[2]));e.DO_NOT_ALTER_FILE_COORDINATES?(i.push(s,s+2,s+1),s+=3):i.push(s++,s++,s++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,t.setVerticesData(g.VertexBuffer.PositionKind,o),t.setVerticesData(g.VertexBuffer.NormalKind,a),t.setIndices(i),t.computeWorldMatrix(!0)},e.DO_NOT_ALTER_FILE_COORDINATES=!1,e}();(0,g.RegisterSceneLoaderPlugin)(new ur);var cr="splat",fr={".splat":{isBinary:!0},".ply":{isBinary:!0},".spz":{isBinary:!0},".json":{isBinary:!1},".sog":{isBinary:!0}},hr=.28209479177387814;function dr(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r,o){var a,i=n.createCanvasImage();if(!i)throw new Error("Failed to create ImageBitmap");if(i.onload=function(){try{var e=n.createCanvas(i.width,i.height);if(!e)throw new Error("Failed to create canvas");var t=e.getContext("2d");if(!t)throw new Error("Failed to get 2D context");t.drawImage(i,0,0);var a=t.getImageData(0,0,e.width,e.height);r({bits:new Uint8Array(a.data.buffer),width:a.width})}catch(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))}},i.onerror=function(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))},i.crossOrigin="anonymous","string"==typeof e){if(!t)throw new Error("filename is required when using a URL");i.src=e+t}else{var s=new Blob([e],{type:"image/webp"});a=URL.createObjectURL(s),i.src=a}}))];case 1:return[2,r.sent()]}}))}))}function pr(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c,f,h,d,p,m,_,y,b,v,T,x,A,w,O,C,E,M,F,R,P,N,I,S,B,k,G,V,D,H,U,j,K,W,Y,z,Z,q,X,Q,J,$,ee,te,ne,re,oe,ae,ie,se,le,ue,ce,fe,he,de,pe;return(0,L.YH)(this,(function(L){switch(L.label){case 0:if(r=e.count?e.count:e.means.shape[0],o=new ArrayBuffer(32*r),a=new Float32Array(o),i=new Float32Array(o),s=new Uint8ClampedArray(o),l=new Uint8ClampedArray(o),u=function(e){return Math.sign(e)*(Math.exp(Math.abs(e))-1)},c=t[0].bits,f=t[1].bits,!Array.isArray(e.means.mins)||!Array.isArray(e.means.maxs))throw new Error("Missing arrays in SOG data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<3;se++)h=e.means.mins[se],d=e.means.maxs[se],p=f[w+se],m=c[w+se],U=p<<8|m,ne=g.Scalar.Lerp(h,d,U/65535),a[8*te+se]=u(ne);if(_=t[2].bits,2===e.version){if(!e.scales.codebook)throw new Error("Missing codebook in SOG version 2 scales data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<3;se++)b=e.scales.codebook[_[w+se]],y=Math.exp(b),i[8*te+3+se]=y}else{if(!Array.isArray(e.scales.mins)||!Array.isArray(e.scales.maxs))throw new Error("Missing arrays in SOG scales data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<3;se++)b=_[w+se],v=g.Scalar.Lerp(e.scales.mins[se],e.scales.maxs[se],b/255),T=Math.exp(v),i[8*te+3+se]=T}if(x=t[4].bits,2===e.version){if(!e.sh0.codebook)throw new Error("Missing codebook in SOG version 2 sh0 data.");for(te=0;te<r;te++){for(w=4*te,se=0;se<3;se++)A=.5+e.sh0.codebook[x[w+se]]*hr,s[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*A)));s[32*te+24+3]=x[w+3]}}else{if(!Array.isArray(e.sh0.mins)||!Array.isArray(e.sh0.maxs))throw new Error("Missing arrays in SOG sh0 data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<4;se++)O=e.sh0.mins[se],C=e.sh0.maxs[se],E=x[w+se],G=g.Scalar.Lerp(O,C,E/255),void 0,M=se<3?.5+G*hr:1/(1+Math.exp(-G)),s[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*M)))}for(F=function(e){return 2*(e/255-.5)/Math.SQRT2},R=t[3].bits,te=0;te<r;te++){switch(P=R[4*te+0],N=R[4*te+1],I=R[4*te+2],S=R[4*te+3],B=F(P),k=F(N),G=F(I),V=S-252,D=B*B+k*k+G*G,H=Math.sqrt(Math.max(0,1-D)),U=void 0,V){case 0:U=[H,B,k,G];break;case 1:U=[B,H,k,G];break;case 2:U=[B,k,H,G];break;case 3:U=[B,k,G,H];break;default:throw new Error("Invalid quaternion mode")}l[32*te+28+0]=127.5*U[0]+127.5,l[32*te+28+1]=127.5*U[1]+127.5,l[32*te+28+2]=127.5*U[2]+127.5,l[32*te+28+3]=127.5*U[3]+127.5}if(!e.shN)return[3,2];for(j=[0,3,8,15],K=e.shN.bands?j[e.shN.bands]:e.shN.shape[1]/3,W=t[5].bits,Y=t[6].bits,z=t[5].width,Z=3*K,q=Math.ceil(Z/16),X=[],Q=n.getEngine(),J=Q.getCaps().maxTextureSize,$=Math.ceil(r/J),ce=0;ce<q;ce++)ee=new Uint8Array($*J*4*4),X.push(ee);if(2===e.version){if(!e.shN.codebook)throw new Error("Missing codebook in SOG version 2 shN data.");for(te=0;te<r;te++)for(ne=Y[4*te+0]+(Y[4*te+1]<<8),re=ne%64*K,oe=Math.floor(ne/64),le=0;le<K;le++)for(se=0;se<3;se++)ue=3*le+se,ce=Math.floor(ue/16),fe=X[ce],he=ue%16,de=16*te,pe=127.5*e.shN.codebook[W[4*(re+le)+se+oe*z*4]]+127.5,fe[he+de]=Math.max(0,Math.min(255,pe))}else for(te=0;te<r;te++)for(ne=Y[4*te+0]+(Y[4*te+1]<<8),re=ne%64*K,oe=Math.floor(ne/64),ae=e.shN.mins,ie=e.shN.maxs,se=0;se<3;se++)for(le=0;le<K/3;le++)ue=3*le+se,ce=Math.floor(ue/16),fe=X[ce],he=ue%16,de=16*te,pe=127.5*g.Scalar.Lerp(ae,ie,W[4*(re+le)+se+oe*z*4]/255)+127.5,fe[he+de]=Math.max(0,Math.min(255,pe));return[4,new Promise((function(e){e({mode:0,data:o,hasVertexColors:!1,sh:X})}))];case 1:case 3:return[2,L.sent()];case 2:return[4,new Promise((function(e){e({mode:0,data:o,hasVertexColors:!1})}))]}}))}))}function mr(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l=this;return(0,L.YH)(this,(function(u){switch(u.label){case 0:if(e instanceof Map){if(!(a=(o=e).get("meta.json")))throw new Error("meta.json not found in files Map");r=JSON.parse((new TextDecoder).decode(a))}else r=e;return i=(0,L.fX)((0,L.fX)((0,L.fX)((0,L.fX)([],r.means.files,!0),r.scales.files,!0),r.quats.files,!0),r.sh0.files,!0),r.shN&&i.push.apply(i,r.shN.files),[4,Promise.all(i.map((function(e){return(0,L.sH)(l,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return o&&o.has(e)?[4,dr(o.get(e),e,n.getEngine())]:[3,2];case 1:case 3:return[2,r.sent()];case 2:return[4,dr(t,e,n.getEngine())]}}))}))})))];case 1:return s=u.sent(),[4,pr(r,s,n)];case 2:return[2,u.sent()]}}))}))}var _r=function(){function e(t){void 0===t&&(t=e._DefaultLoadingOptions),this.name=cr,this._assetContainer=null,this.extensions=fr,this._loadingOptions=t}return e.prototype.createPlugin=function(t){return new e(t[cr])},e.prototype.importMeshAsync=function(e,t,n,r,o,a){return(0,L.sH)(this,void 0,void 0,(function(){return(0,L.YH)(this,(function(o){switch(o.label){case 0:return[4,this._parseAsync(e,t,n,r).then((function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))];case 1:return[2,o.sent()]}}))}))},e._BuildPointCloud=function(e,t){if(!t.byteLength)return!1;var n=new Uint8Array(t),r=new Float32Array(t),o=n.length/32;return e.addPoints(o,(function(e,t){var o=r[8*t+0],a=r[8*t+1],i=r[8*t+2];e.position=new g.Vector3(o,a,i);var s=n[32*t+24+0]/255,l=n[32*t+24+1]/255,u=n[32*t+24+2]/255;e.color=new g.Color4(s,l,u,1)})),!0},e._BuildMesh=function(e,t){for(var n=new g.Mesh("PLYMesh",e),r=new Uint8Array(t.data),o=new Float32Array(t.data),a=r.length/32,i=[],s=new g.VertexData,l=0;l<a;l++){var u=o[8*l+0],c=o[8*l+1],f=o[8*l+2];i.push(u,c,f)}if(t.hasVertexColors){var h=new Float32Array(4*a);for(l=0;l<a;l++){var d=r[32*l+24+0]/255,p=r[32*l+24+1]/255,m=r[32*l+24+2]/255;h[4*l+0]=d,h[4*l+1]=p,h[4*l+2]=m,h[4*l+3]=1}s.colors=h}return s.positions=i,s.indices=t.faces,s.applyToMesh(n),n},e.prototype._unzipWithFFlateAsync=function(e){return(0,L.sH)(this,void 0,void 0,(function(){var t,n,r,o,a,i,s,l,u,c;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return(t=this._loadingOptions.fflate)?[3,3]:void 0!==window.fflate?[3,2]:[4,g.Tools.LoadScriptAsync(null!==(c=this._loadingOptions.deflateURL)&&void 0!==c?c:"https://unpkg.com/fflate/umd/index.js")];case 1:f.sent(),f.label=2;case 2:t=window.fflate,f.label=3;case 3:for(n=t.unzipSync,r=n(e),o=new Map,a=0,i=Object.entries(r);a<i.length;a++)s=i[a],l=s[0],u=s[1],o.set(l,u);return[2,o]}}))}))},e.prototype._parseAsync=function(t,n,r,o){var a=this,i=[],s=function(e){var t;n._blockEntityCollection=!!a._assetContainer;var r=null!==(t=a._loadingOptions.gaussianSplattingMesh)&&void 0!==t?t:new g.GaussianSplattingMesh("GaussianSplatting",null,n,a._loadingOptions.keepInRam);r._parentContainer=a._assetContainer,i.push(r),r.updateData(e.data,e.sh,{flipY:!1}),r.scaling.y*=-1,r.computeWorldMatrix(!0),n._blockEntityCollection=!1};if("string"==typeof r){var l=JSON.parse(r);if(l&&l.means&&l.scales&&l.quats&&l.sh0)return new Promise((function(e){mr(l,o,n).then((function(t){s(t),e(i)})).catch((function(){throw new Error("Failed to parse SOG data.")}))}))}var u=r instanceof ArrayBuffer?new Uint8Array(r):r;if(80===u[0]&&75===u[1])return new Promise((function(e){a._unzipWithFFlateAsync(u).then((function(t){mr(t,o,n).then((function(t){s(t),e(i)})).catch((function(){throw new Error("Failed to parse SOG zip data.")}))}))}));var c=new ReadableStream({start:function(e){e.enqueue(new Uint8Array(r)),e.close()}}),f=new DecompressionStream("gzip"),h=c.pipeThrough(f);return new Promise((function(t){new Response(h).arrayBuffer().then((function(e){(function(e,t){var n=new Uint8Array(e),r=new Uint32Array(e.slice(0,12)),o=r[2],a=n[12],i=n[13],s=n[14],l=n[15],u=r[1];if(l||1347635022!=r[0]||2!=u&&3!=u)return new Promise((function(e){e({mode:3,data:c,hasVertexColors:!1})}));for(var c=new ArrayBuffer(32*o),f=1/(1<<i),h=new Int32Array(1),d=new Uint8Array(h.buffer),p=function(e,t){return d[0]=e[t+0],d[1]=e[t+1],d[2]=e[t+2],d[3]=128&e[t+2]?255:0,h[0]*f},m=16,_=new Float32Array(c),y=new Float32Array(c),b=new Uint8ClampedArray(c),v=new Uint8ClampedArray(c),T=0;T<o;T++)_[8*T+0]=p(n,m+0),_[8*T+1]=p(n,m+3),_[8*T+2]=p(n,m+6),m+=9;for(T=0;T<o;T++){for(var x=0;x<3;x++){var A=(n[m+o+3*T+x]-127.5)/38.25;b[32*T+24+x]=g.Scalar.Clamp(255*(.5+.282*A),0,255)}b[32*T+24+3]=n[m+T]}for(m+=4*o,T=0;T<o;T++)y[8*T+3+0]=Math.exp(n[m+0]/16-10),y[8*T+3+1]=Math.exp(n[m+1]/16-10),y[8*T+3+2]=Math.exp(n[m+2]/16-10),m+=3;if(u>=3){var w=Math.SQRT1_2;for(T=0;T<o;T++){for(var O=[n[m+0],n[m+1],n[m+2],n[m+3]],C=O[0]+(O[1]<<8)+(O[2]<<16)+(O[3]<<24),E=[],M=C>>>30,F=C,R=0,P=3;P>=0;--P)if(P!==M){var L=511&F,N=F>>>9&1;F>>>=10,E[P]=w*(L/511),1===N&&(E[P]=-E[P]),R+=E[P]*E[P]}var I=1-R;E[M]=Math.sqrt(Math.max(I,0));for(var S=[3,0,1,2],B=0;B<4;B++)v[32*T+28+B]=Math.round(127.5+127.5*E[S[B]]);m+=4}}else for(T=0;T<o;T++){var k=n[m+0],G=n[m+1],V=n[m+2],D=k/127.5-1,H=G/127.5-1,U=V/127.5-1;v[32*T+28+1]=k,v[32*T+28+2]=G,v[32*T+28+3]=V;var j=1-(D*D+H*H+U*U);v[32*T+28+0]=127.5+127.5*Math.sqrt(j<0?0:j),m+=3}if(a){for(var K=3*((a+1)*(a+1)-1),W=Math.ceil(K/16),Y=m,z=[],Z=t.getEngine().getCaps().maxTextureSize,q=Math.ceil(o/Z),X=0;X<W;X++){var Q=new Uint8Array(q*Z*4*4);z.push(Q)}for(T=0;T<o;T++)for(var J=0;J<K;J++){var $=n[Y++];X=Math.floor(J/16),z[X][J%16+16*T]=$}return new Promise((function(e){e({mode:0,data:c,hasVertexColors:!1,sh:z,trainedWithAntialiasing:!!s})}))}return new Promise((function(e){e({mode:0,data:c,hasVertexColors:!1,trainedWithAntialiasing:!!s})}))})(e,n,a._loadingOptions).then((function(e){var r;n._blockEntityCollection=!!a._assetContainer;var o=null!==(r=a._loadingOptions.gaussianSplattingMesh)&&void 0!==r?r:new g.GaussianSplattingMesh("GaussianSplatting",null,n,a._loadingOptions.keepInRam);if(e.trainedWithAntialiasing){var s=o.material;s.kernelSize=.1,s.compensation=!0}o._parentContainer=a._assetContainer,i.push(o),o.updateData(e.data,e.sh,{flipY:!1}),a._loadingOptions.flipY||(o.scaling.y*=-1,o.computeWorldMatrix(!0)),n._blockEntityCollection=!1,a.applyAutoCameraLimits(e,n),t(i)}))})).catch((function(){e._ConvertPLYToSplat(r).then((function(r){return(0,L.sH)(a,void 0,void 0,(function(){var o,a,s;return(0,L.YH)(this,(function(l){switch(l.label){case 0:switch(n._blockEntityCollection=!!this._assetContainer,r.mode){case 0:return[3,1];case 1:return[3,2];case 2:return[3,6]}return[3,7];case 1:switch((o=null!==(s=this._loadingOptions.gaussianSplattingMesh)&&void 0!==s?s:new g.GaussianSplattingMesh("GaussianSplatting",null,n,this._loadingOptions.keepInRam))._parentContainer=this._assetContainer,i.push(o),o.updateData(r.data,r.sh,{flipY:!1}),o.scaling.y*=-1,"RightHanded"===r.chirality&&(o.scaling.y*=-1),r.upAxis){case"X":o.rotation=new g.Vector3(0,0,Math.PI/2);break;case"Y":o.rotation=new g.Vector3(0,0,Math.PI);break;case"Z":o.rotation=new g.Vector3(-Math.PI/2,Math.PI,0)}return o.computeWorldMatrix(!0),[3,8];case 2:return a=new g.PointsCloudSystem("PointCloud",1,n),e._BuildPointCloud(a,r.data)?[4,a.buildMeshAsync().then((function(e){i.push(e)}))]:[3,4];case 3:return l.sent(),[3,5];case 4:a.dispose(),l.label=5;case 5:return[3,8];case 6:if(!r.faces)throw new Error("PLY mesh doesn't contain face informations.");return i.push(e._BuildMesh(n,r)),[3,8];case 7:throw new Error("Unsupported Splat mode");case 8:return n._blockEntityCollection=!1,this.applyAutoCameraLimits(r,n),t(i),[2]}}))}))}))}))}))},e.prototype.applyAutoCameraLimits=function(e,t){var n;if(!this._loadingOptions.disableAutoCameraLimits&&(void 0!==e.safeOrbitCameraRadiusMin||void 0!==e.safeOrbitCameraElevationMinMax)&&"ArcRotateCamera"===(null===(n=t.activeCamera)||void 0===n?void 0:n.getClassName())){var r=t.activeCamera;e.safeOrbitCameraElevationMinMax&&(r.lowerBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[1],r.upperBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[0]),e.safeOrbitCameraRadiusMin&&(r.lowerRadiusLimit=e.safeOrbitCameraRadiusMin)}},e.prototype.loadAssetContainerAsync=function(e,t,n){var r=this,o=new g.AssetContainer(e);return this._assetContainer=o,this.importMeshAsync(null,e,t,n).then((function(e){for(var t=0,n=e.meshes;t<n.length;t++){var a=n[t];o.meshes.push(a)}return r._assetContainer=null,o})).catch((function(e){throw r._assetContainer=null,e}))},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then((function(){}))},e._ConvertPLYToSplat=function(e){var t=this,n=new Uint8Array(e),r=(new TextDecoder).decode(n.slice(0,10240)),o=r.indexOf("end_header\n");if(o<0||!r)return new Promise((function(t){t({mode:0,data:e,rawSplat:!0})}));var a=parseInt(/element vertex (\d+)\n/.exec(r)[1]),i=/element face (\d+)\n/.exec(r),s=0;i&&(s=parseInt(i[1]));var l=/element chunk (\d+)\n/.exec(r),u=0;l&&(u=parseInt(l[1]));for(var c=0,f=0,h={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0},d=1,p=[],m=[],_=r.slice(0,o).split("\n"),y={},b=0,v=_;b<v.length;b++){var T=v[b];if(T.startsWith("property ")){var x=T.split(" "),A=x[1],w=x[2];if(1==d)m.push({name:w,type:A,offset:f}),f+=h[A];else if(0==d)p.push({name:w,type:A,offset:c}),c+=h[A];else if(2==d)p.push({name:w,type:A,offset:c});else if(3==d){var O=new DataView(e,f,2*h.float);y.safeOrbitCameraElevationMinMax=[O.getFloat32(0,!0),O.getFloat32(4,!0)]}else 4==d?(O=new DataView(e,f,h.float),y.safeOrbitCameraRadiusMin=O.getFloat32(0,!0)):5==d&&(O=new DataView(e,f,h.uchar),"up_axis"==w?y.upAxis=0==O.getUint8(0)?"X":1==O.getUint8(0)?"Y":"Z":"chirality"==w&&(y.chirality=0==O.getUint8(0)?"LeftHanded":"RightHanded"));h[A]||g.Logger.Warn("Unsupported property type: ".concat(A,"."))}else T.startsWith("element ")&&("chunk"==(A=T.split(" ")[1])?d=1:"vertex"==A?d=0:"sh"==A?d=2:"safe_orbit_camera_elevation_min_max_radians"==A?d=3:"safe_orbit_camera_radius_min"==A?d=4:"up_axis"!=A&&"chirality"!=A||(d=5))}var C=c,E=f;return g.GaussianSplattingMesh.ConvertPLYWithSHToSplatAsync(e).then((function(n){return(0,L.sH)(t,void 0,void 0,(function(){var t,r,i,l,c,f,h,d,m,_,g,b,v,T,x;return(0,L.YH)(this,(function(A){switch(A.label){case 0:if(t=new DataView(e,o+11),r=E*u+C*a,i=[],s)for(l=0;l<s;l++)if(3==(c=t.getUint8(r))){for(r+=1,f=0;f<c;f++)h=t.getUint32(r+4*(2-f),!0),i.push(h);r+=12}return u?[4,new Promise((function(e){e({mode:0,data:n.buffer,sh:n.sh,faces:i,hasVertexColors:!1,compressed:!0,rawSplat:!1})}))]:[3,2];case 1:case 3:return[2,A.sent()];case 2:for(d=0,m=0,_=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],g=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"],b=0;b<p.length;b++)v=p[b],_.includes(v.name)&&d++,g.includes(v.name)&&m++;return T=d==_.length&&3==m,x=s?2:T?0:1,[4,new Promise((function(e){e((0,L.Cl)((0,L.Cl)({},y),{mode:x,data:n.buffer,sh:n.sh,faces:i,hasVertexColors:!!m,compressed:!1,rawSplat:!1}))}))]}}))}))}))},e._DefaultLoadingOptions={keepInRam:!1,flipY:!1},e}();(0,g.RegisterSceneLoaderPlugin)(new _r);var gr=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==gr)for(var yr in s)gr.BABYLON[yr]||(gr.BABYLON[yr]=s[yr]);var br=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==br){for(var vr in br.BABYLON=br.BABYLON||{},u)br.BABYLON[vr]=u[vr];for(var vr in l)br.BABYLON[vr]=l[vr]}var Tr=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Tr)for(var xr in Tr.BABYLON=Tr.BABYLON||{},Tr.BABYLON.GLTF1=Tr.BABYLON.GLTF1||{},c)Tr.BABYLON.GLTF1[xr]=c[xr];var Ar=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Ar){Ar.BABYLON=Ar.BABYLON||{};var wr=Ar.BABYLON;wr.GLTF2=wr.GLTF2||{},wr.GLTF2.Loader=wr.GLTF2.Loader||{},wr.GLTF2.Loader.Extensions=wr.GLTF2.Loader.Extensions||{};var Or=[];for(var Cr in h)wr.GLTF2.Loader.Extensions[Cr]=h[Cr],Or.push(Cr);for(var Cr in f)wr.GLTF2.Loader[Cr]=f[Cr],Or.push(Cr);for(var Cr in d)Or.indexOf(Cr)>-1||(wr.GLTF2[Cr]=d[Cr])}var Er=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Er)for(var Mr in p)Er.BABYLON[Mr]||(Er.BABYLON[Mr]=p[Mr]);var Fr=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Fr)for(var Rr in m)Fr.BABYLON[Rr]||(Fr.BABYLON[Rr]=m[Rr]);const Pr=_;return i.default})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t,n,r={274:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphGLTFDataProvider:()=>a});var r=n(322),o=n(597),a=function(e){function t(t){var n,r,a=e.call(this)||this,i=t.glTF,s=(null===(n=i.animations)||void 0===n?void 0:n.map((function(e){return e._babylonAnimationGroup})))||[];a.animationGroups=a.registerDataOutput("animationGroups",o.RichTypeAny,s);var l=(null===(r=i.nodes)||void 0===r?void 0:r.map((function(e){return e._babylonTransformNode})))||[];return a.nodes=a.registerDataOutput("nodes",o.RichTypeAny,l),a}return(0,r.C6)(t,e),t.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},t}(o.FlowGraphBlock)},322:(e,t,n)=>{n.d(t,{C6:()=>o,Cl:()=>a,YH:()=>s,fX:()=>l,sH:()=>i});var r=function(e,t){return r=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])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=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},a.apply(this,arguments)};function i(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 s(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 l(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError},561:(e,t,n)=>{n.r(t),n.d(t,{PBRMaterialLoadingAdapter:()=>o});var r=n(597),o=function(){function e(e){this._extinctionCoefficient=r.Vector3.Zero(),this._material=e,this._material.enableSpecularAntiAliasing=!0}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 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=r.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=r.Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=r.Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR)},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._material.metallicReflectanceColor},set:function(e){this._material.metallicReflectanceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._material.reflectanceTexture},set:function(e){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,"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!=r.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 r.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 r.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,"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},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,"extinctionCoefficient",{get:function(){return this._extinctionCoefficient},set:function(e){this._extinctionCoefficient=e},enumerable:!1,configurable:!0}),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 t=this.extinctionCoefficient,n=Math.max(t.x,Math.max(t.y,t.z)),o=n>0?1/n:1;this._material.subSurface.diffusionDistance=new r.Color3(Math.exp(-t.x*o),Math.exp(-t.y*o),Math.exp(-t.z*o))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceConstantTint",{get:function(){return this._material.subSurface.tintColor},set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceConstantTintTexture",{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:r.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.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}()},597:t=>{t.exports=e},698:(e,t,n)=>{n.d(t,{oR:()=>p,tQ:()=>f,Wt:()=>c,ZU:()=>h});var r=n(597),o=[{regex:new RegExp("^/nodes/\\d+/extensions/")}],a=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 a=e.split("/");if(a.shift(),a[a.length-1].includes(".length")){var i=a[a.length-1].split(".");a.pop(),a.push.apply(a,i)}for(var s=!1,l=0,u=a;l<u.length;l++){var c=u[l],f="length"===c;if(f&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(s=!0),n.__array__&&!f)n=n.__array__;else if(!(n=n[c]))throw new Error("Path ".concat(e," is invalid"));if(!s)if(void 0===t){if(!o.find((function(t){return t.regex.test(e)})))throw new Error("Path ".concat(e," is invalid"))}else f||(t=null==t?void 0:t[c]);(n.__target__||f)&&(r=t)}return{object:r,info:n}},e}();function i(e,t,n,r){var o=s(e);return r?o[n][r]:o[n]}function s(e,t,n){var o,a,i;return null===(i=null===(o=e._data)||void 0===o?void 0:o[null!==(a=null==n?void 0:n.fillMode)&&void 0!==a?a:r.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function l(e,t){return{offset:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uOffset,null==s?void 0:s.vOffset)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uOffset=n.x,s.vOffset=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uOffset")},function(){return"".concat(e).concat(t?"."+t:"",".vOffset")}]},rotation:{type:"number",get:function(n,r,o){var a;return null===(a=i(n,0,e,t))||void 0===a?void 0:a.wAng},getTarget:s,set:function(n,r,o,a){return i(r,0,e,t).wAng=n},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uScale,null==s?void 0:s.vScale)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uScale=n.x,s.vScale=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uScale")},function(){return"".concat(e).concat(t?"."+t:"",".vScale")}]}}}var u={cameras:{__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var t,n,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoLeft)&&void 0!==n?n: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 t,n,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoBottom)&&void 0!==n?n: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"}]}}}},nodes:{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 t,n,o;return r.Matrix.Compose(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.scaling,null===(n=e._babylonTransformNode)||void 0===n?void 0:n.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 t,n,o,a,i,s,l,u=r.Matrix.Identity(),c=e.parent;c&&c.parent;)c=c.parent;var f=(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.position._isDirty)||(null===(o=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.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 t,n;return null===(n=null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0])||void 0===n?void 0:n.intensity},getTarget:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0];n&&(n.intensity=e)}}},color:{type:"Color3",get:function(e){var t,n;return null===(n=null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0])||void 0===n?void 0:n.diffuse},getTarget:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0];n&&(n.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}))}}}}}},materials:{__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).emissiveColor},set:function(e,t,n,r){return s(t,0,r).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:l("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=i(e,0,"bumpTexture"))||void 0===r?void 0:r.level},set:function(e,t,n,r){var o=i(t,0,"bumpTexture");o&&(o.level=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:l("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return s(e,0,n).ambientTextureStrength},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.ambientTextureStrength=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:l("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,t,n){var o=s(e,0,n);return r.Color4.FromColor3(o.albedoColor,o.alpha)},set:function(e,t,n,r){var o=s(t,0,r);o.albedoColor.set(e.r,e.g,e.b),o.alpha=e.a},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:l("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallic},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.metallic=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).roughness},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.roughness=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:l("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.intensity},set:function(e,t,n,r){s(t,0,r).anisotropy.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.angle},set:function(e,t,n,r){s(t,0,r).anisotropy.angle=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:l("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.intensity},set:function(e,t,n,r){s(t,0,r).clearCoat.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.roughness},set:function(e,t,n,r){s(t,0,r).clearCoat.roughness=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:l("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=s(e,0,n).clearCoat.bumpTexture)||void 0===r?void 0:r.level},getTarget:s,set:function(e,t,n,r){return s(t,0,r).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:l("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:l("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.dispersion},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return s(e,0,n).emissiveIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return s(e,0,n).indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:l("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.minimumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:l("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).sheen.color},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:l("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).sheen.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:l("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallicF0Factor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).metallicReflectanceColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:l("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:l("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.refractionIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.translucencyIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.translucencyColor},getTarget:s,set:function(e,t,n,r){var o;return e&&(null===(o=s(t,0,r).subSurface.translucencyColor)||void 0===o?void 0:o.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.tintColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.tintColorAtDistance},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:l("subSurface","thicknessTexture")}}}}}},extensions:{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 t;return e._babylonTexture&&r.Quaternion.FromRotationMatrix(null===(t=e._babylonTexture)||void 0===t?void 0:t.getReflectionTextureMatrix())},set:function(e,t){var n;t._babylonTexture&&((null===(n=t._babylonTexture.getScene())||void 0===n?void 0:n.useRightHandedSystem)||(e=r.Quaternion.Inverse(e)),r.Matrix.FromQuaternionToRef(e,t._babylonTexture.getReflectionTextureMatrix()))},getTarget:function(e){return e._babylonTexture}}}}}},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 c(e){return new a(e,u)}function f(e){for(var t=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),n=u,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 h(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),r=u,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 p(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),r=u,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)}},727:(e,t,n)=>{n.r(t),n.d(t,{AnimationPropertyInfo:()=>u,TransformNodeAnimationPropertyInfo:()=>c,WeightAnimationPropertyInfo:()=>f,getQuaternion:()=>s,getVector3:()=>i,getWeights:()=>l});var r=n(322),o=n(597),a=n(698);function i(e,t,n,r){return o.Vector3.FromArray(t,n).scaleInPlace(r)}function s(e,t,n,r){return o.Quaternion.FromArray(t,n).scaleInPlace(r)}function l(e,t,n,r){for(var o=new Array(e._numMorphTargets),a=0;a<o.length;a++)o[a]=t[n++]*r;return o}var u=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,t,n){var r=new o.Animation(e,this.name,t,this.type);return r.setKeys(n,!0),r},e}(),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(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}(u),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new o.Animation("".concat(t,"_").concat(i),s.name,n,s.type);if(l.setKeys(r.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),p=l.clone();h.animations.push(p),a.push({babylonAnimatable:h,babylonAnimation:p})}}},s=this,l=0;l<e._numMorphTargets;l++)i(l);return a},t}(u);(0,a.ZU)("/nodes/{}/translation",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"position",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/rotation",[new c(o.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",s,(function(){return 4}))]),(0,a.ZU)("/nodes/{}/scale",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"scaling",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/weights",[new f(o.Animation.ANIMATIONTYPE_FLOAT,"influence",l,(function(e){return e._numMorphTargets}))])},833:(e,t,n)=>{n.r(t),n.d(t,{OpenPBRMaterialLoadingAdapter:()=>o});var r=n(597),o=function(){function e(e){this._extinctionCoefficient=r.Vector3.Zero(),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)},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,"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",{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",{set:function(e){this._material.coatIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"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(){},Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.transmissionWeight},set:function(e){this._material.transmissionWeight=e,this._material.transmissionColor=this._material.baseColor,this._material.transmissionColorTexture=this._material.baseColorTexture,this._material.transmissionDepth=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"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(r.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}),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(){},Object.defineProperty(e.prototype,"extinctionCoefficient",{get:function(){return this._extinctionCoefficient},set:function(e){this._extinctionCoefficient=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceConstantTint",{get:function(){return r.Color3.White()},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceConstantTintTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadius",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadiusScale",{get:function(){return r.Color3.White()},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceScatterAnisotropy",{set:function(e){},enumerable:!1,configurable:!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}()}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,a),n.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);a.r(o);var i={};t=t||[null,n({}),n([]),n(n)];for(var s=2&r&&e;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,a.d(o,i),o},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.d(i,{default:()=>Nr});var s={};a.r(s),a.d(s,{BVHFileLoader:()=>I,ReadBvh:()=>R});var l={};a.r(l),a.d(l,{GLTFValidation:()=>D});var u={};a.r(u),a.d(u,{GLTFFileLoader:()=>te,GLTFLoaderAnimationStartMode:()=>G,GLTFLoaderCoordinateSystemMode:()=>k,GLTFLoaderDefaultOptions:()=>ee,GLTFLoaderState:()=>V});var c={};a.r(c),a.d(c,{EBlendingFunction:()=>J,EComponentType:()=>W,ECullingType:()=>Q,EParameterType:()=>z,EShaderType:()=>Y,ETextureFilterType:()=>q,ETextureFormat:()=>X,ETextureWrapMode:()=>Z,GLTFBinaryExtension:()=>Me,GLTFLoader:()=>Oe,GLTFLoaderBase:()=>we,GLTFLoaderExtension:()=>Ce,GLTFMaterialsCommonExtension:()=>Ee,GLTFUtils:()=>re});var f={};a.r(f);var h={};a.r(h),a.d(h,{AddObjectAccessorToKey:()=>Ne.oR,EXT_lights_area:()=>at,EXT_lights_ies:()=>$e,EXT_lights_image_based:()=>je,EXT_mesh_gpu_instancing:()=>We,EXT_meshopt_compression:()=>ze,EXT_texture_avif:()=>Qe,EXT_texture_webp:()=>qe,ExtrasAsMetadata:()=>ar,FlowGraphGLTFDataProvider:()=>ir.FlowGraphGLTFDataProvider,GetMappingForKey:()=>Ne.tQ,GetPathToObjectConverter:()=>Ne.Wt,InteractivityGraphToFlowGraphParser:()=>Yn,KHR_animation_pointer:()=>En,KHR_draco_mesh_compression:()=>tt,KHR_interactivity:()=>Zn,KHR_lights:()=>rt,KHR_materials_anisotropy:()=>gt,KHR_materials_clearcoat:()=>ft,KHR_materials_coat:()=>pt,KHR_materials_diffuse_roughness:()=>Ut,KHR_materials_diffuse_transmission:()=>It,KHR_materials_dispersion:()=>Dt,KHR_materials_emissive_strength:()=>bt,KHR_materials_fuzz:()=>At,KHR_materials_ior:()=>Mt,KHR_materials_iridescence:()=>mt,KHR_materials_pbrSpecularGlossiness:()=>st,KHR_materials_sheen:()=>Tt,KHR_materials_specular:()=>Ot,KHR_materials_transmission:()=>Lt,KHR_materials_unlit:()=>ut,KHR_materials_variants:()=>Pt,KHR_materials_volume:()=>Bt,KHR_materials_volume_scatter:()=>Gt,KHR_mesh_quantization:()=>Kt,KHR_node_hoverability:()=>rr,KHR_node_selectability:()=>$n,KHR_node_visibility:()=>Qn,KHR_texture_basisu:()=>Yt,KHR_texture_transform:()=>Zt,KHR_xmp_json_ld:()=>Xt,MSFT_audio_emitter:()=>Fn,MSFT_lod:()=>Ln,MSFT_minecraftMesh:()=>In,MSFT_sRGBFactors:()=>Bn,SetInterpolationForKey:()=>Ne.ZU,_AddInteractivityObjectModel:()=>qn,addNewInteractivityFlowGraphMapping:()=>Vn,getAllSupportedNativeNodeTypes:()=>Kn,getMappingForDeclaration:()=>Gn,getMappingForFullOperationName:()=>kn,gltfTypeToBabylonType:()=>Wn});var p={};a.r(p),a.d(p,{AddObjectAccessorToKey:()=>Ne.oR,AnimationPropertyInfo:()=>Ve.AnimationPropertyInfo,ArrayItem:()=>Be,EXT_lights_area:()=>at,EXT_lights_ies:()=>$e,EXT_lights_image_based:()=>je,EXT_mesh_gpu_instancing:()=>We,EXT_meshopt_compression:()=>ze,EXT_texture_avif:()=>Qe,EXT_texture_webp:()=>qe,ExtrasAsMetadata:()=>ar,FlowGraphGLTFDataProvider:()=>ir.FlowGraphGLTFDataProvider,GLTFFileLoader:()=>te,GLTFLoader:()=>Ge,GetMappingForKey:()=>Ne.tQ,GetPathToObjectConverter:()=>Ne.Wt,InteractivityGraphToFlowGraphParser:()=>Yn,KHR_animation_pointer:()=>En,KHR_draco_mesh_compression:()=>tt,KHR_interactivity:()=>Zn,KHR_lights:()=>rt,KHR_materials_anisotropy:()=>gt,KHR_materials_clearcoat:()=>ft,KHR_materials_coat:()=>pt,KHR_materials_diffuse_roughness:()=>Ut,KHR_materials_diffuse_transmission:()=>It,KHR_materials_dispersion:()=>Dt,KHR_materials_emissive_strength:()=>bt,KHR_materials_fuzz:()=>At,KHR_materials_ior:()=>Mt,KHR_materials_iridescence:()=>mt,KHR_materials_pbrSpecularGlossiness:()=>st,KHR_materials_sheen:()=>Tt,KHR_materials_specular:()=>Ot,KHR_materials_transmission:()=>Lt,KHR_materials_unlit:()=>ut,KHR_materials_variants:()=>Pt,KHR_materials_volume:()=>Bt,KHR_materials_volume_scatter:()=>Gt,KHR_mesh_quantization:()=>Kt,KHR_node_hoverability:()=>rr,KHR_node_selectability:()=>$n,KHR_node_visibility:()=>Qn,KHR_texture_basisu:()=>Yt,KHR_texture_transform:()=>Zt,KHR_xmp_json_ld:()=>Xt,LoadBoundingInfoFromPositionAccessor:()=>ke,MSFT_audio_emitter:()=>Fn,MSFT_lod:()=>Ln,MSFT_minecraftMesh:()=>In,MSFT_sRGBFactors:()=>Bn,OpenPBRMaterialLoadingAdapter:()=>De.OpenPBRMaterialLoadingAdapter,PBRMaterialLoadingAdapter:()=>He.PBRMaterialLoadingAdapter,SetInterpolationForKey:()=>Ne.ZU,TransformNodeAnimationPropertyInfo:()=>Ve.TransformNodeAnimationPropertyInfo,WeightAnimationPropertyInfo:()=>Ve.WeightAnimationPropertyInfo,_AddInteractivityObjectModel:()=>qn,addNewInteractivityFlowGraphMapping:()=>Vn,getAllSupportedNativeNodeTypes:()=>Kn,getMappingForDeclaration:()=>Gn,getMappingForFullOperationName:()=>kn,getQuaternion:()=>Ve.getQuaternion,getVector3:()=>Ve.getVector3,getWeights:()=>Ve.getWeights,gltfTypeToBabylonType:()=>Wn,registerGLTFExtension:()=>Re,registeredGLTFExtensions:()=>Fe,unregisterGLTFExtension:()=>Le});var d={};a.r(d),a.d(d,{MTLFileLoader:()=>sr,OBJFileLoader:()=>ur,SolidParser:()=>lr});var m={};a.r(m),a.d(m,{STLFileLoader:()=>fr});var _={};a.r(_),a.d(_,{BVHFileLoader:()=>I,GLTF1:()=>c,GLTF2:()=>p,GLTFFileLoader:()=>te,GLTFLoaderAnimationStartMode:()=>G,GLTFLoaderCoordinateSystemMode:()=>k,GLTFLoaderDefaultOptions:()=>ee,GLTFLoaderState:()=>V,GLTFValidation:()=>D,MTLFileLoader:()=>sr,OBJFileLoader:()=>ur,ReadBvh:()=>R,SPLATFileLoader:()=>yr,STLFileLoader:()=>fr,SolidParser:()=>lr});var g=a(597),y="Xposition",b="Yposition",v="Zposition",T="Xrotation",x="Yrotation",A="Zrotation",w="HIERARCHY",O="MOTION",C=function(e){this.loopMode=g.Animation.ANIMATIONLOOPMODE_CYCLE,this.list=[],this.root=M(),this.numFrames=0,this.frameRate=0,this.skeleton=e};function M(){return{name:"",type:"",offset:new g.Vector3,channels:[],children:[],frames:[],parent:null}}function E(e,t,n){for(var r=function(e){var t=e.offset.x,n=e.offset.y,r=e.offset.z;return g.Matrix.Translation(t,n,r)}(e),o=new g.Bone(e.name,n.skeleton,t,r),a=function(e,t){if(0===e.frames.length)return[];for(var n=[],r=e.channels.some((function(e){return e===y||e===b||e===v})),o=e.channels.some((function(e){return e===T||e===x||e===A})),a=new g.Animation("".concat(e.name,"_pos"),"position",t.frameRate,g.Animation.ANIMATIONTYPE_VECTOR3,t.loopMode),i=new g.Animation("".concat(e.name,"_rot"),"rotationQuaternion",t.frameRate,g.Animation.ANIMATIONTYPE_QUATERNION,t.loopMode),s=[],l=[],u=0;u<e.frames.length;u++){var c=e.frames[u];r&&c.position&&s.push({frame:c.frame,value:c.position.clone()}),o&&l.push({frame:c.frame,value:c.rotation.clone()})}return s.length>0&&(a.setKeys(s),n.push(a)),l.length>0&&(i.setKeys(l),n.push(i)),n}(e,n),i=0,s=a;i<s.length;i++){var l=s[i];l.getKeys()&&l.getKeys().length>0&&o.animations.push(l)}for(var u=0,c=e.children;u<c.length;u++)E(c[u],o,n)}function P(e,t,n,r){if("ENDSITE"!==n.type){var o={frame:0,position:new g.Vector3,rotation:new g.Quaternion};o.frame=t,o.position=new g.Vector3,o.rotation=new g.Quaternion,n.frames.push(o);for(var a=g.Matrix.Identity(),i=0;i<n.channels.length;++i){var s=n.channels[i],l=e[r.i++];if(l){var u=parseFloat(l.trim());if(s.endsWith("position"))switch(s){case y:o.position.x=u;break;case b:o.position.y=u;break;case v:o.position.z=u}else if(s.endsWith("rotation")){var c=g.Tools.ToRadians(u),f=void 0;switch(s){case T:f=g.Matrix.RotationX(c);break;case x:f=g.Matrix.RotationY(c);break;case A:f=g.Matrix.RotationZ(c)}a=f.multiply(a)}}}g.Quaternion.FromRotationMatrixToRef(a,o.rotation);for(var h=0,p=n.children;h<p.length;h++)P(e,t,p[h],r)}}function F(e,t,n,r){var o,a,i,s,l=M();l.parent=n,r.list.push(l);var u=t.trim().split(/\s+/);if("END"===u[0].toUpperCase()&&"SITE"===u[1].toUpperCase()?(l.type="ENDSITE",l.name="ENDSITE"):(l.name=u[1],l.type=u[0].toUpperCase()),"{"!=(null===(o=e.shift())||void 0===o?void 0:o.trim()))throw new Error("Expected opening { after type & name");var c=null===(a=e.shift())||void 0===a?void 0:a.trim().split(/\s+/);if(!c)throw new Error("Unexpected end of file: missing OFFSET");if("OFFSET"!=(u=c)[0].toUpperCase())throw new Error("Expected OFFSET, but got: "+u[0]);if(4!=u.length)throw new Error("OFFSET: Invalid number of values");var f=new g.Vector3(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));if(isNaN(f.x)||isNaN(f.y)||isNaN(f.z))throw new Error("OFFSET: Invalid values");if(l.offset=f,"ENDSITE"!=l.type){if(!(u=null===(i=e.shift())||void 0===i?void 0:i.trim().split(/\s+/)))throw new Error("Unexpected end of file: missing CHANNELS");if("CHANNELS"!=u[0].toUpperCase())throw new Error("Expected CHANNELS definition");var h=parseInt(u[1]);l.channels=u.splice(2,h),l.children=[]}for(;e.length>0;){var p=null===(s=e.shift())||void 0===s?void 0:s.trim();if("}"===p)return l;p&&l.children.push(F(e,p,l,r))}throw new Error("Unexpected end of file: missing closing brace")}function R(e,t,n,r){var o=e.split("\n"),a=r.loopMode;t._blockEntityCollection=!!n;var i=new g.Skeleton("","",t);i._parentContainer=n,t._blockEntityCollection=!1;var s=new C(i);s.loopMode=a;var l=o.shift();if(!l||l.trim().toUpperCase()!==w)throw new Error("HIERARCHY expected");var u=o.shift();if(!u)throw new Error("Unexpected end of file after HIERARCHY");var c=F(o,u.trim(),null,s),f=o.shift();if(!f||f.trim().toUpperCase()!==O)throw new Error("MOTION expected");var h=o.shift();if(!h)throw new Error("Unexpected end of file before frame count");var p=h.trim().split(/[\s]+/);if(p.length<2)throw new Error("Invalid frame count line");var d=parseInt(p[1]);if(isNaN(d))throw new Error("Failed to read number of frames.");s.numFrames=d;var m=o.shift();if(!m)throw new Error("Unexpected end of file before frame time");var _=m.trim().split(/[\s]+/);if(_.length<3)throw new Error("Invalid frame time line");var y=parseFloat(_[2]);if(isNaN(y))throw new Error("Failed to read frame time.");if(y<=0)throw new Error("Failed to read frame time. Invalid value "+y);s.frameRate=1/y;for(var b=0;b<d;++b){var v=o.shift();v&&P(v.trim().split(/[\s]+/)||[],b,c,{i:0})}return s.root=c,E(s.root,null,s),s.skeleton.returnToRest(),s.skeleton}var L=a(322),N={".bvh":{isBinary:!1}},I=function(){function e(t){this.name="bvh",this.extensions=N,this._loadingOptions=(0,L.Cl)((0,L.Cl)({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{loopMode:g.Animation.ANIMATIONLOOPMODE_CYCLE}},enumerable:!1,configurable:!0}),e.prototype.createPlugin=function(t){return new e(t.bvh)},e.prototype.canDirectLoad=function(e){return this.isBvhHeader(e)},e.prototype.isBvhHeader=function(e){return"HIERARCHY"==e.split("\n")[0]},e.prototype.isNotBvhHeader=function(e){return!this.isBvhHeader(e)},e.prototype.importMeshAsync=function(e,t,n){if("string"!=typeof n)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(n))return Promise.reject("BVH loader expects HIERARCHY header.");try{var r=R(n,t,null,this._loadingOptions);return Promise.resolve({meshes:[],particleSystems:[],skeletons:[r],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]})}catch(e){return Promise.reject(e)}},e.prototype.loadAsync=function(e,t){return"string"!=typeof t?Promise.reject("BVH loader expects string data."):this.isNotBvhHeader(t)?Promise.reject("BVH loader expects HIERARCHY header."):this.importMeshAsync(null,e,t).then((function(){}))},e.prototype.loadAssetContainerAsync=function(e,t){if("string"!=typeof t)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(t))return Promise.reject("BVH loader expects HIERARCHY header.");var n=new g.AssetContainer(e);try{var r=R(t,e,n,this._loadingOptions);return n.skeletons.push(r),Promise.resolve(n)}catch(e){return Promise.reject(e)}},e}();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 B(){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)}}}(0,g.RegisterSceneLoaderPlugin)(new I);var k,G,V,D=function(){function e(){}return e.ValidateAsync=function(t,n,r,o){var a=this;return"function"==typeof Worker?new Promise((function(i,s){var l="".concat(S,"(").concat(B,")()"),u=URL.createObjectURL(new Blob([l],{type:"application/javascript"})),c=new Worker(u),f=function(e){c.removeEventListener("error",f),c.removeEventListener("message",h),s(e)},h=function(t){var n=t.data;switch(n.id){case"getExternalResource":o(n.uri).then((function(e){c.postMessage({id:"getExternalResource.resolve",index:n.index,value:e},[e.buffer])}),(function(e){c.postMessage({id:"getExternalResource.reject",index:n.index,reason:e})}));break;case"validate.resolve":c.removeEventListener("error",f),c.removeEventListener("message",h),e._LastResults=n.value,i(n.value),c.terminate();break;case"validate.reject":c.removeEventListener("error",f),c.removeEventListener("message",h),s(n.reason),c.terminate()}};if(c.addEventListener("error",f),c.addEventListener("message",h),c.postMessage({id:"init",url:g.Tools.GetBabylonScriptURL(a.Configuration.url)}),ArrayBuffer.isView(t)){var p=t.slice();c.postMessage({id:"validate",data:p,rootUrl:n,fileName:r},[p.buffer])}else c.postMessage({id:"validate",data:t,rootUrl:n,fileName:r})})):(this._LoadScriptPromise||(this._LoadScriptPromise=g.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return S(t,n,r,o)})))},e.Configuration={url:"".concat(g.Tools._DefaultCdnUrl,"/gltf_validator.js")},e._LastResults=null,e}(),H="Z2xURg",U="gltf",j={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};function K(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(k||(k={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(G||(G={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(V||(V={}));var W,Y,z,Z,q,X,Q,J,$=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=G.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=k.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},ee=new $,te=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new g.Observable,n.onMeshLoadedObservable=new g.Observable,n.onSkinLoadedObservable=new g.Observable,n.onTextureLoadedObservable=new g.Observable,n.onMaterialLoadedObservable=new g.Observable,n.onCameraLoadedObservable=new g.Observable,n.onCompleteObservable=new g.Observable,n.onErrorObservable=new g.Observable,n.onDisposeObservable=new g.Observable,n.onExtensionLoadedObservable=new g.Observable,n.onValidatedObservable=new g.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=U,n.extensions=j,n.onLoaderStateChangedObservable=new g.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(Object.assign((0,L.Cl)({},ee),t)),n}return(0,L.C6)(t,e),Object.defineProperty(t.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(t.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(t.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(t.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(t.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(t.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(t.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loggingEnabled",{get:function(){return this._loggingEnabled},set:function(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"capturePerformanceCounters",{get:function(){return this._capturePerformanceCounters},set:function(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},t.prototype.loadFile=function(e,t,n,r,o,a,i,s){var l=this;if(ArrayBuffer.isView(t))return this._loadBinary(e,t,n,r,i,s),null;this._progressCallback=o;var u=t.name||g.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&g.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new g.Observable},f={readAsync:function(n,r){return new Promise((function(o,a){l._loadFile(e,t,(function(e){o(new Uint8Array(e))}),!0,(function(e){a(e)}),(function(e){e.setRequestHeader("Range","bytes=".concat(n,"-").concat(n+r-1))}))}))},byteLength:0};return this._unpackBinaryAsync(new g.DataReader(f)).then((function(e){c.onCompleteObservable.notifyObservers(c),r(e)}),i?function(e){return i(void 0,e)}:void 0),c}return this._loadFile(e,t,(function(t){l._validate(e,new Uint8Array(t,0,t.byteLength),n,u),l._unpackBinaryAsync(new g.DataReader({readAsync:function(e,n){return K(t,e,n)},byteLength:t.byteLength})).then((function(e){r(e)}),i?function(e){return i(void 0,e)}:void 0)}),!0,i)}return this._loadFile(e,t,(function(t){try{l._validate(e,t,n,u),r({json:l._parseJson(t)})}catch(e){i&&i()}}),!1,i)},t.prototype._loadBinary=function(e,t,n,r,o,a){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n,a),this._unpackBinaryAsync(new g.DataReader({readAsync:function(e,n){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)}}(t,e,n)},byteLength:t.byteLength})).then((function(e){r(e)}),o?function(e){return o(void 0,e)}:void 0)},t.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)}))},t.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)}))},t.prototype.loadAssetContainerAsync=function(e,t,n,r,o){var a=this;return Promise.resolve().then((function(){a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t);var i=new g.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var u=[];a.onCameraLoadedObservable.add((function(e){u.push(e)}));var c=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&c.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,n,r,o).then((function(e){return Array.prototype.push.apply(i.geometries,e.geometries),Array.prototype.push.apply(i.meshes,e.meshes),Array.prototype.push.apply(i.particleSystems,e.particleSystems),Array.prototype.push.apply(i.skeletons,e.skeletons),Array.prototype.push.apply(i.animationGroups,e.animationGroups),Array.prototype.push.apply(i.materials,s),Array.prototype.push.apply(i.textures,l),Array.prototype.push.apply(i.lights,e.lights),Array.prototype.push.apply(i.transformNodes,e.transformNodes),Array.prototype.push.apply(i.cameras,u),Array.prototype.push.apply(i.morphTargetManagers,c),i}))}))},t.prototype.canDirectLoad=function(e){return function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+H)||e.startsWith("data:;base64,"+H)||e.startsWith("data:application/octet-stream;base64,"+H)||e.startsWith("data:model/gltf-binary;base64,"+H)}(e)},t.prototype.directLoad=function(e,t){if(t.startsWith("base64,"+H)||t.startsWith(";base64,"+H)||t.startsWith("application/octet-stream;base64,"+H)||t.startsWith("model/gltf-binary;base64,"+H)){var n=(0,g.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new g.DataReader({readAsync:function(e,t){return K(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})},t.prototype.createPlugin=function(e){return new t(e[U])},Object.defineProperty(t.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,n){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){n(e)}))}))},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(V[this._state]))},t.prototype._loadFile=function(e,t,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},t.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})}},t.prototype._validate=function(e,t,n,r){var o=this;void 0===n&&(n=""),void 0===r&&(r=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),D.ValidateAsync(t,n,r,(function(t){return o.preprocessUrlAsync(n+t).then((function(t){return e._loadFileAsync(t,void 0,!0,!0).then((function(e){return new Uint8Array(e,0,e.byteLength)}))}))})).then((function(e){o._endPerformanceCounter("Validate JSON"),o.onValidatedObservable.notifyObservers(e),o.onValidatedObservable.clear()}),(function(e){o._endPerformanceCounter("Validate JSON"),g.Tools.Warn("Failed to validate: ".concat(e.message)),o.onValidatedObservable.clear()})))},t.prototype._getLoader=function(e){var n=e.json.asset||{};this._log("Asset version: ".concat(n.version)),n.minVersion&&this._log("Asset minimum version: ".concat(n.minVersion)),n.generator&&this._log("Asset generator: ".concat(n.generator));var r=t._parseVersion(n.version);if(!r)throw new Error("Invalid version: "+n.version);if(void 0!==n.minVersion){var o=t._parseVersion(n.minVersion);if(!o)throw new Error("Invalid minimum version: "+n.minVersion);if(t._compareVersion(o,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+n.minVersion)}var a={1:t._CreateGLTF1Loader,2:t._CreateGLTF2Loader}[r.major];if(!a)throw new Error("Unsupported version: "+n.version);return a(this)},t.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: ".concat(e.length));var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},t.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var n=e.readUint32();if(1179937895!==n)throw new g.RuntimeError("Unexpected magic: "+n,g.ErrorCodes.GLTFLoaderUnexpectedMagicError);var r=e.readUint32();t.loggingEnabled&&t._log("Binary version: ".concat(r));var o,a=e.readUint32();switch(t.useRangeRequests||a===e.buffer.byteLength||g.Logger.Warn("Length in header does not match actual data length: ".concat(a," != ").concat(e.buffer.byteLength)),r){case 1:o=t._unpackBinaryV1Async(e,a);break;case 2:o=t._unpackBinaryV2Async(e,a);break;default:throw new Error("Unsupported version: "+r)}return t._endPerformanceCounter("Unpack Binary"),o}))},t.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)},t.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()}))},t._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},t._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},t.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},t.prototype._logClose=function(){--this._logIndentLevel},t.prototype._logEnabled=function(e){var n=t._logSpaces.substring(0,2*this._logIndentLevel);g.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){g.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){g.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(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(0,L.C6)(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,h,p,d,m,_,g,y,b,v,T,x,A,w,O,C;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!==(p=e.loadOnlyMaterials)&&void 0!==p?p:this.loadOnlyMaterials,this.loadSkins=null!==(d=e.loadSkins)&&void 0!==d?d: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!==(w=e.useSRGBBuffers)&&void 0!==w?w:this.useSRGBBuffers,this.validate=null!==(O=e.validate)&&void 0!==O?O:this.validate,this.dontUseTransmissionHelper=null!==(C=e.dontUseTransmissionHelper)&&void 0!==C?C:this.dontUseTransmissionHelper)},t}($));(0,g.RegisterSceneLoaderPlugin)(new te),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"}(W||(W={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(Y||(Y={})),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"}(z||(z={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(Z||(Z={})),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"}(q||(q={})),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"}(X||(X={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(Q||(Q={})),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"}(J||(J={}));var ne,re=function(){function e(){}return e.SetMatrix=function(e,t,n,r,o){var a=null;if("MODEL"===n.semantic?a=t.getWorldMatrix():"PROJECTION"===n.semantic?a=e.getProjectionMatrix():"VIEW"===n.semantic?a=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===n.semantic?a=g.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===n.semantic?a=t.getWorldMatrix().invert():"VIEWINVERSE"===n.semantic?a=e.getViewMatrix().invert():"PROJECTIONINVERSE"===n.semantic?a=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===n.semantic&&(a=g.Matrix.Transpose(t.getWorldMatrix().invert())),a)switch(n.type){case z.FLOAT_MAT2:o.setMatrix2x2(r,g.Matrix.GetAsMatrix2x2(a));break;case z.FLOAT_MAT3:o.setMatrix3x3(r,g.Matrix.GetAsMatrix3x3(a));break;case z.FLOAT_MAT4:o.setMatrix(r,a)}},e.SetUniform=function(e,t,n,r){switch(r){case z.FLOAT:return e.setFloat(t,n),!0;case z.FLOAT_VEC2:return e.setVector2(t,g.Vector2.FromArray(n)),!0;case z.FLOAT_VEC3:return e.setVector3(t,g.Vector3.FromArray(n)),!0;case z.FLOAT_VEC4:return e.setVector4(t,g.Vector4.FromArray(n)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case Z.CLAMP_TO_EDGE:return g.Texture.CLAMP_ADDRESSMODE;case Z.MIRRORED_REPEAT:return g.Texture.MIRROR_ADDRESSMODE;case Z.REPEAT:default:return g.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 q.LINEAR:case q.LINEAR_MIPMAP_NEAREST:case q.LINEAR_MIPMAP_LINEAR:return g.Texture.TRILINEAR_SAMPLINGMODE;case q.NEAREST:case q.NEAREST_MIPMAP_NEAREST:return g.Texture.NEAREST_SAMPLINGMODE;default:return g.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 W.BYTE:return new Int8Array(i,n,r);case W.UNSIGNED_BYTE:return new Uint8Array(i,n,r);case W.SHORT:return new Int16Array(i,n,r);case W.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(t){if(!e._DefaultMaterial){g.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"),g.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var n={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new g.ShaderMaterial("GLTFDefaultMaterial",t,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},n),e._DefaultMaterial.setColor4("u_emission",new g.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"}(ne||(ne={}));var oe=function(){function e(e){this._pos=0,this.currentToken=ne.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 ne.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=ne.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=ne.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}(),ae=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],ie=["world","view","projection","worldView","worldViewProjection","mBones"],se=["translation","rotation","scale"],le=["position","rotationQuaternion","scaling"],ue=function(e,t,n){for(var r in e){var o=e[r];n[t][r]=o}},ce=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},fe=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},he=function(e){var t=null;if(e.translation||e.rotation||e.scale){var n=g.Vector3.FromArray(e.scale||[1,1,1]),r=g.Quaternion.FromArray(e.rotation||[0,0,0,1]),o=g.Vector3.FromArray(e.translation||[0,0,0]);t=g.Matrix.Compose(n,r,o)}else t=g.Matrix.FromArray(e.matrix);return t},pe=function(e,t,n,r){for(var o=0;o<r.bones.length;o++)if(r.bones[o].name===n)return r.bones[o];var a=e.nodes;for(var i in a){var s=a[i];if(s.jointName){var l=s.children;for(o=0;o<l.length;o++){var u=e.nodes[l[o]];if(u.jointName&&u.jointName===n){var c=he(s),f=new g.Bone(s.name||"",r,pe(e,t,s.jointName,r),c);return f.id=i,f}}}}return null},de=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},me=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},_e=function(e,t){for(var n=0;n<e.jointNames.length;n++)if(e.jointNames[n]===t)return!0;return!1},ge=function(e,t,n,r,o){if(o||(e.scene._blockEntityCollection=!!e.assetContainer,(o=new g.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,o.id=r),!t.babylonNode)return o;for(var a,i=[],s=null,l=[],u=[],c=[],f=[],h=0;h<n.length;h++){var p=n[h];if(P=e.meshes[p])for(var d=0;d<P.primitives.length;d++){var m=new g.VertexData,_=P.primitives[d];_.mode;var y=_.attributes,b=null,v=null;for(var T in y)if(b=e.accessors[y[T]],v=re.GetBufferFromAccessor(e,b),"NORMAL"===T)m.normals=new Float32Array(v.length),m.normals.set(v);else if("POSITION"===T){if(te.HomogeneousCoordinates){m.positions=new Float32Array(v.length-v.length/4);for(var x=0;x<v.length;x+=4)m.positions[x]=v[x],m.positions[x+1]=v[x+1],m.positions[x+2]=v[x+2]}else m.positions=new Float32Array(v.length),m.positions.set(v);u.push(m.positions.length)}else if(-1!==T.indexOf("TEXCOORD_")){var A=Number(T.split("_")[1]),w=g.VertexBuffer.UVKind+(0===A?"":A+1),O=new Float32Array(v.length);O.set(v),ce(O),m.set(O,w)}else"JOINT"===T?(m.matricesIndices=new Float32Array(v.length),m.matricesIndices.set(v)):"WEIGHT"===T?(m.matricesWeights=new Float32Array(v.length),m.matricesWeights.set(v)):"COLOR"===T&&(m.colors=new Float32Array(v.length),m.colors.set(v));if(b=e.accessors[_.indices])v=re.GetBufferFromAccessor(e,b),m.indices=new Int32Array(v.length),m.indices.set(v),f.push(m.indices.length);else{var C=[];for(x=0;x<m.positions.length/3;x++)C.push(x);m.indices=new Int32Array(C),f.push(m.indices.length)}s?s.merge(m):s=m;var M=e.scene.getMaterialById(_.material);i.push(null===M?re.GetDefaultMaterial(e.scene):M),l.push(0===l.length?0:l[l.length-1]+u[u.length-2]),c.push(0===c.length?0:c[c.length-1]+f[f.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,i.length>1?(a=new g.MultiMaterial("multimat"+r,e.scene)).subMaterials=i:a=new g.StandardMaterial("multimat"+r,e.scene),1===i.length&&(a=i[0]),a._parentContainer=e.assetContainer,o.material||(o.material=a),new g.Geometry(r,e.scene,s,!1,o),o.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,o.subMeshes=[];var E=0;for(h=0;h<n.length;h++){var P;if(p=n[h],P=e.meshes[p])for(d=0;d<P.primitives.length;d++)P.primitives[d].mode,g.SubMesh.AddToMesh(E,l[E],u[E],c[E],f[E],o,o,!0),E++}return o},ye=function(e,t,n,r){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=n),e.scaling&&(e.scaling=r)},be=function(e,t,n){var r=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(a=ge(e,t,t.meshes,n,t.babylonNode)).skeleton=e.scene.getLastSkeletonById(t.skin),null===a.skeleton&&(a.skeleton=function(e,t,n,r){if(r||(r=new g.Skeleton(t.name||"","",e.scene)),!t.babylonSkeleton)return r;var o=[],a=[];!function(e,t,n,r){for(var o in e.nodes){var a=e.nodes[o],i=o;if(a.jointName&&!_e(n,a.jointName)){var s=he(a),l=new g.Bone(a.name||"",t,null,s);l.id=i,r.push({bone:l,node:a,id:i})}}for(var u=0;u<r.length;u++)for(var c=r[u],f=c.node.children,h=0;h<f.length;h++){for(var p=null,d=0;d<r.length;d++)if(r[d].id===f[h]){p=r[d];break}p&&(p.bone._parent=c.bone,c.bone.children.push(p.bone))}}(e,r,t,o),r.bones=[];for(var i=0;i<t.jointNames.length;i++)if(v=me(e,t.jointNames[i])){var s=v.node;if(s){var l=v.id,u=e.scene.getBoneById(l);if(u)r.bones.push(u);else{for(var c=!1,f=null,h=0;h<i;h++){var p=me(e,t.jointNames[h]);if(p){var d=p.node;if(d){var m=d.children;if(m){c=!1;for(var _=0;_<m.length;_++)if(m[_]===l){f=pe(e,t,t.jointNames[h],r),c=!0;break}if(c)break}}else g.Tools.Warn("Joint named "+t.jointNames[h]+" does not exist when looking for parent")}}var y=he(s);!f&&o.length>0&&(f=de(o,l))&&-1===a.indexOf(f)&&a.push(f),new g.Bone(s.jointName||"",r,f,y).id=l}}else g.Tools.Warn("Joint named "+t.jointNames[i]+" does not exist")}var b=r.bones;for(r.bones=[],i=0;i<t.jointNames.length;i++){var v;if(v=me(e,t.jointNames[i]))for(h=0;h<b.length;h++)if(b[h].id===v.id){r.bones.push(b[h]);break}}for(r.prepare(),i=0;i<a.length;i++)r.bones.push(a[i]);return r}(e,o,0,o.babylonSkeleton),o.babylonSkeleton||(o.babylonSkeleton=a.skeleton)),r=a}}else if(t.meshes){var a;r=a=ge(e,t,t.mesh?[t.mesh]:t.meshes,n,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var i=e.cameras[t.camera];if(i){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===i.type){var s=new g.FreeCamera(t.camera,g.Vector3.Zero(),e.scene,!1);s.name=t.name||"",s.mode=g.Camera.ORTHOGRAPHIC_CAMERA,s.attachControl(),r=s,s._parentContainer=e.assetContainer}else if("perspective"===i.type){var l=i[i.type],u=new g.FreeCamera(t.camera,g.Vector3.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),l.aspectRatio||(l.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),l.znear&&l.zfar&&(u.maxZ=l.zfar,u.minZ=l.znear),r=u,u._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var c=e.lights[t.light];if(c)if("ambient"===c.type){var f=c[c.type],h=new g.HemisphericLight(t.light,g.Vector3.Zero(),e.scene);h.name=t.name||"",f.color&&(h.diffuse=g.Color3.FromArray(f.color)),r=h}else if("directional"===c.type){var p=c[c.type],d=new g.DirectionalLight(t.light,g.Vector3.Zero(),e.scene);d.name=t.name||"",p.color&&(d.diffuse=g.Color3.FromArray(p.color)),r=d}else if("point"===c.type){var m=c[c.type],_=new g.PointLight(t.light,g.Vector3.Zero(),e.scene);_.name=t.name||"",m.color&&(_.diffuse=g.Color3.FromArray(m.color)),r=_}else if("spot"===c.type){var y=c[c.type],b=new g.SpotLight(t.light,g.Vector3.Zero(),g.Vector3.Zero(),0,0,e.scene);b.name=t.name||"",y.color&&(b.diffuse=g.Color3.FromArray(y.color)),y.fallOfAngle&&(b.angle=y.fallOfAngle),y.fallOffExponent&&(b.exponent=y.fallOffExponent),r=b}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===r){e.scene._blockEntityCollection=!!e.assetContainer;var v=new g.Mesh(t.name||"",e.scene);v._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,t.babylonNode=v,r=v}}if(null!==r){if(t.matrix&&r instanceof g.Mesh)!function(e,t){if(t.matrix){var n=new g.Vector3(0,0,0),r=new g.Quaternion,o=new g.Vector3(0,0,0);g.Matrix.FromArray(t.matrix).decompose(o,r,n),ye(e,n,r,o)}else t.translation&&t.rotation&&t.scale&&ye(e,g.Vector3.FromArray(t.translation),g.Quaternion.FromArray(t.rotation),g.Vector3.FromArray(t.scale));e.computeWorldMatrix(!0)}(r,t);else{var T=t.translation||[0,0,0],x=t.rotation||[0,0,0,1],A=t.scale||[1,1,1];ye(r,g.Vector3.FromArray(T),g.Quaternion.FromArray(x),g.Vector3.FromArray(A))}r.updateCache(!0),t.babylonNode=r}return r},ve=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=be(e,o,t))&&(a.id=t,a.parent=n),o.children)for(var i=0;i<o.children.length;i++)ve(e,o.children[i],a,r)},Te=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null);for(function(e){for(var t in e.animations){var n=e.animations[t];if(n.channels&&n.samplers)for(var r=null,o=0;o<n.channels.length;o++){var a=n.channels[o],i=n.samplers[a.sampler];if(i){var s=null,l=null;n.parameters?(s=n.parameters[i.input],l=n.parameters[i.output]):(s=i.input,l=i.output);var u=re.GetBufferFromAccessor(e,e.accessors[s]),c=re.GetBufferFromAccessor(e,e.accessors[l]),f=a.target.id,h=e.scene.getNodeById(f);if(null===h&&(h=e.scene.getNodeByName(f)),null!==h){var p=h instanceof g.Bone,d=a.target.path,m=se.indexOf(d);-1!==m&&(d=le[m]);var _=g.Animation.ANIMATIONTYPE_MATRIX;p||("rotationQuaternion"===d?(_=g.Animation.ANIMATIONTYPE_QUATERNION,h.rotationQuaternion=new g.Quaternion):_=g.Animation.ANIMATIONTYPE_VECTOR3);var y=null,b=[],v=0,T=!1;p&&r&&r.getKeys().length===u.length&&(y=r,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,y=new g.Animation(t,p?"_matrix":d,1,_,g.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var x=0;x<u.length;x++){var A=null;if("rotationQuaternion"===d?(A=g.Quaternion.FromArray([c[v],c[v+1],c[v+2],c[v+3]]),v+=4):(A=g.Vector3.FromArray([c[v],c[v+1],c[v+2]]),v+=3),p){var w=h,O=g.Vector3.Zero(),C=new g.Quaternion,M=g.Vector3.Zero(),E=w.getBaseMatrix();T&&r&&(E=r.getKeys()[x].value),E.decompose(M,C,O),"position"===d?O=A:"rotationQuaternion"===d?C=A:M=A,A=g.Matrix.Compose(M,C,O)}T?r&&(r.getKeys()[x].value=A):b.push({frame:u[x],value:A})}!T&&y&&(y.setKeys(b),h.animations.push(y)),r=y,e.scene.stopAnimation(h),e.scene.beginAnimation(h,0,u[u.length-1],!0,1)}else g.Tools.Warn("Creating animation named "+t+". But cannot find node named "+f+" to attach to")}}}}(e),n=0;n<e.scene.skeletons.length;n++){var o=e.scene.skeletons[n];e.scene.beginAnimation(o,0,Number.MAX_VALUE,!0,1)}},xe=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=ae.indexOf(a.semantic);if(-1!==i)return delete n[r],ie[i]}}return e.currentIdentifier},Ae=function(e){for(var t in e.materials)Ce.LoadMaterialAsync(e,t,(function(){}),(function(){}))},we=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&&ue(e.extensions,"extensions",r),e.extensionsUsed&&ue(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&&ue(e.bufferViews,"bufferViews",r),e.accessors&&ue(e.accessors,"accessors",r),e.meshes&&ue(e.meshes,"meshes",r),e.lights&&ue(e.lights,"lights",r),e.cameras&&ue(e.cameras,"cameras",r),e.nodes&&ue(e.nodes,"nodes",r),e.images&&ue(e.images,"images",r),e.textures&&ue(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&&ue(e.programs,"programs",r),e.samplers&&ue(e.samplers,"samplers",r),e.techniques&&ue(e.techniques,"techniques",r),e.materials&&ue(e.materials,"materials",r),e.animations&&ue(e.animations,"animations",r),e.skins&&ue(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,t,n,r,o){var a=e.buffers[t];g.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(g.Tools.DecodeBase64(a.uri)))})):g.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),o,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))},e.LoadTextureBufferAsync=function(e,t,n,r){var o=e.textures[t];if(o&&o.source)if(o.babylonTexture)n(null);else{var a=e.images[o.source];g.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(g.Tools.DecodeBase64(a.uri)))})):g.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))}else r("")},e.CreateTextureAsync=function(e,t,n,r){var o=e.textures[t];if(o.babylonTexture)r(o.babylonTexture);else{var a=e.samplers[o.sampler],i=a.minFilter===q.NEAREST_MIPMAP_NEAREST||a.minFilter===q.NEAREST_MIPMAP_LINEAR||a.minFilter===q.LINEAR_MIPMAP_NEAREST||a.minFilter===q.LINEAR_MIPMAP_LINEAR,s=g.Texture.BILINEAR_SAMPLINGMODE,l=null==n?new Blob:new Blob([n]),u=URL.createObjectURL(l),c=function(){return URL.revokeObjectURL(u)},f=new g.Texture(u,e.scene,!i,!0,s,c,c);void 0!==a.wrapS&&(f.wrapU=re.GetWrapMode(a.wrapS)),void 0!==a.wrapT&&(f.wrapV=re.GetWrapMode(a.wrapT)),f.name=t,o.babylonTexture=f,r(f)}},e.LoadShaderStringAsync=function(e,t,n,r){var o=e.shaders[t];if(g.Tools.IsBase64(o.uri)){var a=atob(o.uri.split(",")[1]);n&&n(a)}else g.Tools.LoadFile(e.rootUrl+o.uri,n,void 0,void 0,!1,(function(e){e&&r&&r(e.status+" "+e.statusText)}))},e.LoadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(o.technique){var a=e.techniques[o.technique];if(!a){e.scene._blockEntityCollection=!!e.assetContainer;var i=new g.StandardMaterial(t,e.scene);return i._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,i.diffuseColor=new g.Color3(.5,.5,.5),i.sideOrientation=g.Material.CounterClockWiseSideOrientation,void n(i)}var s=e.programs[a.program],l=a.states,u=g.Effect.ShadersStore[s.vertexShader+"VertexShader"],c=g.Effect.ShadersStore[s.fragmentShader+"PixelShader"],f="",h="",p=new oe(u),d=new oe(c),m={},_=[],y=[],b=[];for(var v in a.uniforms){var T=a.uniforms[v],x=a.parameters[T];if(m[v]=x,!x.semantic||x.node||x.source)x.type===z.SAMPLER_2D?b.push(v):_.push(v);else{var A=ae.indexOf(x.semantic);-1!==A?(_.push(ie[A]),delete m[v]):_.push(v)}}for(var w in a.attributes){var O=a.attributes[w];if((E=a.parameters[O]).semantic){var C=fe(E);C&&y.push(C)}}for(;!p.isEnd()&&p.getNextToken();)if(p.currentToken===ne.IDENTIFIER){var M=!1;for(var w in a.attributes){O=a.attributes[w];var E=a.parameters[O];if(p.currentIdentifier===w&&E.semantic){f+=fe(E),M=!0;break}}M||(f+=xe(p,a,m))}else f+=p.currentString;for(;!d.isEnd()&&d.getNextToken();)d.currentToken===ne.IDENTIFIER?h+=xe(d,a,m):h+=d.currentString;var P={vertex:s.vertexShader+t,fragment:s.fragmentShader+t},F={attributes:y,uniforms:_,samplers:b,needAlphaBlending:l&&l.enable&&-1!==l.enable.indexOf(3042)};g.Effect.ShadersStore[s.vertexShader+t+"VertexShader"]=f,g.Effect.ShadersStore[s.fragmentShader+t+"PixelShader"]=h;var R=new g.ShaderMaterial(t,e.scene,P,F);if(R.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")}}(s,R,r),R.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===z.SAMPLER_2D?Ce.LoadTextureAsync(e,r.values?u:s.value,c(n),(function(){return c(null)})):s.value&&re.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===z.FLOAT_MAT2||c===z.FLOAT_MAT3||c===z.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;re.SetMatrix(t.scene,f,u,l,r.getEffect())}}else re.SetMatrix(t.scene,e,u,l,r.getEffect());else{var h=s[o.uniforms[l]];if(!h)continue;if(c===z.SAMPLER_2D){var p=t.textures[a.values?h:u.value].babylonTexture;if(null==p)continue;r.getEffect().setTexture(l,p)}else re.SetUniform(r.getEffect(),l,h,c)}}i(r)}(i,e,o,t,n,r,a)}}}(e,R,a,o,m,n),R.sideOrientation=g.Material.CounterClockWiseSideOrientation,l&&l.functions){var L=l.functions;L.cullFace&&L.cullFace[0]!==Q.BACK&&(R.backFaceCulling=!1);var N=L.blendFuncSeparate;N&&(N[0]===J.SRC_ALPHA&&N[1]===J.ONE_MINUS_SRC_ALPHA&&N[2]===J.ONE&&N[3]===J.ONE?R.alphaMode=g.Constants.ALPHA_COMBINE:N[0]===J.ONE&&N[1]===J.ONE&&N[2]===J.ZERO&&N[3]===J.ONE?R.alphaMode=g.Constants.ALPHA_ONEONE:N[0]===J.SRC_ALPHA&&N[1]===J.ONE&&N[2]===J.ZERO&&N[3]===J.ONE?R.alphaMode=g.Constants.ALPHA_ADD:N[0]===J.ZERO&&N[1]===J.ONE_MINUS_SRC_COLOR&&N[2]===J.ONE&&N[3]===J.ONE?R.alphaMode=g.Constants.ALPHA_SUBTRACT:N[0]===J.DST_COLOR&&N[1]===J.ZERO&&N[2]===J.ONE&&N[3]===J.ONE?R.alphaMode=g.Constants.ALPHA_MULTIPLY:N[0]===J.SRC_ALPHA&&N[1]===J.ONE_MINUS_SRC_COLOR&&N[2]===J.ONE&&N[3]===J.ONE&&(R.alphaMode=g.Constants.ALPHA_MAXIMIZED))}}else r&&r("No technique found.")},e}(),Oe=function(){function e(){}return e.RegisterExtension=function(t){e.Extensions[t.name]?g.Tools.Error('Tool with the same name "'+t.name+'" already exists'):e.Extensions[t.name]=t},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,t,n,r,o,a,i,s){var l=this;return t.useRightHandedSystem=!0,Ce.LoadRuntimeAsync(t,n,r,(function(t){t.assetContainer=o,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],g.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],l._createNodes(t);var n=[],r=[];for(var i in t.nodes){var s=t.nodes[i];s.babylonNode instanceof g.AbstractMesh&&n.push(s.babylonNode)}for(var u in t.skins){var c=t.skins[u];c.babylonSkeleton instanceof g.Skeleton&&r.push(c.babylonSkeleton)}l._loadBuffersAsync(t,(function(){l._loadShadersAsync(t,(function(){Ae(t),Te(t),!te.IncrementalLoading&&a&&a(n,r)}))})),te.IncrementalLoading&&a&&a(n,r)}),s),!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,Ce.LoadRuntimeAsync(e,t,n,(function(e){Ce.LoadRuntimeExtensionsAsync(e,(function(){i._createNodes(e),i._loadBuffersAsync(e,(function(){i._loadShadersAsync(e,(function(){Ae(e),Te(e),te.IncrementalLoading||r()}))})),te.IncrementalLoading&&r()}),a)}),a)},e.prototype.loadAsync=function(e,t,n,r){return(0,L.sH)(this,void 0,void 0,(function(){var o=this;return(0,L.YH)(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,t){var n=!1,r=function(n,r){Ce.LoadShaderStringAsync(e,n,(function(o){o instanceof ArrayBuffer||(e.loadedShaderCount++,o&&(g.Effect.ShadersStore[n+(r.type===Y.VERTEX?"VertexShader":"PixelShader")]=o),e.loadedShaderCount===e.shaderscount&&t())}),(function(){g.Tools.Error("Error when loading shader program named "+n+" located at "+r.uri)}))};for(var o in e.shaders){n=!0;var a=e.shaders[o];a?r.bind(this,o,a)():g.Tools.Error("No shader named: "+o)}n||t()},e.prototype._loadBuffersAsync=function(e,t){var n=!1,r=function(n,r){Ce.LoadBufferAsync(e,n,(function(o){e.loadedBufferCount++,o&&(o.byteLength!=e.buffers[n].byteLength&&g.Tools.Error("Buffer named "+n+" is length "+o.byteLength+". Expected: "+r.byteLength),e.loadedBufferViews[n]=o),e.loadedBufferCount===e.buffersCount&&t()}),(function(){g.Tools.Error("Error when loading buffer named "+n+" located at "+r.uri)}))};for(var o in e.buffers){n=!0;var a=e.buffers[o];a?r.bind(this,o,a)():g.Tools.Error("No buffer named: "+o)}n||t()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)ve(e,t.nodes[n],null)},e.Extensions={},e}(),Ce=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(we.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(){we.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(){we.LoadShaderStringAsync(t,n,r,o)}))},e.LoadMaterialAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadMaterialAsync(t,n,r,o)}),(function(){we.LoadMaterialAsync(t,n,r,o)}))},e._LoadTextureBufferAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadTextureBufferAsync(t,n,r,o)}),(function(){we.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(){we.CreateTextureAsync(t,n,r,o)}))},e._ApplyExtensions=function(e,t){for(var n in Oe.Extensions)if(e(Oe.Extensions[n]))return;t()},e}();te._CreateGLTF1Loader=function(){return new Oe};var Me=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return(0,L.C6)(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(we.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(re.GetBufferFromBufferView(e,i,0,i.byteLength,W.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=re.GetBufferFromBufferView(e,a,0,a.byteLength,W.UNSIGNED_BYTE);return setTimeout((function(){var e=re.DecodeBufferToText(i);n(e)})),!0},t}(Ce);Oe.RegisterExtension(new Me);var Ee=function(e){function t(){return e.call(this,"KHR_materials_common")||this}return(0,L.C6)(t,e),t.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var t=e.extensions[this.name];if(!t)return!1;var n=t.lights;if(n)for(var r in n){var o=n[r];switch(o.type){case"ambient":var a=new g.HemisphericLight(o.name,new g.Vector3(0,1,0),e.scene),i=o.ambient;i&&(a.diffuse=g.Color3.FromArray(i.color||[1,1,1]));break;case"point":var s=new g.PointLight(o.name,new g.Vector3(10,10,10),e.scene),l=o.point;l&&(s.diffuse=g.Color3.FromArray(l.color||[1,1,1]));break;case"directional":var u=new g.DirectionalLight(o.name,new g.Vector3(0,-1,0),e.scene),c=o.directional;c&&(u.diffuse=g.Color3.FromArray(c.color||[1,1,1]));break;case"spot":var f=o.spot;f&&(new g.SpotLight(o.name,new g.Vector3(0,10,0),new g.Vector3(0,-1,0),f.fallOffAngle||Math.PI,f.fallOffExponent||0,e.scene).diffuse=g.Color3.FromArray(f.color||[1,1,1]));break;default:g.Tools.Warn('GLTF Material Common extension: light type "'+o.type+"” not supported")}}return!1},t.prototype.loadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(!o||!o.extensions)return!1;var a=o.extensions[this.name];if(!a)return!1;var i=new g.StandardMaterial(t,e.scene);return i.sideOrientation=g.Material.CounterClockWiseSideOrientation,"CONSTANT"===a.technique&&(i.disableLighting=!0),i.backFaceCulling=void 0!==a.doubleSided&&!a.doubleSided,i.alpha=void 0===a.values.transparency?1:a.values.transparency,i.specularPower=void 0===a.values.shininess?0:a.values.shininess,"string"==typeof a.values.ambient?this._loadTexture(e,a.values.ambient,i,"ambientTexture",r):i.ambientColor=g.Color3.FromArray(a.values.ambient||[0,0,0]),"string"==typeof a.values.diffuse?this._loadTexture(e,a.values.diffuse,i,"diffuseTexture",r):i.diffuseColor=g.Color3.FromArray(a.values.diffuse||[0,0,0]),"string"==typeof a.values.emission?this._loadTexture(e,a.values.emission,i,"emissiveTexture",r):i.emissiveColor=g.Color3.FromArray(a.values.emission||[0,0,0]),"string"==typeof a.values.specular?this._loadTexture(e,a.values.specular,i,"specularTexture",r):i.specularColor=g.Color3.FromArray(a.values.specular||[0,0,0]),!0},t.prototype._loadTexture=function(e,t,n,r,o){we.LoadTextureBufferAsync(e,t,(function(o){we.CreateTextureAsync(e,t,o,(function(e){return n[r]=e}))}),o)},t}(Ce);Oe.RegisterExtension(new Ee);var Pe=new Map,Fe=Pe;function Re(e,t,n){Le(e)&&g.Logger.Warn("Extension with the name '".concat(e,"' already exists")),Pe.set(e,{isGLTFExtension:t,factory:n})}function Le(e){return Pe.delete(e)}var Ne=a(698),Ie=new g.Lazy((function(){return Promise.resolve().then(a.t.bind(a,597,23))})),Se=new g.Lazy((function(){return Promise.resolve().then(a.bind(a,727))})),Be=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 ke(e){if(e.min&&e.max){var t=e.min,n=e.max,r=g.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=g.TmpVectors.Vector3[1].copyFromFloats(n[0],n[1],n[2]);if(e.normalized&&5126!==e.componentType){var a=1;switch(e.componentType){case 5120:a=127;break;case 5121:a=255;break;case 5122:a=32767;break;case 5123:a=65535}var i=1/a;r.scaleInPlace(i),o.scaleInPlace(i)}return new g.BoundingInfo(r,o)}return null}var Ge=function(){function e(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._pbrMaterialImpl=null,this._parent=e}return e.RegisterExtension=function(e,t){Re(e,!1,t)},e.UnregisterExtension=function(e){return Le(e)},Object.defineProperty(e.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootUrl",{get:function(){return this._rootUrl},enumerable:!1,configurable:!0}),e.prototype._getOrCreateMaterialAdapter=function(e){var t=this._materialAdapterCache.get(e);if(!t){if(!this._pbrMaterialImpl)throw new Error("Appropriate material adapter class not found");t=new this._pbrMaterialImpl.adapterClass(e),this._materialAdapterCache.set(e,t)}return t},e.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._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())},e.prototype.importMeshAsync=function(e,t,n,r,o,a){return(0,L.sH)(this,arguments,void 0,(function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),(0,L.YH)(this,(function(a){switch(a.label){case 0:return[4,Promise.resolve().then((function(){return(0,L.sH)(s,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,L.YH)(this,(function(h){switch(h.label){case 0:if(this._babylonScene=t,this._assetContainer=n,this._loadData(r),a=null,e){if(s={},this._gltf.nodes)for(l=0,u=this._gltf.nodes;l<u.length;l++)(c=u[l]).name&&(s[c.name]=c.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,i,a,(function(){return{meshes:f._getMeshes(),particleSystems:[],skeletons:f._getSkeletons(),animationGroups:f._getAnimationGroups(),lights:f._babylonLights,transformNodes:f._getTransformNodes(),geometries:f._getGeometries(),spriteManagers:[]}}))];case 1:return[2,h.sent()]}}))}))}))];case 1:return[2,a.sent()]}}))}))},e.prototype.loadAsync=function(e,t,n,r){return(0,L.sH)(this,arguments,void 0,(function(e,t,n,r,o){return void 0===o&&(o=""),(0,L.YH)(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()]}}))}))},e.prototype._loadAsync=function(e,t,n,r){return(0,L.sH)(this,void 0,void 0,(function(){var o=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return(0,L.sH)(o,void 0,void 0,(function(){var o,i,s,l,u,c,f,h,p,d,m,_,y,b,v=this;return(0,L.YH)(this,(function(T){switch(T.label){case 0:return this._rootUrl=e,this._uniqueRootUrl=!e.startsWith("file:")&&t?e:"".concat(e).concat(Date.now(),"/"),this._fileName=t,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:return T.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(o=this,y={},[4,Promise.resolve().then(a.t.bind(a,597,23))]):[3,4];case 2:return y.materialClass=T.sent().OpenPBRMaterial,[4,Promise.resolve().then(a.bind(a,833))];case 3:return o._pbrMaterialImpl=(y.adapterClass=T.sent().OpenPBRMaterialLoadingAdapter,y),[3,7];case 4:return i=this,b={},[4,Promise.resolve().then(a.t.bind(a,597,23))];case 5:return b.materialClass=T.sent().PBRMaterial,[4,Promise.resolve().then(a.bind(a,561))];case 6:i._pbrMaterialImpl=(b.adapterClass=T.sent().PBRMaterialLoadingAdapter,b),T.label=7;case 7:if(s="".concat(V[V.LOADING]," => ").concat(V[V.READY]),l="".concat(V[V.LOADING]," => ").concat(V[V.COMPLETE]),this._parent._startPerformanceCounter(s),this._parent._startPerformanceCounter(l),this._parent._setState(V.LOADING),this._extensionsOnLoading(),u=new Array,c=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(n?u.push(this.loadSceneAsync("/nodes",{nodes:n,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(f=Be.Get("/scene",this._gltf.scenes,this._gltf.scene||0),u.push(this.loadSceneAsync("/scenes/".concat(f.index),f)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(h=0;h<this._gltf.materials.length;++h)p=this._gltf.materials[h],d="/materials/"+h,m=g.Material.TriangleFillMode,u.push(this._loadMaterialAsync(d,p,null,m,(function(){})));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=c:this._babylonScene._forceBlockMaterialDirtyMechanism(c),this._parent.compileMaterials&&u.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&u.push(this._compileShadowGeneratorsAsync()),_=Promise.all(u).then((function(){v._rootBabylonMesh&&v._rootBabylonMesh!==v._parent.customRootNode&&v._rootBabylonMesh.setEnabled(!0);for(var e=0,t=v._babylonScene.materials;e<t.length;e++){var n=t[e];void 0!==n.maxSimultaneousLights&&(n.maxSimultaneousLights=Math.max(n.maxSimultaneousLights,v._babylonScene.lights.length))}return v._extensionsOnReady(),v._parent._setState(V.READY),v._skipStartAnimationStep||v._startAnimations(),r()})),[4,_.then((function(e){return v._parent._endPerformanceCounter(s),g.Tools.SetImmediate((function(){v._disposed||Promise.all(v._completePromises).then((function(){v._parent._endPerformanceCounter(l),v._parent._setState(V.COMPLETE),v._parent.onCompleteObservable.notifyObservers(void 0),v._parent.onCompleteObservable.clear(),v.dispose()}),(function(e){v._parent.onErrorObservable.notifyObservers(e),v._parent.onErrorObservable.clear(),v.dispose()}))})),e}))];case 8:return[2,T.sent()]}}))}))})).catch((function(e){throw o._disposed||(o._parent.onErrorObservable.notifyObservers(e),o._parent.onErrorObservable.clear(),o.dispose()),e}))];case 1:return[2,i.sent()]}}))}))},e.prototype._loadData=function(e){if(this._gltf=e.json,this._setupData(),e.bin){var t=this._gltf.buffers;if(t&&t[0]&&!t[0].uri){var n=t[0];(n.byteLength<e.bin.byteLength-3||n.byteLength>e.bin.byteLength)&&g.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else g.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(Be.Assign(this._gltf.accessors),Be.Assign(this._gltf.animations),Be.Assign(this._gltf.buffers),Be.Assign(this._gltf.bufferViews),Be.Assign(this._gltf.cameras),Be.Assign(this._gltf.images),Be.Assign(this._gltf.materials),Be.Assign(this._gltf.meshes),Be.Assign(this._gltf.nodes),Be.Assign(this._gltf.samplers),Be.Assign(this._gltf.scenes),Be.Assign(this._gltf.skins),Be.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]}}},e.prototype._loadExtensionsAsync=function(){return(0,L.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a,i,s,l,u,c,f=this;return(0,L.YH)(this,(function(h){switch(h.label){case 0:return e=[],Fe.forEach((function(t,n){var r;!1===(null===(r=f.parent.extensionOptions[n])||void 0===r?void 0:r.enabled)?t.isGLTFExtension&&f.isExtensionUsed(n)&&g.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!f.isExtensionUsed(n)||e.push((0,L.sH)(f,void 0,void 0,(function(){var e;return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,t.factory(this)];case 1:return(e=r.sent()).name!==n&&g.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(n)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}}))})))})),n=(t=(u=this._extensions).push).apply,r=[u],[4,Promise.all(e)];case 1:if(n.apply(t,r.concat([h.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(o=function(e){if(!a._extensions.some((function(t){return t.name===e&&t.enabled}))){if(!1===(null===(c=a.parent.extensionOptions[e])||void 0===c?void 0:c.enabled))throw new Error("Required extension ".concat(e," is disabled"));throw new Error("Required extension ".concat(e," is not available"))}},a=this,i=0,s=this._gltf.extensionsRequired;i<s.length;i++)l=s[i],o(l);return[2]}}))}))},e.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 t=new g.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=t,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var n={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case k.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case k.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(t),n},e.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=Be.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(){}))},e.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var n=0,r=e._primitiveBabylonMeshes;n<r.length;n++)t(r[n])},e.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},e.prototype._getMeshes=function(){var e=[];this._rootBabylonMesh instanceof g.AbstractMesh&&e.push(this._rootBabylonMesh);var 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){e.push(t)}))}return e},e.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},e.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},e.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},e.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case G.NONE:break;case G.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case G.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void g.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},e.prototype.loadNodeAsync=function(t,n,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadNodeAsync(t,n,r);if(a)return a;if(n._babylonTransformNode)throw new Error("".concat(t,": Invalid recursive node hierarchy"));var i=new Array;this.logOpen("".concat(t," ").concat(n.name||""));var s=function(a){if(e.AddPointerMetadata(a,t),e._LoadTransform(n,a),null!=n.camera){var s=Be.Get("".concat(t,"/camera"),o._gltf.cameras,n.camera);i.push(o.loadCameraAsync("/cameras/".concat(s.index),s,(function(e){e.parent=a,o._babylonScene.useRightHandedSystem||(a.scaling.x=-1)})))}if(n.children)for(var l=0,u=n.children;l<u.length;l++){var c=u[l],f=Be.Get("".concat(t,"/children/").concat(c),o._gltf.nodes,c);i.push(o.loadNodeAsync("/nodes/".concat(f.index),f,(function(e){e.parent=a})))}r(a)},l=null!=n.mesh,u=this._parent.loadSkins&&null!=n.skin;if(!l||u){var c=n.name||"node".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var f=new g.TransformNode(c,this._babylonScene);f._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==n.mesh?n._babylonTransformNode=f:n._babylonTransformNodeForSkin=f,s(f)}if(l)if(u){var h=Be.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh);i.push(this._loadMeshAsync("/meshes/".concat(h.index),n,h,(function(e){var r=n._babylonTransformNodeForSkin;e.metadata=(0,g.deepMerge)(r.metadata,e.metadata||{});var a=Be.Get("".concat(t,"/skin"),o._gltf.skins,n.skin);i.push(o._loadSkinAsync("/skins/".concat(a.index),n,a,(function(t){o._forEachPrimitive(n,(function(e){e.skeleton=t})),o._postSceneLoadActions.push((function(){if(null!=a.skeleton){var t=Be.Get("/skins/".concat(a.index,"/skeleton"),o._gltf.nodes,a.skeleton).parent;n.index===t.index?e.parent=r.parent:e.parent=t._babylonTransformNode}else e.parent=o._rootBabylonMesh;o._parent.onSkinLoadedObservable.notifyObservers({node:r,skinnedNode:e})}))})))})))}else h=Be.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh),i.push(this._loadMeshAsync("/meshes/".concat(h.index),n,h,s));return this.logClose(),Promise.all(i).then((function(){return o._forEachPrimitive(n,(function(e){var t=e;!t.isAnInstance&&t.geometry&&t.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)})),n._babylonTransformNode}))},e.prototype._loadMeshAsync=function(e,t,n,r){var o=n.primitives;if(!o||!o.length)throw new Error("".concat(e,": Primitives are missing"));null==o[0].index&&Be.Assign(o);var a=new Array;this.logOpen("".concat(e," ").concat(n.name||""));var i=t.name||"node".concat(t.index);if(1===o.length){var s=n.primitives[0];a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),i,t,n,s,(function(e){t._babylonTransformNode=e,t._primitiveBabylonMeshes=[e]})))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new g.TransformNode(i,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(var l=0,u=o;l<u.length;l++)s=u[l],a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),"".concat(i,"_primitive").concat(s.index),t,n,s,(function(e){e.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(e)})))}return r(t._babylonTransformNode),this.logClose(),Promise.all(a).then((function(){return t._babylonTransformNode}))},e.prototype._loadMeshPrimitiveAsync=function(t,n,r,o,a,i){var s=this,l=this._extensionsLoadMeshPrimitiveAsync(t,n,r,o,a,i);if(l)return l;this.logOpen("".concat(t));var u,c,f=0===this._disableInstancedMesh&&this._parent.createInstances&&null==r.skin&&!o.primitives[0].targets;if(f&&a._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(u=a._instanceData.babylonSourceMesh.createInstance(n))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c=a._instanceData.promise;else{var h=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var p=new g.Mesh(n,this._babylonScene);if(p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,p.sideOrientation=this._babylonScene.useRightHandedSystem?g.Material.CounterClockWiseSideOrientation:g.Material.ClockWiseSideOrientation,this._createMorphTargets(t,r,o,a,p),h.push(this._loadVertexDataAsync(t,a,p).then((function(e){return(0,L.sH)(s,void 0,void 0,(function(){var n=this;return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(t,a,p,e).then((function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,e.applyToMesh(p),e._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1)}))];case 1:return[2,r.sent()]}}))}))}))),!this.parent.skipMaterials){var d=e._GetDrawMode(t,a.mode);if(null==a.material){var m=this._defaultBabylonMaterialData[d];m||(m=this._createDefaultMaterial("__GLTFLoader._default",d),this._parent.onMaterialLoadedObservable.notifyObservers(m),this._defaultBabylonMaterialData[d]=m),p.material=m}else{var _=Be.Get("".concat(t,"/material"),this._gltf.materials,a.material);h.push(this._loadMaterialAsync("/materials/".concat(_.index),_,p,d,(function(e){p.material=e})))}}c=Promise.all(h),f&&(a._instanceData={babylonSourceMesh:p,promise:c}),u=p}return e.AddPointerMetadata(u,t),this._parent.onMeshLoadedObservable.notifyObservers(u),i(u),this.logClose(),c.then((function(){return u}))},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this,o=this._extensionsLoadVertexDataAsync(e,t,n);if(o)return o;var a=t.attributes;if(!a)throw new Error("".concat(e,": Attributes are missing"));var i=new Array,s=new g.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=Be.Get("".concat(e,"/indices"),this._gltf.accessors,t.indices);i.push(this._loadIndicesAccessorAsync("/accessors/".concat(l.index),l).then((function(e){s.setIndices(e)})))}var u=function(t,o,l){if(null!=a[t]){n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o);var u=Be.Get("".concat(e,"/attributes/").concat(t),r._gltf.accessors,a[t]);i.push(r._loadVertexAccessorAsync("/accessors/".concat(u.index),u,o).then((function(e){if(e.getKind()===g.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=ke(u);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,u.count)}))),o==g.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(u)}};return u("POSITION",g.VertexBuffer.PositionKind),u("NORMAL",g.VertexBuffer.NormalKind),u("TANGENT",g.VertexBuffer.TangentKind),u("TEXCOORD_0",g.VertexBuffer.UVKind),u("TEXCOORD_1",g.VertexBuffer.UV2Kind),u("TEXCOORD_2",g.VertexBuffer.UV3Kind),u("TEXCOORD_3",g.VertexBuffer.UV4Kind),u("TEXCOORD_4",g.VertexBuffer.UV5Kind),u("TEXCOORD_5",g.VertexBuffer.UV6Kind),u("JOINTS_0",g.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",g.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",g.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",g.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",g.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(n.hasVertexAlpha=!0)})),Promise.all(i).then((function(){return s}))},e.prototype._createMorphTargets=function(e,t,n,r,o){if(r.targets&&this._parent.loadMorphTargets){if(null==t._numMorphTargets)t._numMorphTargets=r.targets.length;else if(r.targets.length!==t._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var a=n.extras?n.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,o.morphTargetManager=new g.MorphTargetManager(this._babylonScene),o.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,o.morphTargetManager.areUpdatesFrozen=!0;for(var i=0;i<r.targets.length;i++){var s=t.weights?t.weights[i]:n.weights?n.weights[i]:0,l=a?a[i]:"morphTarget".concat(i);o.morphTargetManager.addTarget(new g.MorphTarget(l,s,o.getScene()))}}},e.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}))},e.prototype._loadMorphTargetVertexDataAsync=function(e,t,n,r){return(0,L.sH)(this,void 0,void 0,(function(){var o,a,i=this;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return o=new Array,(a=function(r,a,s){if(null!=n[r]){var l=t.getVertexBuffer(a);if(l){var u=Be.Get("".concat(e,"/").concat(r),i._gltf.accessors,n[r]);o.push(i._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then((function(e){s(l,e)})))}}})("POSITION",g.VertexBuffer.PositionKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setPositions(n)})),a("NORMAL",g.VertexBuffer.NormalKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(n.length,(function(e,r){n[r]=t[r]+e})),r.setNormals(n)})),a("TANGENT",g.VertexBuffer.TangentKind,(function(e,t){var n=new Float32Array(t.length/3*4),o=0;e.forEach(t.length/3*4,(function(e,r){(r+1)%4!=0&&(n[o]=t[o]+e,o++)})),r.setTangents(n)})),a("TEXCOORD_0",g.VertexBuffer.UVKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setUVs(n)})),a("TEXCOORD_1",g.VertexBuffer.UV2Kind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setUV2s(n)})),a("COLOR_0",g.VertexBuffer.ColorKind,(function(t,n){var o=null,a=t.getSize();if(3===a){o=new Float32Array(n.length/3*4),t.forEach(n.length,(function(e,t){var r=Math.floor(t/3),a=t%3;o[4*r+a]=n[3*r+a]+e}));for(var i=0;i<n.length/3;++i)o[4*i+3]=1}else{if(4!==a)throw new Error("".concat(e,": Invalid number of components (").concat(a,") for COLOR_0 attribute"));o=new Float32Array(n.length),t.forEach(n.length,(function(e,t){o[t]=n[t]+e}))}r.setColors(o)})),[4,Promise.all(o).then((function(){}))];case 1:return[2,s.sent()]}}))}))},e._LoadTransform=function(e,t){if(null==e.skin){var n=g.Vector3.Zero(),r=g.Quaternion.Identity(),o=g.Vector3.One();e.matrix?g.Matrix.FromArray(e.matrix).decompose(o,r,n):(e.translation&&(n=g.Vector3.FromArray(e.translation)),e.rotation&&(r=g.Quaternion.FromArray(e.rotation)),e.scale&&(o=g.Vector3.FromArray(e.scale))),t.position=n,t.rotationQuaternion=r,t.scaling=o}},e.prototype._loadSkinAsync=function(e,t,n,r){var o=this;if(!this._parent.loadSkins)return Promise.resolve();var a=this._extensionsLoadSkinAsync(e,t,n);if(a)return a;if(n._data)return r(n._data.babylonSkeleton),n._data.promise;var i="skeleton".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var s=new g.Skeleton(n.name||i,i,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,n,s);var l=this._loadSkinInverseBindMatricesDataAsync(e,n).then((function(e){o._updateBoneMatrices(s,e)}));return n._data={babylonSkeleton:s,promise:l},r(s),l},e.prototype._loadBones=function(e,t,n){if(null==t.skeleton||this._parent.alwaysComputeSkeletonRootNode){var r=this._findSkeletonRootNode("".concat(e,"/joints"),t.joints);if(r)if(void 0===t.skeleton)t.skeleton=r.index;else{var o=Be.Get("".concat(e,"/skeleton"),this._gltf.nodes,t.skeleton);o===r||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1}(o,r)||(g.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index)}else g.Logger.Warn("".concat(e,": Failed to find common root"))}for(var a={},i=0,s=t.joints;i<s.length;i++){var l=s[i],u=Be.Get("".concat(e,"/joints/").concat(l),this._gltf.nodes,l);this._loadBone(u,t,n,a)}},e.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=Be.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}},e.prototype._loadBone=function(e,t,n,r){e._isJoint=!0;var o=r[e.index];if(o)return o;var a=null;e.index!==t.skeleton&&(e.parent&&-1!==e.parent.index?a=this._loadBone(e.parent,t,n,r):void 0!==t.skeleton&&g.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return o=new g.Bone(e.name||"joint".concat(e.index),n,a,this._getNodeMatrix(e),null,null,i),r[e.index]=o,this._postSceneLoadActions.push((function(){o.linkTransformNode(e._babylonTransformNode)})),o},e.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);var n=Be.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("/accessors/".concat(n.index),n)},e.prototype._updateBoneMatrices=function(e,t){for(var n=0,r=e.bones;n<r.length;n++){var o=r[n],a=g.Matrix.Identity(),i=o._index;t&&-1!==i&&(g.Matrix.FromArrayToRef(t,16*i,a),a.invertToRef(a));var s=o.getParent();s&&a.multiplyToRef(s.getAbsoluteInverseBindMatrix(),a),o.updateMatrix(a,!1,!1),o._updateAbsoluteBindMatrices(void 0,!1)}},e.prototype._getNodeMatrix=function(e){return e.matrix?g.Matrix.FromArray(e.matrix):g.Matrix.Compose(e.scale?g.Vector3.FromArray(e.scale):g.Vector3.One(),e.rotation?g.Quaternion.FromArray(e.rotation):g.Quaternion.Identity(),e.translation?g.Vector3.FromArray(e.translation):g.Vector3.Zero())},e.prototype.loadCameraAsync=function(t,n,r){void 0===r&&(r=function(){});var o=this._extensionsLoadCameraAsync(t,n,r);if(o)return o;var a=new Array;this.logOpen("".concat(t," ").concat(n.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var i=new g.FreeCamera(n.name||"camera".concat(n.index),g.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._babylonCamera=i,i.setTarget(new g.Vector3(0,0,-1)),n.type){case"perspective":var s=n.perspective;if(!s)throw new Error("".concat(t,": Camera perspective properties are missing"));i.fov=s.yfov,i.minZ=s.znear,i.maxZ=s.zfar||0;break;case"orthographic":if(!n.orthographic)throw new Error("".concat(t,": Camera orthographic properties are missing"));i.mode=g.Camera.ORTHOGRAPHIC_CAMERA,i.orthoLeft=-n.orthographic.xmag,i.orthoRight=n.orthographic.xmag,i.orthoBottom=-n.orthographic.ymag,i.orthoTop=n.orthographic.ymag,i.minZ=n.orthographic.znear,i.maxZ=n.orthographic.zfar;break;default:throw new Error("".concat(t,": Invalid camera type (").concat(n.type,")"))}return e.AddPointerMetadata(i,t),this._parent.onCameraLoadedObservable.notifyObservers(i),r(i),this.logClose(),Promise.all(a).then((function(){return i}))},e.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")}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return this._parent._startPerformanceCounter("Load animation"),this._extensionsLoadAnimationAsync(e,t)||Ie.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;Be.Assign(t.channels),Be.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}))}))},e.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=Be.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?Se.value.then((function(){var i,u,c,f,h;switch(l){case"translation":h=null===(i=(0,Ne.tQ)("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":h=null===(u=(0,Ne.tQ)("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":h=null===(c=(0,Ne.tQ)("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":h=null===(f=(0,Ne.tQ)("/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 p={object:s,info:h};return a._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,p,o)})):Promise.resolve()},e.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=Be.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),p=e.input,d=e.output,m=new Array(p.length),_=0;switch(e.interpolation){case"STEP":for(var g=0;g<p.length;g++){var y=f.getValue(l,d,_,1);_+=h,m[g]={frame:p[g]*i,value:y,interpolation:1}}break;case"CUBICSPLINE":for(g=0;g<p.length;g++){var b=f.getValue(l,d,_,s);_+=h,y=f.getValue(l,d,_,1),_+=h;var v=f.getValue(l,d,_,s);_+=h,m[g]={frame:p[g]*i,inTangent:b,value:y,outTangent:v}}break;case"LINEAR":for(g=0;g<p.length;g++)y=f.getValue(l,d,_,1),_+=h,m[g]={frame:p[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 w=A[x];t++,a(w.babylonAnimatable,w.babylonAnimation)}}}))},e.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=Be.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=Be.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},e.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))}}))},e.prototype.loadBufferViewAsync=function(e,t){var n=this._extensionsLoadBufferViewAsync(e,t);if(n)return n;if(t._data)return t._data;var r=Be.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},e.prototype._loadAccessorAsync=function(t,n,r){var o=this;if(n._data)return n._data;var a=e._GetNumComponents(t,n.type),i=a*g.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new r(s));else{var l=Be.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){if(5126!==n.componentType||n.normalized||l.byteStride&&l.byteStride!==i){var u=new r(s);return g.VertexBuffer.ForEach(o,n.byteOffset||0,l.byteStride||i,a,n.componentType,u.length,n.normalized||!1,(function(e,t){u[t]=e})),u}return e._GetTypedArray(t,n.componentType,o,n.byteOffset,s)}))}if(n.sparse){var u=n.sparse;n._data=n._data.then((function(s){var l=s,c=Be.Get("".concat(t,"/sparse/indices/bufferView"),o._gltf.bufferViews,u.indices.bufferView),f=Be.Get("".concat(t,"/sparse/values/bufferView"),o._gltf.bufferViews,u.values.bufferView);return Promise.all([o.loadBufferViewAsync("/bufferViews/".concat(c.index),c),o.loadBufferViewAsync("/bufferViews/".concat(f.index),f)]).then((function(o){var s,c=o[0],f=o[1],h=e._GetTypedArray("".concat(t,"/sparse/indices"),u.indices.componentType,c,u.indices.byteOffset,u.count),p=a*u.count;if(5126!==n.componentType||n.normalized){var d=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,p);s=new r(p),g.VertexBuffer.ForEach(d,0,i,a,n.componentType,s.length,n.normalized||!1,(function(e,t){s[t]=e}))}else s=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,p);for(var m=0,_=0;_<h.length;_++)for(var y=h[_]*a,b=0;b<a;b++)l[y++]=s[m++];return l}))}))}return n._data},e.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},e.prototype._loadIndicesAccessorAsync=function(t,n){if("SCALAR"!==n.type)throw new Error("".concat(t,"/type: Invalid value ").concat(n.type));if(5121!==n.componentType&&5123!==n.componentType&&5125!==n.componentType)throw new Error("".concat(t,"/componentType: Invalid value ").concat(n.componentType));if(n._data)return n._data;if(n.sparse){var r=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n.componentType);n._data=this._loadAccessorAsync(t,n,r)}else{var o=Be.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(o.index),o).then((function(r){return e._GetTypedArray(t,n.componentType,r,n.byteOffset,n.count)}))}return n._data},e.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then((function(e){return new g.Buffer(t,e,!1)})),e._babylonBuffer},e.prototype._loadVertexAccessorAsync=function(t,n,r){var o;if(null===(o=n._babylonVertexBuffer)||void 0===o?void 0:o[r])return n._babylonVertexBuffer[r];n._babylonVertexBuffer||(n._babylonVertexBuffer={});var a=this._babylonScene.getEngine();if(n.sparse||null==n.bufferView)n._babylonVertexBuffer[r]=this._loadFloatAccessorAsync(t,n).then((function(e){return new g.VertexBuffer(a,e,r,!1)}));else{var i=Be.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._babylonVertexBuffer[r]=this._loadVertexBufferViewAsync(i).then((function(o){var s=e._GetNumComponents(t,n.type);return new g.VertexBuffer(a,o,r,!1,void 0,i.byteStride,void 0,n.byteOffset,s,n.componentType,n.normalized,!0,void 0,!0)}))}return n._babylonVertexBuffer[r]},e.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,t,n){var r=new Array,o=this._getOrCreateMaterialAdapter(n);return t&&(t.baseColorFactor?(o.baseColor=g.Color3.FromArray(t.baseColorFactor),o.geometryOpacity=t.baseColorFactor[3]):o.baseColor=g.Color3.White(),o.baseMetalness=null==t.metallicFactor?1:t.metallicFactor,o.specularRoughness=null==t.roughnessFactor?1:t.roughnessFactor,t.baseColorTexture&&r.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),t.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),o.baseColorTexture=e}))),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),t.metallicRoughnessTexture,(function(e){e.name="".concat(n.name," (Metallic Roughness)"),o.baseMetalnessTexture=e,o.specularRoughnessTexture=e}))),o.useRoughnessFromMetallicTextureGreen=!0,o.useMetallicFromMetallicTextureBlue=!0)),Promise.all(r).then((function(){}))},e.prototype._loadMaterialAsync=function(t,n,r,o,a){void 0===a&&(a=function(){});var i=this._extensionsLoadMaterialAsync(t,n,r,o,a);if(i)return i;n._data=n._data||{};var s=n._data[o];if(!s){this.logOpen("".concat(t," ").concat(n.name||""));var l=this.createMaterial(t,n,o);s={babylonMaterial:l,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(t,n,l)},n._data[o]=s,e.AddPointerMetadata(l,t),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}))},e.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},e.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)},e.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(){}))},e.prototype.loadMaterialBasePropertiesAsync=function(e,t,n){var r,o=new Array,a=this._getOrCreateMaterialAdapter(n);a.emissionColor=t.emissiveFactor?g.Color3.FromArray(t.emissiveFactor):new g.Color3(0,0,0),t.doubleSided&&(a.backFaceCulling=!1,a.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),t.normalTexture,(function(e){var r;e.name="".concat(n.name," (Normal)"),a.geometryNormalTexture=e,null!=(null===(r=t.normalTexture)||void 0===r?void 0:r.scale)&&(e.level=t.normalTexture.scale)}))),a.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));var i,s=1;return t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),t.occlusionTexture,(function(e){e.name="".concat(n.name," (Occlusion)"),r=e}))),null!=t.occlusionTexture.strength&&(s=t.occlusionTexture.strength)),t.emissiveTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),t.emissiveTexture,(function(e){e.name="".concat(n.name," (Emissive)"),i=e}))),Promise.all(o).then((function(){r&&(a.ambientOcclusionTexture=r,a.ambientOcclusionTextureStrength=s),i&&(a.emissionColorTexture=i)}))},e.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,")"))}},e.prototype.loadTextureInfoAsync=function(t,n,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadTextureInfoAsync(t,n,r);if(a)return a;if(this.logOpen("".concat(t)),n.texCoord>=6)throw new Error("".concat(t,"/texCoord: Invalid value (").concat(n.texCoord,")"));var i=Be.Get("".concat(t,"/index"),this._gltf.textures,n.index);i._textureInfo=n;var s=this._loadTextureAsync("/textures/".concat(n.index),i,(function(a){a.coordinatesIndex=n.texCoord||0,e.AddPointerMetadata(a,t),o._parent.onTextureLoadedObservable.notifyObservers(a),r(a)}));return this.logClose(),s},e.prototype._loadTextureAsync=function(t,n,r){void 0===r&&(r=function(){});var o=this._extensionsLoadTextureAsync(t,n,r);if(o)return o;this.logOpen("".concat(t," ").concat(n.name||""));var a=null==n.sampler?e.DefaultSampler:Be.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=Be.Get("".concat(t,"/source"),this._gltf.images,n.source),s=this._createTextureAsync(t,a,i,r,void 0,!n._textureInfo.nonColorData);return this.logClose(),s},e.prototype._createTextureAsync=function(e,t,n,r,o,a){var i,s,l=this;void 0===r&&(r=function(){});var u=this._loadSampler("/samplers/".concat(t.index),t),c=new Array,f=new g.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var h={noMipmap:u.noMipMaps,invertY:!1,samplingMode:u.samplingMode,onLoad:function(){l._disposed||f.resolve()},onError:function(t,n){l._disposed||f.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:null!==(i=n.mimeType)&&void 0!==i?i:(0,g.GetMimeType)(null!==(s=n.uri)&&void 0!==s?s:""),loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},p=new g.Texture(null,this._babylonScene,h);return p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c.push(f.promise),c.push(this.loadImageAsync("/images/".concat(n.index),n).then((function(e){var t=n.uri||"".concat(l._fileName,"#image").concat(n.index),r="data:".concat(l._uniqueRootUrl).concat(t);p.updateURL(r,e);var o=p.getInternalTexture();o&&(o.label=n.name)}))),p.wrapU=u.wrapU,p.wrapV=u.wrapV,r(p),this._parent.useGltfTextureNames&&(p.name=n.name||n.uri||"image".concat(n.index)),Promise.all(c).then((function(){return p}))},e.prototype._loadSampler=function(t,n){return n._data||(n._data={noMipMaps:9728===n.minFilter||9729===n.minFilter,samplingMode:e._GetTextureSamplingMode(t,n),wrapU:e._GetTextureWrapMode("".concat(t,"/wrapS"),n.wrapS),wrapV:e._GetTextureWrapMode("".concat(t,"/wrapT"),n.wrapT)}),n._data},e.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=Be.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(n.index),n)}this.logClose()}return t._data},e.prototype.loadUriAsync=function(t,n,r){var o=this,a=this._extensionsLoadUriAsync(t,n,r);if(a)return a;if(!e._ValidateUri(r))throw new Error("".concat(t,": '").concat(r,"' is invalid"));if((0,g.IsBase64DataUrl)(r)){var i=new Uint8Array((0,g.DecodeBase64UrlToBinary)(r));return this.log("".concat(t,": Decoded ").concat(r.substring(0,64),"... (").concat(i.length," bytes)")),Promise.resolve(i)}return this.log("".concat(t,": Loading ").concat(r)),this._parent.preprocessUrlAsync(this._rootUrl+r).then((function(e){return new Promise((function(n,a){o._parent._loadFile(o._babylonScene,e,(function(e){o._disposed||(o.log("".concat(t,": Loaded ").concat(r," (").concat(e.byteLength," bytes)")),n(new Uint8Array(e)))}),!0,(function(e){a(new g.LoadFileError("".concat(t,": Failed to load '").concat(r,"'").concat(e?": "+e.status+" "+e.statusText:""),e))}))}))}))},e.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)},e._GetTextureWrapMode=function(e,t){switch(t=null==t?10497:t){case 33071:return g.Texture.CLAMP_ADDRESSMODE;case 33648:return g.Texture.MIRROR_ADDRESSMODE;case 10497:return g.Texture.WRAP_ADDRESSMODE;default:return g.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),g.Texture.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var n=null==t.magFilter?9729:t.magFilter,r=null==t.minFilter?9987:t.minFilter;if(9729===n)switch(r){case 9728:return g.Texture.LINEAR_NEAREST;case 9729:return g.Texture.LINEAR_LINEAR;case 9984:return g.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return g.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return g.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return g.Texture.LINEAR_LINEAR_MIPLINEAR;default:return g.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),g.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&g.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),r){case 9728:return g.Texture.NEAREST_NEAREST;case 9729:return g.Texture.NEAREST_LINEAR;case 9984:return g.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return g.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return g.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return g.Texture.NEAREST_LINEAR_MIPLINEAR;default:return g.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),g.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,g.GetTypedArrayConstructor)(t)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}},e._GetTypedArray=function(t,n,r,o,a){var i=r.buffer;o=r.byteOffset+(o||0);var s=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n),l=g.VertexBuffer.GetTypeByteLength(n);return o%l!==0?(g.Logger.Warn("".concat(t,": Copying buffer as byte offset (").concat(o,") is not a multiple of component type byte length (").concat(l,")")),new s(i.slice(o,o+a*l),0)):new s(i,o,a)},e._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,")"))},e._ValidateUri=function(e){return g.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return g.Material.PointListDrawMode;case 1:return g.Material.LineListDrawMode;case 2:return g.Material.LineLoopDrawMode;case 3:return g.Material.LineStripDrawMode;case 4:return g.Material.TriangleFillMode;case 5:return g.Material.TriangleStripDrawMode;case 6:return g.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(t,")"))},e.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")}))},e.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")}))},e.prototype._forEachExtensions=function(e){for(var t=0,n=this._extensions;t<n.length;t++){var r=n[t];r.enabled&&e(r)}},e.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},e.prototype._extensionsOnLoading=function(){this._forEachExtensions((function(e){return e.onLoading&&e.onLoading()}))},e.prototype._extensionsOnReady=function(){this._forEachExtensions((function(e){return e.onReady&&e.onReady()}))},e.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",(function(n){return n.loadSceneAsync&&n.loadSceneAsync(e,t)}))},e.prototype._extensionsLoadNodeAsync=function(e,t,n){return this._applyExtensions(t,"loadNode",(function(r){return r.loadNodeAsync&&r.loadNodeAsync(e,t,n)}))},e.prototype._extensionsLoadCameraAsync=function(e,t,n){return this._applyExtensions(t,"loadCamera",(function(r){return r.loadCameraAsync&&r.loadCameraAsync(e,t,n)}))},e.prototype._extensionsLoadVertexDataAsync=function(e,t,n){return this._applyExtensions(t,"loadVertexData",(function(r){return r._loadVertexDataAsync&&r._loadVertexDataAsync(e,t,n)}))},e.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)}))},e.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)}))},e.prototype._extensionsCreateMaterial=function(e,t,n){return this._applyExtensions(t,"createMaterial",(function(r){return r.createMaterial&&r.createMaterial(e,t,n)}))},e.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,n){return this._applyExtensions(t,"loadMaterialProperties",(function(r){return r.loadMaterialPropertiesAsync&&r.loadMaterialPropertiesAsync(e,t,n)}))},e.prototype._extensionsLoadTextureInfoAsync=function(e,t,n){return this._applyExtensions(t,"loadTextureInfo",(function(r){return r.loadTextureInfoAsync&&r.loadTextureInfoAsync(e,t,n)}))},e.prototype._extensionsLoadTextureAsync=function(e,t,n){return this._applyExtensions(t,"loadTexture",(function(r){return r._loadTextureAsync&&r._loadTextureAsync(e,t,n)}))},e.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",(function(n){return n.loadAnimationAsync&&n.loadAnimationAsync(e,t)}))},e.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)}))},e.prototype._extensionsLoadSkinAsync=function(e,t,n){return this._applyExtensions(n,"loadSkin",(function(r){return r._loadSkinAsync&&r._loadSkinAsync(e,t,n)}))},e.prototype._extensionsLoadUriAsync=function(e,t,n){return this._applyExtensions(t,"loadUri",(function(r){return r._loadUriAsync&&r._loadUriAsync(e,t,n)}))},e.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",(function(n){return n.loadBufferViewAsync&&n.loadBufferViewAsync(e,t)}))},e.prototype._extensionsLoadBufferAsync=function(e,t,n,r){return this._applyExtensions(t,"loadBuffer",(function(o){return o.loadBufferAsync&&o.loadBufferAsync(e,t,n,r)}))},e.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},e.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},e.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},e.prototype.logOpen=function(e){this._parent._logOpen(e)},e.prototype.logClose=function(){this._parent._logClose()},e.prototype.log=function(e){this._parent._log(e)},e.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},e.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},e.DefaultSampler={index:-1},e}();te._CreateGLTF2Loader=function(e){return new Ge(e)};var Ve=a(727),De=a(833),He=a(561),Ue="EXT_lights_image_based",je=function(){function e(e){this.name=Ue,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ue)}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 Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,a,i=this;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,(n=new Array).push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen("".concat(r)),a=Be.Get("".concat(r,"/light"),this._lights,o.light),n.push(this._loadLightAsync("/extensions/".concat(this.name,"/lights/").concat(o.light),a).then((function(e){i._loader.babylonScene.environmentTexture=e}))),this._loader.logClose(),[4,Promise.all(n).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},e.prototype._loadLightAsync=function(e,t){var n=this;if(!t._loaded){var r=new Array;this._loader.logOpen("".concat(e));for(var o=new Array(t.specularImages.length),a=function(n){var a=t.specularImages[n];o[n]=new Array(a.length);for(var s=function(t){var s="".concat(e,"/specularImages/").concat(n,"/").concat(t);i._loader.logOpen("".concat(s));var l=a[t],u=Be.Get(s,i._loader.gltf.images,l);r.push(i._loader.loadImageAsync("/images/".concat(l),u).then((function(e){o[n][t]=e}))),i._loader.logClose()},l=0;l<a.length;l++)s(l)},i=this,s=0;s<t.specularImages.length;s++)a(s);this._loader.logClose(),t._loaded=Promise.all(r).then((function(){return(0,L.sH)(n,void 0,void 0,(function(){var n,r,a,i,s;return(0,L.YH)(this,(function(l){switch(l.label){case 0:if((n=new g.RawCubeTexture(this._loader.babylonScene,null,t.specularImageSize)).name=t.name||"environment",t._babylonTexture=n,null!=t.intensity&&(n.level=t.intensity),t.rotation&&(r=g.Quaternion.FromArray(t.rotation),this._loader.babylonScene.useRightHandedSystem||(r=g.Quaternion.Inverse(r)),g.Matrix.FromQuaternionToRef(r,n.getReflectionTextureMatrix())),!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(a=g.SphericalHarmonics.FromArray(t.irradianceCoefficients)).scaleInPlace(t.intensity),a.convertIrradianceToLambertianRadiance(),i=g.SphericalPolynomial.FromHarmonics(a),s=(o.length-1)/Math.log2(t.specularImageSize),[4,n.updateRGBDAsync(o,i,s)];case 1:return[2,l.sent()]}}))}))}))}return t._loaded.then((function(){return t._babylonTexture}))},e}();Le(Ue),Re(Ue,!0,(function(e){return new je(e)}));var Ke="EXT_mesh_gpu_instancing",We=function(){function e(e){this.name=Ke,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ke)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,L.sH)(r,void 0,void 0,(function(){var r,a,i,s,l=this;return(0,L.YH)(this,(function(u){switch(u.label){case 0:return this._loader._disableInstancedMesh++,r=this._loader.loadNodeAsync("/nodes/".concat(t.index),t,n),this._loader._disableInstancedMesh--,t._primitiveBabylonMeshes?[3,2]:[4,r];case 1:case 3:return[2,u.sent()];case 2:return a=new Array,i=0,(s=function(t){if(null!=o.attributes[t]){var n=Be.Get("".concat(e,"/attributes/").concat(t),l._loader.gltf.accessors,o.attributes[t]);if(a.push(l._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===i)i=n.count;else if(i!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else a.push(Promise.resolve(null))})("TRANSLATION"),s("ROTATION"),s("SCALE"),s("_COLOR_0"),[4,r.then((function(e){return(0,L.sH)(l,void 0,void 0,(function(){var n,r,o,s,l,u,c,f,h,p;return(0,L.YH)(this,(function(d){switch(d.label){case 0:return[4,Promise.all(a)];case 1:for(n=d.sent(),r=n[0],o=n[1],s=n[2],l=n[3],u=new Float32Array(16*i),g.TmpVectors.Vector3[0].copyFromFloats(0,0,0),g.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),g.TmpVectors.Vector3[1].copyFromFloats(1,1,1),c=0;c<i;++c)r&&g.Vector3.FromArrayToRef(r,3*c,g.TmpVectors.Vector3[0]),o&&g.Quaternion.FromArrayToRef(o,4*c,g.TmpVectors.Quaternion[0]),s&&g.Vector3.FromArrayToRef(s,3*c,g.TmpVectors.Vector3[1]),g.Matrix.ComposeToRef(g.TmpVectors.Vector3[1],g.TmpVectors.Quaternion[0],g.TmpVectors.Vector3[0],g.TmpVectors.Matrix[0]),g.TmpVectors.Matrix[0].copyToArray(u,16*c);for(f=0,h=t._primitiveBabylonMeshes;f<h.length;f++)(p=h[f]).thinInstanceSetBuffer("matrix",u,16,!0),l&&(l.length===3*i?p.thinInstanceSetBuffer("color",l,3,!0):l.length===4*i?p.thinInstanceSetBuffer("color",l,4,!0):g.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+p.name));return[2,e]}}))}))}))]}}))}))}))},e}();Le(Ke),Re(Ke,!0,(function(e){return new We(e)}));var Ye="EXT_meshopt_compression",ze=function(){function e(e){this.name=Ye,this.enabled=e.isExtensionUsed(Ye),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,r,a=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(n=t)._meshOptData?[4,n._meshOptData]:[3,2];case 1:case 3:return[2,i.sent()];case 2:return r=Be.Get("".concat(e,"/buffer"),this._loader.gltf.buffers,o.buffer),n._meshOptData=this._loader.loadBufferAsync("/buffers/".concat(r.index),r,o.byteOffset||0,o.byteLength).then((function(e){return(0,L.sH)(a,void 0,void 0,(function(){return(0,L.YH)(this,(function(t){switch(t.label){case 0:return[4,g.MeshoptCompression.Default.decodeGltfBufferAsync(e,o.count,o.byteStride,o.mode,o.filter)];case 1:return[2,t.sent()]}}))}))})),[4,n._meshOptData]}}))}))}))},e}();Le(Ye),Re(Ye,!0,(function(e){return new ze(e)}));var Ze="EXT_texture_webp",qe=function(){function e(e){this.name=Ze,this._loader=e,this.enabled=e.isExtensionUsed(Ze)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ge.DefaultSampler:Be.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Be.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();Le(Ze),Re(Ze,!0,(function(e){return new qe(e)}));var Xe="EXT_texture_avif",Qe=function(){function e(e){this.name=Xe,this._loader=e,this.enabled=e.isExtensionUsed(Xe)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ge.DefaultSampler:Be.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Be.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();Le(Xe),Re(Xe,!0,(function(e){return new Qe(e)}));var Je="EXT_lights_ies",$e=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,Be.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i,s,l,u,c=this;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t=(i=Be.Get(o,c._lights,a.light)).name||e.name;c._loader.babylonScene._blockEntityCollection=!!c._loader._assetContainer,(r=new g.SpotLight(t,g.Vector3.Zero(),g.Vector3.Backward(),0,1,c._loader.babylonScene)).angle=Math.PI/2,r.innerAngle=0,r._parentContainer=c._loader._assetContainer,c._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=r,r.falloffType=g.Light.FALLOFF_GLTF,r.diffuse=a.color?g.Color3.FromArray(a.color):g.Color3.White(),r.intensity=a.multiplier||1,r.range=Number.MAX_VALUE,r.parent=e,c._loader._babylonLights.push(r),Ge.AddPointerMetadata(r,o),n(e)}))];case 1:return s=f.sent(),i.uri?[4,this._loader.loadUriAsync(e,i,i.uri)]:[3,3];case 2:return l=f.sent(),[3,5];case 3:return u=Be.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,i.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u)];case 4:l=f.sent(),f.label=5;case 5:return r.iesProfileTexture=new g.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,l,!0,void 0,void 0,void 0,void 0,".ies"),[2,s]}}))}))}))},e}();Le(Je),Re(Je,!0,(function(e){return new $e(e)}));var et="KHR_draco_mesh_compression",tt=function(){function e(e){this.name=et,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=g.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(et)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i,s,l,u=this;return(0,L.YH)(this,(function(c){switch(c.label){case 0:if(null!=t.mode&&4!==t.mode&&5!==t.mode)throw new Error("".concat(e,": Unsupported mode ").concat(t.mode));return r={},i={},(s=function(e,o){var s=a.attributes[e];if(null!=s&&(n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o),r[o]=s,u.useNormalizedFlagFromAccessor)){var l=Be.TryGet(u._loader.gltf.accessors,t.attributes[e]);l&&(i[o]=l.normalized||!1)}})("POSITION",g.VertexBuffer.PositionKind),s("NORMAL",g.VertexBuffer.NormalKind),s("TANGENT",g.VertexBuffer.TangentKind),s("TEXCOORD_0",g.VertexBuffer.UVKind),s("TEXCOORD_1",g.VertexBuffer.UV2Kind),s("TEXCOORD_2",g.VertexBuffer.UV3Kind),s("TEXCOORD_3",g.VertexBuffer.UV4Kind),s("TEXCOORD_4",g.VertexBuffer.UV5Kind),s("TEXCOORD_5",g.VertexBuffer.UV6Kind),s("JOINTS_0",g.VertexBuffer.MatricesIndicesKind),s("WEIGHTS_0",g.VertexBuffer.MatricesWeightsKind),s("COLOR_0",g.VertexBuffer.ColorKind),(l=Be.Get(o,this._loader.gltf.bufferViews,a.bufferView))._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){return(0,L.sH)(u,void 0,void 0,(function(){var a,s,l;return(0,L.YH)(this,(function(u){switch(u.label){case 0:return a=this.dracoDecoder||g.DracoDecoder.Default,s=Be.TryGet(this._loader.gltf.accessors,t.attributes.POSITION),l=this._loader.parent.alwaysComputeBoundingBox||n.skeleton||!s?null:ke(s),[4,a._decodeMeshToGeometryForGltfAsync(n.name,this._loader.babylonScene,o,r,i,l).catch((function(t){throw new Error("".concat(e,": ").concat(t.message))}))];case 1:return[2,u.sent()]}}))}))}))),[4,l._dracoBabylonGeometry];case 1:return[2,c.sent()]}}))}))}))},e}();Le(et),Re(et,!0,(function(e){return new tt(e)}));var nt="KHR_lights_punctual",rt=function(){function e(e){this.name=nt,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}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,Be.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i=Be.Get(o,r._lights,a.light),s=i.name||e.name;switch(r._loader.babylonScene._blockEntityCollection=!!r._loader._assetContainer,i.type){case"directional":var l=new g.DirectionalLight(s,g.Vector3.Backward(),r._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new g.PointLight(s,g.Vector3.Zero(),r._loader.babylonScene);break;case"spot":var u=new g.SpotLight(s,g.Vector3.Zero(),g.Vector3.Backward(),0,1,r._loader.babylonScene);u.angle=2*(i.spot&&i.spot.outerConeAngle||Math.PI/4),u.innerAngle=2*(i.spot&&i.spot.innerConeAngle||0),t=u;break;default:throw r._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(o,": Invalid light type (").concat(i.type,")"))}t._parentContainer=r._loader._assetContainer,r._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=t,t.falloffType=g.Light.FALLOFF_GLTF,t.diffuse=i.color?g.Color3.FromArray(i.color):g.Color3.White(),t.intensity=null==i.intensity?1:i.intensity,t.range=null==i.range?Number.MAX_VALUE:i.range,t.parent=e,r._loader._babylonLights.push(t),Ge.AddPointerMetadata(t,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();Le(nt),Re(nt,!0,(function(e){return new rt(e)}));var ot="EXT_lights_area",at=function(){function e(e){this.name=ot,this._loader=e,this.enabled=this._loader.isExtensionUsed(ot)}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,Be.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i,s=Be.Get(o,r._lights,a.light),l=s.name||e.name;r._loader.babylonScene._blockEntityCollection=!!r._loader._assetContainer;var u=void 0!==s.size?s.size:1;switch(s.type){case"rect":var c=void 0!==(null===(t=s.rect)||void 0===t?void 0:t.aspect)?s.rect.aspect*u:u,f=u;i=new g.RectAreaLight(l,g.Vector3.Zero(),c,f,r._loader.babylonScene);break;case"disk":var h=Math.sqrt(u*u*.25*Math.PI);i=new g.RectAreaLight(l,g.Vector3.Zero(),h,h,r._loader.babylonScene);break;default:throw r._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(o,": Invalid area light type (").concat(s.type,")"))}i._parentContainer=r._loader._assetContainer,r._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=i,i.falloffType=g.Light.FALLOFF_GLTF,i.diffuse=s.color?g.Color3.FromArray(s.color):g.Color3.White(),i.intensity=null==s.intensity?1:s.intensity;var p=new g.TransformNode("".concat(l,"_orientation"),r._loader.babylonScene);p.rotationQuaternion=g.Quaternion.RotationAxis(g.Vector3.Up(),Math.PI),p.parent=e,i.parent=p,r._loader._babylonLights.push(i),Ge.AddPointerMetadata(i,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();Le(ot),Re(ot,!0,(function(e){return new at(e)}));var it="KHR_materials_pbrSpecularGlossiness",st=function(){function e(e){this.name=it,this.order=200,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialBasePropertiesAsync(e,t,n)),r.push(this._loadSpecularGlossinessPropertiesAsync(o,a,n)),this._loader.loadMaterialAlphaProperties(e,t,n),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSpecularGlossinessPropertiesAsync=function(e,t,n){if(!(n instanceof g.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return n.metallic=null,n.roughness=null,t.diffuseFactor?(n.albedoColor=g.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=g.Color3.White(),n.reflectivityColor=t.specularFactor?g.Color3.FromArray(t.specularFactor):g.Color3.White(),n.microSurface=null==t.glossinessFactor?1:t.glossinessFactor,t.diffuseTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),t.diffuseTexture,(function(e){e.name="".concat(n.name," (Diffuse)"),n.albedoTexture=e}))),t.specularGlossinessTexture&&(r.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),t.specularGlossinessTexture,(function(e){e.name="".concat(n.name," (Specular Glossiness)"),n.reflectivityTexture=e,n.reflectivityTexture.hasAlpha=!0}))),n.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(r).then((function(){}))},e}();Le(it),Re(it,!0,(function(e){return new st(e)}));var lt="KHR_materials_unlit",ut=function(){function e(e){this.name=lt,this.order=210,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 Ge.LoadExtensionAsync(e,t,this.name,(function(){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(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,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=t.pbrMetallicRoughness;return a&&(a.baseColorFactor&&(r.baseColor=g.Color3.FromArray(a.baseColorFactor),r.geometryOpacity=a.baseColorFactor[3]),a.baseColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),a.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),r.baseColorTexture=e})))),r.isUnlit=!0,t.doubleSided&&(r.backFaceCulling=!1,r.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(o).then((function(){}))},e}();Le(lt),Re(lt,!0,(function(e){return new ut(e)}));var ct="KHR_materials_clearcoat",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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadClearCoatPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.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}();Le(ct),Re(ct,!0,(function(e){return new ft(e)}));var ht="KHR_materials_coat",pt=function(){function e(e){this.name=ht,this.order=191,this.useOpenPBR=!1,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.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,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadCoatPropertiesAsync=function(e,t,n){var r,o,a=this._loader._getOrCreateMaterialAdapter(n),i=new Array;a.configureCoat(),a.coatWeight=void 0!==t.coatFactor?t.coatFactor:0,a.coatRoughness=void 0!==t.coatRoughnessFactor?t.coatRoughnessFactor:0,t.coatTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatTexture"),t.coatTexture,(function(e){e.name="".concat(n.name," (Coat)"),a.coatWeightTexture=e}))),t.coatRoughnessTexture&&(t.coatRoughnessTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatRoughnessTexture"),t.coatRoughnessTexture,(function(e){e.name="".concat(n.name," (Coat Roughness)"),a.coatRoughnessTexture=e})))),t.coatNormalTexture&&(t.coatNormalTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatNormalTexture"),t.coatNormalTexture,(function(e){var r;e.name="".concat(n.name," (Coat Normal)"),a.geometryCoatNormalTexture=e,null!=(null===(r=t.coatNormalTexture)||void 0===r?void 0:r.scale)&&(a.geometryCoatNormalTextureScale=t.coatNormalTexture.scale)}))),a.setNormalMapInversions(!n.getScene().useRightHandedSystem,n.getScene().useRightHandedSystem)),a.coatDarkening=void 0!==t.coatDarkeningFactor?t.coatDarkeningFactor:1,a.coatIor=void 0!==t.coatIor?t.coatIor:1.5;var s=g.Color3.White();void 0!==t.coatColorFactor&&s.fromArray(t.coatColorFactor),a.coatColor=s,t.coatColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatColorTexture"),t.coatColorTexture,(function(e){e.name="".concat(n.name," (Coat Color)"),a.coatColorTexture=e})));var l=null!==(r=t.coatAnisotropyStrength)&&void 0!==r?r:0,u=null!==(o=t.coatAnisotropyRotation)&&void 0!==o?o:0;return a.coatRoughnessAnisotropy=l,a.geometryCoatTangentAngle=u,this.useOpenPBR||a.configureGltfStyleAnisotropy(!0),t.coatAnisotropyTexture&&(t.coatAnisotropyTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatAnisotropyTexture"),t.coatAnisotropyTexture,(function(e){e.name="".concat(n.name," (Coat Anisotropy)"),a.geometryCoatTangentTexture=e})))),Promise.all(i).then((function(){}))},e}();Le(ht),Re(ht,!0,(function(e){return new pt(e)}));var dt="KHR_materials_iridescence",mt=function(){function e(e){this.name=dt,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(dt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIridescencePropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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}();Le(dt),Re(dt,!0,(function(e){return new mt(e)}));var _t="KHR_materials_anisotropy",gt=function(){function e(e){this.name=_t,this.order=195,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadAnisotropyPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadAnisotropyPropertiesAsync=function(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=null!==(l=t.anisotropyStrength)&&void 0!==l?l:0,i=null!==(u=t.anisotropyRotation)&&void 0!==u?u:0,r.specularRoughnessAnisotropy=a,r.geometryTangentAngle=i,(s=null!==(c=t.extensions)&&void 0!==c?c:{}).EXT_materials_anisotropy_openpbr&&s.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 f.sent(),[2]}}))}))},e}();Le(_t),Re(_t,!0,(function(e){return new gt(e)}));var yt="KHR_materials_emissive_strength",bt=function(){function e(e){this.name=yt,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(yt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadMaterialPropertiesAsync(e,t,n)];case 1:return r.sent(),this._loadEmissiveProperties(o,a,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}();Le(yt),Re(yt,!0,(function(e){return new bt(e)}));var vt="KHR_materials_sheen",Tt=function(){function e(e){this.name=vt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(vt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSheenPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSheenPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;r.configureFuzz();var a=void 0!==t.sheenColorFactor?g.Color3.FromArray(t.sheenColorFactor):g.Color3.Black(),i=void 0!==t.sheenRoughnessFactor?t.sheenRoughnessFactor:0;return r.fuzzWeight=1,r.fuzzColor=a,r.fuzzRoughness=i,t.sheenColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),t.sheenColorTexture,(function(e){e.name="".concat(n.name," (Sheen Color)"),r.fuzzColorTexture=e}))),t.sheenRoughnessTexture&&(t.sheenRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),t.sheenRoughnessTexture,(function(e){e.name="".concat(n.name," (Sheen Roughness)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();Le(vt),Re(vt,!0,(function(e){return new Tt(e)}));var xt="KHR_materials_fuzz",At=function(){function e(e){this.name=xt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(xt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadFuzzPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadFuzzPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;return r.configureFuzz(),r.fuzzWeight=void 0!==t.fuzzFactor?t.fuzzFactor:0,r.fuzzColor=void 0!==t.fuzzColorFactor?g.Color3.FromArray(t.fuzzColorFactor):g.Color3.White(),r.fuzzRoughness=void 0!==t.fuzzRoughnessFactor?t.fuzzRoughnessFactor:.5,t.fuzzTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzTexture"),t.fuzzTexture,(function(e){e.name="".concat(n.name," (Fuzz)"),r.fuzzWeightTexture=e}))),t.fuzzColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzColorTexture"),t.fuzzColorTexture,(function(e){e.name="".concat(n.name," (Fuzz Color)"),r.fuzzColorTexture=e}))),t.fuzzRoughnessTexture&&(t.fuzzRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzRoughnessTexture"),t.fuzzRoughnessTexture,(function(e){e.name="".concat(n.name," (Fuzz Roughness)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();Le(xt),Re(xt,!0,(function(e){return new At(e)}));var wt="KHR_materials_specular",Ot=function(){function e(e){this.name=wt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(wt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSpecularPropertiesAsync(o,a,n)),i=this._loader._getOrCreateMaterialAdapter(n),a.extensions&&a.extensions.EXT_materials_specular_edge_color&&a.extensions.EXT_materials_specular_edge_color.specularEdgeColorEnabled&&i.enableSpecularEdgeColor(!0),[4,Promise.all(r).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},e.prototype._loadSpecularPropertiesAsync=function(e,t,n){var r,o=this._loader._getOrCreateMaterialAdapter(n),a=new Array;return o.specularWeight=null!==(r=t.specularFactor)&&void 0!==r?r:1,o.specularColor=void 0!==t.specularColorFactor?g.Color3.FromArray(t.specularColorFactor):new g.Color3(1,1,1),t.specularTexture&&(t.specularTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),t.specularTexture,(function(e){e.name="".concat(n.name," (Specular)"),o.specularWeightTexture=e})))),t.specularColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),t.specularColorTexture,(function(e){e.name="".concat(n.name," (Specular Color)"),o.specularColorTexture=e}))),Promise.all(a).then((function(){}))},e}();Le(wt),Re(wt,!0,(function(e){return new Ot(e)}));var Ct="KHR_materials_ior",Mt=function(){function e(e){this.name=Ct,this.order=180,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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIorPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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}();Le(Ct),Re(Ct,!0,(function(e){return new Mt(e)}));var Et="KHR_materials_variants",Pt=function(){function e(e){this.name=Et,this._loader=e,this.enabled=this._loader.isExtensionUsed(Et)&&!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(Et," 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(Et," 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(Et," 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[Et])||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[Et];(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(t,n,r,o,a,i){var s=this;return Ge.LoadExtensionAsync(t,a,this.name,(function(l,u){return(0,L.sH)(s,void 0,void 0,(function(){var s,c=this;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return(s=new Array).push(this._loader._loadMeshPrimitiveAsync(t,n,r,o,a,(function(n){if(i(n),n instanceof g.Mesh){var r=Ge._GetDrawMode(t,a.mode),o=c._loader.rootBabylonMesh,f=o?o._internalMetadata=o._internalMetadata||{}:{},h=f.gltf=f.gltf||{},p=h[Et]=h[Et]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:n,material:n.material});for(var d=function(t){var a=u.mappings[t],i=Be.Get("".concat(l,"/mappings/").concat(t,"/material"),c._loader.gltf.materials,a.material);s.push(c._loader._loadMaterialAsync("#/materials/".concat(a.material),i,n,r,(function(t){for(var r=function(r){var i=a.variants[r],s=Be.Get("/extensions/".concat(Et,"/variants/").concat(i),c._variants,i);p.variants[s.name]=p.variants[s.name]||[],p.variants[s.name].push({mesh:n,material:t}),n.onClonedObservable.add((function(t){var r=t,a=null,i=r;do{if(!(i=i.parent))return;a=e._GetExtensionMetadata(i)}while(null===a);if(o&&a===e._GetExtensionMetadata(o)){for(var l in i._internalMetadata={},o._internalMetadata)i._internalMetadata[l]=o._internalMetadata[l];for(var l in i._internalMetadata.gltf=[],o._internalMetadata.gltf)i._internalMetadata.gltf[l]=o._internalMetadata.gltf[l];i._internalMetadata.gltf[Et]={lastSelected:null,original:[],variants:{}};for(var u=0,c=a.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[Et].original.push({mesh:f.mesh,material:f.material})}for(var l in a.variants)if(Object.prototype.hasOwnProperty.call(a.variants,l)){i._internalMetadata.gltf[Et].variants[l]=[];for(var h=0,p=a.variants[l];h<p.length;h++){var d=p[h];i._internalMetadata.gltf[Et].variants[l].push({mesh:d.mesh,material:d.material})}}a=i._internalMetadata.gltf[Et]}for(var m=0,_=a.original;m<_.length;m++)(b=_[m]).mesh===n&&(b.mesh=r);for(var g=0,y=a.variants[s.name];g<y.length;g++){var b;(b=y[g]).mesh===n&&(b.mesh=r)}}))},i=0;i<a.variants.length;++i)r(i)})))},m=0;m<u.mappings.length;++m)d(m)}}))),[4,Promise.all(s).then((function(e){return e[0]}))];case 1:return[2,f.sent()]}}))}))}))},e}();Le(Et),Re(Et,!0,(function(e){return new Pt(e)}));var Ft=function(){function e(t,n,r){var o=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,L.Cl)((0,L.Cl)({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this._loader=r,this.onErrorObservable=new g.Observable,this._scene.onDisposeObservable.addOnce((function(){o.dispose()})),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:g.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=(0,L.Cl)((0,L.Cl)({},this._options),e),o=this._options;this._options=r,r.renderSize===o.renderSize&&r.renderTargetTextureType===o.renderTargetTextureType&&r.generateMipmaps===o.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._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),g.Tools.SetImmediate((function(){if(e.material){var n=t._loader._getOrCreateMaterialAdapter(e.material);n.transmissionWeight>0?(n.refractionBackgroundTexture=t._opaqueRenderTarget,-1===t._transparentMeshesCache.indexOf(e)&&t._transparentMeshesCache.push(e)):-1===t._opaqueMeshesCache.indexOf(e)&&t._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)},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),r=e.material?this._loader._getOrCreateMaterialAdapter(e.material):null;r&&r.transmissionWeight>0?(r&&(r.refractionBackgroundTexture=this._opaqueRenderTarget),-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,t,n,r=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new g.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!==(t=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==t?t:this._scene.clearColor.clone(),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){n=r._scene.environmentIntensity,r._scene.environmentIntensity=1,r._options.clearColor?e.clearColor.copyFrom(r._options.clearColor):r._scene.clearColor.toLinearSpaceToRef(e.clearColor,r._scene.getEngine().useExactSrgbConversions)})),this._opaqueRenderTarget.onAfterUnbindObservable.add((function(){r._scene.environmentIntensity=n}));for(var o=0,a=this._transparentMeshesCache;o<a.length;o++){var i=a[o];if(i.material){var s=this._loader._getOrCreateMaterialAdapter(i.material);s.transmissionWeight>0&&(s.refractionBackgroundTexture=this._opaqueRenderTarget)}}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},e}(),Rt="KHR_materials_transmission",Lt=function(){function e(e){this.name=Rt,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(Rt),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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTransparentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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 Ft({},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}();Le(Rt),Re(Rt,!0,(function(e){return new Lt(e)}));var Nt="KHR_materials_diffuse_transmission",It=function(){function e(e){this.name=Nt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Nt),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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTranslucentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadTranslucentPropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);a.configureSubsurface(),a.subsurfaceWeight=null!==(o=r.diffuseTransmissionFactor)&&void 0!==o?o:0,a.subsurfaceConstantTint=void 0!==r.diffuseTransmissionColorFactor?g.Color3.FromArray(r.diffuseTransmissionColorFactor):g.Color3.White();var i=new Array;return r.diffuseTransmissionTexture&&(r.diffuseTransmissionTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),r.diffuseTransmissionTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission)"),a.subsurfaceWeightTexture=e})))),r.diffuseTransmissionColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),r.diffuseTransmissionColorTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission Color)"),a.subsurfaceConstantTintTexture=e}))),Promise.all(i).then((function(){}))},e}();Le(Nt),Re(Nt,!0,(function(e){return new It(e)}));var St="KHR_materials_volume",Bt=function(){function e(e){this.name=St,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(St),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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadVolumePropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadVolumePropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);if(0===a.transmissionWeight&&0===a.subsurfaceWeight||!r.thicknessFactor)return Promise.resolve();var i=void 0!==r.attenuationDistance?r.attenuationDistance:Number.MAX_VALUE,s=void 0!==r.attenuationColor&&3==r.attenuationColor.length?g.Color3.FromArray(r.attenuationColor):g.Color3.White(),l=new g.Vector3(-Math.log(s.r),-Math.log(s.g),-Math.log(s.b));l.scaleInPlace(1/Math.max(i,.001)),a.extinctionCoefficient=l,a.transmissionDepth=i,a.transmissionColor=s,a.volumeThickness=null!==(o=r.thicknessFactor)&&void 0!==o?o:0;var u=new Array;return r.thicknessTexture&&(r.thicknessTexture.nonColorData=!0,u.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),r.thicknessTexture,(function(e){e.name="".concat(n.name," (Thickness)"),a.volumeThicknessTexture=e})))),Promise.all(u).then((function(){}))},e}();Le(St),Re(St,!0,(function(e){return new Bt(e)}));var kt="KHR_materials_volume_scatter",Gt=function(){function e(e){this.name=kt,this.order=172,this._loader=e,this.enabled=this._loader.isExtensionUsed(kt),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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadVolumePropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadVolumePropertiesAsync=function(e,t,n,r){var o=this._loader._getOrCreateMaterialAdapter(n);if(0===o.transmissionWeight&&0===o.subsurfaceWeight)return Promise.resolve();var a=void 0!==r.multiscatterColor&&3==r.multiscatterColor.length?g.Color3.FromArray(r.multiscatterColor):g.Color3.Black(),i=void 0!==r.scatterAnisotropy?r.scatterAnisotropy:0;if(o.transmissionWeight>0){var s=function(e){var t=new g.Vector3(e.r,e.g,e.b),n=new g.Vector3(4.09712,4.09712,4.09712);n.multiplyInPlace(t),n.addInPlace(new g.Vector3(4.20863,4.20863,4.20863));var r=new g.Vector3(9.59217,9.59217,9.59217);return r.addInPlace(new g.Vector3(41.6808,41.6808,41.6808).multiplyInPlace(t)),r.addInPlace(new g.Vector3(17.7126,17.7126,17.7126).multiplyInPlace(t.multiply(t))),n.subtractInPlace(new g.Vector3(Math.sqrt(r.x),Math.sqrt(r.y),Math.sqrt(r.z))),new g.Vector3(1,1,1).subtract(n.multiply(n))}(a),l=new g.Vector3(-Math.log(o.transmissionColor.r),-Math.log(o.transmissionColor.g),-Math.log(o.transmissionColor.b));l.scaleInPlace(1/Math.max(o.transmissionDepth,.001));var u=l.multiply(s);u.scaleInPlace(o.transmissionDepth),o.transmissionScatter.set(u.x,u.y,u.z);var c=Promise.resolve(null);return r.multiscatterColorTexture&&(r.multiscatterColorTexture.nonColorData=!0,c=this._loader.loadTextureInfoAsync("".concat(e,"/multiscatterColorTexture"),r.multiscatterColorTexture,(function(e){e.name="".concat(n.name," (Transmission)"),o.transmissionWeightTexture=e}))),o.transmissionScatterAnisotropy=i,c.then((function(){}))}if(o.subsurfaceWeight>0){o.subsurfaceScatterAnisotropy=i,o.subsurfaceColor=a;var f=new g.Vector3(0!==o.extinctionCoefficient.x?1/o.extinctionCoefficient.x:1,0!==o.extinctionCoefficient.y?1/o.extinctionCoefficient.y:1,0!==o.extinctionCoefficient.z?1/o.extinctionCoefficient.z:1);o.subsurfaceRadius=Math.max(f.x,f.y,f.z),o.subsurfaceRadiusScale=new g.Color3(f.x/o.subsurfaceRadius,f.y/o.subsurfaceRadius,f.z/o.subsurfaceRadius)}return Promise.resolve()},e}();Le(kt),Re(kt,!0,(function(e){return new Gt(e)}));var Vt="KHR_materials_dispersion",Dt=function(){function e(e){this.name=Vt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Vt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDispersionPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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}();Le(Vt),Re(Vt,!0,(function(e){return new Dt(e)}));var Ht="KHR_materials_diffuse_roughness",Ut=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 Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDiffuseRoughnessPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.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}();Le(Ht),Re(Ht,!0,(function(e){return new Ut(e)}));var jt="KHR_mesh_quantization",Kt=function(){function e(e){this.name=jt,this.enabled=e.isExtensionUsed(jt)}return e.prototype.dispose=function(){},e}();Le(jt),Re(jt,!0,(function(e){return new Kt(e)}));var Wt="KHR_texture_basisu",Yt=function(){function e(e){this.name=Wt,this._loader=e,this.enabled=e.isExtensionUsed(Wt)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ge.DefaultSampler:Be.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Be.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();Le(Wt),Re(Wt,!0,(function(e){return new Yt(e)}));var zt="KHR_texture_transform",Zt=function(){function e(e){this.name=zt,this._loader=e,this.enabled=this._loader.isExtensionUsed(zt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof g.Texture))throw new Error("".concat(o,": Texture type not supported"));a.offset&&(e.uOffset=a.offset[0],e.vOffset=a.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,a.rotation&&(e.wAng=-a.rotation),a.scale&&(e.uScale=a.scale[0],e.vScale=a.scale[1]),null!=a.texCoord&&(e.coordinatesIndex=a.texCoord),n(e)}))];case 1:return[2,r.sent()]}}))}))}))},e}();Le(zt),Re(zt,!0,(function(e){return new Zt(e)}));var qt="KHR_xmp_json_ld",Xt=function(){function e(e){this.name=qt,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(qt)}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 Qt(e,t,n,r){return g.Color3.FromArray(t,n).scale(r)}function Jt(e,t,n,r){return t[n]*r}function $t(e,t,n,r){return-t[n]*r}function en(e,t,n,r){return t[n+1]*r}function tn(e,t,n,r){return t[n]*r*2}function nn(e){return{scale:[new on(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Jt,(function(){return 2})),new on(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),en,(function(){return 2}))],offset:[new on(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Jt,(function(){return 2})),new on(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),en,(function(){return 2}))],rotation:[new on(g.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),$t,(function(){return 1}))]}}Le(qt),Re(qt,!0,(function(e){return new Xt(e)}));var rn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ve.AnimationPropertyInfo),on=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(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}(Ve.AnimationPropertyInfo),an=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ve.AnimationPropertyInfo),sn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,L.C6)(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}(Ve.AnimationPropertyInfo);(0,Ne.ZU)("/cameras/{}/orthographic/xmag",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",$t,(function(){return 1})),new rn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",en,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/orthographic/ymag",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",$t,(function(){return 1})),new rn(g.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",en,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/orthographic/zfar",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Jt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/orthographic/znear",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"minZ",Jt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/perspective/yfov",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"fov",Jt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/perspective/zfar",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Jt,(function(){return 1}))]),(0,Ne.ZU)("/cameras/{}/perspective/znear",[new rn(g.Animation.ANIMATIONTYPE_FLOAT,"minZ",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new on(g.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",Qt,(function(){return 4})),new on(g.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,r){return t[n+3]*r}),(function(){return 4}))]),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"metallic",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"roughness",Jt,(function(){return 1}))]);var ln=nn("albedoTexture");(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",ln.scale),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",ln.offset),(0,Ne.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",ln.rotation);var un=nn("metallicTexture");(0,Ne.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",un.scale),(0,Ne.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",un.offset),(0,Ne.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",un.rotation),(0,Ne.ZU)("/materials/{}/emissiveFactor",[new on(g.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",Qt,(function(){return 3}))]);var cn=nn("bumpTexture");(0,Ne.ZU)("/materials/{}/normalTexture/scale",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",cn.scale),(0,Ne.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",cn.offset),(0,Ne.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",cn.rotation),(0,Ne.ZU)("/materials/{}/occlusionTexture/strength",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Jt,(function(){return 1}))]);var fn=nn("ambientTexture");(0,Ne.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",fn.scale),(0,Ne.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",fn.offset),(0,Ne.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",fn.rotation);var hn=nn("emissiveTexture");(0,Ne.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",hn.scale),(0,Ne.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",hn.offset),(0,Ne.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",hn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Jt,(function(){return 1}))]);var pn=nn("anisotropy.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",pn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",pn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",pn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Jt,(function(){return 1}))]);var dn=nn("clearCoat.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",dn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",dn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",dn.rotation);var mn=nn("clearCoat.bumpTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",mn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",mn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",mn.rotation);var _n=nn("clearCoat.textureRoughness");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",_n.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",_n.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",_n.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_ior/ior",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Jt,(function(){return 1}))]);var gn=nn("iridescence.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",gn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",gn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",gn.rotation);var yn=nn("iridescence.thicknessTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",yn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",yn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",yn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new on(g.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",Qt,(function(){return 3}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Jt,(function(){return 1}))]);var bn=nn("sheen.texture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",bn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",bn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",bn.rotation);var vn=nn("sheen.textureRoughness");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",vn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",vn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",vn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new on(g.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Qt,(function(){return 3}))]);var Tn=nn("metallicReflectanceTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",Tn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",Tn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",Tn.rotation);var xn=nn("reflectanceTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",xn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",xn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",xn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Jt,(function(){return 1}))]);var An=nn("subSurface.refractionIntensityTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",An.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",An.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",An.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new on(g.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Qt,(function(){return 3}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Jt,(function(){return 1}))]),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Jt,(function(){return 1}))]);var wn=nn("subSurface.thicknessTexture");(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",wn.scale),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",wn.offset),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",wn.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new on(g.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Jt,(function(){return 1}))]);var On=nn("subSurface.translucencyIntensityTexture");(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",On.scale),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",On.offset),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",On.rotation),(0,Ne.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new on(g.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",Qt,(function(){return 3}))]);var Cn=nn("subSurface.translucencyColorTexture");(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",Cn.scale),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",Cn.offset),(0,Ne.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",Cn.rotation),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/color",[new an(g.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Qt,(function(){return 3}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"intensity",Jt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/range",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"range",Jt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",tn,(function(){return 1}))]),(0,Ne.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"angle",tn,(function(){return 1}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/color",[new an(g.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Qt,(function(){return 3}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/intensity",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"intensity",Jt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/size",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"radius",Jt,(function(){return 1}))]),(0,Ne.ZU)("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"radius",Jt,(function(){return 1}))]),(0,Ne.ZU)("/nodes/{}/extensions/EXT_lights_ies/color",[new an(g.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Qt,(function(){return 3}))]),(0,Ne.ZU)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new an(g.Animation.ANIMATIONTYPE_FLOAT,"intensity",Jt,(function(){return 1}))]),(0,Ne.ZU)("/nodes/{}/extensions/KHR_node_visibility/visible",[new sn(g.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Jt,(function(){return 1}))]);var Mn="KHR_animation_pointer",En=function(){function e(e){this.name=Mn,this._loader=e,this._pathToObjectConverter=(0,Ne.Wt)(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(Mn)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,t,n,r,o){var a,i=null===(a=r.target.extensions)||void 0===a?void 0:a.KHR_animation_pointer;if(!i||!this._pathToObjectConverter)return null;"pointer"!==r.target.path&&g.Logger.Warn("".concat(e,"/target/path: Value (").concat(r.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=r.target.node&&g.Logger.Warn("".concat(e,"/target/node: Value (").concat(r.target.node,") must not be present when using the ").concat(this.name," extension"));var s="".concat(e,"/extensions/").concat(this.name),l=i.pointer;if(!l)throw new Error("".concat(s,": Pointer is missing"));try{var u=this._pathToObjectConverter.convert(l);if(!u.info.interpolation)throw new Error("".concat(s,"/pointer: Interpolation is missing"));return this._loader._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,{object:u.object,info:u.info.interpolation},o)}catch(e){return g.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();Le(Mn),Re(Mn,!0,(function(e){return new En(e)}));var Pn="MSFT_audio_emitter",Fn=function(){function e(e){this.name=Pn,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pn)}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,Be.Assign(this._clips),Be.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,L.YH)(this,(function(u){switch(u.label){case 0:for((n=new Array).push(this._loader.loadSceneAsync(e,t)),a=0,i=o.emitters;a<i.length;a++){if(s=i[a],null!=(l=Be.Get("".concat(r,"/emitters"),this._emitters,s)).refDistance||null!=l.maxDistance||null!=l.rolloffFactor||null!=l.distanceModel||null!=l.innerAngle||null!=l.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(l.index),l))}return[4,Promise.all(n)];case 1:return u.sent(),[2]}}))}))}))},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,L.sH)(r,void 0,void 0,(function(){var r,a,i=this;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return r=new Array,[4,this._loader.loadNodeAsync(e,t,(function(t){for(var a=function(n){var o=Be.Get("".concat(e,"/emitters"),i._emitters,n);r.push(i._loadEmitterAsync("".concat(e,"/emitters/").concat(o.index),o).then((function(){for(var e=0,n=o._babylonSounds;e<n.length;e++){var r=n[e];r.attachToMesh(t),null==o.innerAngle&&null==o.outerAngle||(r.setLocalDirectionToMesh(g.Vector3.Forward()),r.setDirectionalCone(2*g.Tools.ToDegrees(null==o.innerAngle?Math.PI:o.innerAngle),2*g.Tools.ToDegrees(null==o.outerAngle?Math.PI:o.outerAngle),0))}})))},s=0,l=o.emitters;s<l.length;s++)a(l[s]);n(t)}))];case 1:return a=s.sent(),[4,Promise.all(r)];case 2:return s.sent(),[2,a]}}))}))}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,L.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,L.YH)(this,(function(u){switch(u.label){case 0:return[4,this._loader.loadAnimationAsync(e,t)];case 1:for(n=u.sent(),a=new Array,Be.Assign(o.events),i=0,s=o.events;i<s.length;i++)l=s[i],a.push(this._loadAnimationEventAsync("".concat(r,"/events/").concat(l.index),e,t,l,n));return[4,Promise.all(a)];case 2:return u.sent(),[2,n]}}))}))}))},e.prototype._loadClipAsync=function(e,t){if(t._objectURL)return t._objectURL;var n;if(t.uri)n=this._loader.loadUriAsync(e,t,t.uri);else{var r=Be.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,t.bufferView);n=this._loader.loadBufferViewAsync("/bufferViews/".concat(r.index),r)}return t._objectURL=n.then((function(e){return URL.createObjectURL(new Blob([e],{type:t.mimeType}))})),t._objectURL},e.prototype._loadEmitterAsync=function(e,t){var n=this;if(t._babylonSounds=t._babylonSounds||[],!t._babylonData){for(var r=new Array,o=t.name||"emitter".concat(t.index),a={loop:!1,autoplay:!1,volume:null==t.volume?1:t.volume},i=function(e){var i="/extensions/".concat(s.name,"/clips"),l=Be.Get(i,s._clips,t.clips[e].clip);r.push(s._loadClipAsync("".concat(i,"/").concat(t.clips[e].clip),l).then((function(r){var i=t._babylonSounds[e]=new g.Sound(o,r,n._loader.babylonScene,null,a);i.refDistance=t.refDistance||1,i.maxDistance=t.maxDistance||256,i.rolloffFactor=t.rolloffFactor||1,i.distanceModel=t.distanceModel||"exponential"})))},s=this,l=0;l<t.clips.length;l++)i(l);var u=Promise.all(r).then((function(){var e=t.clips.map((function(e){return e.weight||1})),n=new g.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*g.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*g.Tools.ToDegrees(t.outerAngle)),t.volume&&(n.volume=t.volume),t._babylonData.sound=n}));t._babylonData={loaded:u}}return t._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,t,n,r,o){var a=this;if(0==o.targetedAnimations.length)return Promise.resolve();var i=o.targetedAnimations[0],s=r.emitter,l=Be.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,s);return this._loadEmitterAsync(e,l).then((function(){var t=l._babylonData.sound;if(t){var n=new g.AnimationEvent(r.time,a._getEventAction(e,t,r.action,r.time,r.startOffset));i.animation.addEvent(n),o.onAnimationGroupEndObservable.add((function(){t.stop()})),o.onAnimationGroupPauseObservable.add((function(){t.pause()}))}}))},e}();Le(Pn),Re(Pn,!0,(function(e){return new Fn(e)}));var Rn="MSFT_lod",Ln=function(){function e(e){var t,n;this.name=Rn,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new g.Observable,this.onMaterialLODsLoadedObservable=new g.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!==(n=null===(t=this._loader.parent.extensionOptions[Rn])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(Rn)}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,t,n){var r=this;return Ge.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,L.sH)(r,void 0,void 0,(function(){var r,a,i,s,l,u=this;return(0,L.YH)(this,(function(c){switch(c.label){case 0:for(a=this._getLODs(e,t,this._loader.gltf.nodes,o.ids),this._loader.logOpen("".concat(e)),i=function(e){var t=a[e];0!==e&&(s._nodeIndexLOD=e,s._nodeSignalLODs[e]=s._nodeSignalLODs[e]||new g.Deferred);var o=s._loader.loadNodeAsync("/nodes/".concat(t.index),t,(function(e){n(e),e.setEnabled(!1)})).then((function(t){if(0!==e){var n=a[e-1];n._babylonTransformNode&&(u._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t}));s._nodePromiseLODs[e]=s._nodePromiseLODs[e]||[],0===e?r=o:(s._nodeIndexLOD=null,s._nodePromiseLODs[e].push(o))},s=this,l=0;l<a.length;l++)i(l);return this._loader.logClose(),[4,r];case 1:return[2,c.sent()]}}))}))}))},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var a=this;return this._nodeIndexLOD?null:Ge.LoadExtensionAsync(e,t,this.name,(function(e,i){return(0,L.sH)(a,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,L.YH)(this,(function(h){switch(h.label){case 0:for(s=this._getLODs(e,t,this._loader.gltf.materials,i.ids),this._loader.logOpen("".concat(e)),l=function(e){var t=s[e];0!==e&&(u._materialIndexLOD=e);var i=u._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]&&(f._disposeMaterials([n[r].babylonMaterial]),delete n[r])}return t}));u._materialPromiseLODs[e]=u._materialPromiseLODs[e]||[],0===e?a=i:(u._materialIndexLOD=null,u._materialPromiseLODs[e].push(i))},u=this,c=0;c<s.length;c++)l(c);return this._loader.logClose(),[4,a];case 1:return[2,h.sent()]}}))}))}))},e.prototype._loadUriAsync=function(e,t,n){var r=this;if(null!==this._nodeIndexLOD){this._loader.log("deferred");var o=this._nodeIndexLOD-1;return this._nodeSignalLODs[o]=this._nodeSignalLODs[o]||new g.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))}return null!==this._materialIndexLOD?(this._loader.log("deferred"),o=this._materialIndexLOD-1,this._materialSignalLODs[o]=this._materialSignalLODs[o]||new g.Deferred,this._materialSignalLODs[o].promise.then((function(){return(0,L.sH)(r,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))):null},e.prototype.loadBufferAsync=function(e,t,n,r){var o=this;if(this._loader.parent.useRangeRequests&&!t.uri){if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));var a=function(e,t){return(0,L.sH)(o,void 0,void 0,(function(){var o,a,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return a=(o=n)+r-1,(i=e[t])?(i.start=Math.min(i.start,o),i.end=Math.max(i.end,a)):(i={start:o,end:a,loaded:new g.Deferred},e[t]=i),[4,i.loaded.promise.then((function(e){return new Uint8Array(e.buffer,e.byteOffset+n-i.start,r)}))];case 1:return[2,s.sent()]}}))}))};return this._loader.log("deferred"),null!==this._nodeIndexLOD?a(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?a(this._materialBufferLODs,this._materialIndexLOD):a(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(Be.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}();Le(Rn),Re(Rn,!0,(function(e){return new Ln(e)}));var Nn="MSFT_minecraftMesh",In=function(){function e(e){this.name=Nn,this._loader=e,this.enabled=this._loader.isExtensionUsed(Nn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ge.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r;return(0,L.YH)(this,(function(i){switch(i.label){case 0:if(!a)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,i.sent()];case 2:return[2]}}))}))}))},e}();Le(Nn),Re(Nn,!0,(function(e){return new In(e)}));var Sn="MSFT_sRGBFactors",Bn=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 Ge.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,L.sH)(r,void 0,void 0,(function(){var r,o,i;return(0,L.YH)(this,(function(s){switch(s.label){case 0:return a?(r=this._loader._getOrCreateMaterialAdapter(n),o=this._loader.loadMaterialPropertiesAsync(e,t,n),i=n.getScene().getEngine().useExactSrgbConversions,r.baseColorTexture||r.baseColor.toLinearSpaceToRef(r.baseColor,i),r.specularColorTexture||r.specularColor.toLinearSpaceToRef(r.specularColor,i),[4,o]):[3,2];case 1:return[2,s.sent()];case 2:return[2]}}))}))}))},e}();function kn(e){var t=e.split(":");return Gn({op:t[0],extension:t[1]})}function Gn(e,t){var n;void 0===t&&(t=!0);var r=e.extension?null===(n=Dn[e.extension])||void 0===n?void 0:n[e.op]:Hn[e.op];if(!r&&(g.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),t)){var o={},a={flows:{}};if(e.inputValueSockets)for(var i in o.values={},e.inputValueSockets)o.values[i]={name:i};return e.outputValueSockets&&(a.values={},Object.keys(e.outputValueSockets).forEach((function(e){a.values[e]={name:e}}))),{blocks:[],inputs:o,outputs:a}}return r}function Vn(e,t,n){Dn[t]||(Dn[t]={}),Dn[t][e]=n}Le(Sn),Re(Sn,!0,(function(e){return new Bn(e)}));var Dn={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},Hn={"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,t){var n,r;if(!e.configuration)return g.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};var o=e.configuration.event;if(!o)return g.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 a=null===(n=o.value)||void 0===n?void 0:n[0];return"number"!=typeof a?(g.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):(null===(r=t.events)||void 0===r?void 0:r[a])?{valid:!0}:(g.Logger.Error("Event with id ".concat(a," not found")),{valid:!1,error:"Event with id ".concat(a," 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":Un("FlowGraphEBlock"),"math/Pi":Un("FlowGraphPIBlock"),"math/Inf":Un("FlowGraphInfBlock"),"math/NaN":Un("FlowGraphNaNBlock"),"math/abs":Un("FlowGraphAbsBlock"),"math/sign":Un("FlowGraphSignBlock"),"math/trunc":Un("FlowGraphTruncBlock"),"math/floor":Un("FlowGraphFloorBlock"),"math/ceil":Un("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":Un("FlowGraphFractBlock"),"math/neg":Un("FlowGraphNegationBlock"),"math/add":Un("FlowGraphAddBlock",["a","b"],!0),"math/sub":Un("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?jn(e):{valid:!0}}},"math/div":Un("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Un("FlowGraphModuloBlock",["a","b"]),"math/min":Un("FlowGraphMinBlock",["a","b"]),"math/max":Un("FlowGraphMaxBlock",["a","b"]),"math/clamp":Un("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Un("FlowGraphSaturateBlock"),"math/mix":Un("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Un("FlowGraphEqualityBlock",["a","b"]),"math/lt":Un("FlowGraphLessThanBlock",["a","b"]),"math/le":Un("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Un("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Un("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":Un("FlowGraphIsNaNBlock"),"math/isInf":Un("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":Un("FlowGraphSinBlock"),"math/cos":Un("FlowGraphCosBlock"),"math/tan":Un("FlowGraphTanBlock"),"math/asin":Un("FlowGraphASinBlock"),"math/acos":Un("FlowGraphACosBlock"),"math/atan":Un("FlowGraphATanBlock"),"math/atan2":Un("FlowGraphATan2Block",["a","b"]),"math/sinh":Un("FlowGraphSinhBlock"),"math/cosh":Un("FlowGraphCoshBlock"),"math/tanh":Un("FlowGraphTanhBlock"),"math/asinh":Un("FlowGraphASinhBlock"),"math/acosh":Un("FlowGraphACoshBlock"),"math/atanh":Un("FlowGraphATanhBlock"),"math/exp":Un("FlowGraphExponentialBlock"),"math/log":Un("FlowGraphLogBlock"),"math/log2":Un("FlowGraphLog2Block"),"math/log10":Un("FlowGraphLog10Block"),"math/sqrt":Un("FlowGraphSquareRootBlock"),"math/cbrt":Un("FlowGraphCubeRootBlock"),"math/pow":Un("FlowGraphPowerBlock",["a","b"]),"math/length":Un("FlowGraphLengthBlock"),"math/normalize":Un("FlowGraphNormalizeBlock"),"math/dot":Un("FlowGraphDotBlock",["a","b"]),"math/cross":Un("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":Un("FlowGraphTransposeBlock"),"math/determinant":Un("FlowGraphDeterminantBlock"),"math/inverse":Un("FlowGraphInvertMatrixBlock"),"math/matMul":Un("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":Un("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":Un("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":Un("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":Un("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":Un("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Un("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Un("FlowGraphLeadingZerosBlock"),"math/ctz":Un("FlowGraphTrailingZerosBlock"),"math/popcnt":Un("FlowGraphOneBitsCounterBlock"),"math/rad":Un("FlowGraphDegToRadBlock"),"math/deg":Un("FlowGraphRadToDegBlock"),"type/boolToInt":Un("FlowGraphBooleanToInt"),"type/boolToFloat":Un("FlowGraphBooleanToFloat"),"type/intToBool":Un("FlowGraphIntToBoolean"),"type/intToFloat":Un("FlowGraphIntToFloat"),"type/floatToInt":Un("FlowGraphFloatToInt"),"type/floatToBool":Un("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 t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return g.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}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 t,n;return(null===(n=null===(t=e.configuration)||void 0===t?void 0:t.variable)||void 0===n?void 0:n.value)?{valid:!0}:(g.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,t,n,r,o){var a,i,s,l,u,c,f=o[0],h=null===(i=null===(a=e.configuration)||void 0===a?void 0:a.variable.value)||void 0===i?void 0:i[0];if("number"!=typeof h)throw g.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var p=r.arrays.staticVariables[h];void 0===(null===(l=null===(s=f.config)||void 0===s?void 0:s.animationType)||void 0===l?void 0:l.value)&&(f.config||(f.config={}),(u=f.config).animationType||(u.animationType={}),f.config.animationType.value=(0,g.getAnimationTypeByFlowGraphType)(p.type));var d=o[4];return d.config||(d.config={}),(c=d.config).variable||(c.variable={}),d.config.variable.value=r.getVariableName(h),o}},"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 t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return g.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}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 Un(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?jn(e):{valid:!0}}}}function jn(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 Kn(){return Object.keys(Hn)}var Wn={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"}},Yn=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(Wn[n.signature])}},e.prototype._parseDeclarations=function(){if(this._interactivityGraph.declarations)for(var e=0,t=this._interactivityGraph.declarations;e<t.length;e++){var n=t[e],r=Gn(n);if(!r)throw g.Logger.Error(["No mapping found for declaration",n]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:r,fullOperationName:n.extension?n.op+":"+n.extension:n.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,t){var n=this._types[e.type];if(!n)throw g.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==n.length)throw g.Logger.Error(["Invalid value length for variable",e,n]),new Error("Error parsing variables");var r=e.value||[];if(!r.length)switch(n.flowGraphType){case"boolean":r.push(!1);break;case"FlowGraphInteger":r.push(0);break;case"number":r.push(NaN);break;case"Vector2":r.push(NaN,NaN);break;case"Vector3":r.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":r.fill(NaN,0,4);break;case"Matrix":r.fill(NaN,0,16);break;case"Matrix3D":r.fill(NaN,0,9)}return"number"===n.elementType&&"string"==typeof r[0]&&(r[0]=parseFloat(r[0])),{type:n.flowGraphType,value:t?t(r,this):r}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var t=function(t){var r={eventId:t.id||"internalEvent_"+n._internalEventsCounter++};t.values&&(r.eventData=Object.keys(t.values).map((function(n){var r,o=null===(r=t.values)||void 0===r?void 0:r[n];if(!o)throw g.Logger.Error(["No value found for event key",n]),new Error("Error parsing events");var a=e._types[o.type];if(!a)throw g.Logger.Error(["No type found for event value",o]),new Error("Error parsing events");var i=void 0!==o.value?e._parseVariable(o):void 0;return{id:n,type:a.flowGraphType,eventData:!0,value:i}}))),n._events.push(r)},n=this,r=0,o=this._interactivityGraph.events;r<o.length;r++)t(o[r])},e.prototype._parseNodes=function(){var e;if(this._interactivityGraph.nodes)for(var t=0,n=this._interactivityGraph.nodes;t<n.length;t++){var r=n[t];if("number"!=typeof r.declaration)throw g.Logger.Error(["No declaration found for node",r]),new Error("Error parsing nodes");var o=this._mappings[r.declaration];if(!o)throw g.Logger.Error(["No mapping found for node",r]),new Error("Error parsing nodes");if(o.flowGraphMapping.validation){var a=o.flowGraphMapping.validation(r,this._interactivityGraph,this._gltf);if(!a.valid)throw new Error("Error validating interactivity node ".concat(null===(e=this._interactivityGraph.declarations)||void 0===e?void 0:e[r.declaration].op," - ").concat(a.error))}for(var i=[],s=0,l=o.flowGraphMapping.blocks;s<l.length;s++){var u=l[s],c=this._getEmptyBlock(u,o.fullOperationName);this._parseNodeConfiguration(r,c,o.flowGraphMapping,u),i.push(c)}this._nodes.push({blocks:i,fullOperationName:o.fullOperationName})}},e.prototype._getEmptyBlock=function(e,t){return{uniqueId:(0,g.RandomGUID)(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,t,n,r){var o,a=e.configuration;if(a)for(var i in a){var s=a[i];if(!s)throw new Error("Error parsing node configuration");var l=null===(o=n.configuration)||void 0===o?void 0:o[i];if(l&&l.toBlock?l.toBlock===r:0===n.blocks.indexOf(r)){var u=null==l?void 0:l.defaultValue;(null==s?void 0:s.value)&&(u=s.value),(null==l?void 0:l.isArray)||(1!==u.length&&g.Logger.Warn("Invalid non-array value length: ".concat(u.length)),u=u[0]),(null==l?void 0:l.dataTransformer)&&(u=l.dataTransformer(u,this)),void 0!==u&&(t.config[(null==l?void 0:l.name)||i]={value:u})}}},e.prototype._parseNodeConnections=function(e){for(var t,n,r,o,a,i,s,l,u,c,f,h,p,d,m,_,y,b,v,T=0;T<this._nodes.length;T++){var x=null===(t=this._interactivityGraph.nodes)||void 0===t?void 0:t[T];if(!x)throw g.Logger.Error(["No node found for interactivity node",this._nodes[T]]),new Error("Error parsing node connections");var A=this._nodes[T],w=this._mappings[x.declaration];if(!w)throw g.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var O=x.flows||{},C=Object.keys(O).sort(),M=function(e){var t=O[e],u=null===(r=null===(n=w.flowGraphMapping.outputs)||void 0===n?void 0:n.flows)||void 0===r?void 0:r[e],c=(null==u?void 0:u.name)||e,f=E._createNewSocketConnection(c,!0);(u&&u.toBlock&&A.blocks.find((function(e){return e.className===u.toBlock}))||A.blocks[0]).signalOutputs.push(f);var h=t.node,p=E._nodes[h];if(!p)throw g.Logger.Error(["No node found for input node id",h]),new Error("Error parsing node connections");var d=kn(p.fullOperationName);if(!d)throw g.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var m=null===(a=null===(o=d.inputs)||void 0===o?void 0:o.flows)||void 0===a?void 0:a[t.socket||"in"],_=!1;if(!m)for(var y in null===(i=d.inputs)||void 0===i?void 0:i.flows)y.startsWith("[")&&y.endsWith("]")&&(_=!0,m=null===(l=null===(s=d.inputs)||void 0===s?void 0:s.flows)||void 0===l?void 0:l[y]);var b=m?_?m.name.replace("$1",t.socket||""):m.name:t.socket||"in",v=m&&m.toBlock&&p.blocks.find((function(e){return e.className===m.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(f.uniqueId),f.connectedPointIds.push(T.uniqueId)},E=this,P=0,F=C;P<F.length;P++)M(F[P]);for(var R=x.values||{},L=Object.keys(R),N=function(t){var n=R[t],r=null===(c=null===(u=w.flowGraphMapping.inputs)||void 0===u?void 0:u.values)||void 0===c?void 0:c[t],o=!1;if(!r)for(var a in null===(f=w.flowGraphMapping.inputs)||void 0===f?void 0:f.values)a.startsWith("[")&&a.endsWith("]")&&(o=!0,r=null===(p=null===(h=w.flowGraphMapping.inputs)||void 0===h?void 0:h.values)||void 0===p?void 0:p[a]);var i=r?o?r.name.replace("$1",t):r.name:t,s=I._createNewSocketConnection(i);if((r&&r.toBlock&&A.blocks.find((function(e){return e.className===r.toBlock}))||A.blocks[0]).dataInputs.push(s),void 0!==n.value){var l=I._parseVariable(n,r&&r.dataTransformer);e._connectionValues[s.uniqueId]=l}else{if(void 0===n.node)throw g.Logger.Error(["Invalid value for value connection",n]),new Error("Error parsing node connections");var v=n.node,T=n.socket||"value",x=I._nodes[v];if(!x)throw g.Logger.Error(["No node found for output socket reference",n]),new Error("Error parsing node connections");var O=kn(x.fullOperationName);if(!O)throw g.Logger.Error(["No mapping found for output socket reference",n]),new Error("Error parsing node connections");var C=null===(m=null===(d=O.outputs)||void 0===d?void 0:d.values)||void 0===m?void 0:m[T],M=!1;if(!C)for(var a in null===(_=O.outputs)||void 0===_?void 0:_.values)a.startsWith("[")&&a.endsWith("]")&&(M=!0,C=null===(b=null===(y=O.outputs)||void 0===y?void 0:y.values)||void 0===b?void 0:b[a]);var E=C?M?C.name.replace("$1",T):null==C?void 0:C.name:T,P=C&&C.toBlock&&x.blocks.find((function(e){return e.className===C.toBlock}))||x.blocks[0],F=P.dataOutputs.find((function(e){return e.name===E}));F||(F=I._createNewSocketConnection(E,!0),P.dataOutputs.push(F)),s.connectedPointIds.push(F.uniqueId),F.connectedPointIds.push(s.uniqueId)}},I=this,S=0,B=L;S<B.length;S++)N(B[S]);if(w.flowGraphMapping.interBlockConnectors)for(var k=0,G=w.flowGraphMapping.interBlockConnectors;k<G.length;k++){var V=G[k],D=V.input,H=V.output,U=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],U)}if(w.flowGraphMapping.extraProcessor){var j=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!j)throw g.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=w.flowGraphMapping.extraProcessor(x,j,w.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,t){return{uniqueId:(0,g.RandomGUID)(),name:e,_connectionType:t?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:(0,g.RandomGUID)(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var t=0;t<this._staticVariables.length;t++){var n=this._staticVariables[t];e._userVariables[this.getVariableName(t)]=n}return{rightHanded:!0,allBlocks:this._nodes.reduce((function(e,t){return e.concat(t.blocks)}),[]),executionContexts:[e]}},e}(),zn="KHR_interactivity",Zn=function(){function e(e){this._loader=e,this.name=zn,this.enabled=this._loader.isExtensionUsed(zn),this._pathConverter=(0,Ne.Wt)(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&qn(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return(0,L.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a=this;return(0,L.YH)(this,(function(i){switch(i.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(t=null===(o=this._loader.gltf.extensions)||void 0===o?void 0:o.KHR_interactivity)?((n=new g.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,r=t.graphs.map((function(e){return new Yn(e,a._loader.gltf,a._loader.parent.targetFps).serializeToFlowGraph()})),[4,Promise.all(r.map((function(e){return(0,L.sH)(a,void 0,void 0,(function(){return(0,L.YH)(this,(function(t){switch(t.label){case 0:return[4,(0,g.ParseFlowGraphAsync)(e,{coordinator:n,pathConverter:this._pathConverter})];case 1:return[2,t.sent()]}}))}))})))]):[2]):[2];case 1:return i.sent(),n.start(),[2]}}))}))},e}();function qn(e){(0,Ne.oR)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new g.Quaternion(NaN,NaN,NaN,NaN);var t=g.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:function(){return e.activeCamera}}),(0,Ne.oR)("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new g.Vector3(NaN,NaN,NaN);var t=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(t.x*=-1),t},type:"Vector3",getTarget:function(){return e.activeCamera}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}}),(0,Ne.oR)("/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}})}(0,g.addToBlockFactory)(zn,"FlowGraphGLTFDataProvider",(function(){return(0,L.sH)(void 0,void 0,void 0,(function(){return(0,L.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(a.bind(a,274))];case 1:return[2,e.sent().FlowGraphGLTFDataProvider]}}))}))})),Le(zn),Re(zn,!0,(function(e){return new Zn(e)}));var Xn="KHR_node_visibility";(0,Ne.oR)("/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 Qn=function(){function e(e){this.name=Xn,this._loader=e,this.enabled=e.isExtensionUsed(Xn)}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}();Le(Xn),Re(Xn,!0,(function(e){return new Qn(e)}));var Jn="KHR_node_selectability";Vn("event/onSelect",Jn,{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,p,d=o[o.length-1];d.config=d.config||{},d.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===(p=null===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}}),(0,Ne.oR)("/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 $n=function(){function e(e){this.name=Jn,this._loader=e,this.enabled=e.isExtensionUsed(Jn)}return e.prototype.onReady=function(){return(0,L.sH)(this,void 0,void 0,(function(){var e;return(0,L.YH)(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}();Le(Jn),Re(Jn,!0,(function(e){return new $n(e)}));var er="KHR_node_hoverability",tr="targetMeshPointerOver_";Vn("event/onHoverIn",er,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return tr+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,p,d=o[o.length-1];d.config=d.config||{},d.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 _=tr+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===(p=null===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}});var nr="targetMeshPointerOut_";Vn("event/onHoverOut",er,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return nr+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,p,d=o[o.length-1];d.config=d.config||{},d.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 _=nr+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===(p=null===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}}),(0,Ne.oR)("/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 rr=function(){function e(e){this.name=er,this._loader=e,this.enabled=e.isExtensionUsed(er)}return e.prototype.onReady=function(){return(0,L.sH)(this,void 0,void 0,(function(){var e;return(0,L.YH)(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}();Le(er),Re(er,!0,(function(e){return new rr(e)}));var or="ExtrasAsMetadata",ar=function(){function e(e){this.name=or,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}();Le(or),Re(or,!1,(function(e){return new ar(e)}));var ir=a(274),sr=function(){function e(){this.materials=[]}return e.prototype.parseMTL=function(t,n,r,o){if(!(n instanceof ArrayBuffer)){for(var a,i=n.split("\n"),s=/\s+/,l=null,u=0;u<i.length;u++){var c=i[u].trim();if(0!==c.length&&"#"!==c.charAt(0)){var f=c.indexOf(" "),h=f>=0?c.substring(0,f):c;h=h.toLowerCase();var p=f>=0?c.substring(f+1).trim():"";if("newmtl"===h)l&&this.materials.push(l),t._blockEntityCollection=!!o,(l=new g.StandardMaterial(p,t))._parentContainer=o,t._blockEntityCollection=!1;else if("kd"===h&&l)a=p.split(s,3).map(parseFloat),l.diffuseColor=g.Color3.FromArray(a);else if("ka"===h&&l)a=p.split(s,3).map(parseFloat),l.ambientColor=g.Color3.FromArray(a);else if("ks"===h&&l)a=p.split(s,3).map(parseFloat),l.specularColor=g.Color3.FromArray(a);else if("ke"===h&&l)a=p.split(s,3).map(parseFloat),l.emissiveColor=g.Color3.FromArray(a);else if("ns"===h&&l)l.specularPower=parseFloat(p);else if("d"===h&&l)l.alpha=parseFloat(p);else if("map_ka"===h&&l)l.ambientTexture=e._GetTexture(r,p,t);else if("map_kd"===h&&l)l.diffuseTexture=e._GetTexture(r,p,t);else if("map_ks"===h&&l)l.specularTexture=e._GetTexture(r,p,t);else if("map_ns"===h);else if("map_bump"===h&&l){var d=p.split(s),m=d.indexOf("-bm"),_=null;m>=0&&(_=d[m+1],d.splice(m,2)),l.bumpTexture=e._GetTexture(r,d.join(" "),t),l.bumpTexture&&null!==_&&(l.bumpTexture.level=parseFloat(_))}else"map_d"===h&&l&&(l.opacityTexture=e._GetTexture(r,p,t))}}l&&this.materials.push(l)}},e._GetTexture=function(t,n,r){if(!n)return null;var o=t;if("file:"===t){var a=n.lastIndexOf("\\");-1===a&&(a=n.lastIndexOf("/")),o+=a>-1?n.substring(a+1):n}else o+=n;return new g.Texture(o,r,!1,e.INVERT_TEXTURE_Y)},e.INVERT_TEXTURE_Y=!0,e}(),lr=function(){function e(e,t,n){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._extColors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new g.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=e,this._babylonMeshesArray=t,this._loadingOptions=n}return e.prototype._isInArray=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[]});var n=e[t[0]].normals.indexOf(t[1]);return-1===n?-1:e[t[0]].idx[n]},e.prototype._isInArrayUV=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[],uv:[]});var n=e[t[0]].normals.indexOf(t[1]);return 1!=n&&t[2]===e[t[0]].uv[n]?e[t[0]].idx[n]:-1},e.prototype._setData=function(e){var t,n,r;null!==(t=e.indiceUvsFromObj)&&void 0!==t||(e.indiceUvsFromObj=-1),null!==(n=e.indiceNormalFromObj)&&void 0!==n||(e.indiceNormalFromObj=-1),-1===(r=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj,e.indiceUvsFromObj]):this._isInArray(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(e.positionVectorFromOBJ),void 0!==e.textureVectorFromOBJ&&this._wrappedUvsForBabylon.push(e.textureVectorFromOBJ),void 0!==e.normalsVectorFromOBJ&&this._wrappedNormalsForBabylon.push(e.normalsVectorFromOBJ),void 0!==e.positionColorsFromOBJ&&this._wrappedColorsForBabylon.push(e.positionColorsFromOBJ),this._tuplePosNorm[e.indicePositionFromObj].normals.push(e.indiceNormalFromObj),this._tuplePosNorm[e.indicePositionFromObj].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[e.indicePositionFromObj].uv.push(e.indiceUvsFromObj)):this._indicesForBabylon.push(r)},e.prototype._unwrapData=function(){try{for(var e=0;e<this._wrappedPositionForBabylon.length;e++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[e].x*this._handednessSign,this._wrappedPositionForBabylon[e].y,this._wrappedPositionForBabylon[e].z),this._wrappedNormalsForBabylon.length&&this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[e].x*this._handednessSign,this._wrappedNormalsForBabylon[e].y,this._wrappedNormalsForBabylon[e].z),this._wrappedUvsForBabylon.length&&this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[e].x,this._wrappedUvsForBabylon[e].y),this._unwrappedColorsForBabylon.length&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[e].r,this._wrappedColorsForBabylon[e].g,this._wrappedColorsForBabylon[e].b,this._wrappedColorsForBabylon[e].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0}catch(e){throw new Error("Unable to unwrap data while parsing OBJ data.")}},e.prototype._getTriangles=function(e,t){for(var n=t;n<e.length-1;n++)this._pushTriangle(e,n)},e.prototype._getColor=function(e){var t;return this._loadingOptions.importVertexColors?null!==(t=this._extColors[e])&&void 0!==t?t:this._colors[e]:void 0},e.prototype._setDataForCurrentFaceWithPattern1=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=parseInt(this._triangles[n])-1;this._setData({indicePositionFromObj:r,positionVectorFromOBJ:this._positions[r],positionColorsFromOBJ:this._getColor(r)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern2=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern3=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1,i=parseInt(r[2])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i]})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern4=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("//"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceNormalFromObj:a,positionVectorFromOBJ:this._positions[o],normalsVectorFromOBJ:this._normals[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern5=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=this._positions.length+parseInt(r[0]),a=this._uvs.length+parseInt(r[1]),i=this._normals.length+parseInt(r[2]);this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice()),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon.slice()),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._handledMesh.hasLines=this._hasLineData,this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},e.prototype._optimizeNormals=function(e){var t=e.getVerticesData(g.VertexBuffer.PositionKind),n=e.getVerticesData(g.VertexBuffer.NormalKind),r={};if(t&&n){for(var o=0;o<t.length/3;o++)(s=r[i=t[3*o+0]+"_"+t[3*o+1]+"_"+t[3*o+2]])||(s=[],r[i]=s),s.push(o);var a=new g.Vector3;for(var i in r){var s;if(!((s=r[i]).length<2)){var l=s[0];for(o=1;o<s.length;++o){var u=s[o];n[3*l+0]+=n[3*u+0],n[3*l+1]+=n[3*u+1],n[3*l+2]+=n[3*u+2]}for(a.copyFromFloats(n[3*l+0],n[3*l+1],n[3*l+2]),a.normalize(),o=0;o<s.length;++o)n[3*(u=s[o])+0]=a.x,n[3*u+1]=a.y,n[3*u+2]=a.z}}e.setVerticesData(g.VertexBuffer.NormalKind,n)}},e._IsLineElement=function(e){return e.startsWith("l")},e._IsObjectElement=function(e){return e.startsWith("o")},e._IsGroupElement=function(e){return e.startsWith("g")},e._GetZbrushMRGB=function(e,t){if(!e.startsWith("mrgb"))return null;if(e=e.replace("mrgb","").trim(),t)return[];var n=e.match(/[a-z0-9]/g);if(!n||n.length%8!=0)return[];for(var r=[],o=0;o<n.length/8;o++){var a=n[8*o+2]+n[8*o+3],i=n[8*o+4]+n[8*o+5],s=n[8*o+6]+n[8*o+7];r.push(new g.Color4(parseInt(a,16)/255,parseInt(i,16)/255,parseInt(s,16)/255,1))}return r},e.prototype.parse=function(t,n,r,o,a){var i,s,l=this;n=(n=n.replace(/#MRGB/g,"mrgb")).replace(/#.*$/gm,"").trim(),this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(e,t){return l._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=1):r.useRightHandedSystem?(this._pushTriangle=function(e,t){return l._triangles.push(e[0],e[t+1],e[t])},this._handednessSign=1):(this._pushTriangle=function(e,t){return l._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=-1);var u=n.split("\n"),c=[],f=[];c.push(f);for(var h=0;h<u.length;h++)if(0!==(_=u[h].trim().replace(/\s\s/g," ")).length&&"#"!==_.charAt(0))if((e._IsGroupElement(_)||e._IsObjectElement(_))&&(f=[],c.push(f)),e._IsLineElement(_))for(var p=_.split(" "),d=1;d<p.length-1;d++)f.push("l ".concat(p[d]," ").concat(p[d+1]));else f.push(_);var m=c.flat();for(h=0;h<m.length;h++){var _,y=void 0;if(0!==(_=m[h].trim().replace(/\s\s/g," ")).length&&"#"!==_.charAt(0))if(e.VertexPattern.test(_)){if(y=_.match(/[^ ]+/g),this._positions.push(new g.Vector3(parseFloat(y[1]),parseFloat(y[2]),parseFloat(y[3]))),this._loadingOptions.importVertexColors)if(y.length>=7){var b=parseFloat(y[4]),v=parseFloat(y[5]),T=parseFloat(y[6]);this._colors.push(new g.Color4(b>1?b/255:b,v>1?v/255:v,T>1?T/255:T,7===y.length||void 0===y[7]?1:parseFloat(y[7])))}else this._colors.push(this._grayColor)}else if(null!==(y=e.NormalPattern.exec(_)))this._normals.push(new g.Vector3(parseFloat(y[1]),parseFloat(y[2]),parseFloat(y[3])));else if(null!==(y=e.UVPattern.exec(_)))this._uvs.push(new g.Vector2(parseFloat(y[1])*this._loadingOptions.UVScaling.x,parseFloat(y[2])*this._loadingOptions.UVScaling.y));else if(null!==(y=e.FacePattern3.exec(_)))this._setDataForCurrentFaceWithPattern3(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern4.exec(_)))this._setDataForCurrentFaceWithPattern4(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern5.exec(_)))this._setDataForCurrentFaceWithPattern5(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern2.exec(_)))this._setDataForCurrentFaceWithPattern2(y[1].trim().split(" "),1);else if(null!==(y=e.FacePattern1.exec(_)))this._setDataForCurrentFaceWithPattern1(y[1].trim().split(" "),1);else if(null!==(y=e.LinePattern1.exec(_)))this._setDataForCurrentFaceWithPattern1(y[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(y=e.LinePattern2.exec(_)))this._setDataForCurrentFaceWithPattern2(y[1].trim().split(" "),0),this._hasLineData=!0;else if(y=e._GetZbrushMRGB(_,!this._loadingOptions.importVertexColors))for(var x=0,A=y;x<A.length;x++){var w=A[x];this._extColors.push(w)}else if(null!==(y=e.LinePattern3.exec(_)))this._setDataForCurrentFaceWithPattern3(y[1].trim().split(" "),0),this._hasLineData=!0;else if(e.GroupDescriptor.test(_)||e.ObjectDescriptor.test(_)){var O={name:_.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:e.ObjectDescriptor.test(_)};this._addPreviousObjMesh(),this._meshesFromObj.push(O),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else e.UseMtlDescriptor.test(_)?(this._materialNameFromObj=_.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),O={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(O),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):e.MtlLibGroupDescriptor.test(_)?a(_.substring(7).trim()):e.SmoothDescriptor.test(_)||g.Logger.Log("Unhandled expression at line : "+_)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon),this._handledMesh.hasLines=this._hasLineData),!this._hasMeshes){var C=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var M=0,E=this._positions;M<E.length;M++){var P=E[M];this._unwrappedPositionsForBabylon.push(P.x,P.y,P.z)}if(this._normals.length)for(var F=0,R=this._normals;F<R.length;F++){var L=R[F];this._unwrappedNormalsForBabylon.push(L.x,L.y,L.z)}if(this._uvs.length)for(var N=0,I=this._uvs;N<I.length;N++){var S=I[N];this._unwrappedUVForBabylon.push(S.x,S.y)}if(this._extColors.length)for(var B=0,k=this._extColors;B<k.length;B++){var G=k[B];this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a)}else if(this._colors.length)for(var V=0,D=this._colors;V<D.length;V++)G=D[V],this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a);this._materialNameFromObj||((C=new g.StandardMaterial(g.Geometry.RandomId(),r)).pointsCloud=!0,this._materialNameFromObj=C.name,this._normals.length||(C.disableLighting=!0,C.emissiveColor=g.Color3.White()))}this._meshesFromObj.push({name:g.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:C,isObject:!0,hasLines:this._hasLineData})}for(var H=0;H<this._meshesFromObj.length;H++){if(t&&this._meshesFromObj[H].name)if(t instanceof Array){if(-1===t.indexOf(this._meshesFromObj[H].name))continue}else if(this._meshesFromObj[H].name!==t)continue;this._handledMesh=this._meshesFromObj[H],r._blockEntityCollection=!!o;var U=new g.Mesh(this._meshesFromObj[H].name,r);if(U._parentContainer=o,r._blockEntityCollection=!1,this._handledMesh._babylonMesh=U,!this._handledMesh.isObject)for(var j=H-1;j>=0;--j)if(this._meshesFromObj[j].isObject&&this._meshesFromObj[j]._babylonMesh){U.parent=this._meshesFromObj[j]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[H].materialName),this._handledMesh.hasLines&&(null!==(i=U._internalMetadata)&&void 0!==i||(U._internalMetadata={}),U._internalMetadata._isLine=!0),0!==(null===(s=this._handledMesh.positions)||void 0===s?void 0:s.length)){var K=new g.VertexData;if(K.indices=this._handledMesh.indices,K.positions=this._handledMesh.positions,this._loadingOptions.computeNormals||!this._handledMesh.normals){var W=new Array;g.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,W),K.normals=W}else K.normals=this._handledMesh.normals;this._handledMesh.uvs&&(K.uvs=this._handledMesh.uvs),this._handledMesh.colors&&(K.colors=this._handledMesh.colors),K.applyToMesh(U),this._loadingOptions.invertY&&(U.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(U),this._babylonMeshesArray.push(U),this._handledMesh.directMaterial&&(U.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(U)}},e.ObjectDescriptor=/^o/,e.GroupDescriptor=/^g/,e.MtlLibGroupDescriptor=/^mtllib /,e.UseMtlDescriptor=/^usemtl /,e.SmoothDescriptor=/^s /,e.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,e.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,e.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,e.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,e.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e}(),ur=function(){function e(t){this.name="obj",this.extensions=".obj",this._assetContainer=null,this._loadingOptions=(0,L.Cl)((0,L.Cl)({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"INVERT_TEXTURE_Y",{get:function(){return sr.INVERT_TEXTURE_Y},set:function(e){sr.INVERT_TEXTURE_Y=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{computeNormals:e.COMPUTE_NORMALS,optimizeNormals:e.OPTIMIZE_NORMALS,importVertexColors:e.IMPORT_VERTEX_COLORS,invertY:e.INVERT_Y,invertTextureY:e.INVERT_TEXTURE_Y,UVScaling:e.UV_SCALING,materialLoadingFailsSilently:e.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:e.OPTIMIZE_WITH_UV,skipMaterials:e.SKIP_MATERIALS,useLegacyBehavior:e.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),e.prototype._loadMTL=function(e,t,n,r){var o=t+e;g.Tools.LoadFile(o,n,void 0,void 0,!1,(function(e,t){r(o,t)}))},e.prototype.createPlugin=function(t){return new e(t.obj)},e.prototype.canDirectLoad=function(){return!1},e.prototype.importMeshAsync=function(e,t,n,r){return this._parseSolidAsync(e,t,n,r).then((function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then((function(){}))},e.prototype.loadAssetContainerAsync=function(e,t,n){var r=this,o=new g.AssetContainer(e);return this._assetContainer=o,this.importMeshAsync(null,e,t,n).then((function(e){return e.meshes.forEach((function(e){return o.meshes.push(e)})),e.meshes.forEach((function(e){var t=e.material;t&&-1==o.materials.indexOf(t)&&(o.materials.push(t),t.getActiveTextures().forEach((function(e){-1==o.textures.indexOf(e)&&o.textures.push(e)})))})),r._assetContainer=null,o})).catch((function(e){throw r._assetContainer=null,e}))},e.prototype._parseSolidAsync=function(e,t,n,r){var o=this,a="",i=new sr,s=[],l=[];n=n.replace(/#.*$/gm,"").trim(),new lr(s,l,this._loadingOptions).parse(e,n,t,this._assetContainer,(function(e){a=e}));var u=[];return""===a||this._loadingOptions.skipMaterials||u.push(new Promise((function(e,n){o._loadMTL(a,r,(function(u){try{i.parseMTL(t,u,r,o._assetContainer);for(var c=0;c<i.materials.length;c++){for(var f=0,h=[],p=void 0;(p=s.indexOf(i.materials[c].name,f))>-1;)h.push(p),f=p+1;if(-1===p&&0===h.length)i.materials[c].dispose();else for(var d=0;d<h.length;d++){var m=l[h[d]],_=i.materials[c];m.material=_,m.getTotalIndices()||(_.pointsCloud=!0)}}e()}catch(t){g.Tools.Warn("Error processing MTL file: '".concat(a,"'")),o._loadingOptions.materialLoadingFailsSilently?e():n(t)}}),(function(t,r){g.Tools.Warn("Error downloading MTL file: '".concat(a,"'")),o._loadingOptions.materialLoadingFailsSilently?e():n(r)}))}))),Promise.all(u).then((function(){var e=function(e){var t,n;return Boolean(null!==(n=null===(t=e._internalMetadata)||void 0===t?void 0:t._isLine)&&void 0!==n&&n)};return l.forEach((function(n){var r,o;if(e(n)){var a=null!==(r=n.material)&&void 0!==r?r:new g.StandardMaterial(n.name+"_line",t);a.getBindedMeshes().filter((function(t){return!e(t)})).length>0&&(a=null!==(o=a.clone(a.name+"_line"))&&void 0!==o?o:a),a.wireframe=!0,n.material=a,n._internalMetadata&&(n._internalMetadata._isLine=void 0)}})),l}))},e.OPTIMIZE_WITH_UV=!0,e.INVERT_Y=!1,e.IMPORT_VERTEX_COLORS=!1,e.COMPUTE_NORMALS=!1,e.OPTIMIZE_NORMALS=!1,e.UV_SCALING=new g.Vector2(1,1),e.SKIP_MATERIALS=!1,e.MATERIAL_LOADING_FAILS_SILENTLY=!0,e.USE_LEGACY_BEHAVIOR=!1,e}();(0,g.RegisterSceneLoaderPlugin)(new ur);var cr={".stl":{isBinary:!0}},fr=function(){function e(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name="stl",this.extensions=cr}return e.prototype.importMesh=function(e,t,n,r,o){var a;if("string"!=typeof n){if(this._isBinary(n)){var i=new g.Mesh("stlmesh",t);return this._parseBinary(i,n),o&&o.push(i),!0}n=(new TextDecoder).decode(new Uint8Array(n))}for(;a=this.solidPattern.exec(n);){var s=a[1],l=a[3];if(l&&s!=l)return g.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(e&&s)if(e instanceof Array){if(!e.indexOf(s))continue}else if(s!==e)continue;s=s||"stlmesh",i=new g.Mesh(s,t),this._parseASCII(i,a[2]),o&&o.push(i)}return!0},e.prototype.load=function(e,t,n){return this.importMesh(null,e,t,n,null)},e.prototype.loadAssetContainer=function(e,t,n){var r=new g.AssetContainer(e);return e._blockEntityCollection=!0,this.importMesh(null,e,t,n,r.meshes),e._blockEntityCollection=!1,r},e.prototype._isBinary=function(e){var t=new DataView(e);if(t.byteLength<=80)return!1;if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var n=[115,111,108,105,100],r=0;r<5;r++)if(t.getUint8(r)!==n[r])return!0;return!1},e.prototype._parseBinary=function(t,n){for(var r=new DataView(n),o=r.getUint32(80,!0),a=0,i=new Float32Array(3*o*3),s=new Float32Array(3*o*3),l=new Uint32Array(3*o),u=0,c=0;c<o;c++){for(var f=84+50*c,h=r.getFloat32(f,!0),p=r.getFloat32(f+4,!0),d=r.getFloat32(f+8,!0),m=1;m<=3;m++){var _=f+12*m;i[a]=r.getFloat32(_,!0),s[a]=h,e.DO_NOT_ALTER_FILE_COORDINATES?(i[a+1]=r.getFloat32(_+4,!0),i[a+2]=r.getFloat32(_+8,!0),s[a+1]=p,s[a+2]=d):(i[a+2]=r.getFloat32(_+4,!0),i[a+1]=r.getFloat32(_+8,!0),s[a+2]=p,s[a+1]=d),a+=3}e.DO_NOT_ALTER_FILE_COORDINATES?(l[u]=u,l[u+1]=u+2,l[u+2]=u+1,u+=3):(l[u]=u++,l[u]=u++,l[u]=u++)}t.setVerticesData(g.VertexBuffer.PositionKind,i),t.setVerticesData(g.VertexBuffer.NormalKind,s),t.setIndices(l),t.computeWorldMatrix(!0)},e.prototype._parseASCII=function(t,n){for(var r,o=[],a=[],i=[],s=0;r=this.facetsPattern.exec(n);){var l=r[1],u=this.normalPattern.exec(l);if(this.normalPattern.lastIndex=0,u){for(var c=[Number(u[1]),Number(u[5]),Number(u[3])],f=void 0;f=this.vertexPattern.exec(l);)e.DO_NOT_ALTER_FILE_COORDINATES?(o.push(Number(f[1]),Number(f[3]),Number(f[5])),a.push(c[0],c[2],c[1])):(o.push(Number(f[1]),Number(f[5]),Number(f[3])),a.push(c[0],c[1],c[2]));e.DO_NOT_ALTER_FILE_COORDINATES?(i.push(s,s+2,s+1),s+=3):i.push(s++,s++,s++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,t.setVerticesData(g.VertexBuffer.PositionKind,o),t.setVerticesData(g.VertexBuffer.NormalKind,a),t.setIndices(i),t.computeWorldMatrix(!0)},e.DO_NOT_ALTER_FILE_COORDINATES=!1,e}();(0,g.RegisterSceneLoaderPlugin)(new fr);var hr="splat",pr={".splat":{isBinary:!0},".ply":{isBinary:!0},".spz":{isBinary:!0},".json":{isBinary:!1},".sog":{isBinary:!0}},dr=.28209479177387814;function mr(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r,o){var a,i=n.createCanvasImage();if(!i)throw new Error("Failed to create ImageBitmap");if(i.onload=function(){try{var e=n.createCanvas(i.width,i.height);if(!e)throw new Error("Failed to create canvas");var t=e.getContext("2d");if(!t)throw new Error("Failed to get 2D context");t.drawImage(i,0,0);var a=t.getImageData(0,0,e.width,e.height);r({bits:new Uint8Array(a.data.buffer),width:a.width})}catch(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))}},i.onerror=function(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))},i.crossOrigin="anonymous","string"==typeof e){if(!t)throw new Error("filename is required when using a URL");i.src=e+t}else{var s=new Blob([e],{type:"image/webp"});a=URL.createObjectURL(s),i.src=a}}))];case 1:return[2,r.sent()]}}))}))}function _r(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c,f,h,p,d,m,_,y,b,v,T,x,A,w,O,C,M,E,P,F,R,N,I,S,B,k,G,V,D,H,U,j,K,W,Y,z,Z,q,X,Q,J,$,ee,te,ne,re,oe,ae,ie,se,le,ue,ce,fe,he,pe,de;return(0,L.YH)(this,(function(L){switch(L.label){case 0:if(r=e.count?e.count:e.means.shape[0],o=new ArrayBuffer(32*r),a=new Float32Array(o),i=new Float32Array(o),s=new Uint8ClampedArray(o),l=new Uint8ClampedArray(o),u=function(e){return Math.sign(e)*(Math.exp(Math.abs(e))-1)},c=t[0].bits,f=t[1].bits,!Array.isArray(e.means.mins)||!Array.isArray(e.means.maxs))throw new Error("Missing arrays in SOG data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<3;se++)h=e.means.mins[se],p=e.means.maxs[se],d=f[w+se],m=c[w+se],U=d<<8|m,ne=g.Scalar.Lerp(h,p,U/65535),a[8*te+se]=u(ne);if(_=t[2].bits,2===e.version){if(!e.scales.codebook)throw new Error("Missing codebook in SOG version 2 scales data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<3;se++)b=e.scales.codebook[_[w+se]],y=Math.exp(b),i[8*te+3+se]=y}else{if(!Array.isArray(e.scales.mins)||!Array.isArray(e.scales.maxs))throw new Error("Missing arrays in SOG scales data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<3;se++)b=_[w+se],v=g.Scalar.Lerp(e.scales.mins[se],e.scales.maxs[se],b/255),T=Math.exp(v),i[8*te+3+se]=T}if(x=t[4].bits,2===e.version){if(!e.sh0.codebook)throw new Error("Missing codebook in SOG version 2 sh0 data.");for(te=0;te<r;te++){for(w=4*te,se=0;se<3;se++)A=.5+e.sh0.codebook[x[w+se]]*dr,s[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*A)));s[32*te+24+3]=x[w+3]}}else{if(!Array.isArray(e.sh0.mins)||!Array.isArray(e.sh0.maxs))throw new Error("Missing arrays in SOG sh0 data.");for(te=0;te<r;te++)for(w=4*te,se=0;se<4;se++)O=e.sh0.mins[se],C=e.sh0.maxs[se],M=x[w+se],G=g.Scalar.Lerp(O,C,M/255),void 0,E=se<3?.5+G*dr:1/(1+Math.exp(-G)),s[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*E)))}for(P=function(e){return 2*(e/255-.5)/Math.SQRT2},F=t[3].bits,te=0;te<r;te++){switch(R=F[4*te+0],N=F[4*te+1],I=F[4*te+2],S=F[4*te+3],B=P(R),k=P(N),G=P(I),V=S-252,D=B*B+k*k+G*G,H=Math.sqrt(Math.max(0,1-D)),U=void 0,V){case 0:U=[H,B,k,G];break;case 1:U=[B,H,k,G];break;case 2:U=[B,k,H,G];break;case 3:U=[B,k,G,H];break;default:throw new Error("Invalid quaternion mode")}l[32*te+28+0]=127.5*U[0]+127.5,l[32*te+28+1]=127.5*U[1]+127.5,l[32*te+28+2]=127.5*U[2]+127.5,l[32*te+28+3]=127.5*U[3]+127.5}if(!e.shN)return[3,2];for(j=[0,3,8,15],K=e.shN.bands?j[e.shN.bands]:e.shN.shape[1]/3,W=t[5].bits,Y=t[6].bits,z=t[5].width,Z=3*K,q=Math.ceil(Z/16),X=[],Q=n.getEngine(),J=Q.getCaps().maxTextureSize,$=Math.ceil(r/J),ce=0;ce<q;ce++)ee=new Uint8Array($*J*4*4),X.push(ee);if(2===e.version){if(!e.shN.codebook)throw new Error("Missing codebook in SOG version 2 shN data.");for(te=0;te<r;te++)for(ne=Y[4*te+0]+(Y[4*te+1]<<8),re=ne%64*K,oe=Math.floor(ne/64),le=0;le<K;le++)for(se=0;se<3;se++)ue=3*le+se,ce=Math.floor(ue/16),fe=X[ce],he=ue%16,pe=16*te,de=127.5*e.shN.codebook[W[4*(re+le)+se+oe*z*4]]+127.5,fe[he+pe]=Math.max(0,Math.min(255,de))}else for(te=0;te<r;te++)for(ne=Y[4*te+0]+(Y[4*te+1]<<8),re=ne%64*K,oe=Math.floor(ne/64),ae=e.shN.mins,ie=e.shN.maxs,se=0;se<3;se++)for(le=0;le<K/3;le++)ue=3*le+se,ce=Math.floor(ue/16),fe=X[ce],he=ue%16,pe=16*te,de=127.5*g.Scalar.Lerp(ae,ie,W[4*(re+le)+se+oe*z*4]/255)+127.5,fe[he+pe]=Math.max(0,Math.min(255,de));return[4,new Promise((function(e){e({mode:0,data:o,hasVertexColors:!1,sh:X})}))];case 1:case 3:return[2,L.sent()];case 2:return[4,new Promise((function(e){e({mode:0,data:o,hasVertexColors:!1})}))]}}))}))}function gr(e,t,n){return(0,L.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l=this;return(0,L.YH)(this,(function(u){switch(u.label){case 0:if(e instanceof Map){if(!(a=(o=e).get("meta.json")))throw new Error("meta.json not found in files Map");r=JSON.parse((new TextDecoder).decode(a))}else r=e;return i=(0,L.fX)((0,L.fX)((0,L.fX)((0,L.fX)([],r.means.files,!0),r.scales.files,!0),r.quats.files,!0),r.sh0.files,!0),r.shN&&i.push.apply(i,r.shN.files),[4,Promise.all(i.map((function(e){return(0,L.sH)(l,void 0,void 0,(function(){return(0,L.YH)(this,(function(r){switch(r.label){case 0:return o&&o.has(e)?[4,mr(o.get(e),e,n.getEngine())]:[3,2];case 1:case 3:return[2,r.sent()];case 2:return[4,mr(t,e,n.getEngine())]}}))}))})))];case 1:return s=u.sent(),[4,_r(r,s,n)];case 2:return[2,u.sent()]}}))}))}var yr=function(){function e(t){void 0===t&&(t=e._DefaultLoadingOptions),this.name=hr,this._assetContainer=null,this.extensions=pr,this._loadingOptions=t}return e.prototype.createPlugin=function(t){return new e(t[hr])},e.prototype.importMeshAsync=function(e,t,n,r,o,a){return(0,L.sH)(this,void 0,void 0,(function(){return(0,L.YH)(this,(function(o){switch(o.label){case 0:return[4,this._parseAsync(e,t,n,r).then((function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}}))];case 1:return[2,o.sent()]}}))}))},e._BuildPointCloud=function(e,t){if(!t.byteLength)return!1;var n=new Uint8Array(t),r=new Float32Array(t),o=n.length/32;return e.addPoints(o,(function(e,t){var o=r[8*t+0],a=r[8*t+1],i=r[8*t+2];e.position=new g.Vector3(o,a,i);var s=n[32*t+24+0]/255,l=n[32*t+24+1]/255,u=n[32*t+24+2]/255;e.color=new g.Color4(s,l,u,1)})),!0},e._BuildMesh=function(e,t){for(var n=new g.Mesh("PLYMesh",e),r=new Uint8Array(t.data),o=new Float32Array(t.data),a=r.length/32,i=[],s=new g.VertexData,l=0;l<a;l++){var u=o[8*l+0],c=o[8*l+1],f=o[8*l+2];i.push(u,c,f)}if(t.hasVertexColors){var h=new Float32Array(4*a);for(l=0;l<a;l++){var p=r[32*l+24+0]/255,d=r[32*l+24+1]/255,m=r[32*l+24+2]/255;h[4*l+0]=p,h[4*l+1]=d,h[4*l+2]=m,h[4*l+3]=1}s.colors=h}return s.positions=i,s.indices=t.faces,s.applyToMesh(n),n},e.prototype._unzipWithFFlateAsync=function(e){return(0,L.sH)(this,void 0,void 0,(function(){var t,n,r,o,a,i,s,l,u,c;return(0,L.YH)(this,(function(f){switch(f.label){case 0:return(t=this._loadingOptions.fflate)?[3,3]:void 0!==window.fflate?[3,2]:[4,g.Tools.LoadScriptAsync(null!==(c=this._loadingOptions.deflateURL)&&void 0!==c?c:"https://unpkg.com/fflate/umd/index.js")];case 1:f.sent(),f.label=2;case 2:t=window.fflate,f.label=3;case 3:for(n=t.unzipSync,r=n(e),o=new Map,a=0,i=Object.entries(r);a<i.length;a++)s=i[a],l=s[0],u=s[1],o.set(l,u);return[2,o]}}))}))},e.prototype._parseAsync=function(t,n,r,o){var a=this,i=[],s=function(e){var t;n._blockEntityCollection=!!a._assetContainer;var r=null!==(t=a._loadingOptions.gaussianSplattingMesh)&&void 0!==t?t:new g.GaussianSplattingMesh("GaussianSplatting",null,n,a._loadingOptions.keepInRam);r._parentContainer=a._assetContainer,i.push(r),r.updateData(e.data,e.sh,{flipY:!1}),r.scaling.y*=-1,r.computeWorldMatrix(!0),n._blockEntityCollection=!1};if("string"==typeof r){var l=JSON.parse(r);if(l&&l.means&&l.scales&&l.quats&&l.sh0)return new Promise((function(e){gr(l,o,n).then((function(t){s(t),e(i)})).catch((function(){throw new Error("Failed to parse SOG data.")}))}))}var u=r instanceof ArrayBuffer?new Uint8Array(r):r;if(80===u[0]&&75===u[1])return new Promise((function(e){a._unzipWithFFlateAsync(u).then((function(t){gr(t,o,n).then((function(t){s(t),e(i)})).catch((function(){throw new Error("Failed to parse SOG zip data.")}))}))}));var c=new ReadableStream({start:function(e){e.enqueue(new Uint8Array(r)),e.close()}}),f=new DecompressionStream("gzip"),h=c.pipeThrough(f);return new Promise((function(t){new Response(h).arrayBuffer().then((function(e){(function(e,t){var n=new Uint8Array(e),r=new Uint32Array(e.slice(0,12)),o=r[2],a=n[12],i=n[13],s=n[14],l=n[15],u=r[1];if(l||1347635022!=r[0]||2!=u&&3!=u)return new Promise((function(e){e({mode:3,data:c,hasVertexColors:!1})}));for(var c=new ArrayBuffer(32*o),f=1/(1<<i),h=new Int32Array(1),p=new Uint8Array(h.buffer),d=function(e,t){return p[0]=e[t+0],p[1]=e[t+1],p[2]=e[t+2],p[3]=128&e[t+2]?255:0,h[0]*f},m=16,_=new Float32Array(c),y=new Float32Array(c),b=new Uint8ClampedArray(c),v=new Uint8ClampedArray(c),T=0;T<o;T++)_[8*T+0]=d(n,m+0),_[8*T+1]=d(n,m+3),_[8*T+2]=d(n,m+6),m+=9;for(T=0;T<o;T++){for(var x=0;x<3;x++){var A=(n[m+o+3*T+x]-127.5)/38.25;b[32*T+24+x]=g.Scalar.Clamp(255*(.5+.282*A),0,255)}b[32*T+24+3]=n[m+T]}for(m+=4*o,T=0;T<o;T++)y[8*T+3+0]=Math.exp(n[m+0]/16-10),y[8*T+3+1]=Math.exp(n[m+1]/16-10),y[8*T+3+2]=Math.exp(n[m+2]/16-10),m+=3;if(u>=3){var w=Math.SQRT1_2;for(T=0;T<o;T++){for(var O=[n[m+0],n[m+1],n[m+2],n[m+3]],C=O[0]+(O[1]<<8)+(O[2]<<16)+(O[3]<<24),M=[],E=C>>>30,P=C,F=0,R=3;R>=0;--R)if(R!==E){var L=511&P,N=P>>>9&1;P>>>=10,M[R]=w*(L/511),1===N&&(M[R]=-M[R]),F+=M[R]*M[R]}var I=1-F;M[E]=Math.sqrt(Math.max(I,0));for(var S=[3,0,1,2],B=0;B<4;B++)v[32*T+28+B]=Math.round(127.5+127.5*M[S[B]]);m+=4}}else for(T=0;T<o;T++){var k=n[m+0],G=n[m+1],V=n[m+2],D=k/127.5-1,H=G/127.5-1,U=V/127.5-1;v[32*T+28+1]=k,v[32*T+28+2]=G,v[32*T+28+3]=V;var j=1-(D*D+H*H+U*U);v[32*T+28+0]=127.5+127.5*Math.sqrt(j<0?0:j),m+=3}if(a){for(var K=3*((a+1)*(a+1)-1),W=Math.ceil(K/16),Y=m,z=[],Z=t.getEngine().getCaps().maxTextureSize,q=Math.ceil(o/Z),X=0;X<W;X++){var Q=new Uint8Array(q*Z*4*4);z.push(Q)}for(T=0;T<o;T++)for(var J=0;J<K;J++){var $=n[Y++];X=Math.floor(J/16),z[X][J%16+16*T]=$}return new Promise((function(e){e({mode:0,data:c,hasVertexColors:!1,sh:z,trainedWithAntialiasing:!!s})}))}return new Promise((function(e){e({mode:0,data:c,hasVertexColors:!1,trainedWithAntialiasing:!!s})}))})(e,n,a._loadingOptions).then((function(e){var r;n._blockEntityCollection=!!a._assetContainer;var o=null!==(r=a._loadingOptions.gaussianSplattingMesh)&&void 0!==r?r:new g.GaussianSplattingMesh("GaussianSplatting",null,n,a._loadingOptions.keepInRam);if(e.trainedWithAntialiasing){var s=o.material;s.kernelSize=.1,s.compensation=!0}o._parentContainer=a._assetContainer,i.push(o),o.updateData(e.data,e.sh,{flipY:!1}),a._loadingOptions.flipY||(o.scaling.y*=-1,o.computeWorldMatrix(!0)),n._blockEntityCollection=!1,a.applyAutoCameraLimits(e,n),t(i)}))})).catch((function(){e._ConvertPLYToSplat(r).then((function(r){return(0,L.sH)(a,void 0,void 0,(function(){var o,a,s;return(0,L.YH)(this,(function(l){switch(l.label){case 0:switch(n._blockEntityCollection=!!this._assetContainer,r.mode){case 0:return[3,1];case 1:return[3,2];case 2:return[3,6]}return[3,7];case 1:switch((o=null!==(s=this._loadingOptions.gaussianSplattingMesh)&&void 0!==s?s:new g.GaussianSplattingMesh("GaussianSplatting",null,n,this._loadingOptions.keepInRam))._parentContainer=this._assetContainer,i.push(o),o.updateData(r.data,r.sh,{flipY:!1}),o.scaling.y*=-1,"RightHanded"===r.chirality&&(o.scaling.y*=-1),r.upAxis){case"X":o.rotation=new g.Vector3(0,0,Math.PI/2);break;case"Y":o.rotation=new g.Vector3(0,0,Math.PI);break;case"Z":o.rotation=new g.Vector3(-Math.PI/2,Math.PI,0)}return o.computeWorldMatrix(!0),[3,8];case 2:return a=new g.PointsCloudSystem("PointCloud",1,n),e._BuildPointCloud(a,r.data)?[4,a.buildMeshAsync().then((function(e){i.push(e)}))]:[3,4];case 3:return l.sent(),[3,5];case 4:a.dispose(),l.label=5;case 5:return[3,8];case 6:if(!r.faces)throw new Error("PLY mesh doesn't contain face informations.");return i.push(e._BuildMesh(n,r)),[3,8];case 7:throw new Error("Unsupported Splat mode");case 8:return n._blockEntityCollection=!1,this.applyAutoCameraLimits(r,n),t(i),[2]}}))}))}))}))}))},e.prototype.applyAutoCameraLimits=function(e,t){var n;if(!this._loadingOptions.disableAutoCameraLimits&&(void 0!==e.safeOrbitCameraRadiusMin||void 0!==e.safeOrbitCameraElevationMinMax)&&"ArcRotateCamera"===(null===(n=t.activeCamera)||void 0===n?void 0:n.getClassName())){var r=t.activeCamera;e.safeOrbitCameraElevationMinMax&&(r.lowerBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[1],r.upperBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[0]),e.safeOrbitCameraRadiusMin&&(r.lowerRadiusLimit=e.safeOrbitCameraRadiusMin)}},e.prototype.loadAssetContainerAsync=function(e,t,n){var r=this,o=new g.AssetContainer(e);return this._assetContainer=o,this.importMeshAsync(null,e,t,n).then((function(e){for(var t=0,n=e.meshes;t<n.length;t++){var a=n[t];o.meshes.push(a)}return r._assetContainer=null,o})).catch((function(e){throw r._assetContainer=null,e}))},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then((function(){}))},e._ConvertPLYToSplat=function(e){var t=this,n=new Uint8Array(e),r=(new TextDecoder).decode(n.slice(0,10240)),o=r.indexOf("end_header\n");if(o<0||!r)return new Promise((function(t){t({mode:0,data:e,rawSplat:!0})}));var a=parseInt(/element vertex (\d+)\n/.exec(r)[1]),i=/element face (\d+)\n/.exec(r),s=0;i&&(s=parseInt(i[1]));var l=/element chunk (\d+)\n/.exec(r),u=0;l&&(u=parseInt(l[1]));for(var c=0,f=0,h={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0},p=1,d=[],m=[],_=r.slice(0,o).split("\n"),y={},b=0,v=_;b<v.length;b++){var T=v[b];if(T.startsWith("property ")){var x=T.split(" "),A=x[1],w=x[2];if(1==p)m.push({name:w,type:A,offset:f}),f+=h[A];else if(0==p)d.push({name:w,type:A,offset:c}),c+=h[A];else if(2==p)d.push({name:w,type:A,offset:c});else if(3==p){var O=new DataView(e,f,2*h.float);y.safeOrbitCameraElevationMinMax=[O.getFloat32(0,!0),O.getFloat32(4,!0)]}else 4==p?(O=new DataView(e,f,h.float),y.safeOrbitCameraRadiusMin=O.getFloat32(0,!0)):5==p&&(O=new DataView(e,f,h.uchar),"up_axis"==w?y.upAxis=0==O.getUint8(0)?"X":1==O.getUint8(0)?"Y":"Z":"chirality"==w&&(y.chirality=0==O.getUint8(0)?"LeftHanded":"RightHanded"));h[A]||g.Logger.Warn("Unsupported property type: ".concat(A,"."))}else T.startsWith("element ")&&("chunk"==(A=T.split(" ")[1])?p=1:"vertex"==A?p=0:"sh"==A?p=2:"safe_orbit_camera_elevation_min_max_radians"==A?p=3:"safe_orbit_camera_radius_min"==A?p=4:"up_axis"!=A&&"chirality"!=A||(p=5))}var C=c,M=f;return g.GaussianSplattingMesh.ConvertPLYWithSHToSplatAsync(e).then((function(n){return(0,L.sH)(t,void 0,void 0,(function(){var t,r,i,l,c,f,h,p,m,_,g,b,v,T,x;return(0,L.YH)(this,(function(A){switch(A.label){case 0:if(t=new DataView(e,o+11),r=M*u+C*a,i=[],s)for(l=0;l<s;l++)if(3==(c=t.getUint8(r))){for(r+=1,f=0;f<c;f++)h=t.getUint32(r+4*(2-f),!0),i.push(h);r+=12}return u?[4,new Promise((function(e){e({mode:0,data:n.buffer,sh:n.sh,faces:i,hasVertexColors:!1,compressed:!0,rawSplat:!1})}))]:[3,2];case 1:case 3:return[2,A.sent()];case 2:for(p=0,m=0,_=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],g=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"],b=0;b<d.length;b++)v=d[b],_.includes(v.name)&&p++,g.includes(v.name)&&m++;return T=p==_.length&&3==m,x=s?2:T?0:1,[4,new Promise((function(e){e((0,L.Cl)((0,L.Cl)({},y),{mode:x,data:n.buffer,sh:n.sh,faces:i,hasVertexColors:!!m,compressed:!1,rawSplat:!1}))}))]}}))}))}))},e._DefaultLoadingOptions={keepInRam:!1,flipY:!1},e}();(0,g.RegisterSceneLoaderPlugin)(new yr);var br=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==br)for(var vr in s)br.BABYLON[vr]||(br.BABYLON[vr]=s[vr]);var Tr=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Tr){for(var xr in Tr.BABYLON=Tr.BABYLON||{},u)Tr.BABYLON[xr]=u[xr];for(var xr in l)Tr.BABYLON[xr]=l[xr]}var Ar=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Ar)for(var wr in Ar.BABYLON=Ar.BABYLON||{},Ar.BABYLON.GLTF1=Ar.BABYLON.GLTF1||{},c)Ar.BABYLON.GLTF1[wr]=c[wr];var Or=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Or){Or.BABYLON=Or.BABYLON||{};var Cr=Or.BABYLON;Cr.GLTF2=Cr.GLTF2||{},Cr.GLTF2.Loader=Cr.GLTF2.Loader||{},Cr.GLTF2.Loader.Extensions=Cr.GLTF2.Loader.Extensions||{};var Mr=[];for(var Er in h)Cr.GLTF2.Loader.Extensions[Er]=h[Er],Mr.push(Er);for(var Er in f)Cr.GLTF2.Loader[Er]=f[Er],Mr.push(Er);for(var Er in p)Mr.indexOf(Er)>-1||(Cr.GLTF2[Er]=p[Er])}var Pr=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Pr)for(var Fr in d)Pr.BABYLON[Fr]||(Pr.BABYLON[Fr]=d[Fr]);var Rr=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Rr)for(var Lr in m)Rr.BABYLON[Lr]||(Rr.BABYLON[Lr]=m[Lr]);const Nr=_;return i.default})()));
|
|
2
2
|
//# sourceMappingURL=babylonjs.loaders.min.js.map
|