@shopware-ag/dive 2.0.1-beta.0 → 2.0.1-beta.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/build/chunks/{SelectTool-BRKko7uz.cjs → SelectTool-BAXTVyWs.cjs} +1 -1
- package/build/chunks/{SelectTool-mTRiZYaC.mjs → SelectTool-Bd8cC9nb.mjs} +15 -15
- package/build/chunks/{package-BvoZkrge.mjs → package-BHjZWYD6.mjs} +1 -1
- package/build/chunks/{package-BFpY3sIj.cjs → package-JHvTSNgQ.cjs} +1 -1
- package/build/dive.cjs +2 -2
- package/build/dive.mjs +471 -565
- package/build/src/components/floor/Floor.d.ts +2 -2
- package/build/src/components/grid/Grid.d.ts +1 -1
- package/build/src/components/light/AmbientLight.d.ts +3 -3
- package/build/src/components/light/PointLight.d.ts +3 -3
- package/build/src/components/light/SceneLight.d.ts +3 -3
- package/build/src/components/model/Model.d.ts +7 -4
- package/build/src/components/node/Node.d.ts +2 -2
- package/build/src/components/primitive/Primitive.d.ts +3 -3
- package/build/src/components/root/Root.d.ts +19 -29
- package/build/src/core/Dive.d.ts +4 -4
- package/build/src/engine/Engine.d.ts +2 -6
- package/build/src/engine/scene/Scene.d.ts +4 -22
- package/build/src/modules/asset/draco/README.md +32 -0
- package/build/src/modules/asset/draco/draco_decoder.js +33 -0
- package/build/src/modules/asset/draco/draco_decoder.wasm +0 -0
- package/build/src/modules/asset/draco/draco_encoder.js +33 -0
- package/build/src/modules/asset/draco/draco_wasm_wrapper.js +116 -0
- package/build/src/modules/asset/draco/gltf/draco_decoder.js +33 -0
- package/build/src/modules/asset/draco/gltf/draco_decoder.wasm +0 -0
- package/build/src/modules/asset/draco/gltf/draco_encoder.js +33 -0
- package/build/src/modules/asset/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/build/src/modules/asset/loader/AssetLoader.cjs +3 -2
- package/build/src/modules/asset/loader/AssetLoader.mjs +1274 -1039
- package/build/src/modules/state/State.cjs +9 -9
- package/build/src/modules/state/State.mjs +579 -554
- package/build/src/modules/state/actions/camera/movecamera.d.ts +2 -2
- package/build/src/modules/state/actions/object/addobject.d.ts +1 -1
- package/build/src/modules/state/actions/object/deleteobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/deselectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/dropit.d.ts +2 -2
- package/build/src/modules/state/actions/object/getobjects.d.ts +2 -2
- package/build/src/modules/state/actions/object/placeonfloor.d.ts +2 -2
- package/build/src/modules/state/actions/object/selectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/setparent.d.ts +2 -2
- package/build/src/modules/state/actions/object/updateobject.d.ts +2 -2
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +1 -1
- package/build/src/modules/state/types/COMEntity.d.ts +5 -0
- package/build/src/modules/state/types/COMGroup.d.ts +1 -0
- package/build/src/modules/state/types/COMLight.d.ts +18 -2
- package/build/src/modules/state/types/COMModel.d.ts +1 -0
- package/build/src/modules/state/types/COMPov.d.ts +1 -0
- package/build/src/modules/state/types/COMPrimitive.d.ts +1 -0
- package/build/src/modules/toolbox/Toolbox.cjs +1 -1
- package/build/src/modules/toolbox/Toolbox.mjs +1 -1
- package/build/src/types/SceneObjects.d.ts +3 -1
- package/package.json +2 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(h){var n=0;return function(){return n<h.length?{done:!1,value:h[n++]}:{done:!0}}};$jscomp.arrayIterator=function(h){return{next:$jscomp.arrayIteratorImpl(h)}};$jscomp.makeIterator=function(h){var n="undefined"!=typeof Symbol&&Symbol.iterator&&h[Symbol.iterator];return n?n.call(h):$jscomp.arrayIterator(h)};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
|
|
2
|
+
$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.getGlobal=function(h){h=["object"==typeof globalThis&&globalThis,h,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var n=0;n<h.length;++n){var k=h[n];if(k&&k.Math==Math)return k}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
|
|
3
|
+
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(h,n,k){if(h==Array.prototype||h==Object.prototype)return h;h[n]=k.value;return h};$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";
|
|
4
|
+
var $jscomp$lookupPolyfilledValue=function(h,n){var k=$jscomp.propertyToPolyfillSymbol[n];if(null==k)return h[n];k=h[k];return void 0!==k?k:h[n]};$jscomp.polyfill=function(h,n,k,p){n&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(h,n,k,p):$jscomp.polyfillUnisolated(h,n,k,p))};
|
|
5
|
+
$jscomp.polyfillUnisolated=function(h,n,k,p){k=$jscomp.global;h=h.split(".");for(p=0;p<h.length-1;p++){var l=h[p];if(!(l in k))return;k=k[l]}h=h[h.length-1];p=k[h];n=n(p);n!=p&&null!=n&&$jscomp.defineProperty(k,h,{configurable:!0,writable:!0,value:n})};
|
|
6
|
+
$jscomp.polyfillIsolated=function(h,n,k,p){var l=h.split(".");h=1===l.length;p=l[0];p=!h&&p in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var y=0;y<l.length-1;y++){var f=l[y];if(!(f in p))return;p=p[f]}l=l[l.length-1];k=$jscomp.IS_SYMBOL_NATIVE&&"es6"===k?p[l]:null;n=n(k);null!=n&&(h?$jscomp.defineProperty($jscomp.polyfills,l,{configurable:!0,writable:!0,value:n}):n!==k&&(void 0===$jscomp.propertyToPolyfillSymbol[l]&&(k=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[l]=$jscomp.IS_SYMBOL_NATIVE?
|
|
7
|
+
$jscomp.global.Symbol(l):$jscomp.POLYFILL_PREFIX+k+"$"+l),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[l],{configurable:!0,writable:!0,value:n})))};
|
|
8
|
+
$jscomp.polyfill("Promise",function(h){function n(){this.batch_=null}function k(f){return f instanceof l?f:new l(function(q,u){q(f)})}if(h&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return h;n.prototype.asyncExecute=function(f){if(null==this.batch_){this.batch_=[];var q=this;this.asyncExecuteFunction(function(){q.executeBatch_()})}this.batch_.push(f)};
|
|
9
|
+
var p=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(f){p(f,0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var f=this.batch_;this.batch_=[];for(var q=0;q<f.length;++q){var u=f[q];f[q]=null;try{u()}catch(A){this.asyncThrow_(A)}}}this.batch_=null};n.prototype.asyncThrow_=function(f){this.asyncExecuteFunction(function(){throw f;})};var l=function(f){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];this.isRejectionHandled_=!1;var q=this.createResolveAndReject_();
|
|
10
|
+
try{f(q.resolve,q.reject)}catch(u){q.reject(u)}};l.prototype.createResolveAndReject_=function(){function f(A){return function(F){u||(u=!0,A.call(q,F))}}var q=this,u=!1;return{resolve:f(this.resolveTo_),reject:f(this.reject_)}};l.prototype.resolveTo_=function(f){if(f===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof l)this.settleSameAsPromise_(f);else{a:switch(typeof f){case "object":var q=null!=f;break a;case "function":q=!0;break a;default:q=!1}q?this.resolveToNonPromiseObj_(f):
|
|
11
|
+
this.fulfill_(f)}};l.prototype.resolveToNonPromiseObj_=function(f){var q=void 0;try{q=f.then}catch(u){this.reject_(u);return}"function"==typeof q?this.settleSameAsThenable_(q,f):this.fulfill_(f)};l.prototype.reject_=function(f){this.settle_(2,f)};l.prototype.fulfill_=function(f){this.settle_(1,f)};l.prototype.settle_=function(f,q){if(0!=this.state_)throw Error("Cannot settle("+f+", "+q+"): Promise already settled in state"+this.state_);this.state_=f;this.result_=q;2===this.state_&&this.scheduleUnhandledRejectionCheck_();
|
|
12
|
+
this.executeOnSettledCallbacks_()};l.prototype.scheduleUnhandledRejectionCheck_=function(){var f=this;p(function(){if(f.notifyUnhandledRejection_()){var q=$jscomp.global.console;"undefined"!==typeof q&&q.error(f.result_)}},1)};l.prototype.notifyUnhandledRejection_=function(){if(this.isRejectionHandled_)return!1;var f=$jscomp.global.CustomEvent,q=$jscomp.global.Event,u=$jscomp.global.dispatchEvent;if("undefined"===typeof u)return!0;"function"===typeof f?f=new f("unhandledrejection",{cancelable:!0}):
|
|
13
|
+
"function"===typeof q?f=new q("unhandledrejection",{cancelable:!0}):(f=$jscomp.global.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.result_;return u(f)};l.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var f=0;f<this.onSettledCallbacks_.length;++f)y.asyncExecute(this.onSettledCallbacks_[f]);this.onSettledCallbacks_=null}};var y=new n;l.prototype.settleSameAsPromise_=function(f){var q=this.createResolveAndReject_();
|
|
14
|
+
f.callWhenSettled_(q.resolve,q.reject)};l.prototype.settleSameAsThenable_=function(f,q){var u=this.createResolveAndReject_();try{f.call(q,u.resolve,u.reject)}catch(A){u.reject(A)}};l.prototype.then=function(f,q){function u(w,B){return"function"==typeof w?function(R){try{A(w(R))}catch(Z){F(Z)}}:B}var A,F,v=new l(function(w,B){A=w;F=B});this.callWhenSettled_(u(f,A),u(q,F));return v};l.prototype.catch=function(f){return this.then(void 0,f)};l.prototype.callWhenSettled_=function(f,q){function u(){switch(A.state_){case 1:f(A.result_);
|
|
15
|
+
break;case 2:q(A.result_);break;default:throw Error("Unexpected state: "+A.state_);}}var A=this;null==this.onSettledCallbacks_?y.asyncExecute(u):this.onSettledCallbacks_.push(u);this.isRejectionHandled_=!0};l.resolve=k;l.reject=function(f){return new l(function(q,u){u(f)})};l.race=function(f){return new l(function(q,u){for(var A=$jscomp.makeIterator(f),F=A.next();!F.done;F=A.next())k(F.value).callWhenSettled_(q,u)})};l.all=function(f){var q=$jscomp.makeIterator(f),u=q.next();return u.done?k([]):new l(function(A,
|
|
16
|
+
F){function v(R){return function(Z){w[R]=Z;B--;0==B&&A(w)}}var w=[],B=0;do w.push(void 0),B++,k(u.value).callWhenSettled_(v(w.length-1),F),u=q.next();while(!u.done)})};return l},"es6","es3");$jscomp.owns=function(h,n){return Object.prototype.hasOwnProperty.call(h,n)};$jscomp.assign=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.assign?Object.assign:function(h,n){for(var k=1;k<arguments.length;k++){var p=arguments[k];if(p)for(var l in p)$jscomp.owns(p,l)&&(h[l]=p[l])}return h};
|
|
17
|
+
$jscomp.polyfill("Object.assign",function(h){return h||$jscomp.assign},"es6","es3");$jscomp.checkStringArgs=function(h,n,k){if(null==h)throw new TypeError("The 'this' value for String.prototype."+k+" must not be null or undefined");if(n instanceof RegExp)throw new TypeError("First argument to String.prototype."+k+" must not be a regular expression");return h+""};
|
|
18
|
+
$jscomp.polyfill("String.prototype.startsWith",function(h){return h?h:function(n,k){var p=$jscomp.checkStringArgs(this,n,"startsWith");n+="";var l=p.length,y=n.length;k=Math.max(0,Math.min(k|0,p.length));for(var f=0;f<y&&k<l;)if(p[k++]!=n[f++])return!1;return f>=y}},"es6","es3");
|
|
19
|
+
$jscomp.polyfill("Array.prototype.copyWithin",function(h){function n(k){k=Number(k);return Infinity===k||-Infinity===k?k:k|0}return h?h:function(k,p,l){var y=this.length;k=n(k);p=n(p);l=void 0===l?y:n(l);k=0>k?Math.max(y+k,0):Math.min(k,y);p=0>p?Math.max(y+p,0):Math.min(p,y);l=0>l?Math.max(y+l,0):Math.min(l,y);if(k<p)for(;p<l;)p in this?this[k++]=this[p++]:(delete this[k++],p++);else for(l=Math.min(l,y+p-k),k+=l-p;l>p;)--l in this?this[--k]=this[l]:delete this[--k];return this}},"es6","es3");
|
|
20
|
+
$jscomp.typedArrayCopyWithin=function(h){return h?h:Array.prototype.copyWithin};$jscomp.polyfill("Int8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");
|
|
21
|
+
$jscomp.polyfill("Uint16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float64Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");
|
|
22
|
+
var DracoDecoderModule=function(){var h="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(h=h||__filename);return function(n){function k(e){return a.locateFile?a.locateFile(e,U):U+e}function p(e,b){if(e){var c=ia;var d=e+b;for(b=e;c[b]&&!(b>=d);)++b;if(16<b-e&&c.buffer&&ra)c=ra.decode(c.subarray(e,b));else{for(d="";e<b;){var g=c[e++];if(g&128){var t=c[e++]&63;if(192==(g&224))d+=String.fromCharCode((g&31)<<6|t);else{var aa=c[e++]&
|
|
23
|
+
63;g=224==(g&240)?(g&15)<<12|t<<6|aa:(g&7)<<18|t<<12|aa<<6|c[e++]&63;65536>g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}c=d}}else c="";return c}function l(){var e=ja.buffer;a.HEAP8=W=new Int8Array(e);a.HEAP16=new Int16Array(e);a.HEAP32=ca=new Int32Array(e);a.HEAPU8=ia=new Uint8Array(e);a.HEAPU16=new Uint16Array(e);a.HEAPU32=Y=new Uint32Array(e);a.HEAPF32=new Float32Array(e);a.HEAPF64=new Float64Array(e)}function y(e){if(a.onAbort)a.onAbort(e);
|
|
24
|
+
e="Aborted("+e+")";da(e);sa=!0;e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.");ka(e);throw e;}function f(e){try{if(e==P&&ea)return new Uint8Array(ea);if(ma)return ma(e);throw"both async and sync fetching of the wasm failed";}catch(b){y(b)}}function q(){if(!ea&&(ta||fa)){if("function"==typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+P+"'";return e.arrayBuffer()}).catch(function(){return f(P)});
|
|
25
|
+
if(na)return new Promise(function(e,b){na(P,function(c){e(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return f(P)})}function u(e){for(;0<e.length;)e.shift()(a)}function A(e){this.excPtr=e;this.ptr=e-24;this.set_type=function(b){Y[this.ptr+4>>2]=b};this.get_type=function(){return Y[this.ptr+4>>2]};this.set_destructor=function(b){Y[this.ptr+8>>2]=b};this.get_destructor=function(){return Y[this.ptr+8>>2]};this.set_refcount=function(b){ca[this.ptr>>2]=b};this.set_caught=function(b){W[this.ptr+
|
|
26
|
+
12>>0]=b?1:0};this.get_caught=function(){return 0!=W[this.ptr+12>>0]};this.set_rethrown=function(b){W[this.ptr+13>>0]=b?1:0};this.get_rethrown=function(){return 0!=W[this.ptr+13>>0]};this.init=function(b,c){this.set_adjusted_ptr(0);this.set_type(b);this.set_destructor(c);this.set_refcount(0);this.set_caught(!1);this.set_rethrown(!1)};this.add_ref=function(){ca[this.ptr>>2]+=1};this.release_ref=function(){var b=ca[this.ptr>>2];ca[this.ptr>>2]=b-1;return 1===b};this.set_adjusted_ptr=function(b){Y[this.ptr+
|
|
27
|
+
16>>2]=b};this.get_adjusted_ptr=function(){return Y[this.ptr+16>>2]};this.get_exception_ptr=function(){if(ua(this.get_type()))return Y[this.excPtr>>2];var b=this.get_adjusted_ptr();return 0!==b?b:this.excPtr}}function F(){function e(){if(!la&&(la=!0,a.calledRun=!0,!sa)){va=!0;u(oa);wa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)xa.unshift(a.postRun.shift());u(xa)}}if(!(0<ba)){if(a.preRun)for("function"==
|
|
28
|
+
typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ya.unshift(a.preRun.shift());u(ya);0<ba||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);e()},1)):e())}}function v(){}function w(e){return(e||v).__cache__}function B(e,b){var c=w(b),d=c[e];if(d)return d;d=Object.create((b||v).prototype);d.ptr=e;return c[e]=d}function R(e){if("string"===typeof e){for(var b=0,c=0;c<e.length;++c){var d=e.charCodeAt(c);127>=d?b++:2047>=d?b+=2:55296<=d&&57343>=
|
|
29
|
+
d?(b+=4,++c):b+=3}b=Array(b+1);c=0;d=b.length;if(0<d){d=c+d-1;for(var g=0;g<e.length;++g){var t=e.charCodeAt(g);if(55296<=t&&57343>=t){var aa=e.charCodeAt(++g);t=65536+((t&1023)<<10)|aa&1023}if(127>=t){if(c>=d)break;b[c++]=t}else{if(2047>=t){if(c+1>=d)break;b[c++]=192|t>>6}else{if(65535>=t){if(c+2>=d)break;b[c++]=224|t>>12}else{if(c+3>=d)break;b[c++]=240|t>>18;b[c++]=128|t>>12&63}b[c++]=128|t>>6&63}b[c++]=128|t&63}}b[c]=0}e=r.alloc(b,W);r.copy(b,W,e);return e}return e}function Z(e){if("object"===
|
|
30
|
+
typeof e){var b=r.alloc(e,W);r.copy(e,W,b);return b}return e}function X(){throw"cannot construct a VoidPtr, no constructor in IDL";}function S(){this.ptr=za();w(S)[this.ptr]=this}function Q(){this.ptr=Aa();w(Q)[this.ptr]=this}function V(){this.ptr=Ba();w(V)[this.ptr]=this}function x(){this.ptr=Ca();w(x)[this.ptr]=this}function D(){this.ptr=Da();w(D)[this.ptr]=this}function G(){this.ptr=Ea();w(G)[this.ptr]=this}function H(){this.ptr=Fa();w(H)[this.ptr]=this}function E(){this.ptr=Ga();w(E)[this.ptr]=
|
|
31
|
+
this}function T(){this.ptr=Ha();w(T)[this.ptr]=this}function C(){throw"cannot construct a Status, no constructor in IDL";}function I(){this.ptr=Ia();w(I)[this.ptr]=this}function J(){this.ptr=Ja();w(J)[this.ptr]=this}function K(){this.ptr=Ka();w(K)[this.ptr]=this}function L(){this.ptr=La();w(L)[this.ptr]=this}function M(){this.ptr=Ma();w(M)[this.ptr]=this}function N(){this.ptr=Na();w(N)[this.ptr]=this}function O(){this.ptr=Oa();w(O)[this.ptr]=this}function z(){this.ptr=Pa();w(z)[this.ptr]=this}function m(){this.ptr=
|
|
32
|
+
Qa();w(m)[this.ptr]=this}n=void 0===n?{}:n;var a="undefined"!=typeof n?n:{},wa,ka;a.ready=new Promise(function(e,b){wa=e;ka=b});var Ra=!1,Sa=!1;a.onRuntimeInitialized=function(){Ra=!0;if(Sa&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Sa=!0;if(Ra&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(e){if("string"!==typeof e)return!1;e=e.split(".");return 2>e.length||3<e.length?!1:1==e[0]&&0<=e[1]&&5>=e[1]?!0:0!=e[0]||10<
|
|
33
|
+
e[1]?!1:!0};var Ta=Object.assign({},a),ta="object"==typeof window,fa="function"==typeof importScripts,Ua="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,U="";if(Ua){var Va=require("fs"),pa=require("path");U=fa?pa.dirname(U)+"/":__dirname+"/";var Wa=function(e,b){e=e.startsWith("file://")?new URL(e):pa.normalize(e);return Va.readFileSync(e,b?void 0:"utf8")};var ma=function(e){e=Wa(e,!0);e.buffer||(e=new Uint8Array(e));return e};var na=function(e,
|
|
34
|
+
b,c){e=e.startsWith("file://")?new URL(e):pa.normalize(e);Va.readFile(e,function(d,g){d?c(d):b(g.buffer)})};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);a.inspect=function(){return"[Emscripten Module object]"}}else if(ta||fa)fa?U=self.location.href:"undefined"!=typeof document&&document.currentScript&&(U=document.currentScript.src),h&&(U=h),U=0!==U.indexOf("blob:")?U.substr(0,U.replace(/[?#].*/,"").lastIndexOf("/")+1):"",Wa=function(e){var b=new XMLHttpRequest;b.open("GET",
|
|
35
|
+
e,!1);b.send(null);return b.responseText},fa&&(ma=function(e){var b=new XMLHttpRequest;b.open("GET",e,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),na=function(e,b,c){var d=new XMLHttpRequest;d.open("GET",e,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)};a.print||console.log.bind(console);var da=a.printErr||console.warn.bind(console);Object.assign(a,Ta);Ta=null;var ea;a.wasmBinary&&
|
|
36
|
+
(ea=a.wasmBinary);"object"!=typeof WebAssembly&&y("no native wasm support detected");var ja,sa=!1,ra="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,W,ia,ca,Y,ya=[],oa=[],xa=[],va=!1,ba=0,qa=null,ha=null;var P="draco_decoder_gltf.wasm";P.startsWith("data:application/octet-stream;base64,")||(P=k(P));var pd=0,qd={b:function(e,b,c){(new A(e)).init(b,c);pd++;throw e;},a:function(){y("")},d:function(e,b,c){ia.copyWithin(e,b,b+c)},c:function(e){var b=ia.length;e>>>=0;if(2147483648<e)return!1;
|
|
37
|
+
for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,e+100663296);var g=Math;d=Math.max(e,d);g=g.min.call(g,2147483648,d+(65536-d%65536)%65536);a:{d=ja.buffer;try{ja.grow(g-d.byteLength+65535>>>16);l();var t=1;break a}catch(aa){}t=void 0}if(t)return!0}return!1}};(function(){function e(g,t){a.asm=g.exports;ja=a.asm.e;l();oa.unshift(a.asm.f);ba--;a.monitorRunDependencies&&a.monitorRunDependencies(ba);0==ba&&(null!==qa&&(clearInterval(qa),qa=null),ha&&(g=ha,ha=null,g()))}function b(g){e(g.instance)}
|
|
38
|
+
function c(g){return q().then(function(t){return WebAssembly.instantiate(t,d)}).then(function(t){return t}).then(g,function(t){da("failed to asynchronously prepare wasm: "+t);y(t)})}var d={a:qd};ba++;a.monitorRunDependencies&&a.monitorRunDependencies(ba);if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(g){da("Module.instantiateWasm callback failed with error: "+g),ka(g)}(function(){return ea||"function"!=typeof WebAssembly.instantiateStreaming||P.startsWith("data:application/octet-stream;base64,")||
|
|
39
|
+
P.startsWith("file://")||Ua||"function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(t){da("wasm streaming compile failed: "+t);da("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ka);return{}})();var Xa=a._emscripten_bind_VoidPtr___destroy___0=function(){return(Xa=a._emscripten_bind_VoidPtr___destroy___0=a.asm.h).apply(null,arguments)},za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=
|
|
40
|
+
function(){return(za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=a.asm.i).apply(null,arguments)},Ya=a._emscripten_bind_DecoderBuffer_Init_2=function(){return(Ya=a._emscripten_bind_DecoderBuffer_Init_2=a.asm.j).apply(null,arguments)},Za=a._emscripten_bind_DecoderBuffer___destroy___0=function(){return(Za=a._emscripten_bind_DecoderBuffer___destroy___0=a.asm.k).apply(null,arguments)},Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=
|
|
41
|
+
a.asm.l).apply(null,arguments)},$a=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return($a=a._emscripten_bind_AttributeTransformData_transform_type_0=a.asm.m).apply(null,arguments)},ab=a._emscripten_bind_AttributeTransformData___destroy___0=function(){return(ab=a._emscripten_bind_AttributeTransformData___destroy___0=a.asm.n).apply(null,arguments)},Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=
|
|
42
|
+
a.asm.o).apply(null,arguments)},bb=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return(bb=a._emscripten_bind_GeometryAttribute___destroy___0=a.asm.p).apply(null,arguments)},Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=a.asm.q).apply(null,arguments)},cb=a._emscripten_bind_PointAttribute_size_0=function(){return(cb=a._emscripten_bind_PointAttribute_size_0=a.asm.r).apply(null,arguments)},db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=
|
|
43
|
+
function(){return(db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=a.asm.s).apply(null,arguments)},eb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return(eb=a._emscripten_bind_PointAttribute_attribute_type_0=a.asm.t).apply(null,arguments)},fb=a._emscripten_bind_PointAttribute_data_type_0=function(){return(fb=a._emscripten_bind_PointAttribute_data_type_0=a.asm.u).apply(null,arguments)},gb=a._emscripten_bind_PointAttribute_num_components_0=function(){return(gb=a._emscripten_bind_PointAttribute_num_components_0=
|
|
44
|
+
a.asm.v).apply(null,arguments)},hb=a._emscripten_bind_PointAttribute_normalized_0=function(){return(hb=a._emscripten_bind_PointAttribute_normalized_0=a.asm.w).apply(null,arguments)},ib=a._emscripten_bind_PointAttribute_byte_stride_0=function(){return(ib=a._emscripten_bind_PointAttribute_byte_stride_0=a.asm.x).apply(null,arguments)},jb=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return(jb=a._emscripten_bind_PointAttribute_byte_offset_0=a.asm.y).apply(null,arguments)},kb=a._emscripten_bind_PointAttribute_unique_id_0=
|
|
45
|
+
function(){return(kb=a._emscripten_bind_PointAttribute_unique_id_0=a.asm.z).apply(null,arguments)},lb=a._emscripten_bind_PointAttribute___destroy___0=function(){return(lb=a._emscripten_bind_PointAttribute___destroy___0=a.asm.A).apply(null,arguments)},Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=a.asm.B).apply(null,arguments)},mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=
|
|
46
|
+
function(){return(mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=a.asm.C).apply(null,arguments)},nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=function(){return(nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=a.asm.D).apply(null,arguments)},ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=a.asm.E).apply(null,arguments)},pb=
|
|
47
|
+
a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(pb=a._emscripten_bind_AttributeQuantizationTransform_range_0=a.asm.F).apply(null,arguments)},qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=function(){return(qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=a.asm.G).apply(null,arguments)},Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=
|
|
48
|
+
a.asm.H).apply(null,arguments)},rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=a.asm.I).apply(null,arguments)},sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=a.asm.J).apply(null,arguments)},tb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(tb=
|
|
49
|
+
a._emscripten_bind_AttributeOctahedronTransform___destroy___0=a.asm.K).apply(null,arguments)},Fa=a._emscripten_bind_PointCloud_PointCloud_0=function(){return(Fa=a._emscripten_bind_PointCloud_PointCloud_0=a.asm.L).apply(null,arguments)},ub=a._emscripten_bind_PointCloud_num_attributes_0=function(){return(ub=a._emscripten_bind_PointCloud_num_attributes_0=a.asm.M).apply(null,arguments)},vb=a._emscripten_bind_PointCloud_num_points_0=function(){return(vb=a._emscripten_bind_PointCloud_num_points_0=a.asm.N).apply(null,
|
|
50
|
+
arguments)},wb=a._emscripten_bind_PointCloud___destroy___0=function(){return(wb=a._emscripten_bind_PointCloud___destroy___0=a.asm.O).apply(null,arguments)},Ga=a._emscripten_bind_Mesh_Mesh_0=function(){return(Ga=a._emscripten_bind_Mesh_Mesh_0=a.asm.P).apply(null,arguments)},xb=a._emscripten_bind_Mesh_num_faces_0=function(){return(xb=a._emscripten_bind_Mesh_num_faces_0=a.asm.Q).apply(null,arguments)},yb=a._emscripten_bind_Mesh_num_attributes_0=function(){return(yb=a._emscripten_bind_Mesh_num_attributes_0=
|
|
51
|
+
a.asm.R).apply(null,arguments)},zb=a._emscripten_bind_Mesh_num_points_0=function(){return(zb=a._emscripten_bind_Mesh_num_points_0=a.asm.S).apply(null,arguments)},Ab=a._emscripten_bind_Mesh___destroy___0=function(){return(Ab=a._emscripten_bind_Mesh___destroy___0=a.asm.T).apply(null,arguments)},Ha=a._emscripten_bind_Metadata_Metadata_0=function(){return(Ha=a._emscripten_bind_Metadata_Metadata_0=a.asm.U).apply(null,arguments)},Bb=a._emscripten_bind_Metadata___destroy___0=function(){return(Bb=a._emscripten_bind_Metadata___destroy___0=
|
|
52
|
+
a.asm.V).apply(null,arguments)},Cb=a._emscripten_bind_Status_code_0=function(){return(Cb=a._emscripten_bind_Status_code_0=a.asm.W).apply(null,arguments)},Db=a._emscripten_bind_Status_ok_0=function(){return(Db=a._emscripten_bind_Status_ok_0=a.asm.X).apply(null,arguments)},Eb=a._emscripten_bind_Status_error_msg_0=function(){return(Eb=a._emscripten_bind_Status_error_msg_0=a.asm.Y).apply(null,arguments)},Fb=a._emscripten_bind_Status___destroy___0=function(){return(Fb=a._emscripten_bind_Status___destroy___0=
|
|
53
|
+
a.asm.Z).apply(null,arguments)},Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=a.asm._).apply(null,arguments)},Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=a.asm.$).apply(null,arguments)},Hb=a._emscripten_bind_DracoFloat32Array_size_0=function(){return(Hb=a._emscripten_bind_DracoFloat32Array_size_0=a.asm.aa).apply(null,arguments)},Ib=
|
|
54
|
+
a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Ib=a._emscripten_bind_DracoFloat32Array___destroy___0=a.asm.ba).apply(null,arguments)},Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=function(){return(Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=a.asm.ca).apply(null,arguments)},Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=a.asm.da).apply(null,arguments)},Kb=a._emscripten_bind_DracoInt8Array_size_0=
|
|
55
|
+
function(){return(Kb=a._emscripten_bind_DracoInt8Array_size_0=a.asm.ea).apply(null,arguments)},Lb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Lb=a._emscripten_bind_DracoInt8Array___destroy___0=a.asm.fa).apply(null,arguments)},Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=a.asm.ga).apply(null,arguments)},Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1=
|
|
56
|
+
a.asm.ha).apply(null,arguments)},Nb=a._emscripten_bind_DracoUInt8Array_size_0=function(){return(Nb=a._emscripten_bind_DracoUInt8Array_size_0=a.asm.ia).apply(null,arguments)},Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=function(){return(Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=a.asm.ja).apply(null,arguments)},La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=a.asm.ka).apply(null,arguments)},Pb=a._emscripten_bind_DracoInt16Array_GetValue_1=
|
|
57
|
+
function(){return(Pb=a._emscripten_bind_DracoInt16Array_GetValue_1=a.asm.la).apply(null,arguments)},Qb=a._emscripten_bind_DracoInt16Array_size_0=function(){return(Qb=a._emscripten_bind_DracoInt16Array_size_0=a.asm.ma).apply(null,arguments)},Rb=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Rb=a._emscripten_bind_DracoInt16Array___destroy___0=a.asm.na).apply(null,arguments)},Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=
|
|
58
|
+
a.asm.oa).apply(null,arguments)},Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=a.asm.pa).apply(null,arguments)},Tb=a._emscripten_bind_DracoUInt16Array_size_0=function(){return(Tb=a._emscripten_bind_DracoUInt16Array_size_0=a.asm.qa).apply(null,arguments)},Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=a.asm.ra).apply(null,arguments)},Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=
|
|
59
|
+
function(){return(Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=a.asm.sa).apply(null,arguments)},Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=function(){return(Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=a.asm.ta).apply(null,arguments)},Wb=a._emscripten_bind_DracoInt32Array_size_0=function(){return(Wb=a._emscripten_bind_DracoInt32Array_size_0=a.asm.ua).apply(null,arguments)},Xb=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return(Xb=a._emscripten_bind_DracoInt32Array___destroy___0=
|
|
60
|
+
a.asm.va).apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=a.asm.wa).apply(null,arguments)},Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=a.asm.xa).apply(null,arguments)},Zb=a._emscripten_bind_DracoUInt32Array_size_0=function(){return(Zb=a._emscripten_bind_DracoUInt32Array_size_0=a.asm.ya).apply(null,arguments)},$b=a._emscripten_bind_DracoUInt32Array___destroy___0=
|
|
61
|
+
function(){return($b=a._emscripten_bind_DracoUInt32Array___destroy___0=a.asm.za).apply(null,arguments)},Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=function(){return(Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=a.asm.Aa).apply(null,arguments)},ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=a.asm.Ba).apply(null,arguments)},bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=
|
|
62
|
+
a.asm.Ca).apply(null,arguments)},cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=a.asm.Da).apply(null,arguments)},dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=a.asm.Ea).apply(null,arguments)},ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=a.asm.Fa).apply(null,
|
|
63
|
+
arguments)},fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=a.asm.Ga).apply(null,arguments)},gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=a.asm.Ha).apply(null,arguments)},hc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return(hc=a._emscripten_bind_MetadataQuerier___destroy___0=a.asm.Ia).apply(null,arguments)},Qa=a._emscripten_bind_Decoder_Decoder_0=
|
|
64
|
+
function(){return(Qa=a._emscripten_bind_Decoder_Decoder_0=a.asm.Ja).apply(null,arguments)},ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=a.asm.Ka).apply(null,arguments)},jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=a.asm.La).apply(null,arguments)},kc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return(kc=a._emscripten_bind_Decoder_GetAttributeId_2=
|
|
65
|
+
a.asm.Ma).apply(null,arguments)},lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=a.asm.Na).apply(null,arguments)},mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=a.asm.Oa).apply(null,arguments)},nc=a._emscripten_bind_Decoder_GetAttribute_2=function(){return(nc=a._emscripten_bind_Decoder_GetAttribute_2=a.asm.Pa).apply(null,arguments)},
|
|
66
|
+
oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=a.asm.Qa).apply(null,arguments)},pc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return(pc=a._emscripten_bind_Decoder_GetMetadata_1=a.asm.Ra).apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=a.asm.Sa).apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=
|
|
67
|
+
function(){return(rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=a.asm.Ta).apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=function(){return(sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=a.asm.Ua).apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=a.asm.Va).apply(null,arguments)},uc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(uc=
|
|
68
|
+
a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=a.asm.Wa).apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=a.asm.Xa).apply(null,arguments)},wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=a.asm.Ya).apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=
|
|
69
|
+
a.asm.Za).apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=a.asm._a).apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=a.asm.$a).apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=
|
|
70
|
+
a.asm.ab).apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=function(){return(Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=a.asm.bb).apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=a.asm.cb).apply(null,arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=
|
|
71
|
+
a.asm.db).apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=function(){return(Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=a.asm.eb).apply(null,arguments)},Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=a.asm.fb).apply(null,arguments)},Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=
|
|
72
|
+
a.asm.gb).apply(null,arguments)},Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=function(){return(Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=a.asm.hb).apply(null,arguments)},Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=a.asm.ib).apply(null,arguments)},Jc=a._emscripten_bind_Decoder___destroy___0=function(){return(Jc=a._emscripten_bind_Decoder___destroy___0=a.asm.jb).apply(null,arguments)},Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=
|
|
73
|
+
function(){return(Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=a.asm.kb).apply(null,arguments)},Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=a.asm.lb).apply(null,arguments)},Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=
|
|
74
|
+
a.asm.mb).apply(null,arguments)},Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=function(){return(Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=a.asm.nb).apply(null,arguments)},Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=a.asm.ob).apply(null,arguments)},Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=
|
|
75
|
+
a.asm.pb).apply(null,arguments)},Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=function(){return(Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=a.asm.qb).apply(null,arguments)},Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=a.asm.rb).apply(null,arguments)},Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=
|
|
76
|
+
a.asm.sb).apply(null,arguments)},Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=function(){return(Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=a.asm.tb).apply(null,arguments)},Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return(Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=a.asm.ub).apply(null,arguments)},Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return(Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=
|
|
77
|
+
a.asm.vb).apply(null,arguments)},Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=function(){return(Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=a.asm.wb).apply(null,arguments)},Xc=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return(Xc=a._emscripten_enum_draco_DataType_DT_INVALID=a.asm.xb).apply(null,arguments)},Yc=a._emscripten_enum_draco_DataType_DT_INT8=function(){return(Yc=a._emscripten_enum_draco_DataType_DT_INT8=a.asm.yb).apply(null,arguments)},Zc=
|
|
78
|
+
a._emscripten_enum_draco_DataType_DT_UINT8=function(){return(Zc=a._emscripten_enum_draco_DataType_DT_UINT8=a.asm.zb).apply(null,arguments)},$c=a._emscripten_enum_draco_DataType_DT_INT16=function(){return($c=a._emscripten_enum_draco_DataType_DT_INT16=a.asm.Ab).apply(null,arguments)},ad=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return(ad=a._emscripten_enum_draco_DataType_DT_UINT16=a.asm.Bb).apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return(bd=a._emscripten_enum_draco_DataType_DT_INT32=
|
|
79
|
+
a.asm.Cb).apply(null,arguments)},cd=a._emscripten_enum_draco_DataType_DT_UINT32=function(){return(cd=a._emscripten_enum_draco_DataType_DT_UINT32=a.asm.Db).apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_INT64=function(){return(dd=a._emscripten_enum_draco_DataType_DT_INT64=a.asm.Eb).apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return(ed=a._emscripten_enum_draco_DataType_DT_UINT64=a.asm.Fb).apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_FLOAT32=
|
|
80
|
+
function(){return(fd=a._emscripten_enum_draco_DataType_DT_FLOAT32=a.asm.Gb).apply(null,arguments)},gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=a.asm.Hb).apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return(hd=a._emscripten_enum_draco_DataType_DT_BOOL=a.asm.Ib).apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=
|
|
81
|
+
a.asm.Jb).apply(null,arguments)},jd=a._emscripten_enum_draco_StatusCode_OK=function(){return(jd=a._emscripten_enum_draco_StatusCode_OK=a.asm.Kb).apply(null,arguments)},kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=a.asm.Lb).apply(null,arguments)},ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=a.asm.Mb).apply(null,arguments)},md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=
|
|
82
|
+
function(){return(md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=a.asm.Nb).apply(null,arguments)},nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=a.asm.Ob).apply(null,arguments)},od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=a.asm.Pb).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.Qb).apply(null,arguments)};
|
|
83
|
+
a._free=function(){return(a._free=a.asm.Rb).apply(null,arguments)};var ua=function(){return(ua=a.asm.Sb).apply(null,arguments)};a.___start_em_js=11660;a.___stop_em_js=11758;var la;ha=function b(){la||F();la||(ha=b)};if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();F();v.prototype=Object.create(v.prototype);v.prototype.constructor=v;v.prototype.__class__=v;v.__cache__={};a.WrapperObject=v;a.getCache=w;a.wrapPointer=B;a.castObject=function(b,
|
|
84
|
+
c){return B(b.ptr,c)};a.NULL=B(0);a.destroy=function(b){if(!b.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";b.__destroy__();delete w(b.__class__)[b.ptr]};a.compare=function(b,c){return b.ptr===c.ptr};a.getPointer=function(b){return b.ptr};a.getClass=function(b){return b.__class__};var r={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(r.needed){for(var b=0;b<r.temps.length;b++)a._free(r.temps[b]);r.temps.length=0;a._free(r.buffer);r.buffer=0;r.size+=
|
|
85
|
+
r.needed;r.needed=0}r.buffer||(r.size+=128,r.buffer=a._malloc(r.size),r.buffer||y(void 0));r.pos=0},alloc:function(b,c){r.buffer||y(void 0);b=b.length*c.BYTES_PER_ELEMENT;b=b+7&-8;r.pos+b>=r.size?(0<b||y(void 0),r.needed+=b,c=a._malloc(b),r.temps.push(c)):(c=r.buffer+r.pos,r.pos+=b);return c},copy:function(b,c,d){d>>>=0;switch(c.BYTES_PER_ELEMENT){case 2:d>>>=1;break;case 4:d>>>=2;break;case 8:d>>>=3}for(var g=0;g<b.length;g++)c[d+g]=b[g]}};X.prototype=Object.create(v.prototype);X.prototype.constructor=
|
|
86
|
+
X;X.prototype.__class__=X;X.__cache__={};a.VoidPtr=X;X.prototype.__destroy__=X.prototype.__destroy__=function(){Xa(this.ptr)};S.prototype=Object.create(v.prototype);S.prototype.constructor=S;S.prototype.__class__=S;S.__cache__={};a.DecoderBuffer=S;S.prototype.Init=S.prototype.Init=function(b,c){var d=this.ptr;r.prepare();"object"==typeof b&&(b=Z(b));c&&"object"===typeof c&&(c=c.ptr);Ya(d,b,c)};S.prototype.__destroy__=S.prototype.__destroy__=function(){Za(this.ptr)};Q.prototype=Object.create(v.prototype);
|
|
87
|
+
Q.prototype.constructor=Q;Q.prototype.__class__=Q;Q.__cache__={};a.AttributeTransformData=Q;Q.prototype.transform_type=Q.prototype.transform_type=function(){return $a(this.ptr)};Q.prototype.__destroy__=Q.prototype.__destroy__=function(){ab(this.ptr)};V.prototype=Object.create(v.prototype);V.prototype.constructor=V;V.prototype.__class__=V;V.__cache__={};a.GeometryAttribute=V;V.prototype.__destroy__=V.prototype.__destroy__=function(){bb(this.ptr)};x.prototype=Object.create(v.prototype);x.prototype.constructor=
|
|
88
|
+
x;x.prototype.__class__=x;x.__cache__={};a.PointAttribute=x;x.prototype.size=x.prototype.size=function(){return cb(this.ptr)};x.prototype.GetAttributeTransformData=x.prototype.GetAttributeTransformData=function(){return B(db(this.ptr),Q)};x.prototype.attribute_type=x.prototype.attribute_type=function(){return eb(this.ptr)};x.prototype.data_type=x.prototype.data_type=function(){return fb(this.ptr)};x.prototype.num_components=x.prototype.num_components=function(){return gb(this.ptr)};x.prototype.normalized=
|
|
89
|
+
x.prototype.normalized=function(){return!!hb(this.ptr)};x.prototype.byte_stride=x.prototype.byte_stride=function(){return ib(this.ptr)};x.prototype.byte_offset=x.prototype.byte_offset=function(){return jb(this.ptr)};x.prototype.unique_id=x.prototype.unique_id=function(){return kb(this.ptr)};x.prototype.__destroy__=x.prototype.__destroy__=function(){lb(this.ptr)};D.prototype=Object.create(v.prototype);D.prototype.constructor=D;D.prototype.__class__=D;D.__cache__={};a.AttributeQuantizationTransform=
|
|
90
|
+
D;D.prototype.InitFromAttribute=D.prototype.InitFromAttribute=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return!!mb(c,b)};D.prototype.quantization_bits=D.prototype.quantization_bits=function(){return nb(this.ptr)};D.prototype.min_value=D.prototype.min_value=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return ob(c,b)};D.prototype.range=D.prototype.range=function(){return pb(this.ptr)};D.prototype.__destroy__=D.prototype.__destroy__=function(){qb(this.ptr)};G.prototype=
|
|
91
|
+
Object.create(v.prototype);G.prototype.constructor=G;G.prototype.__class__=G;G.__cache__={};a.AttributeOctahedronTransform=G;G.prototype.InitFromAttribute=G.prototype.InitFromAttribute=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return!!rb(c,b)};G.prototype.quantization_bits=G.prototype.quantization_bits=function(){return sb(this.ptr)};G.prototype.__destroy__=G.prototype.__destroy__=function(){tb(this.ptr)};H.prototype=Object.create(v.prototype);H.prototype.constructor=H;H.prototype.__class__=
|
|
92
|
+
H;H.__cache__={};a.PointCloud=H;H.prototype.num_attributes=H.prototype.num_attributes=function(){return ub(this.ptr)};H.prototype.num_points=H.prototype.num_points=function(){return vb(this.ptr)};H.prototype.__destroy__=H.prototype.__destroy__=function(){wb(this.ptr)};E.prototype=Object.create(v.prototype);E.prototype.constructor=E;E.prototype.__class__=E;E.__cache__={};a.Mesh=E;E.prototype.num_faces=E.prototype.num_faces=function(){return xb(this.ptr)};E.prototype.num_attributes=E.prototype.num_attributes=
|
|
93
|
+
function(){return yb(this.ptr)};E.prototype.num_points=E.prototype.num_points=function(){return zb(this.ptr)};E.prototype.__destroy__=E.prototype.__destroy__=function(){Ab(this.ptr)};T.prototype=Object.create(v.prototype);T.prototype.constructor=T;T.prototype.__class__=T;T.__cache__={};a.Metadata=T;T.prototype.__destroy__=T.prototype.__destroy__=function(){Bb(this.ptr)};C.prototype=Object.create(v.prototype);C.prototype.constructor=C;C.prototype.__class__=C;C.__cache__={};a.Status=C;C.prototype.code=
|
|
94
|
+
C.prototype.code=function(){return Cb(this.ptr)};C.prototype.ok=C.prototype.ok=function(){return!!Db(this.ptr)};C.prototype.error_msg=C.prototype.error_msg=function(){return p(Eb(this.ptr))};C.prototype.__destroy__=C.prototype.__destroy__=function(){Fb(this.ptr)};I.prototype=Object.create(v.prototype);I.prototype.constructor=I;I.prototype.__class__=I;I.__cache__={};a.DracoFloat32Array=I;I.prototype.GetValue=I.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Gb(c,
|
|
95
|
+
b)};I.prototype.size=I.prototype.size=function(){return Hb(this.ptr)};I.prototype.__destroy__=I.prototype.__destroy__=function(){Ib(this.ptr)};J.prototype=Object.create(v.prototype);J.prototype.constructor=J;J.prototype.__class__=J;J.__cache__={};a.DracoInt8Array=J;J.prototype.GetValue=J.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Jb(c,b)};J.prototype.size=J.prototype.size=function(){return Kb(this.ptr)};J.prototype.__destroy__=J.prototype.__destroy__=function(){Lb(this.ptr)};
|
|
96
|
+
K.prototype=Object.create(v.prototype);K.prototype.constructor=K;K.prototype.__class__=K;K.__cache__={};a.DracoUInt8Array=K;K.prototype.GetValue=K.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Mb(c,b)};K.prototype.size=K.prototype.size=function(){return Nb(this.ptr)};K.prototype.__destroy__=K.prototype.__destroy__=function(){Ob(this.ptr)};L.prototype=Object.create(v.prototype);L.prototype.constructor=L;L.prototype.__class__=L;L.__cache__={};a.DracoInt16Array=
|
|
97
|
+
L;L.prototype.GetValue=L.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Pb(c,b)};L.prototype.size=L.prototype.size=function(){return Qb(this.ptr)};L.prototype.__destroy__=L.prototype.__destroy__=function(){Rb(this.ptr)};M.prototype=Object.create(v.prototype);M.prototype.constructor=M;M.prototype.__class__=M;M.__cache__={};a.DracoUInt16Array=M;M.prototype.GetValue=M.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Sb(c,b)};
|
|
98
|
+
M.prototype.size=M.prototype.size=function(){return Tb(this.ptr)};M.prototype.__destroy__=M.prototype.__destroy__=function(){Ub(this.ptr)};N.prototype=Object.create(v.prototype);N.prototype.constructor=N;N.prototype.__class__=N;N.__cache__={};a.DracoInt32Array=N;N.prototype.GetValue=N.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Vb(c,b)};N.prototype.size=N.prototype.size=function(){return Wb(this.ptr)};N.prototype.__destroy__=N.prototype.__destroy__=function(){Xb(this.ptr)};
|
|
99
|
+
O.prototype=Object.create(v.prototype);O.prototype.constructor=O;O.prototype.__class__=O;O.__cache__={};a.DracoUInt32Array=O;O.prototype.GetValue=O.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Yb(c,b)};O.prototype.size=O.prototype.size=function(){return Zb(this.ptr)};O.prototype.__destroy__=O.prototype.__destroy__=function(){$b(this.ptr)};z.prototype=Object.create(v.prototype);z.prototype.constructor=z;z.prototype.__class__=z;z.__cache__={};a.MetadataQuerier=
|
|
100
|
+
z;z.prototype.HasEntry=z.prototype.HasEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return!!ac(d,b,c)};z.prototype.GetIntEntry=z.prototype.GetIntEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return bc(d,b,c)};z.prototype.GetIntEntryArray=z.prototype.GetIntEntryArray=function(b,c,d){var g=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===
|
|
101
|
+
typeof c?c.ptr:R(c);d&&"object"===typeof d&&(d=d.ptr);cc(g,b,c,d)};z.prototype.GetDoubleEntry=z.prototype.GetDoubleEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return dc(d,b,c)};z.prototype.GetStringEntry=z.prototype.GetStringEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return p(ec(d,b,c))};z.prototype.NumEntries=z.prototype.NumEntries=function(b){var c=this.ptr;
|
|
102
|
+
b&&"object"===typeof b&&(b=b.ptr);return fc(c,b)};z.prototype.GetEntryName=z.prototype.GetEntryName=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return p(gc(d,b,c))};z.prototype.__destroy__=z.prototype.__destroy__=function(){hc(this.ptr)};m.prototype=Object.create(v.prototype);m.prototype.constructor=m;m.prototype.__class__=m;m.__cache__={};a.Decoder=m;m.prototype.DecodeArrayToPointCloud=m.prototype.DecodeArrayToPointCloud=function(b,c,d){var g=
|
|
103
|
+
this.ptr;r.prepare();"object"==typeof b&&(b=Z(b));c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return B(ic(g,b,c,d),C)};m.prototype.DecodeArrayToMesh=m.prototype.DecodeArrayToMesh=function(b,c,d){var g=this.ptr;r.prepare();"object"==typeof b&&(b=Z(b));c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return B(jc(g,b,c,d),C)};m.prototype.GetAttributeId=m.prototype.GetAttributeId=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&
|
|
104
|
+
(c=c.ptr);return kc(d,b,c)};m.prototype.GetAttributeIdByName=m.prototype.GetAttributeIdByName=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return lc(d,b,c)};m.prototype.GetAttributeIdByMetadataEntry=m.prototype.GetAttributeIdByMetadataEntry=function(b,c,d){var g=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);d=d&&"object"===typeof d?d.ptr:R(d);return mc(g,b,c,d)};m.prototype.GetAttribute=
|
|
105
|
+
m.prototype.GetAttribute=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(nc(d,b,c),x)};m.prototype.GetAttributeByUniqueId=m.prototype.GetAttributeByUniqueId=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(oc(d,b,c),x)};m.prototype.GetMetadata=m.prototype.GetMetadata=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return B(pc(c,b),T)};m.prototype.GetAttributeMetadata=m.prototype.GetAttributeMetadata=
|
|
106
|
+
function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(qc(d,b,c),T)};m.prototype.GetFaceFromMesh=m.prototype.GetFaceFromMesh=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!rc(g,b,c,d)};m.prototype.GetTriangleStripsFromMesh=m.prototype.GetTriangleStripsFromMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);
|
|
107
|
+
return sc(d,b,c)};m.prototype.GetTrianglesUInt16Array=m.prototype.GetTrianglesUInt16Array=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!tc(g,b,c,d)};m.prototype.GetTrianglesUInt32Array=m.prototype.GetTrianglesUInt32Array=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!uc(g,b,c,d)};m.prototype.GetAttributeFloat=m.prototype.GetAttributeFloat=
|
|
108
|
+
function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!vc(g,b,c,d)};m.prototype.GetAttributeFloatForAllPoints=m.prototype.GetAttributeFloatForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!wc(g,b,c,d)};m.prototype.GetAttributeIntForAllPoints=m.prototype.GetAttributeIntForAllPoints=function(b,c,d){var g=this.ptr;
|
|
109
|
+
b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!xc(g,b,c,d)};m.prototype.GetAttributeInt8ForAllPoints=m.prototype.GetAttributeInt8ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!yc(g,b,c,d)};m.prototype.GetAttributeUInt8ForAllPoints=m.prototype.GetAttributeUInt8ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=
|
|
110
|
+
b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!zc(g,b,c,d)};m.prototype.GetAttributeInt16ForAllPoints=m.prototype.GetAttributeInt16ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ac(g,b,c,d)};m.prototype.GetAttributeUInt16ForAllPoints=m.prototype.GetAttributeUInt16ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&
|
|
111
|
+
(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Bc(g,b,c,d)};m.prototype.GetAttributeInt32ForAllPoints=m.prototype.GetAttributeInt32ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Cc(g,b,c,d)};m.prototype.GetAttributeUInt32ForAllPoints=m.prototype.GetAttributeUInt32ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===
|
|
112
|
+
typeof d&&(d=d.ptr);return!!Dc(g,b,c,d)};m.prototype.GetAttributeDataArrayForAllPoints=m.prototype.GetAttributeDataArrayForAllPoints=function(b,c,d,g,t){var aa=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);g&&"object"===typeof g&&(g=g.ptr);t&&"object"===typeof t&&(t=t.ptr);return!!Ec(aa,b,c,d,g,t)};m.prototype.SkipAttributeTransform=m.prototype.SkipAttributeTransform=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);Fc(c,
|
|
113
|
+
b)};m.prototype.GetEncodedGeometryType_Deprecated=m.prototype.GetEncodedGeometryType_Deprecated=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Gc(c,b)};m.prototype.DecodeBufferToPointCloud=m.prototype.DecodeBufferToPointCloud=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(Hc(d,b,c),C)};m.prototype.DecodeBufferToMesh=m.prototype.DecodeBufferToMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===
|
|
114
|
+
typeof c&&(c=c.ptr);return B(Ic(d,b,c),C)};m.prototype.__destroy__=m.prototype.__destroy__=function(){Jc(this.ptr)};(function(){function b(){a.ATTRIBUTE_INVALID_TRANSFORM=Kc();a.ATTRIBUTE_NO_TRANSFORM=Lc();a.ATTRIBUTE_QUANTIZATION_TRANSFORM=Mc();a.ATTRIBUTE_OCTAHEDRON_TRANSFORM=Nc();a.INVALID=Oc();a.POSITION=Pc();a.NORMAL=Qc();a.COLOR=Rc();a.TEX_COORD=Sc();a.GENERIC=Tc();a.INVALID_GEOMETRY_TYPE=Uc();a.POINT_CLOUD=Vc();a.TRIANGULAR_MESH=Wc();a.DT_INVALID=Xc();a.DT_INT8=Yc();a.DT_UINT8=Zc();a.DT_INT16=
|
|
115
|
+
$c();a.DT_UINT16=ad();a.DT_INT32=bd();a.DT_UINT32=cd();a.DT_INT64=dd();a.DT_UINT64=ed();a.DT_FLOAT32=fd();a.DT_FLOAT64=gd();a.DT_BOOL=hd();a.DT_TYPES_COUNT=id();a.OK=jd();a.DRACO_ERROR=kd();a.IO_ERROR=ld();a.INVALID_PARAMETER=md();a.UNSUPPORTED_VERSION=nd();a.UNKNOWN_VERSION=od()}va?b():oa.unshift(b)})();if("function"===typeof a.onModuleParsed)a.onModuleParsed();a.Decoder.prototype.GetEncodedGeometryType=function(b){if(b.__class__&&b.__class__===a.DecoderBuffer)return a.Decoder.prototype.GetEncodedGeometryType_Deprecated(b);
|
|
116
|
+
if(8>b.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
"use strict";var re=Object.defineProperty;var ie=(h,t,e)=>t in h?re(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e;var H=(h,t,e)=>ie(h,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("three"),P=require("../../../../chunks/parse-error-2f5qpXP5.cjs"),v=require("../../../../chunks/FileTypes-BjZ0rrIV.cjs");function q(h,t){if(t===l.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(t===l.TriangleFanDrawMode||t===l.TriangleStripDrawMode){let e=h.getIndex();if(e===null){const s=[],a=h.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)s.push(o);h.setIndex(s),e=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const i=e.count-2,n=[];if(t===l.TriangleFanDrawMode)for(let s=1;s<=i;s++)n.push(e.getX(0)),n.push(e.getX(s)),n.push(e.getX(s+1));else for(let s=0;s<i;s++)s%2===0?(n.push(e.getX(s)),n.push(e.getX(s+1)),n.push(e.getX(s+2))):(n.push(e.getX(s+2)),n.push(e.getX(s+1)),n.push(e.getX(s)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=h.clone();return r.setIndex(n),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),h}class oe extends l.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new fe(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new Se(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new Me(e)}),this.register(function(e){return new we(e)})}load(t,e,i,n){const r=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const c=l.LoaderUtils.extractUrlBase(t);s=l.LoaderUtils.resolveURL(c,this.path)}else s=l.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),r.manager.itemError(t),r.manager.itemEnd(t)},o=new l.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{r.parse(c,s,function(f){e(f),r.manager.itemEnd(t)},a)}catch(f){a(f)}},i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){let r;const s={},a={},o=new TextDecoder;if(typeof t=="string")r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===ee){try{s[w.KHR_BINARY_GLTF]=new ye(t)}catch(u){n&&n(u);return}r=JSON.parse(s[w.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(t));else r=t;if(r.asset===void 0||r.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new ke(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const u=this.pluginCallbacks[f](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let f=0;f<r.extensionsUsed.length;++f){const u=r.extensionsUsed[f],m=r.extensionsRequired||[];switch(u){case w.KHR_MATERIALS_UNLIT:s[u]=new le;break;case w.KHR_DRACO_MESH_COMPRESSION:s[u]=new Le(r,this.dracoLoader);break;case w.KHR_TEXTURE_TRANSFORM:s[u]=new _e;break;case w.KHR_MESH_QUANTIZATION:s[u]=new be;break;default:m.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,r){i.parse(t,e,n,r)})}}function ae(){let h={};return{get:function(t){return h[t]},add:function(t,e){h[t]=e},remove:function(t){delete h[t]},removeAll:function(){h={}}}}const w={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ce{constructor(t){this.parser=t,this.name=w.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i<n;i++){const r=e[i];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,i="light:"+t;let n=e.cache.get(i);if(n)return n;const r=e.json,o=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let c;const f=new l.Color(16777215);o.color!==void 0&&f.setRGB(o.color[0],o.color[1],o.color[2],l.LinearSRGBColorSpace);const u=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new l.DirectionalLight(f),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new l.PointLight(f),c.distance=u;break;case"spot":c=new l.SpotLight(f),c.distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),c.decay=2,F(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+t),n=Promise.resolve(c),e.cache.add(i,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,i=this.parser,r=i.json.nodes[t],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return i._getNodeRef(e.cache,a,o)})}}class le{constructor(){this.name=w.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(t,e,i){const n=[];t.color=new l.Color(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const s=r.baseColorFactor;t.color.setRGB(s[0],s[1],s[2],l.LinearSRGBColorSpace),t.opacity=s[3]}r.baseColorTexture!==void 0&&n.push(i.assignTexture(t,"map",r.baseColorTexture,l.SRGBColorSpace))}return Promise.all(n)}}class ue{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return r!==void 0&&(e.emissiveIntensity=r),Promise.resolve()}}class fe{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&r.push(i.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&r.push(i.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(r.push(i.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new l.Vector2(a,a)}return Promise.all(r)}}class de{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&r.push(i.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&r.push(i.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class he{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_SHEEN}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new l.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=n.extensions[this.name];if(s.sheenColorFactor!==void 0){const a=s.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&r.push(i.assignTexture(e,"sheenColorMap",s.sheenColorTexture,l.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&r.push(i.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class pe{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&r.push(i.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class me{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_VOLUME}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&r.push(i.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return e.attenuationColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),Promise.all(r)}}class ge{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_IOR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return e.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class Ae{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_SPECULAR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&r.push(i.assignTexture(e,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return e.specularColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&r.push(i.assignTexture(e,"specularColorMap",s.specularColorTexture,l.SRGBColorSpace)),Promise.all(r)}}class Te{constructor(t){this.parser=t,this.name=w.EXT_MATERIALS_BUMP}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&r.push(i.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class xe{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&r.push(i.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class Re{constructor(t){this.parser=t,this.name=w.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,i=e.json,n=i.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Se{constructor(t){this.parser=t,this.name=w.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Ee{constructor(t){this.parser=t,this.name=w.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Me{constructor(t){this.name=w.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,f=n.count,u=n.byteStride,m=new Uint8Array(a,o,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(f,u,m,n.mode,n.filter).then(function(T){return T.buffer}):s.ready.then(function(){const T=new ArrayBuffer(f*u);return s.decodeGltfBuffer(new Uint8Array(T),f,u,m,n.mode,n.filter),T})})}else return null}}class we{constructor(t){this.name=w.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=e.meshes[i.mesh];for(const c of n.primitives)if(c.mode!==I.TRIANGLES&&c.mode!==I.TRIANGLE_STRIP&&c.mode!==I.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=i.extensions[this.name].attributes,a=[],o={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(f=>(o[c]=f,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const f=c.pop(),u=f.isGroup?f.children:[f],m=c[0].count,T=[];for(const R of u){const y=new l.Matrix4,x=new l.Vector3,S=new l.Quaternion,L=new l.Vector3(1,1,1),_=new l.InstancedMesh(R.geometry,R.material,m);for(let M=0;M<m;M++)o.TRANSLATION&&x.fromBufferAttribute(o.TRANSLATION,M),o.ROTATION&&S.fromBufferAttribute(o.ROTATION,M),o.SCALE&&L.fromBufferAttribute(o.SCALE,M),_.setMatrixAt(M,y.compose(x,S,L));for(const M in o)if(M==="_COLOR_0"){const N=o[M];_.instanceColor=new l.InstancedBufferAttribute(N.array,N.itemSize,N.normalized)}else M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE"&&R.geometry.setAttribute(M,o[M]);l.Object3D.prototype.copy.call(_,R),this.parser.assignFinalMaterial(_),T.push(_)}return f.isGroup?(f.clear(),f.add(...T),f):T[0]}))}}const ee="glTF",G=12,Y={JSON:1313821514,BIN:5130562};class ye{constructor(t){this.name=w.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,G),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==ee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-G,r=new DataView(t,G);let s=0;for(;s<n;){const a=r.getUint32(s,!0);s+=4;const o=r.getUint32(s,!0);if(s+=4,o===Y.JSON){const c=new Uint8Array(t,G+s,a);this.content=i.decode(c)}else if(o===Y.BIN){const c=G+s;this.body=t.slice(c,c+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Le{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=w.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const i=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},c={};for(const f in s){const u=V[f]||f.toLowerCase();a[u]=s[f]}for(const f in t.attributes){const u=V[f]||f.toLowerCase();if(s[f]!==void 0){const m=i.accessors[t.attributes[f]],T=B[m.componentType];c[u]=T.name,o[u]=m.normalized===!0}}return e.getDependency("bufferView",r).then(function(f){return new Promise(function(u,m){n.decodeDracoFile(f,function(T){for(const R in T.attributes){const y=T.attributes[R],x=o[R];x!==void 0&&(y.normalized=x)}u(T)},a,c,l.LinearSRGBColorSpace,m)})})}}class _e{constructor(){this.name=w.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class be{constructor(){this.name=w.KHR_MESH_QUANTIZATION}}class te extends l.Interpolant{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n;for(let s=0;s!==n;s++)e[s]=i[r+s];return e}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,f=n-e,u=(i-e)/f,m=u*u,T=m*u,R=t*c,y=R-c,x=-2*T+3*m,S=T-m,L=1-x,_=S-m+u;for(let M=0;M!==a;M++){const N=s[y+M+a],C=s[y+M+o]*f,b=s[R+M+a],d=s[R+M]*f;r[M]=L*N+_*C+x*b+S*d}return r}}const Ne=new l.Quaternion;class Ce extends te{interpolate_(t,e,i,n){const r=super.interpolate_(t,e,i,n);return Ne.fromArray(r).normalize().toArray(r),r}}const I={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},B={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Q={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},J={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},U={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},V={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ie={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},j={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Oe(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),h.DefaultMaterial}function D(h,t,e){for(const i in e.extensions)h[i]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=e.extensions[i])}function F(h,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(h.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Fe(h,t,e){let i=!1,n=!1,r=!1;for(let c=0,f=t.length;c<f;c++){const u=t[c];if(u.POSITION!==void 0&&(i=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(r=!0),i&&n&&r)break}if(!i&&!n&&!r)return Promise.resolve(h);const s=[],a=[],o=[];for(let c=0,f=t.length;c<f;c++){const u=t[c];if(i){const m=u.POSITION!==void 0?e.getDependency("accessor",u.POSITION):h.attributes.position;s.push(m)}if(n){const m=u.NORMAL!==void 0?e.getDependency("accessor",u.NORMAL):h.attributes.normal;a.push(m)}if(r){const m=u.COLOR_0!==void 0?e.getDependency("accessor",u.COLOR_0):h.attributes.color;o.push(m)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o)]).then(function(c){const f=c[0],u=c[1],m=c[2];return i&&(h.morphAttributes.position=f),n&&(h.morphAttributes.normal=u),r&&(h.morphAttributes.color=m),h.morphTargetsRelative=!0,h})}function De(h,t){if(h.updateMorphTargets(),t.weights!==void 0)for(let e=0,i=t.weights.length;e<i;e++)h.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(h.morphTargetInfluences.length===e.length){h.morphTargetDictionary={};for(let i=0,n=e.length;i<n;i++)h.morphTargetDictionary[e[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Pe(h){let t;const e=h.extensions&&h.extensions[w.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+K(e.attributes):t=h.indices+":"+K(h.attributes)+":"+h.mode,h.targets!==void 0)for(let i=0,n=h.targets.length;i<n;i++)t+=":"+K(h.targets[i]);return t}function K(h){let t="";const e=Object.keys(h).sort();for(let i=0,n=e.length;i<n;i++)t+=e[i]+":"+h[e[i]]+";";return t}function X(h){switch(h){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Be(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ge=new l.Matrix4;class ke{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ae,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=!1,r=-1;typeof navigator<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,r=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||n&&r<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:i,userData:{}};return D(r,a,n),F(a,n),Promise.all(i._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let n=0,r=e.length;n<r;n++){const s=e[n].joints;for(let a=0,o=s.length;a<o;a++)t[s[a]].isBone=!0}for(let n=0,r=t.length;n<r;n++){const s=t[n];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(i[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,i){if(t.refs[e]<=1)return i;const n=i.clone(),r=(s,a)=>{const o=this.associations.get(s);o!=null&&this.associations.set(a,o);for(const[c,f]of s.children.entries())r(f,a.children[c])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const n=t(e[i]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let n=0;n<e.length;n++){const r=t(e[n]);r&&i.push(r)}return i}getDependency(t,e){const i=t+":"+e;let n=this.cache.get(i);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(r){return r.loadNode&&r.loadNode(e)});break;case"mesh":n=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(i,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const i=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(r,s){return i.getDependency(t,s)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],i=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(r,s){i.load(l.LoaderUtils.resolveURL(e.uri,n.path),r,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(i){const n=e.byteLength||0,r=e.byteOffset||0;return i.slice(r,r+n)})}loadAccessor(t){const e=this,i=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const s=U[n.type],a=B[n.componentType],o=n.normalized===!0,c=new a(n.count*s);return Promise.resolve(new l.BufferAttribute(c,s,o))}const r=[];return n.bufferView!==void 0?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),n.sparse!==void 0&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(s){const a=s[0],o=U[n.type],c=B[n.componentType],f=c.BYTES_PER_ELEMENT,u=f*o,m=n.byteOffset||0,T=n.bufferView!==void 0?i.bufferViews[n.bufferView].byteStride:void 0,R=n.normalized===!0;let y,x;if(T&&T!==u){const S=Math.floor(m/T),L="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+S+":"+n.count;let _=e.cache.get(L);_||(y=new c(a,S*T,n.count*T/f),_=new l.InterleavedBuffer(y,T/f),e.cache.add(L,_)),x=new l.InterleavedBufferAttribute(_,o,m%T/f,R)}else a===null?y=new c(n.count*o):y=new c(a,m,n.count*o),x=new l.BufferAttribute(y,o,R);if(n.sparse!==void 0){const S=U.SCALAR,L=B[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,M=n.sparse.values.byteOffset||0,N=new L(s[1],_,n.sparse.count*S),C=new c(s[2],M,n.sparse.count*o);a!==null&&(x=new l.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let b=0,d=N.length;b<d;b++){const p=N[b];if(x.setX(p,C[b*o]),o>=2&&x.setY(p,C[b*o+1]),o>=3&&x.setZ(p,C[b*o+2]),o>=4&&x.setW(p,C[b*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(t){const e=this.json,i=this.options,r=e.textures[t].source,s=e.images[r];let a=this.textureLoader;if(s.uri){const o=i.manager.getHandler(s.uri);o!==null&&(a=o)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,i){const n=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,i).then(function(f){f.flipY=!1,f.name=s.name||a.name||"",f.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(f.name=a.uri);const m=(r.samplers||{})[s.sampler]||{};return f.magFilter=Q[m.magFilter]||l.LinearFilter,f.minFilter=Q[m.minFilter]||l.LinearMipmapLinearFilter,f.wrapS=J[m.wrapS]||l.RepeatWrapping,f.wrapT=J[m.wrapT]||l.RepeatWrapping,n.associations.set(f,{textures:t}),f}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const i=this,n=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());const s=n.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",c=!1;if(s.bufferView!==void 0)o=i.getDependency("bufferView",s.bufferView).then(function(u){c=!0;const m=new Blob([u],{type:s.mimeType});return o=a.createObjectURL(m),o});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const f=Promise.resolve(o).then(function(u){return new Promise(function(m,T){let R=m;e.isImageBitmapLoader===!0&&(R=function(y){const x=new l.Texture(y);x.needsUpdate=!0,m(x)}),e.load(l.LoaderUtils.resolveURL(u,r.path),R,void 0,T)})}).then(function(u){return c===!0&&a.revokeObjectURL(o),u.userData.mimeType=s.mimeType||Be(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),u});return this.sourceCache[t]=f,f}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),r.extensions[w.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[w.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(s);s=r.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,o)}}return n!==void 0&&(s.colorSpace=n),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,s=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new l.PointsMaterial,l.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,o.sizeAttenuation=!1,this.cache.add(a,o)),i=o}else if(t.isLine){const a="LineBasicMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new l.LineBasicMaterial,l.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,this.cache.add(a,o)),i=o}if(n||r||s){let a="ClonedMaterial:"+i.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=i.clone(),r&&(o.vertexColors=!0),s&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(i))),i=o}t.material=i}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(t){const e=this,i=this.json,n=this.extensions,r=i.materials[t];let s;const a={},o=r.extensions||{},c=[];if(o[w.KHR_MATERIALS_UNLIT]){const u=n[w.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(a,r,e))}else{const u=r.pbrMetallicRoughness||{};if(a.color=new l.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const m=u.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],l.LinearSRGBColorSpace),a.opacity=m[3]}u.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",u.baseColorTexture,l.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),s=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=l.DoubleSide);const f=r.alphaMode||j.OPAQUE;if(f===j.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,f===j.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new l.Vector2(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;a.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==l.MeshBasicMaterial){const u=r.emissiveFactor;a.emissive=new l.Color().setRGB(u[0],u[1],u[2],l.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&s!==l.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,l.SRGBColorSpace)),Promise.all(c).then(function(){const u=new s(a);return r.name&&(u.name=r.name),F(u,r),e.associations.set(u,{materials:t}),r.extensions&&D(n,u,r),u})}createUniqueName(t){const e=l.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function r(a){return i[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return Z(o,a,e)})}const s=[];for(let a=0,o=t.length;a<o;a++){const c=t[a],f=Pe(c),u=n[f];if(u)s.push(u.promise);else{let m;c.extensions&&c.extensions[w.KHR_DRACO_MESH_COMPRESSION]?m=r(c):m=Z(new l.BufferGeometry,c,e),n[f]={primitive:c,promise:m},s.push(m)}}return Promise.all(s)}loadMesh(t){const e=this,i=this.json,n=this.extensions,r=i.meshes[t],s=r.primitives,a=[];for(let o=0,c=s.length;o<c;o++){const f=s[o].material===void 0?Oe(this.cache):this.getDependency("material",s[o].material);a.push(f)}return a.push(e.loadGeometries(s)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),f=o[o.length-1],u=[];for(let T=0,R=f.length;T<R;T++){const y=f[T],x=s[T];let S;const L=c[T];if(x.mode===I.TRIANGLES||x.mode===I.TRIANGLE_STRIP||x.mode===I.TRIANGLE_FAN||x.mode===void 0)S=r.isSkinnedMesh===!0?new l.SkinnedMesh(y,L):new l.Mesh(y,L),S.isSkinnedMesh===!0&&S.normalizeSkinWeights(),x.mode===I.TRIANGLE_STRIP?S.geometry=q(S.geometry,l.TriangleStripDrawMode):x.mode===I.TRIANGLE_FAN&&(S.geometry=q(S.geometry,l.TriangleFanDrawMode));else if(x.mode===I.LINES)S=new l.LineSegments(y,L);else if(x.mode===I.LINE_STRIP)S=new l.Line(y,L);else if(x.mode===I.LINE_LOOP)S=new l.LineLoop(y,L);else if(x.mode===I.POINTS)S=new l.Points(y,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(S.geometry.morphAttributes).length>0&&De(S,r),S.name=e.createUniqueName(r.name||"mesh_"+t),F(S,r),x.extensions&&D(n,S,x),e.assignFinalMaterial(S),u.push(S)}for(let T=0,R=u.length;T<R;T++)e.associations.set(u[T],{meshes:t,primitives:T});if(u.length===1)return r.extensions&&D(n,u[0],r),u[0];const m=new l.Group;r.extensions&&D(n,m,r),e.associations.set(m,{meshes:t});for(let T=0,R=u.length;T<R;T++)m.add(u[T]);return m})}loadCamera(t){let e;const i=this.json.cameras[t],n=i[i.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?e=new l.PerspectiveCamera(l.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):i.type==="orthographic"&&(e=new l.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),F(e,i),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],i=[];for(let n=0,r=e.joints.length;n<r;n++)i.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(n){const r=n.pop(),s=n,a=[],o=[];for(let c=0,f=s.length;c<f;c++){const u=s[c];if(u){a.push(u);const m=new l.Matrix4;r!==null&&m.fromArray(r.array,c*16),o.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new l.Skeleton(a,o)})}loadAnimation(t){const e=this.json,i=this,n=e.animations[t],r=n.name?n.name:"animation_"+t,s=[],a=[],o=[],c=[],f=[];for(let u=0,m=n.channels.length;u<m;u++){const T=n.channels[u],R=n.samplers[T.sampler],y=T.target,x=y.node,S=n.parameters!==void 0?n.parameters[R.input]:R.input,L=n.parameters!==void 0?n.parameters[R.output]:R.output;y.node!==void 0&&(s.push(this.getDependency("node",x)),a.push(this.getDependency("accessor",S)),o.push(this.getDependency("accessor",L)),c.push(R),f.push(y))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(f)]).then(function(u){const m=u[0],T=u[1],R=u[2],y=u[3],x=u[4],S=[];for(let L=0,_=m.length;L<_;L++){const M=m[L],N=T[L],C=R[L],b=y[L],d=x[L];if(M===void 0)continue;M.updateMatrix&&M.updateMatrix();const p=i._createAnimationTracks(M,N,C,b,d);if(p)for(let g=0;g<p.length;g++)S.push(p[g])}return new l.AnimationClip(r,void 0,S)})}createNodeMesh(t){const e=this.json,i=this,n=e.nodes[t];return n.mesh===void 0?null:i.getDependency("mesh",n.mesh).then(function(r){const s=i._getNodeRef(i.meshCache,n.mesh,r);return n.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),s})}loadNode(t){const e=this.json,i=this,n=e.nodes[t],r=i._loadNodeShallow(t),s=[],a=n.children||[];for(let c=0,f=a.length;c<f;c++)s.push(i.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([r,Promise.all(s),o]).then(function(c){const f=c[0],u=c[1],m=c[2];m!==null&&f.traverse(function(T){T.isSkinnedMesh&&T.bind(m,Ge)});for(let T=0,R=u.length;T<R;T++)f.add(u[T]);return f})}_loadNodeShallow(t){const e=this.json,i=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const r=e.nodes[t],s=r.name?n.createUniqueName(r.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),r.camera!==void 0&&a.push(n.getDependency("camera",r.camera).then(function(c){return n._getNodeRef(n.cameraCache,r.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let f;if(r.isBone===!0?f=new l.Bone:c.length>1?f=new l.Group:c.length===1?f=c[0]:f=new l.Object3D,f!==c[0])for(let u=0,m=c.length;u<m;u++)f.add(c[u]);if(r.name&&(f.userData.name=r.name,f.name=s),F(f,r),r.extensions&&D(i,f,r),r.matrix!==void 0){const u=new l.Matrix4;u.fromArray(r.matrix),f.applyMatrix4(u)}else r.translation!==void 0&&f.position.fromArray(r.translation),r.rotation!==void 0&&f.quaternion.fromArray(r.rotation),r.scale!==void 0&&f.scale.fromArray(r.scale);return n.associations.has(f)||n.associations.set(f,{}),n.associations.get(f).nodes=t,f}),this.nodeCache[t]}loadScene(t){const e=this.extensions,i=this.json.scenes[t],n=this,r=new l.Group;i.name&&(r.name=n.createUniqueName(i.name)),F(r,i),i.extensions&&D(e,r,i);const s=i.nodes||[],a=[];for(let o=0,c=s.length;o<c;o++)a.push(n.getDependency("node",s[o]));return Promise.all(a).then(function(o){for(let f=0,u=o.length;f<u;f++)r.add(o[f]);const c=f=>{const u=new Map;for(const[m,T]of n.associations)(m instanceof l.Material||m instanceof l.Texture)&&u.set(m,T);return f.traverse(m=>{const T=n.associations.get(m);T!=null&&u.set(m,T)}),u};return n.associations=c(r),r})}_createAnimationTracks(t,e,i,n,r){const s=[],a=t.name?t.name:t.uuid,o=[];O[r.path]===O.weights?t.traverse(function(m){m.morphTargetInfluences&&o.push(m.name?m.name:m.uuid)}):o.push(a);let c;switch(O[r.path]){case O.weights:c=l.NumberKeyframeTrack;break;case O.rotation:c=l.QuaternionKeyframeTrack;break;case O.position:case O.scale:c=l.VectorKeyframeTrack;break;default:switch(i.itemSize){case 1:c=l.NumberKeyframeTrack;break;case 2:case 3:default:c=l.VectorKeyframeTrack;break}break}const f=n.interpolation!==void 0?Ie[n.interpolation]:l.InterpolateLinear,u=this._getArrayFromAccessor(i);for(let m=0,T=o.length;m<T;m++){const R=new c(o[m]+"."+O[r.path],e.array,u,f);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),s.push(R)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const i=X(e.constructor),n=new Float32Array(e.length);for(let r=0,s=e.length;r<s;r++)n[r]=e[r]*i;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(i){const n=this instanceof l.QuaternionKeyframeTrack?Ce:te;return new n(this.times,this.values,this.getValueSize()/3,i)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function He(h,t,e){const i=t.attributes,n=new l.Box3;if(i.POSITION!==void 0){const a=e.json.accessors[i.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new l.Vector3(o[0],o[1],o[2]),new l.Vector3(c[0],c[1],c[2])),a.normalized){const f=X(B[a.componentType]);n.min.multiplyScalar(f),n.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=t.targets;if(r!==void 0){const a=new l.Vector3,o=new l.Vector3;for(let c=0,f=r.length;c<f;c++){const u=r[c];if(u.POSITION!==void 0){const m=e.json.accessors[u.POSITION],T=m.min,R=m.max;if(T!==void 0&&R!==void 0){if(o.setX(Math.max(Math.abs(T[0]),Math.abs(R[0]))),o.setY(Math.max(Math.abs(T[1]),Math.abs(R[1]))),o.setZ(Math.max(Math.abs(T[2]),Math.abs(R[2]))),m.normalized){const y=X(B[m.componentType]);o.multiplyScalar(y)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;const s=new l.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=s}function Z(h,t,e){const i=t.attributes,n=[];function r(s,a){return e.getDependency("accessor",s).then(function(o){h.setAttribute(a,o)})}for(const s in i){const a=V[s]||s.toLowerCase();a in h.attributes||n.push(r(i[s],a))}if(t.indices!==void 0&&!h.index){const s=e.getDependency("accessor",t.indices).then(function(a){h.setIndex(a)});n.push(s)}return l.ColorManagement.workingColorSpace!==l.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${l.ColorManagement.workingColorSpace}" not supported.`),F(h,t),He(h,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Fe(h,t.targets,e):h})}class ve{parse(t){const e={},i=t.split(`
|
|
2
|
-
`);let n=null,r=e;const s=[e];for(const a of i)if(a.includes("=")){const o=a.split("="),c=o[0].trim(),f=o[1].trim();if(f.endsWith("{")){const u={};s.push(u),r[c]=u,r=u}else r[c]=f}else if(a.endsWith("{")){const o=r[n]||{};s.push(o),r[n]=o,r=o}else if(a.endsWith("}")){if(s.pop(),s.length===0)continue;r=s[s.length-1]}else if(a.endsWith("(")){const o={};s.push(o),n=a.split("(")[0].trim()||n,r[n]=o,r=o}else a.endsWith(")")?(s.pop(),r=s[s.length-1]):n=a.trim();return e}}class Ue extends l.Loader{constructor(t){super(t)}load(t,e,i,n){const r=this,s=new l.FileLoader(r.manager);s.setPath(r.path),s.setResponseType("arraybuffer"),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(a){try{e(r.parse(a))}catch(o){n?n(o):console.error(o),r.manager.itemError(t)}},i,n)}parse(t){const e=new ve;function i(d){const p={};new l.FileLoader().setResponseType("arraybuffer");for(const A in d){if(A.endsWith("png")){const E=new Blob([d[A]],{type:{type:"image/png"}});p[A]=URL.createObjectURL(E)}if(A.endsWith("usd")||A.endsWith("usda")){if(n(d[A])){console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");continue}const E=P.strFromU8(d[A]);p[A]=e.parse(E)}}return p}function n(d){const p=d.slice(0,7),g=new Uint8Array([80,88,82,45,85,83,68,67]);return p.every((A,E)=>A===g[E])}function r(d){if(d.length<1)return;const p=Object.keys(d)[0];let g=!1;if(p.endsWith("usda"))return d[p];if(p.endsWith("usdc"))g=!0;else if(p.endsWith("usd"))if(n(d[p]))g=!0;else return d[p];g&&console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.")}const s=P.unzipSync(new Uint8Array(t)),a=i(s),o=r(s);if(o===void 0)return console.warn("THREE.USDZLoader: No usda file found."),new l.Group;const c=P.strFromU8(o),f=e.parse(c);function u(d){if(d){if("prepend references"in d){const g=d["prepend references"].split("@"),A=g[1].replace(/^.\//,""),E=g[2].replace(/^<\//,"").replace(/>$/,"");return m(a[A],E)}return m(d)}}function m(d,p){if(d){if(p!==void 0){const g=`def Mesh "${p}"`;if(g in d)return d[g]}for(const g in d){const A=d[g];if(g.startsWith("def Mesh"))return"point3f[] points"in d&&(A["point3f[] points"]=d["point3f[] points"]),"texCoord2f[] primvars:st"in d&&(A["texCoord2f[] primvars:st"]=d["texCoord2f[] primvars:st"]),"int[] primvars:st:indices"in d&&(A["int[] primvars:st:indices"]=d["int[] primvars:st:indices"]),A;if(typeof A=="object"){const E=m(A);if(E)return E}}}}function T(d){if(!d)return;let p=new l.BufferGeometry;if("int[] faceVertexIndices"in d){const g=JSON.parse(d["int[] faceVertexIndices"]);p.setIndex(g)}if("point3f[] points"in d){const g=JSON.parse(d["point3f[] points"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),3);p.setAttribute("position",A)}if("normal3f[] normals"in d){const g=JSON.parse(d["normal3f[] normals"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),3);p.setAttribute("normal",A)}else p.computeVertexNormals();if("float2[] primvars:st"in d&&(d["texCoord2f[] primvars:st"]=d["float2[] primvars:st"]),"texCoord2f[] primvars:st"in d){const g=JSON.parse(d["texCoord2f[] primvars:st"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),2);if("int[] primvars:st:indices"in d){p=p.toNonIndexed();const E=JSON.parse(d["int[] primvars:st:indices"]);p.setAttribute("uv",R(A,E))}else p.setAttribute("uv",A)}return p}function R(d,p){const g=d.array,A=d.itemSize,E=new g.constructor(p.length*A);let W=0,ne=0;for(let k=0,se=p.length;k<se;k++){W=p[k]*A;for(let z=0;z<A;z++)E[ne++]=g[W++]}return new l.BufferAttribute(E,A)}function y(d){if(d){if("rel material:binding"in d){const A=d["rel material:binding"].replace(/^<\//,"").replace(/>$/,"").split("/");return x(f,` "${A[1]}"`)}return x(d)}}function x(d,p=""){for(const g in d){const A=d[g];if(g.startsWith("def Material"+p))return A;if(typeof A=="object"){const E=x(A,p);if(E)return E}}}function S(d,p){p["float inputs:rotation"]&&(d.rotation=parseFloat(p["float inputs:rotation"])),p["float2 inputs:scale"]&&(d.repeat=new l.Vector2().fromArray(JSON.parse("["+p["float2 inputs:scale"].replace(/[()]*/g,"")+"]"))),p["float2 inputs:translation"]&&(d.offset=new l.Vector2().fromArray(JSON.parse("["+p["float2 inputs:translation"].replace(/[()]*/g,"")+"]")))}function L(d){const p=new l.MeshPhysicalMaterial;if(d!==void 0){if('def Shader "PreviewSurface"'in d){const g=d['def Shader "PreviewSurface"'];if("color3f inputs:diffuseColor.connect"in g){const A=g["color3f inputs:diffuseColor.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.map=M(E),p.map.colorSpace=l.SRGBColorSpace,'def Shader "Transform2d_diffuse"'in d&&S(p.map,d['def Shader "Transform2d_diffuse"'])}else if("color3f inputs:diffuseColor"in g){const A=g["color3f inputs:diffuseColor"].replace(/[()]*/g,"");p.color.fromArray(JSON.parse("["+A+"]"))}if("color3f inputs:emissiveColor.connect"in g){const A=g["color3f inputs:emissiveColor.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.emissiveMap=M(E),p.emissiveMap.colorSpace=l.SRGBColorSpace,p.emissive.set(16777215),'def Shader "Transform2d_emissive"'in d&&S(p.emissiveMap,d['def Shader "Transform2d_emissive"'])}else if("color3f inputs:emissiveColor"in g){const A=g["color3f inputs:emissiveColor"].replace(/[()]*/g,"");p.emissive.fromArray(JSON.parse("["+A+"]"))}if("normal3f inputs:normal.connect"in g){const A=g["normal3f inputs:normal.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.normalMap=M(E),p.normalMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_normal"'in d&&S(p.normalMap,d['def Shader "Transform2d_normal"'])}if("float inputs:roughness.connect"in g){const A=g["float inputs:roughness.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.roughness=1,p.roughnessMap=M(E),p.roughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_roughness"'in d&&S(p.roughnessMap,d['def Shader "Transform2d_roughness"'])}else"float inputs:roughness"in g&&(p.roughness=parseFloat(g["float inputs:roughness"]));if("float inputs:metallic.connect"in g){const A=g["float inputs:metallic.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.metalness=1,p.metalnessMap=M(E),p.metalnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_metallic"'in d&&S(p.metalnessMap,d['def Shader "Transform2d_metallic"'])}else"float inputs:metallic"in g&&(p.metalness=parseFloat(g["float inputs:metallic"]));if("float inputs:clearcoat.connect"in g){const A=g["float inputs:clearcoat.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.clearcoat=1,p.clearcoatMap=M(E),p.clearcoatMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoat"'in d&&S(p.clearcoatMap,d['def Shader "Transform2d_clearcoat"'])}else"float inputs:clearcoat"in g&&(p.clearcoat=parseFloat(g["float inputs:clearcoat"]));if("float inputs:clearcoatRoughness.connect"in g){const A=g["float inputs:clearcoatRoughness.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.clearcoatRoughness=1,p.clearcoatRoughnessMap=M(E),p.clearcoatRoughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoatRoughness"'in d&&S(p.clearcoatRoughnessMap,d['def Shader "Transform2d_clearcoatRoughness"'])}else"float inputs:clearcoatRoughness"in g&&(p.clearcoatRoughness=parseFloat(g["float inputs:clearcoatRoughness"]));if("float inputs:ior"in g&&(p.ior=parseFloat(g["float inputs:ior"])),"float inputs:occlusion.connect"in g){const A=g["float inputs:occlusion.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.aoMap=M(E),p.aoMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_occlusion"'in d&&S(p.aoMap,d['def Shader "Transform2d_occlusion"'])}}if('def Shader "diffuseColor_texture"'in d){const g=d['def Shader "diffuseColor_texture"'];p.map=M(g),p.map.colorSpace=l.SRGBColorSpace}if('def Shader "normal_texture"'in d){const g=d['def Shader "normal_texture"'];p.normalMap=M(g),p.normalMap.colorSpace=l.NoColorSpace}}return p}function _(d,p){for(const g in d){const A=d[g];if(g.startsWith(`def Shader "${p}"`))return A;if(typeof A=="object"){const E=_(A,p);if(E)return E}}}function M(d){if("asset inputs:file"in d){const p=d["asset inputs:file"].replace(/@*/g,""),A=new l.TextureLoader().load(a[p]),E={'"clamp"':l.ClampToEdgeWrapping,'"mirror"':l.MirroredRepeatWrapping,'"repeat"':l.RepeatWrapping};return"token inputs:wrapS"in d&&(A.wrapS=E[d["token inputs:wrapS"]]),"token inputs:wrapT"in d&&(A.wrapT=E[d["token inputs:wrapT"]]),A}return null}function N(d){const p=T(u(d)),g=L(y(d)),A=p?new l.Mesh(p,g):new l.Object3D;if("matrix4d xformOp:transform"in d){const E=JSON.parse("["+d["matrix4d xformOp:transform"].replace(/[()]*/g,"")+"]");A.matrix.fromArray(E),A.matrix.decompose(A.position,A.quaternion,A.scale)}return A}function C(d,p){for(const g in d)if(g.startsWith("def Scope"))C(d[g],p);else if(g.startsWith("def Xform")){const A=N(d[g]);/def Xform "(\w+)"/.test(g)&&(A.name=/def Xform "(\w+)"/.exec(g)[1]),p.add(A),C(d[g],A)}}const b=new l.Group;return C(f,b),b}}class $ extends Error{constructor(t,e,i){super(e),this.url=t,this.cause=i,this.name="NetworkError"}}class je{constructor(){H(this,"_gltfLoader");H(this,"_usdzLoader");this._gltfLoader=new oe,this._usdzLoader=new Ue}async _loadFile(t){const e=await fetch(t);if(!e.ok)throw new $(t,`Failed to fetch file from ${t}`);try{return await e.arrayBuffer()}catch{throw new $(t,`Failed to fetch file from ${t}`)}}async load(t){const e=v.getFileTypeFromUri(t);if(e.length===0)throw new P.FileTypeError("No file extension found in URI","");if(!v.isFileTypeSupported(e))throw new P.FileTypeError(`Unsupported file type: ${e}. Supported types: ${v.SUPPORTED_FILE_TYPES.join(", ")}`,e);const i=await this._loadFile(t);try{switch(e){case"glb":case"gltf":return(await this._gltfLoader.parseAsync(i,"")).scene;case"usdz":return await this._usdzLoader.parse(i)}}catch(n){throw n instanceof Error?new P.ParseError(`Failed to parse ${e} file: ${n.message}`,n):new P.ParseError(`Failed to parse ${e} file`)}}}exports.AssetLoader=je;
|
|
1
|
+
"use strict";var oe=Object.defineProperty;var ie=(p,e,t)=>e in p?oe(p,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[e]=t;var U=(p,e,t)=>ie(p,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("three"),D=require("../../../../chunks/parse-error-2f5qpXP5.cjs"),H=require("../../../../chunks/FileTypes-BjZ0rrIV.cjs");function Y(p,e){if(e===l.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),p;if(e===l.TriangleFanDrawMode||e===l.TriangleStripDrawMode){let t=p.getIndex();if(t===null){const s=[],a=p.getAttribute("position");if(a!==void 0){for(let i=0;i<a.count;i++)s.push(i);p.setIndex(s),t=p.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),p}const o=t.count-2,n=[];if(e===l.TriangleFanDrawMode)for(let s=1;s<=o;s++)n.push(t.getX(0)),n.push(t.getX(s)),n.push(t.getX(s+1));else for(let s=0;s<o;s++)s%2===0?(n.push(t.getX(s)),n.push(t.getX(s+1)),n.push(t.getX(s+2))):(n.push(t.getX(s+2)),n.push(t.getX(s+1)),n.push(t.getX(s)));n.length/3!==o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=p.clone();return r.setIndex(n),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),p}class ae extends l.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new de(t)}),this.register(function(t){return new ye(t)}),this.register(function(t){return new Se(t)}),this.register(function(t){return new we(t)}),this.register(function(t){return new pe(t)}),this.register(function(t){return new me(t)}),this.register(function(t){return new ge(t)}),this.register(function(t){return new Ae(t)}),this.register(function(t){return new fe(t)}),this.register(function(t){return new Te(t)}),this.register(function(t){return new he(t)}),this.register(function(t){return new Re(t)}),this.register(function(t){return new xe(t)}),this.register(function(t){return new le(t)}),this.register(function(t){return new _e(t)}),this.register(function(t){return new Le(t)})}load(e,t,o,n){const r=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const c=l.LoaderUtils.extractUrlBase(e);s=l.LoaderUtils.resolveURL(c,this.path)}else s=l.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){n?n(c):console.error(c),r.manager.itemError(e),r.manager.itemEnd(e)},i=new l.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,function(c){try{r.parse(c,s,function(u){t(u),r.manager.itemEnd(e)},a)}catch(u){a(u)}},o,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,o,n){let r;const s={},a={},i=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(i.decode(new Uint8Array(e,0,4))===te){try{s[L.KHR_BINARY_GLTF]=new Ee(e)}catch(f){n&&n(f);return}r=JSON.parse(s[L.KHR_BINARY_GLTF].content)}else r=JSON.parse(i.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Ue(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const f=this.pluginCallbacks[u](c);f.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[f.name]=f,s[f.name]=!0}if(r.extensionsUsed)for(let u=0;u<r.extensionsUsed.length;++u){const f=r.extensionsUsed[u],d=r.extensionsRequired||[];switch(f){case L.KHR_MATERIALS_UNLIT:s[f]=new ue;break;case L.KHR_DRACO_MESH_COMPRESSION:s[f]=new be(r,this.dracoLoader);break;case L.KHR_TEXTURE_TRANSFORM:s[f]=new Me;break;case L.KHR_MESH_QUANTIZATION:s[f]=new Ce;break;default:d.indexOf(f)>=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(o,n)}parseAsync(e,t){const o=this;return new Promise(function(n,r){o.parse(e,t,n,r)})}}function ce(){let p={};return{get:function(e){return p[e]},add:function(e,t){p[e]=t},remove:function(e){delete p[e]},removeAll:function(){p={}}}}const L={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class le{constructor(e){this.parser=e,this.name=L.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let o=0,n=t.length;o<n;o++){const r=t[o];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,o="light:"+e;let n=t.cache.get(o);if(n)return n;const r=t.json,i=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let c;const u=new l.Color(16777215);i.color!==void 0&&u.setRGB(i.color[0],i.color[1],i.color[2],l.LinearSRGBColorSpace);const f=i.range!==void 0?i.range:0;switch(i.type){case"directional":c=new l.DirectionalLight(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new l.PointLight(u),c.distance=f;break;case"spot":c=new l.SpotLight(u),c.distance=f,i.spot=i.spot||{},i.spot.innerConeAngle=i.spot.innerConeAngle!==void 0?i.spot.innerConeAngle:0,i.spot.outerConeAngle=i.spot.outerConeAngle!==void 0?i.spot.outerConeAngle:Math.PI/4,c.angle=i.spot.outerConeAngle,c.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+i.type)}return c.position.set(0,0,0),c.decay=2,k(c,i),i.intensity!==void 0&&(c.intensity=i.intensity),c.name=t.createUniqueName(i.name||"light_"+e),n=Promise.resolve(c),t.cache.add(o,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,o=this.parser,r=o.json.nodes[e],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(i){return o._getNodeRef(t.cache,a,i)})}}class ue{constructor(){this.name=L.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(e,t,o){const n=[];e.color=new l.Color(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const s=r.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],l.LinearSRGBColorSpace),e.opacity=s[3]}r.baseColorTexture!==void 0&&n.push(o.assignTexture(e,"map",r.baseColorTexture,l.SRGBColorSpace))}return Promise.all(n)}}class fe{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class de{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&r.push(o.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&r.push(o.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(r.push(o.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new l.Vector2(a,a)}return Promise.all(r)}}class he{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&r.push(o.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&r.push(o.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class pe{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_SHEEN}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new l.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=n.extensions[this.name];if(s.sheenColorFactor!==void 0){const a=s.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&r.push(o.assignTexture(t,"sheenColorMap",s.sheenColorTexture,l.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&r.push(o.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class me{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&r.push(o.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class ge{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_VOLUME}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&r.push(o.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return t.attenuationColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),Promise.all(r)}}class Ae{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_IOR}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class Te{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_SPECULAR}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&r.push(o.assignTexture(t,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return t.specularColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&r.push(o.assignTexture(t,"specularColorMap",s.specularColorTexture,l.SRGBColorSpace)),Promise.all(r)}}class xe{constructor(e){this.parser=e,this.name=L.EXT_MATERIALS_BUMP}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&r.push(o.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(r)}}class Re{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const o=this.parser.json.materials[e];return!o.extensions||!o.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const o=this.parser,n=o.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&r.push(o.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class ye{constructor(e){this.parser=e,this.name=L.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,o=t.json,n=o.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(o.extensionsRequired&&o.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,s)}}class Se{constructor(e){this.parser=e,this.name=L.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,o=this.parser,n=o.json,r=n.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],a=n.images[s.source];let i=o.textureLoader;if(a.uri){const c=o.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return o.loadTextureImage(e,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return o.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class we{constructor(e){this.parser=e,this.name=L.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,o=this.parser,n=o.json,r=n.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],a=n.images[s.source];let i=o.textureLoader;if(a.uri){const c=o.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return o.loadTextureImage(e,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return o.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class _e{constructor(e){this.name=L.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,o=t.bufferViews[e];if(o.extensions&&o.extensions[this.name]){const n=o.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const i=n.byteOffset||0,c=n.byteLength||0,u=n.count,f=n.byteStride,d=new Uint8Array(a,i,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(u,f,d,n.mode,n.filter).then(function(g){return g.buffer}):s.ready.then(function(){const g=new ArrayBuffer(u*f);return s.decodeGltfBuffer(new Uint8Array(g),u,f,d,n.mode,n.filter),g})})}else return null}}class Le{constructor(e){this.name=L.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,o=t.nodes[e];if(!o.extensions||!o.extensions[this.name]||o.mesh===void 0)return null;const n=t.meshes[o.mesh];for(const c of n.primitives)if(c.mode!==I.TRIANGLES&&c.mode!==I.TRIANGLE_STRIP&&c.mode!==I.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=o.extensions[this.name].attributes,a=[],i={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(u=>(i[c]=u,i[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),f=u.isGroup?u.children:[u],d=c[0].count,g=[];for(const x of f){const _=new l.Matrix4,R=new l.Vector3,y=new l.Quaternion,E=new l.Vector3(1,1,1),b=new l.InstancedMesh(x.geometry,x.material,d);for(let S=0;S<d;S++)i.TRANSLATION&&R.fromBufferAttribute(i.TRANSLATION,S),i.ROTATION&&y.fromBufferAttribute(i.ROTATION,S),i.SCALE&&E.fromBufferAttribute(i.SCALE,S),b.setMatrixAt(S,_.compose(R,y,E));for(const S in i)if(S==="_COLOR_0"){const C=i[S];b.instanceColor=new l.InstancedBufferAttribute(C.array,C.itemSize,C.normalized)}else S!=="TRANSLATION"&&S!=="ROTATION"&&S!=="SCALE"&&x.geometry.setAttribute(S,i[S]);l.Object3D.prototype.copy.call(b,x),this.parser.assignFinalMaterial(b),g.push(b)}return u.isGroup?(u.clear(),u.add(...g),u):g[0]}))}}const te="glTF",G=12,Q={JSON:1313821514,BIN:5130562};class Ee{constructor(e){this.name=L.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,G),o=new TextDecoder;if(this.header={magic:o.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==te)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-G,r=new DataView(e,G);let s=0;for(;s<n;){const a=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,i===Q.JSON){const c=new Uint8Array(e,G+s,a);this.content=o.decode(c)}else if(i===Q.BIN){const c=G+s;this.body=e.slice(c,c+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class be{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=L.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const o=this.json,n=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,a={},i={},c={};for(const u in s){const f=W[u]||u.toLowerCase();a[f]=s[u]}for(const u in e.attributes){const f=W[u]||u.toLowerCase();if(s[u]!==void 0){const d=o.accessors[e.attributes[u]],g=P[d.componentType];c[f]=g.name,i[f]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(u){return new Promise(function(f,d){n.decodeDracoFile(u,function(g){for(const x in g.attributes){const _=g.attributes[x],R=i[x];R!==void 0&&(_.normalized=R)}f(g)},a,c,l.LinearSRGBColorSpace,d)})})}}class Me{constructor(){this.name=L.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Ce{constructor(){this.name=L.KHR_MESH_QUANTIZATION}}class ne extends l.Interpolant{constructor(e,t,o,n){super(e,t,o,n)}copySampleValue_(e){const t=this.resultBuffer,o=this.sampleValues,n=this.valueSize,r=e*n*3+n;for(let s=0;s!==n;s++)t[s]=o[r+s];return t}interpolate_(e,t,o,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,i=a*2,c=a*3,u=n-t,f=(o-t)/u,d=f*f,g=d*f,x=e*c,_=x-c,R=-2*g+3*d,y=g-d,E=1-R,b=y-d+f;for(let S=0;S!==a;S++){const C=s[_+S+a],N=s[_+S+i]*u,M=s[x+S+a],h=s[x+S]*u;r[S]=E*C+b*N+R*M+y*h}return r}}const Ne=new l.Quaternion;class Ie extends ne{interpolate_(e,t,o,n){const r=super.interpolate_(e,t,o,n);return Ne.fromArray(r).normalize().toArray(r),r}}const I={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},P={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},J={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},Z={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},v={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},W={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Oe={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},j={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function ke(p){return p.DefaultMaterial===void 0&&(p.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),p.DefaultMaterial}function F(p,e,t){for(const o in t.extensions)p[o]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[o]=t.extensions[o])}function k(p,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(p.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Fe(p,e,t){let o=!1,n=!1,r=!1;for(let c=0,u=e.length;c<u;c++){const f=e[c];if(f.POSITION!==void 0&&(o=!0),f.NORMAL!==void 0&&(n=!0),f.COLOR_0!==void 0&&(r=!0),o&&n&&r)break}if(!o&&!n&&!r)return Promise.resolve(p);const s=[],a=[],i=[];for(let c=0,u=e.length;c<u;c++){const f=e[c];if(o){const d=f.POSITION!==void 0?t.getDependency("accessor",f.POSITION):p.attributes.position;s.push(d)}if(n){const d=f.NORMAL!==void 0?t.getDependency("accessor",f.NORMAL):p.attributes.normal;a.push(d)}if(r){const d=f.COLOR_0!==void 0?t.getDependency("accessor",f.COLOR_0):p.attributes.color;i.push(d)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i)]).then(function(c){const u=c[0],f=c[1],d=c[2];return o&&(p.morphAttributes.position=u),n&&(p.morphAttributes.normal=f),r&&(p.morphAttributes.color=d),p.morphTargetsRelative=!0,p})}function De(p,e){if(p.updateMorphTargets(),e.weights!==void 0)for(let t=0,o=e.weights.length;t<o;t++)p.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(p.morphTargetInfluences.length===t.length){p.morphTargetDictionary={};for(let o=0,n=t.length;o<n;o++)p.morphTargetDictionary[t[o]]=o}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Pe(p){let e;const t=p.extensions&&p.extensions[L.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+K(t.attributes):e=p.indices+":"+K(p.attributes)+":"+p.mode,p.targets!==void 0)for(let o=0,n=p.targets.length;o<n;o++)e+=":"+K(p.targets[o]);return e}function K(p){let e="";const t=Object.keys(p).sort();for(let o=0,n=t.length;o<n;o++)e+=t[o]+":"+p[t[o]]+";";return e}function X(p){switch(p){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Ge(p){return p.search(/\.jpe?g($|\?)/i)>0||p.search(/^data\:image\/jpeg/)===0?"image/jpeg":p.search(/\.webp($|\?)/i)>0||p.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Be=new l.Matrix4;class Ue{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ce,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let o=!1,n=!1,r=-1;typeof navigator<"u"&&(o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,r=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||o||n&&r<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const o=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([o.getDependencies("scene"),o.getDependencies("animation"),o.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:o,userData:{}};return F(r,a,n),k(a,n),Promise.all(o._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){for(const i of a.scenes)i.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],o=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){const s=t[n].joints;for(let a=0,i=s.length;a<i;a++)e[s[a]].isBone=!0}for(let n=0,r=e.length;n<r;n++){const s=e[n];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(o[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,o){if(e.refs[t]<=1)return o;const n=o.clone(),r=(s,a)=>{const i=this.associations.get(s);i!=null&&this.associations.set(a,i);for(const[c,u]of s.children.entries())r(u,a.children[c])};return r(o,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let o=0;o<t.length;o++){const n=e(t[o]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const o=[];for(let n=0;n<t.length;n++){const r=e(t[n]);r&&o.push(r)}return o}getDependency(e,t){const o=e+":"+t;let n=this.cache.get(o);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":n=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(o,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const o=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(r,s){return o.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],o=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[L.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(r,s){o.load(l.LoaderUtils.resolveURL(t.uri,n.path),r,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(o){const n=t.byteLength||0,r=t.byteOffset||0;return o.slice(r,r+n)})}loadAccessor(e){const t=this,o=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const s=v[n.type],a=P[n.componentType],i=n.normalized===!0,c=new a(n.count*s);return Promise.resolve(new l.BufferAttribute(c,s,i))}const r=[];return n.bufferView!==void 0?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),n.sparse!==void 0&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(s){const a=s[0],i=v[n.type],c=P[n.componentType],u=c.BYTES_PER_ELEMENT,f=u*i,d=n.byteOffset||0,g=n.bufferView!==void 0?o.bufferViews[n.bufferView].byteStride:void 0,x=n.normalized===!0;let _,R;if(g&&g!==f){const y=Math.floor(d/g),E="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+y+":"+n.count;let b=t.cache.get(E);b||(_=new c(a,y*g,n.count*g/u),b=new l.InterleavedBuffer(_,g/u),t.cache.add(E,b)),R=new l.InterleavedBufferAttribute(b,i,d%g/u,x)}else a===null?_=new c(n.count*i):_=new c(a,d,n.count*i),R=new l.BufferAttribute(_,i,x);if(n.sparse!==void 0){const y=v.SCALAR,E=P[n.sparse.indices.componentType],b=n.sparse.indices.byteOffset||0,S=n.sparse.values.byteOffset||0,C=new E(s[1],b,n.sparse.count*y),N=new c(s[2],S,n.sparse.count*i);a!==null&&(R=new l.BufferAttribute(R.array.slice(),R.itemSize,R.normalized));for(let M=0,h=C.length;M<h;M++){const m=C[M];if(R.setX(m,N[M*i]),i>=2&&R.setY(m,N[M*i+1]),i>=3&&R.setZ(m,N[M*i+2]),i>=4&&R.setW(m,N[M*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return R})}loadTexture(e){const t=this.json,o=this.options,r=t.textures[e].source,s=t.images[r];let a=this.textureLoader;if(s.uri){const i=o.manager.getHandler(s.uri);i!==null&&(a=i)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,o){const n=this,r=this.json,s=r.textures[e],a=r.images[t],i=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[i])return this.textureCache[i];const c=this.loadImageSource(t,o).then(function(u){u.flipY=!1,u.name=s.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const d=(r.samplers||{})[s.sampler]||{};return u.magFilter=J[d.magFilter]||l.LinearFilter,u.minFilter=J[d.minFilter]||l.LinearMipmapLinearFilter,u.wrapS=Z[d.wrapS]||l.RepeatWrapping,u.wrapT=Z[d.wrapT]||l.RepeatWrapping,n.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[i]=c,c}loadImageSource(e,t){const o=this,n=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const s=n.images[e],a=self.URL||self.webkitURL;let i=s.uri||"",c=!1;if(s.bufferView!==void 0)i=o.getDependency("bufferView",s.bufferView).then(function(f){c=!0;const d=new Blob([f],{type:s.mimeType});return i=a.createObjectURL(d),i});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(i).then(function(f){return new Promise(function(d,g){let x=d;t.isImageBitmapLoader===!0&&(x=function(_){const R=new l.Texture(_);R.needsUpdate=!0,d(R)}),t.load(l.LoaderUtils.resolveURL(f,r.path),x,void 0,g)})}).then(function(f){return c===!0&&a.revokeObjectURL(i),f.userData.mimeType=s.mimeType||Ge(s.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),f});return this.sourceCache[e]=u,u}assignTexture(e,t,o,n){const r=this;return this.getDependency("texture",o.index).then(function(s){if(!s)return null;if(o.texCoord!==void 0&&o.texCoord>0&&(s=s.clone(),s.channel=o.texCoord),r.extensions[L.KHR_TEXTURE_TRANSFORM]){const a=o.extensions!==void 0?o.extensions[L.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=r.associations.get(s);s=r.extensions[L.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,i)}}return n!==void 0&&(s.colorSpace=n),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let o=e.material;const n=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new l.PointsMaterial,l.Material.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,i.sizeAttenuation=!1,this.cache.add(a,i)),o=i}else if(e.isLine){const a="LineBasicMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new l.LineBasicMaterial,l.Material.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,this.cache.add(a,i)),o=i}if(n||r||s){let a="ClonedMaterial:"+o.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=o.clone(),r&&(i.vertexColors=!0),s&&(i.flatShading=!0),n&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(o))),o=i}e.material=o}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(e){const t=this,o=this.json,n=this.extensions,r=o.materials[e];let s;const a={},i=r.extensions||{},c=[];if(i[L.KHR_MATERIALS_UNLIT]){const f=n[L.KHR_MATERIALS_UNLIT];s=f.getMaterialType(),c.push(f.extendParams(a,r,t))}else{const f=r.pbrMetallicRoughness||{};if(a.color=new l.Color(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const d=f.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],l.LinearSRGBColorSpace),a.opacity=d[3]}f.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",f.baseColorTexture,l.SRGBColorSpace)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),s=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=l.DoubleSide);const u=r.alphaMode||j.OPAQUE;if(u===j.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===j.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new l.Vector2(1,1),r.normalTexture.scale!==void 0)){const f=r.normalTexture.scale;a.normalScale.set(f,f)}if(r.occlusionTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==l.MeshBasicMaterial){const f=r.emissiveFactor;a.emissive=new l.Color().setRGB(f[0],f[1],f[2],l.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&s!==l.MeshBasicMaterial&&c.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,l.SRGBColorSpace)),Promise.all(c).then(function(){const f=new s(a);return r.name&&(f.name=r.name),k(f,r),t.associations.set(f,{materials:e}),r.extensions&&F(n,f,r),f})}createUniqueName(e){const t=l.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,o=this.extensions,n=this.primitiveCache;function r(a){return o[L.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(i){return $(i,a,t)})}const s=[];for(let a=0,i=e.length;a<i;a++){const c=e[a],u=Pe(c),f=n[u];if(f)s.push(f.promise);else{let d;c.extensions&&c.extensions[L.KHR_DRACO_MESH_COMPRESSION]?d=r(c):d=$(new l.BufferGeometry,c,t),n[u]={primitive:c,promise:d},s.push(d)}}return Promise.all(s)}loadMesh(e){const t=this,o=this.json,n=this.extensions,r=o.meshes[e],s=r.primitives,a=[];for(let i=0,c=s.length;i<c;i++){const u=s[i].material===void 0?ke(this.cache):this.getDependency("material",s[i].material);a.push(u)}return a.push(t.loadGeometries(s)),Promise.all(a).then(function(i){const c=i.slice(0,i.length-1),u=i[i.length-1],f=[];for(let g=0,x=u.length;g<x;g++){const _=u[g],R=s[g];let y;const E=c[g];if(R.mode===I.TRIANGLES||R.mode===I.TRIANGLE_STRIP||R.mode===I.TRIANGLE_FAN||R.mode===void 0)y=r.isSkinnedMesh===!0?new l.SkinnedMesh(_,E):new l.Mesh(_,E),y.isSkinnedMesh===!0&&y.normalizeSkinWeights(),R.mode===I.TRIANGLE_STRIP?y.geometry=Y(y.geometry,l.TriangleStripDrawMode):R.mode===I.TRIANGLE_FAN&&(y.geometry=Y(y.geometry,l.TriangleFanDrawMode));else if(R.mode===I.LINES)y=new l.LineSegments(_,E);else if(R.mode===I.LINE_STRIP)y=new l.Line(_,E);else if(R.mode===I.LINE_LOOP)y=new l.LineLoop(_,E);else if(R.mode===I.POINTS)y=new l.Points(_,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+R.mode);Object.keys(y.geometry.morphAttributes).length>0&&De(y,r),y.name=t.createUniqueName(r.name||"mesh_"+e),k(y,r),R.extensions&&F(n,y,R),t.assignFinalMaterial(y),f.push(y)}for(let g=0,x=f.length;g<x;g++)t.associations.set(f[g],{meshes:e,primitives:g});if(f.length===1)return r.extensions&&F(n,f[0],r),f[0];const d=new l.Group;r.extensions&&F(n,d,r),t.associations.set(d,{meshes:e});for(let g=0,x=f.length;g<x;g++)d.add(f[g]);return d})}loadCamera(e){let t;const o=this.json.cameras[e],n=o[o.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return o.type==="perspective"?t=new l.PerspectiveCamera(l.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):o.type==="orthographic"&&(t=new l.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),o.name&&(t.name=this.createUniqueName(o.name)),k(t,o),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],o=[];for(let n=0,r=t.joints.length;n<r;n++)o.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?o.push(this.getDependency("accessor",t.inverseBindMatrices)):o.push(null),Promise.all(o).then(function(n){const r=n.pop(),s=n,a=[],i=[];for(let c=0,u=s.length;c<u;c++){const f=s[c];if(f){a.push(f);const d=new l.Matrix4;r!==null&&d.fromArray(r.array,c*16),i.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new l.Skeleton(a,i)})}loadAnimation(e){const t=this.json,o=this,n=t.animations[e],r=n.name?n.name:"animation_"+e,s=[],a=[],i=[],c=[],u=[];for(let f=0,d=n.channels.length;f<d;f++){const g=n.channels[f],x=n.samplers[g.sampler],_=g.target,R=_.node,y=n.parameters!==void 0?n.parameters[x.input]:x.input,E=n.parameters!==void 0?n.parameters[x.output]:x.output;_.node!==void 0&&(s.push(this.getDependency("node",R)),a.push(this.getDependency("accessor",y)),i.push(this.getDependency("accessor",E)),c.push(x),u.push(_))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i),Promise.all(c),Promise.all(u)]).then(function(f){const d=f[0],g=f[1],x=f[2],_=f[3],R=f[4],y=[];for(let E=0,b=d.length;E<b;E++){const S=d[E],C=g[E],N=x[E],M=_[E],h=R[E];if(S===void 0)continue;S.updateMatrix&&S.updateMatrix();const m=o._createAnimationTracks(S,C,N,M,h);if(m)for(let A=0;A<m.length;A++)y.push(m[A])}return new l.AnimationClip(r,void 0,y)})}createNodeMesh(e){const t=this.json,o=this,n=t.nodes[e];return n.mesh===void 0?null:o.getDependency("mesh",n.mesh).then(function(r){const s=o._getNodeRef(o.meshCache,n.mesh,r);return n.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let i=0,c=n.weights.length;i<c;i++)a.morphTargetInfluences[i]=n.weights[i]}),s})}loadNode(e){const t=this.json,o=this,n=t.nodes[e],r=o._loadNodeShallow(e),s=[],a=n.children||[];for(let c=0,u=a.length;c<u;c++)s.push(o.getDependency("node",a[c]));const i=n.skin===void 0?Promise.resolve(null):o.getDependency("skin",n.skin);return Promise.all([r,Promise.all(s),i]).then(function(c){const u=c[0],f=c[1],d=c[2];d!==null&&u.traverse(function(g){g.isSkinnedMesh&&g.bind(d,Be)});for(let g=0,x=f.length;g<x;g++)u.add(f[g]);return u})}_loadNodeShallow(e){const t=this.json,o=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],s=r.name?n.createUniqueName(r.name):"",a=[],i=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return i&&a.push(i),r.camera!==void 0&&a.push(n.getDependency("camera",r.camera).then(function(c){return n._getNodeRef(n.cameraCache,r.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let u;if(r.isBone===!0?u=new l.Bone:c.length>1?u=new l.Group:c.length===1?u=c[0]:u=new l.Object3D,u!==c[0])for(let f=0,d=c.length;f<d;f++)u.add(c[f]);if(r.name&&(u.userData.name=r.name,u.name=s),k(u,r),r.extensions&&F(o,u,r),r.matrix!==void 0){const f=new l.Matrix4;f.fromArray(r.matrix),u.applyMatrix4(f)}else r.translation!==void 0&&u.position.fromArray(r.translation),r.rotation!==void 0&&u.quaternion.fromArray(r.rotation),r.scale!==void 0&&u.scale.fromArray(r.scale);return n.associations.has(u)||n.associations.set(u,{}),n.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const t=this.extensions,o=this.json.scenes[e],n=this,r=new l.Group;o.name&&(r.name=n.createUniqueName(o.name)),k(r,o),o.extensions&&F(t,r,o);const s=o.nodes||[],a=[];for(let i=0,c=s.length;i<c;i++)a.push(n.getDependency("node",s[i]));return Promise.all(a).then(function(i){for(let u=0,f=i.length;u<f;u++)r.add(i[u]);const c=u=>{const f=new Map;for(const[d,g]of n.associations)(d instanceof l.Material||d instanceof l.Texture)&&f.set(d,g);return u.traverse(d=>{const g=n.associations.get(d);g!=null&&f.set(d,g)}),f};return n.associations=c(r),r})}_createAnimationTracks(e,t,o,n,r){const s=[],a=e.name?e.name:e.uuid,i=[];O[r.path]===O.weights?e.traverse(function(d){d.morphTargetInfluences&&i.push(d.name?d.name:d.uuid)}):i.push(a);let c;switch(O[r.path]){case O.weights:c=l.NumberKeyframeTrack;break;case O.rotation:c=l.QuaternionKeyframeTrack;break;case O.position:case O.scale:c=l.VectorKeyframeTrack;break;default:switch(o.itemSize){case 1:c=l.NumberKeyframeTrack;break;case 2:case 3:default:c=l.VectorKeyframeTrack;break}break}const u=n.interpolation!==void 0?Oe[n.interpolation]:l.InterpolateLinear,f=this._getArrayFromAccessor(o);for(let d=0,g=i.length;d<g;d++){const x=new c(i[d]+"."+O[r.path],t.array,f,u);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(x),s.push(x)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const o=X(t.constructor),n=new Float32Array(t.length);for(let r=0,s=t.length;r<s;r++)n[r]=t[r]*o;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(o){const n=this instanceof l.QuaternionKeyframeTrack?Ie:ne;return new n(this.times,this.values,this.getValueSize()/3,o)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function He(p,e,t){const o=e.attributes,n=new l.Box3;if(o.POSITION!==void 0){const a=t.json.accessors[o.POSITION],i=a.min,c=a.max;if(i!==void 0&&c!==void 0){if(n.set(new l.Vector3(i[0],i[1],i[2]),new l.Vector3(c[0],c[1],c[2])),a.normalized){const u=X(P[a.componentType]);n.min.multiplyScalar(u),n.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const a=new l.Vector3,i=new l.Vector3;for(let c=0,u=r.length;c<u;c++){const f=r[c];if(f.POSITION!==void 0){const d=t.json.accessors[f.POSITION],g=d.min,x=d.max;if(g!==void 0&&x!==void 0){if(i.setX(Math.max(Math.abs(g[0]),Math.abs(x[0]))),i.setY(Math.max(Math.abs(g[1]),Math.abs(x[1]))),i.setZ(Math.max(Math.abs(g[2]),Math.abs(x[2]))),d.normalized){const _=X(P[d.componentType]);i.multiplyScalar(_)}a.max(i)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}p.boundingBox=n;const s=new l.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,p.boundingSphere=s}function $(p,e,t){const o=e.attributes,n=[];function r(s,a){return t.getDependency("accessor",s).then(function(i){p.setAttribute(a,i)})}for(const s in o){const a=W[s]||s.toLowerCase();a in p.attributes||n.push(r(o[s],a))}if(e.indices!==void 0&&!p.index){const s=t.getDependency("accessor",e.indices).then(function(a){p.setIndex(a)});n.push(s)}return l.ColorManagement.workingColorSpace!==l.LinearSRGBColorSpace&&"COLOR_0"in o&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${l.ColorManagement.workingColorSpace}" not supported.`),k(p,e),He(p,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Fe(p,e.targets,t):p})}class ve{parse(e){const t={},o=e.split(`
|
|
2
|
+
`);let n=null,r=t;const s=[t];for(const a of o)if(a.includes("=")){const i=a.split("="),c=i[0].trim(),u=i[1].trim();if(u.endsWith("{")){const f={};s.push(f),r[c]=f,r=f}else r[c]=u}else if(a.endsWith("{")){const i=r[n]||{};s.push(i),r[n]=i,r=i}else if(a.endsWith("}")){if(s.pop(),s.length===0)continue;r=s[s.length-1]}else if(a.endsWith("(")){const i={};s.push(i),n=a.split("(")[0].trim()||n,r[n]=i,r=i}else a.endsWith(")")?(s.pop(),r=s[s.length-1]):n=a.trim();return t}}class je extends l.Loader{constructor(e){super(e)}load(e,t,o,n){const r=this,s=new l.FileLoader(r.manager);s.setPath(r.path),s.setResponseType("arraybuffer"),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,function(a){try{t(r.parse(a))}catch(i){n?n(i):console.error(i),r.manager.itemError(e)}},o,n)}parse(e){const t=new ve;function o(h){const m={};new l.FileLoader().setResponseType("arraybuffer");for(const T in h){if(T.endsWith("png")){const w=new Blob([h[T]],{type:{type:"image/png"}});m[T]=URL.createObjectURL(w)}if(T.endsWith("usd")||T.endsWith("usda")){if(n(h[T])){console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");continue}const w=D.strFromU8(h[T]);m[T]=t.parse(w)}}return m}function n(h){const m=h.slice(0,7),A=new Uint8Array([80,88,82,45,85,83,68,67]);return m.every((T,w)=>T===A[w])}function r(h){if(h.length<1)return;const m=Object.keys(h)[0];let A=!1;if(m.endsWith("usda"))return h[m];if(m.endsWith("usdc"))A=!0;else if(m.endsWith("usd"))if(n(h[m]))A=!0;else return h[m];A&&console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.")}const s=D.unzipSync(new Uint8Array(e)),a=o(s),i=r(s);if(i===void 0)return console.warn("THREE.USDZLoader: No usda file found."),new l.Group;const c=D.strFromU8(i),u=t.parse(c);function f(h){if(h){if("prepend references"in h){const A=h["prepend references"].split("@"),T=A[1].replace(/^.\//,""),w=A[2].replace(/^<\//,"").replace(/>$/,"");return d(a[T],w)}return d(h)}}function d(h,m){if(h){if(m!==void 0){const A=`def Mesh "${m}"`;if(A in h)return h[A]}for(const A in h){const T=h[A];if(A.startsWith("def Mesh"))return"point3f[] points"in h&&(T["point3f[] points"]=h["point3f[] points"]),"texCoord2f[] primvars:st"in h&&(T["texCoord2f[] primvars:st"]=h["texCoord2f[] primvars:st"]),"int[] primvars:st:indices"in h&&(T["int[] primvars:st:indices"]=h["int[] primvars:st:indices"]),T;if(typeof T=="object"){const w=d(T);if(w)return w}}}}function g(h){if(!h)return;let m=new l.BufferGeometry;if("int[] faceVertexIndices"in h){const A=JSON.parse(h["int[] faceVertexIndices"]);m.setIndex(A)}if("point3f[] points"in h){const A=JSON.parse(h["point3f[] points"].replace(/[()]*/g,"")),T=new l.BufferAttribute(new Float32Array(A),3);m.setAttribute("position",T)}if("normal3f[] normals"in h){const A=JSON.parse(h["normal3f[] normals"].replace(/[()]*/g,"")),T=new l.BufferAttribute(new Float32Array(A),3);m.setAttribute("normal",T)}else m.computeVertexNormals();if("float2[] primvars:st"in h&&(h["texCoord2f[] primvars:st"]=h["float2[] primvars:st"]),"texCoord2f[] primvars:st"in h){const A=JSON.parse(h["texCoord2f[] primvars:st"].replace(/[()]*/g,"")),T=new l.BufferAttribute(new Float32Array(A),2);if("int[] primvars:st:indices"in h){m=m.toNonIndexed();const w=JSON.parse(h["int[] primvars:st:indices"]);m.setAttribute("uv",x(T,w))}else m.setAttribute("uv",T)}return m}function x(h,m){const A=h.array,T=h.itemSize,w=new A.constructor(m.length*T);let z=0,se=0;for(let B=0,re=m.length;B<re;B++){z=m[B]*T;for(let q=0;q<T;q++)w[se++]=A[z++]}return new l.BufferAttribute(w,T)}function _(h){if(h){if("rel material:binding"in h){const T=h["rel material:binding"].replace(/^<\//,"").replace(/>$/,"").split("/");return R(u,` "${T[1]}"`)}return R(h)}}function R(h,m=""){for(const A in h){const T=h[A];if(A.startsWith("def Material"+m))return T;if(typeof T=="object"){const w=R(T,m);if(w)return w}}}function y(h,m){m["float inputs:rotation"]&&(h.rotation=parseFloat(m["float inputs:rotation"])),m["float2 inputs:scale"]&&(h.repeat=new l.Vector2().fromArray(JSON.parse("["+m["float2 inputs:scale"].replace(/[()]*/g,"")+"]"))),m["float2 inputs:translation"]&&(h.offset=new l.Vector2().fromArray(JSON.parse("["+m["float2 inputs:translation"].replace(/[()]*/g,"")+"]")))}function E(h){const m=new l.MeshPhysicalMaterial;if(h!==void 0){if('def Shader "PreviewSurface"'in h){const A=h['def Shader "PreviewSurface"'];if("color3f inputs:diffuseColor.connect"in A){const T=A["color3f inputs:diffuseColor.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.map=S(w),m.map.colorSpace=l.SRGBColorSpace,'def Shader "Transform2d_diffuse"'in h&&y(m.map,h['def Shader "Transform2d_diffuse"'])}else if("color3f inputs:diffuseColor"in A){const T=A["color3f inputs:diffuseColor"].replace(/[()]*/g,"");m.color.fromArray(JSON.parse("["+T+"]"))}if("color3f inputs:emissiveColor.connect"in A){const T=A["color3f inputs:emissiveColor.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.emissiveMap=S(w),m.emissiveMap.colorSpace=l.SRGBColorSpace,m.emissive.set(16777215),'def Shader "Transform2d_emissive"'in h&&y(m.emissiveMap,h['def Shader "Transform2d_emissive"'])}else if("color3f inputs:emissiveColor"in A){const T=A["color3f inputs:emissiveColor"].replace(/[()]*/g,"");m.emissive.fromArray(JSON.parse("["+T+"]"))}if("normal3f inputs:normal.connect"in A){const T=A["normal3f inputs:normal.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.normalMap=S(w),m.normalMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_normal"'in h&&y(m.normalMap,h['def Shader "Transform2d_normal"'])}if("float inputs:roughness.connect"in A){const T=A["float inputs:roughness.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.roughness=1,m.roughnessMap=S(w),m.roughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_roughness"'in h&&y(m.roughnessMap,h['def Shader "Transform2d_roughness"'])}else"float inputs:roughness"in A&&(m.roughness=parseFloat(A["float inputs:roughness"]));if("float inputs:metallic.connect"in A){const T=A["float inputs:metallic.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.metalness=1,m.metalnessMap=S(w),m.metalnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_metallic"'in h&&y(m.metalnessMap,h['def Shader "Transform2d_metallic"'])}else"float inputs:metallic"in A&&(m.metalness=parseFloat(A["float inputs:metallic"]));if("float inputs:clearcoat.connect"in A){const T=A["float inputs:clearcoat.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.clearcoat=1,m.clearcoatMap=S(w),m.clearcoatMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoat"'in h&&y(m.clearcoatMap,h['def Shader "Transform2d_clearcoat"'])}else"float inputs:clearcoat"in A&&(m.clearcoat=parseFloat(A["float inputs:clearcoat"]));if("float inputs:clearcoatRoughness.connect"in A){const T=A["float inputs:clearcoatRoughness.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.clearcoatRoughness=1,m.clearcoatRoughnessMap=S(w),m.clearcoatRoughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoatRoughness"'in h&&y(m.clearcoatRoughnessMap,h['def Shader "Transform2d_clearcoatRoughness"'])}else"float inputs:clearcoatRoughness"in A&&(m.clearcoatRoughness=parseFloat(A["float inputs:clearcoatRoughness"]));if("float inputs:ior"in A&&(m.ior=parseFloat(A["float inputs:ior"])),"float inputs:occlusion.connect"in A){const T=A["float inputs:occlusion.connect"],w=b(u,/(\w+).output/.exec(T)[1]);m.aoMap=S(w),m.aoMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_occlusion"'in h&&y(m.aoMap,h['def Shader "Transform2d_occlusion"'])}}if('def Shader "diffuseColor_texture"'in h){const A=h['def Shader "diffuseColor_texture"'];m.map=S(A),m.map.colorSpace=l.SRGBColorSpace}if('def Shader "normal_texture"'in h){const A=h['def Shader "normal_texture"'];m.normalMap=S(A),m.normalMap.colorSpace=l.NoColorSpace}}return m}function b(h,m){for(const A in h){const T=h[A];if(A.startsWith(`def Shader "${m}"`))return T;if(typeof T=="object"){const w=b(T,m);if(w)return w}}}function S(h){if("asset inputs:file"in h){const m=h["asset inputs:file"].replace(/@*/g,""),T=new l.TextureLoader().load(a[m]),w={'"clamp"':l.ClampToEdgeWrapping,'"mirror"':l.MirroredRepeatWrapping,'"repeat"':l.RepeatWrapping};return"token inputs:wrapS"in h&&(T.wrapS=w[h["token inputs:wrapS"]]),"token inputs:wrapT"in h&&(T.wrapT=w[h["token inputs:wrapT"]]),T}return null}function C(h){const m=g(f(h)),A=E(_(h)),T=m?new l.Mesh(m,A):new l.Object3D;if("matrix4d xformOp:transform"in h){const w=JSON.parse("["+h["matrix4d xformOp:transform"].replace(/[()]*/g,"")+"]");T.matrix.fromArray(w),T.matrix.decompose(T.position,T.quaternion,T.scale)}return T}function N(h,m){for(const A in h)if(A.startsWith("def Scope"))N(h[A],m);else if(A.startsWith("def Xform")){const T=C(h[A]);/def Xform "(\w+)"/.test(A)&&(T.name=/def Xform "(\w+)"/.exec(A)[1]),m.add(T),N(h[A],T)}}const M=new l.Group;return N(u,M),M}}const V=new WeakMap;class Ke extends l.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,o,n){const r=new l.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,s=>{this.parse(s,t,n)},o,n)}parse(e,t,o=()=>{}){this.decodeDracoFile(e,t,null,null,l.SRGBColorSpace).catch(o)}decodeDracoFile(e,t,o,n,r=l.LinearSRGBColorSpace,s=()=>{}){const a={attributeIDs:o||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!o,vertexColorSpace:r};return this.decodeGeometry(e,a).then(t).catch(s)}decodeGeometry(e,t){const o=JSON.stringify(t);if(V.has(e)){const i=V.get(e);if(i.key===o)return i.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const r=this.workerNextTaskID++,s=e.byteLength,a=this._getWorker(r,s).then(i=>(n=i,new Promise((c,u)=>{n._callbacks[r]={resolve:c,reject:u},n.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(i=>this._createGeometry(i.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),V.set(e,{key:o,promise:a}),a}_createGeometry(e){const t=new l.BufferGeometry;e.index&&t.setIndex(new l.BufferAttribute(e.index.array,1));for(let o=0;o<e.attributes.length;o++){const n=e.attributes[o],r=n.name,s=n.array,a=n.itemSize,i=new l.BufferAttribute(s,a);r==="color"&&(this._assignVertexColorSpace(i,n.vertexColorSpace),i.normalized=!(s instanceof Float32Array)),t.setAttribute(r,i)}return t}_assignVertexColorSpace(e,t){if(t!==l.SRGBColorSpace)return;const o=new l.Color;for(let n=0,r=e.count;n<r;n++)o.fromBufferAttribute(e,n).convertSRGBToLinear(),e.setXYZ(n,o.r,o.g,o.b)}_loadLibrary(e,t){const o=new l.FileLoader(this.manager);return o.setPath(this.decoderPath),o.setResponseType(t),o.setWithCredentials(this.withCredentials),new Promise((n,r)=>{o.load(e,n,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(o=>{const n=o[0];e||(this.decoderConfig.wasmBinary=o[1]);const r=Ve.toString(),s=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
3
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(r){const s=r.data;switch(s.type){case"decode":n._callbacks[s.id].resolve(s);break;case"error":n._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,r){return n._taskLoad>r._taskLoad?-1:1});const o=this.workerPool[this.workerPool.length-1];return o._taskCosts[e]=t,o._taskLoad+=t,o})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function Ve(){let p,e;onmessage=function(s){const a=s.data;switch(a.type){case"init":p=a.decoderConfig,e=new Promise(function(u){p.onModuleLoaded=function(f){u({draco:f})},DracoDecoderModule(p)});break;case"decode":const i=a.buffer,c=a.taskConfig;e.then(u=>{const f=u.draco,d=new f.Decoder;try{const g=t(f,d,new Int8Array(i),c),x=g.attributes.map(_=>_.array.buffer);g.index&&x.push(g.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:g},x)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}finally{f.destroy(d)}});break}};function t(s,a,i,c){const u=c.attributeIDs,f=c.attributeTypes;let d,g;const x=a.GetEncodedGeometryType(i);if(x===s.TRIANGULAR_MESH)d=new s.Mesh,g=a.DecodeArrayToMesh(i,i.byteLength,d);else if(x===s.POINT_CLOUD)d=new s.PointCloud,g=a.DecodeArrayToPointCloud(i,i.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const _={index:null,attributes:[]};for(const R in u){const y=self[f[R]];let E,b;if(c.useUniqueIDs)b=u[R],E=a.GetAttributeByUniqueId(d,b);else{if(b=a.GetAttributeId(d,s[u[R]]),b===-1)continue;E=a.GetAttribute(d,b)}const S=n(s,a,d,R,y,E);R==="color"&&(S.vertexColorSpace=c.vertexColorSpace),_.attributes.push(S)}return x===s.TRIANGULAR_MESH&&(_.index=o(s,a,d)),s.destroy(d),_}function o(s,a,i){const u=i.num_faces()*3,f=u*4,d=s._malloc(f);a.GetTrianglesUInt32Array(i,f,d);const g=new Uint32Array(s.HEAPF32.buffer,d,u).slice();return s._free(d),{array:g,itemSize:1}}function n(s,a,i,c,u,f){const d=f.num_components(),x=i.num_points()*d,_=x*u.BYTES_PER_ELEMENT,R=r(s,u),y=s._malloc(_);a.GetAttributeDataArrayForAllPoints(i,f,R,_,y);const E=new u(s.HEAPF32.buffer,y,x).slice();return s._free(y),{name:c,array:E,itemSize:d}}function r(s,a){switch(a){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}class ee extends Error{constructor(e,t,o){super(t),this.url=e,this.cause=o,this.name="NetworkError"}}class We{constructor(){U(this,"_gltfLoader");U(this,"_usdzLoader");const e=new Ke;e.setDecoderPath("../draco/"),this._gltfLoader=new ae,this._gltfLoader.setDRACOLoader(e),this._usdzLoader=new je}async _loadFile(e){const t=await fetch(e);if(!t.ok)throw new ee(e,`Failed to fetch file from ${e}`);try{return await t.arrayBuffer()}catch{throw new ee(e,`Failed to fetch file from ${e}`)}}async load(e){const t=H.getFileTypeFromUri(e);if(t.length===0)throw new D.FileTypeError("No file extension found in URI","");if(!H.isFileTypeSupported(t))throw new D.FileTypeError(`Unsupported file type: ${t}. Supported types: ${H.SUPPORTED_FILE_TYPES.join(", ")}`,t);const o=await this._loadFile(e);try{switch(t){case"glb":case"gltf":return(await this._gltfLoader.parseAsync(o,"")).scene;case"usdz":return await this._usdzLoader.parse(o)}}catch(n){throw n instanceof Error?new D.ParseError(`Failed to parse ${t} file: ${n.message}`,n):new D.ParseError(`Failed to parse ${t} file`)}}}exports.AssetLoader=We;
|