dsh-3d-viewer 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +180 -114
- package/README.zh.md +180 -114
- package/THIRD_PARTY_NOTICES.md +54 -54
- package/assets/hdri/LICENSE.md +17 -17
- package/dist/client.fbx.js +14 -0
- package/dist/client.gltf.js +14 -0
- package/dist/client.js +4472 -0
- package/dist/client.obj.js +19 -0
- package/dist/client.stl.js +14 -0
- package/dist/client.tex-exr.js +14 -0
- package/dist/client.tex-hdr.js +18 -0
- package/dist/client.tex-tga.js +14 -0
- package/index.js +167 -167
- package/package.json +72 -67
- package/client.js +0 -4462
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# Third-party notices
|
|
2
|
-
|
|
3
|
-
This project's own source code is licensed under the MIT License; see
|
|
4
|
-
[LICENSE](LICENSE). The following third-party components are included in or
|
|
5
|
-
used by this package.
|
|
6
|
-
|
|
7
|
-
## Three.js
|
|
8
|
-
|
|
9
|
-
`client.js` bundles the following MIT-licensed Three.js code:
|
|
10
|
-
|
|
11
|
-
- Three.js core (`three`)
|
|
12
|
-
- `FBXLoader`, `OBJLoader`, `MTLLoader`, `GLTFLoader`, `STLLoader`, `OrbitControls`, `HDRLoader`
|
|
13
|
-
- `EffectComposer`, `RenderPass`, `ShaderPass`
|
|
14
|
-
- Three.js addon dependencies used by the loaders (`fflate`, `NURBSCurve`)
|
|
15
|
-
|
|
16
|
-
`src/vendor/
|
|
17
|
-
|
|
18
|
-
The MIT License
|
|
19
|
-
|
|
20
|
-
Copyright © 2010-2026 three.js authors
|
|
21
|
-
|
|
22
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
23
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
24
|
-
in the Software without restriction, including without limitation the rights
|
|
25
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
26
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
27
|
-
furnished to do so, subject to the following conditions:
|
|
28
|
-
|
|
29
|
-
The above copyright notice and this permission notice shall be included in
|
|
30
|
-
all copies or substantial portions of the Software.
|
|
31
|
-
|
|
32
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
33
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
34
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
35
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
36
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
37
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
38
|
-
THE SOFTWARE.
|
|
39
|
-
|
|
40
|
-
## Poly Haven HDRIs
|
|
41
|
-
|
|
42
|
-
`assets/hdri/*.hdr` are Poly Haven assets released under
|
|
43
|
-
[CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/). CC0 requires no
|
|
44
|
-
attribution; the source links and license note are kept in
|
|
45
|
-
[assets/hdri/LICENSE.md](assets/hdri/LICENSE.md) for provenance.
|
|
46
|
-
The HDRIs ship as files in the package and are served at runtime by the
|
|
47
|
-
plugin's Host route (`/dsh-3d-viewer/hdri/`); they are not embedded in
|
|
48
|
-
`client.js`.
|
|
49
|
-
|
|
50
|
-
## React
|
|
51
|
-
|
|
52
|
-
The viewer source imports React, but the production bundle externalizes it
|
|
53
|
-
(`--external:react`). React is supplied by the DSH host at runtime and is not
|
|
54
|
-
included in this package.
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This project's own source code is licensed under the MIT License; see
|
|
4
|
+
[LICENSE](LICENSE). The following third-party components are included in or
|
|
5
|
+
used by this package.
|
|
6
|
+
|
|
7
|
+
## Three.js
|
|
8
|
+
|
|
9
|
+
`client.js` bundles the following MIT-licensed Three.js code:
|
|
10
|
+
|
|
11
|
+
- Three.js core (`three`)
|
|
12
|
+
- `FBXLoader`, `OBJLoader`, `MTLLoader`, `GLTFLoader`, `STLLoader`, `OrbitControls`, `HDRLoader`
|
|
13
|
+
- `EffectComposer`, `RenderPass`, `ShaderPass`
|
|
14
|
+
- Three.js addon dependencies used by the loaders (`fflate`, `NURBSCurve`)
|
|
15
|
+
|
|
16
|
+
`src/vendor/fbx-loader-pbr.js` is a modified copy of Three.js's `FBXLoader`.
|
|
17
|
+
|
|
18
|
+
The MIT License
|
|
19
|
+
|
|
20
|
+
Copyright © 2010-2026 three.js authors
|
|
21
|
+
|
|
22
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
23
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
24
|
+
in the Software without restriction, including without limitation the rights
|
|
25
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
26
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
27
|
+
furnished to do so, subject to the following conditions:
|
|
28
|
+
|
|
29
|
+
The above copyright notice and this permission notice shall be included in
|
|
30
|
+
all copies or substantial portions of the Software.
|
|
31
|
+
|
|
32
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
33
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
34
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
35
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
36
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
37
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
38
|
+
THE SOFTWARE.
|
|
39
|
+
|
|
40
|
+
## Poly Haven HDRIs
|
|
41
|
+
|
|
42
|
+
`assets/hdri/*.hdr` are Poly Haven assets released under
|
|
43
|
+
[CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/). CC0 requires no
|
|
44
|
+
attribution; the source links and license note are kept in
|
|
45
|
+
[assets/hdri/LICENSE.md](assets/hdri/LICENSE.md) for provenance.
|
|
46
|
+
The HDRIs ship as files in the package and are served at runtime by the
|
|
47
|
+
plugin's Host route (`/dsh-3d-viewer/hdri/`); they are not embedded in
|
|
48
|
+
`client.js`.
|
|
49
|
+
|
|
50
|
+
## React
|
|
51
|
+
|
|
52
|
+
The viewer source imports React, but the production bundle externalizes it
|
|
53
|
+
(`--external:react`). React is supplied by the DSH host at runtime and is not
|
|
54
|
+
included in this package.
|
package/assets/hdri/LICENSE.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# HDRI assets
|
|
2
|
-
|
|
3
|
-
All four 1k HDRIs are downloaded from [Poly Haven](https://polyhaven.com/) and
|
|
4
|
-
are licensed under [CC0](https://polyhaven.com/license). They can be used
|
|
5
|
-
commercially without attribution; the source links below are recorded for
|
|
6
|
-
provenance.
|
|
7
|
-
|
|
8
|
-
| File | Source | Download |
|
|
9
|
-
| --- | --- | --- |
|
|
10
|
-
| `nature.hdr` | [Forest Slope](https://polyhaven.com/a/forest_slope) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/forest_slope_1k.hdr` |
|
|
11
|
-
| `city.hdr` | [Potsdamer Platz](https://polyhaven.com/a/potsdamer_platz) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/potsdamer_platz_1k.hdr` |
|
|
12
|
-
| `indoor.hdr` | [Lythwood Room](https://polyhaven.com/a/lythwood_room) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/lythwood_room_1k.hdr` |
|
|
13
|
-
| `studio.hdr` | [Studio Small 09](https://polyhaven.com/a/studio_small_09) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/studio_small_09_1k.hdr` |
|
|
14
|
-
|
|
15
|
-
The files ship inside the plugin package and are served at runtime by the
|
|
16
|
-
plugin's Host route (`/dsh-3d-viewer/hdri/`), so the client bundle does not
|
|
17
|
-
embed them and no network request is made.
|
|
1
|
+
# HDRI assets
|
|
2
|
+
|
|
3
|
+
All four 1k HDRIs are downloaded from [Poly Haven](https://polyhaven.com/) and
|
|
4
|
+
are licensed under [CC0](https://polyhaven.com/license). They can be used
|
|
5
|
+
commercially without attribution; the source links below are recorded for
|
|
6
|
+
provenance.
|
|
7
|
+
|
|
8
|
+
| File | Source | Download |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| `nature.hdr` | [Forest Slope](https://polyhaven.com/a/forest_slope) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/forest_slope_1k.hdr` |
|
|
11
|
+
| `city.hdr` | [Potsdamer Platz](https://polyhaven.com/a/potsdamer_platz) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/potsdamer_platz_1k.hdr` |
|
|
12
|
+
| `indoor.hdr` | [Lythwood Room](https://polyhaven.com/a/lythwood_room) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/lythwood_room_1k.hdr` |
|
|
13
|
+
| `studio.hdr` | [Studio Small 09](https://polyhaven.com/a/studio_small_09) | `https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/studio_small_09_1k.hdr` |
|
|
14
|
+
|
|
15
|
+
The files ship inside the plugin package and are served at runtime by the
|
|
16
|
+
plugin's Host route (`/dsh-3d-viewer/hdri/`), so the client bundle does not
|
|
17
|
+
embed them and no network request is made.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! dsh-3d-viewer fbx loader chunk | bundles Three.js addons (MIT). See THIRD_PARTY_NOTICES.md. */
|
|
2
|
+
window.__ModuleLoader__.load({
|
|
3
|
+
id: "dsh-3d-viewer",
|
|
4
|
+
chunk: "client.fbx.js",
|
|
5
|
+
factory(require) {
|
|
6
|
+
var localRequire = (id) => id === 'three' ? globalThis.__DSH3DV_THREE__ : require(id);
|
|
7
|
+
var module = { exports: {} };
|
|
8
|
+
var exports = module.exports;
|
|
9
|
+
(function (require, module, exports) {
|
|
10
|
+
var ce=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var ct=(a,e)=>{for(var t in e)ce(a,t,{get:e[t],enumerable:!0})},ut=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of at(e))!lt.call(a,r)&&r!==t&&ce(a,r,{get:()=>e[r],enumerable:!(n=ot(e,r))||n.enumerable});return a};var ft=a=>ut(ce({},"__esModule",{value:!0}),a);var Qt={};ct(Qt,{loadFbxModel:()=>tt});module.exports=ft(Qt);var ht=/^(?:data:|blob:|https?:|file:|\/\/)/iu,ke=/^(?:[A-Za-z]:[\\/]|\/)/u,pt=new Map([["bin","application/octet-stream"],["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["webp","image/webp"],["gif","image/gif"],["bmp","image/bmp"],["tga","image/x-tga"],["dds","image/vnd-ms.dds"],["exr","image/x-exr"],["hdr","image/vnd.radiance"]]),_t=new TextDecoder("utf-8");function Z(a){if(a instanceof ArrayBuffer)return a;if(ArrayBuffer.isView(a))return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength);if(typeof a=="string")return new TextEncoder().encode(a).buffer;throw new TypeError("The 3D preview was not given binary data")}function ue(a){let e=String(a).split(/[?#]/u,1)[0];try{return decodeURIComponent(e).replaceAll("\\","/")}catch{return e.replaceAll("\\","/")}}function Le(a){return typeof a=="string"&&a!==""&&ht.test(a)===!1}function Be(a){let e=ue(a),t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return pt.get(t)??"application/octet-stream"}function j(a="Model loading was cancelled."){let e=new Error(a);return e.name="AbortError",e}function $(a){typeof console<"u"&&console.warn(a)}var Re=require("three");function ze(a){let e=new Set,t=new Set,n=new Set,r=new Set,i=new Set;a.traverse(s=>{s.geometry!==void 0&&s.geometry!==null&&e.add(s.geometry),s.isSkinnedMesh===!0&&s.skeleton!==void 0&&s.skeleton!==null&&r.add(s.skeleton);let o=s.material;if(o!=null){for(let c of Array.isArray(o)?o:[o])if(c!=null){t.add(c);for(let f of Object.values(c))if(!(f===null||typeof f!="object")){if(f.isTexture===!0)n.add(f);else if(Array.isArray(f))for(let h of f)h!==null&&typeof h=="object"&&h.isTexture===!0&&n.add(h)}}}});for(let s of n){let o=s.image?.src;typeof o=="string"&&o.startsWith("blob:")&&i.add(o),s.dispose()}if(typeof URL.revokeObjectURL=="function")for(let s of i)try{URL.revokeObjectURL(s)}catch{}for(let s of r)s.dispose();for(let s of t)s.dispose();for(let s of e)s.dispose()}var u=require("three");var k=Uint8Array,H=Uint16Array,gt=Int32Array,Oe=new k([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ue=new k([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),dt=new k([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ve=function(a,e){for(var t=new H(31),n=0;n<31;++n)t[n]=e+=1<<a[n-1];for(var r=new gt(t[30]),n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)r[i]=i-t[n]<<5|n;return{b:t,r}},je=Ve(Oe,2),Ge=je.b,mt=je.r;Ge[28]=258,mt[258]=28;var We=Ve(Ue,0),vt=We.b,nn=We.r,pe=new H(32768);for(A=0;A<32768;++A)O=(A&43690)>>1|(A&21845)<<1,O=(O&52428)>>2|(O&13107)<<2,O=(O&61680)>>4|(O&3855)<<4,pe[A]=((O&65280)>>8|(O&255)<<8)>>1;var O,A,Y=(function(a,e,t){for(var n=a.length,r=0,i=new H(e);r<n;++r)a[r]&&++i[a[r]-1];var s=new H(e);for(r=1;r<e;++r)s[r]=s[r-1]+i[r-1]<<1;var o;if(t){o=new H(1<<e);var c=15-e;for(r=0;r<n;++r)if(a[r])for(var f=r<<4|a[r],h=e-a[r],l=s[a[r]-1]++<<h,p=l|(1<<h)-1;l<=p;++l)o[pe[l]>>c]=f}else for(o=new H(n),r=0;r<n;++r)a[r]&&(o[r]=pe[s[a[r]-1]++]>>15-a[r]);return o}),q=new k(288);for(A=0;A<144;++A)q[A]=8;var A;for(A=144;A<256;++A)q[A]=9;var A;for(A=256;A<280;++A)q[A]=7;var A;for(A=280;A<288;++A)q[A]=8;var A,Xe=new k(32);for(A=0;A<32;++A)Xe[A]=5;var A;var yt=Y(q,9,1);var wt=Y(Xe,5,1),fe=function(a){for(var e=a[0],t=1;t<a.length;++t)a[t]>e&&(e=a[t]);return e},L=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},he=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},xt=function(a){return(a+7)/8|0},At=function(a,e,t){return(e==null||e<0)&&(e=0),(t==null||t>a.length)&&(t=a.length),new k(a.subarray(e,t))};var Tt=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],B=function(a,e,t){var n=new Error(e||Tt[a]);if(n.code=a,Error.captureStackTrace&&Error.captureStackTrace(n,B),!t)throw n;return n},St=function(a,e,t,n){var r=a.length,i=n?n.length:0;if(!r||e.f&&!e.l)return t||new k(0);var s=!t,o=s||e.i!=2,c=e.i;s&&(t=new k(r*3));var f=function(Pe){var De=t.length;if(Pe>De){var Ce=new k(Math.max(De*2,Pe));Ce.set(t),t=Ce}},h=e.f||0,l=e.p||0,p=e.b||0,g=e.l,d=e.d,m=e.m,v=e.n,x=r*8;do{if(!g){h=L(a,l,1);var T=L(a,l+1,3);if(l+=3,T)if(T==1)g=yt,d=wt,m=9,v=5;else if(T==2){var b=L(a,l,31)+257,C=L(a,l+10,15)+4,D=b+L(a,l+5,31)+1;l+=14;for(var R=new k(D),z=new k(19),S=0;S<C;++S)z[dt[S]]=L(a,l+S*3,7);l+=C*3;for(var G=fe(z),se=(1<<G)-1,nt=Y(z,G,1),S=0;S<D;){var Fe=nt[L(a,l,se)];l+=Fe&15;var y=Fe>>4;if(y<16)R[S++]=y;else{var W=0,ee=0;for(y==16?(ee=3+L(a,l,3),l+=2,W=R[S-1]):y==17?(ee=3+L(a,l,7),l+=3):y==18&&(ee=11+L(a,l,127),l+=7);ee--;)R[S++]=W}}var Ie=R.subarray(0,b),U=R.subarray(b);m=fe(Ie),v=fe(U),g=Y(Ie,m,1),d=Y(U,v,1)}else B(1);else{var y=xt(l)+4,I=a[y-4]|a[y-3]<<8,E=y+I;if(E>r){c&&B(0);break}o&&f(p+I),t.set(a.subarray(y,E),p),e.b=p+=I,e.p=l=E*8,e.f=h;continue}if(l>x){c&&B(0);break}}o&&f(p+131072);for(var rt=(1<<m)-1,it=(1<<v)-1,oe=l;;oe=l){var W=g[he(a,l)&rt],X=W>>4;if(l+=W&15,l>x){c&&B(0);break}if(W||B(2),X<256)t[p++]=X;else if(X==256){oe=l,g=null;break}else{var be=X-254;if(X>264){var S=X-257,N=Oe[S];be=L(a,l,(1<<N)-1)+Ge[S],l+=N}var ae=d[he(a,l)&it],le=ae>>4;ae||B(3),l+=ae&15;var U=vt[le];if(le>3){var N=Ue[le];U+=he(a,l)&(1<<N)-1,l+=N}if(l>x){c&&B(0);break}o&&f(p+131072);var Me=p+be;if(p<U){var Ee=i-U,st=Math.min(U,Me);for(Ee+p<0&&B(3);p<st;++p)t[p]=n[Ee+p]}for(;p<Me;++p)t[p]=t[p-U]}}e.l=g,e.p=oe,e.b=p,e.f=h,g&&(h=1,e.m=m,e.d=d,e.n=v)}while(!h);return p!=t.length&&s?At(t,0,p):t.subarray(0,p)};var Ft=new k(0);var It=function(a,e){return((a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31)&&B(6,"invalid zlib data"),(a[1]>>5&1)==+!e&&B(6,"invalid zlib data: "+(a[1]&32?"need":"unexpected")+" dictionary"),(a[1]>>3&4)+2};function He(a,e){return St(a.subarray(It(a,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var bt=typeof TextDecoder<"u"&&new TextDecoder,Mt=0;try{bt.decode(Ft,{stream:!0}),Mt=1}catch{}var V=require("three");var Q=require("three");function Ke(a,e,t){let n=t.length-a-1;if(e>=t[n])return n-1;if(e<=t[a])return a;let r=a,i=n,s=Math.floor((r+i)/2);for(;e<t[s]||e>=t[s+1];)e<t[s]?i=s:r=s,s=Math.floor((r+i)/2);return s}function Et(a,e,t,n){let r=[],i=[],s=[];r[0]=1;for(let o=1;o<=t;++o){i[o]=e-n[a+1-o],s[o]=n[a+o]-e;let c=0;for(let f=0;f<o;++f){let h=s[f+1],l=i[o-f],p=r[f]/(h+l);r[f]=c+h*p,c=l*p}r[o]=c}return r}function Ne(a,e,t,n){let r=Ke(a,n,e),i=Et(r,n,a,e),s=new Q.Vector4(0,0,0,0);for(let o=0;o<=a;++o){let c=t[r-a+o],f=i[o],h=c.w*f;s.x+=c.x*h,s.y+=c.y*h,s.z+=c.z*h,s.w+=c.w*f}return s}function Pt(a,e,t,n,r){let i=[];for(let l=0;l<=t;++l)i[l]=0;let s=[];for(let l=0;l<=n;++l)s[l]=i.slice(0);let o=[];for(let l=0;l<=t;++l)o[l]=i.slice(0);o[0][0]=1;let c=i.slice(0),f=i.slice(0);for(let l=1;l<=t;++l){c[l]=e-r[a+1-l],f[l]=r[a+l]-e;let p=0;for(let g=0;g<l;++g){let d=f[g+1],m=c[l-g];o[l][g]=d+m;let v=o[g][l-1]/o[l][g];o[g][l]=p+d*v,p=m*v}o[l][l]=p}for(let l=0;l<=t;++l)s[0][l]=o[l][t];for(let l=0;l<=t;++l){let p=0,g=1,d=[];for(let m=0;m<=t;++m)d[m]=i.slice(0);d[0][0]=1;for(let m=1;m<=n;++m){let v=0,x=l-m,T=t-m;l>=m&&(d[g][0]=d[p][0]/o[T+1][x],v=d[g][0]*o[x][T]);let y=x>=-1?1:-x,I=l-1<=T?m-1:t-l;for(let b=y;b<=I;++b)d[g][b]=(d[p][b]-d[p][b-1])/o[T+1][x+b],v+=d[g][b]*o[x+b][T];l<=T&&(d[g][m]=-d[p][m-1]/o[T+1][l],v+=d[g][m]*o[l][T]),s[m][l]=v;let E=p;p=g,g=E}}let h=t;for(let l=1;l<=n;++l){for(let p=0;p<=t;++p)s[l][p]*=h;h*=t-l}return s}function Dt(a,e,t,n,r){let i=r<a?r:a,s=[],o=Ke(a,n,e),c=Pt(o,n,a,i,e),f=[];for(let h=0;h<t.length;++h){let l=t[h].clone(),p=l.w;l.x*=p,l.y*=p,l.z*=p,f[h]=l}for(let h=0;h<=i;++h){let l=f[o-a].clone().multiplyScalar(c[h][0]);for(let p=1;p<=a;++p)l.add(f[o-a+p].clone().multiplyScalar(c[h][p]));s[h]=l}for(let h=i+1;h<=r+1;++h)s[h]=new Q.Vector4(0,0,0);return s}function Ct(a,e){let t=1;for(let r=2;r<=a;++r)t*=r;let n=1;for(let r=2;r<=e;++r)n*=r;for(let r=2;r<=a-e;++r)n*=r;return t/n}function kt(a){let e=a.length,t=[],n=[];for(let i=0;i<e;++i){let s=a[i];t[i]=new Q.Vector3(s.x,s.y,s.z),n[i]=s.w}let r=[];for(let i=0;i<e;++i){let s=t[i].clone();for(let o=1;o<=i;++o)s.sub(r[i-o].clone().multiplyScalar(Ct(i,o)*n[o]));r[i]=s.divideScalar(n[0])}return r}function Ze(a,e,t,n,r){let i=Dt(a,e,t,n,r);return kt(i)}var te=class extends V.Curve{constructor(e,t,n,r,i){super();let s=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||s;for(let c=0;c<o;++c){let f=n[c];this.controlPoints[c]=new V.Vector4(f.x,f.y,f.z,f.w)}}getPoint(e,t=new V.Vector3){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Ne(this.degree,this.knots,this.controlPoints,r);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new V.Vector3){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Ze(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}copy(e){return super.copy(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>t.clone()),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=>t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>new V.Vector4(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function Ye(a,e){if(a===null||typeof a!="object")return;let t=s=>{if(typeof s=="number")return Number.isFinite(s)?s:void 0;if(typeof s=="string"&&s.trim()!==""){let o=Number(s);return Number.isFinite(o)?o:void 0}if(Array.isArray(s))return t(s[0]);if(s!==null&&typeof s=="object"&&Object.prototype.hasOwnProperty.call(s,"value"))return t(s.value)},n=new Map,r=(s,o)=>{if(typeof s!="string")return;let c=s.split("|").pop().toLowerCase().replace(/[^a-z0-9]/g,"");if(e.includes(c)===!1||n.has(c))return;let f=t(o);f!==void 0&&n.set(c,Math.min(1,Math.max(0,f)))};for(let[s,o]of Object.entries(a))r(s,o);let i=a.Properties70??a.properties70;if(i!==null&&typeof i=="object"&&Array.isArray(i)===!1)for(let[s,o]of Object.entries(i))r(s,o);for(let s of e)if(n.has(s))return n.get(s)}function Bt(a){return Ye(a,["metalness","metalnessfactor","metallic","metallicfactor"])}function Rt(a){return Ye(a,["roughness","roughnessfactor"])}var w,F,M,J=class extends u.Loader{constructor(e){super(e),this.trimAnimationClips=!1}load(e,t,n,r){let i=this,s=i.path===""?u.LoaderUtils.extractUrlBase(e):i.path,o=new u.FileLoader(this.manager);o.setPriority(this.priority),o.setCache(this.cache),o.setPath(i.path),o.setResponseType("arraybuffer"),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(c){try{t(i.parse(c,s))}catch(f){r?r(f):console.error(f),i.manager.itemError(e)}},n,r)}parse(e,t){if(zt(e))w=new Ae().parse(e);else{let r=Qe(e);if(!Ot(r))throw new Error("THREE.FBXLoader: Unknown format.");if($e(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+$e(r));w=new xe().parse(r)}let n=new u.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return n.setPriority(this.priority),n.setCache(this.cache),new ve(n,this.manager,this.trimAnimationClips).parse(w)}},ve=class{constructor(e,t,n){this.textureLoader=e,this.manager=t,this.trimAnimationClips=n}parse(){F=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),i=new ye().parse(r);return this.parseScene(r,i,n),M}parseConnections(){let e=new Map;return"Connections"in w&&w.Connections.connections.forEach(function(n){let r=n[0],i=n[1],s=n[2];e.has(r)||e.set(r,{parents:[],children:[]});let o={ID:i,relationship:s};e.get(r).parents.push(o),e.has(i)||e.set(i,{parents:[],children:[]});let c={ID:r,relationship:s};e.get(i).children.push(c)}),e}parseImages(){let e={},t={};if("Video"in w.Objects){let n=w.Objects.Video;for(let r in n){let i=n[r],s=parseInt(r);if(e[s]=i.RelativeFilename||i.Filename,"Content"in i){let o=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,c=typeof i.Content=="string"&&i.Content!=="";if(o||c){let f=this.parseImage(n[r]);t[i.RelativeFilename||i.Filename]=f}}}}for(let n in e){let r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase(),i;switch(r){case"bmp":i="image/bmp";break;case"jpg":case"jpeg":i="image/jpeg";break;case"png":i="image/png";break;case"tif":i="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),i="image/tga";break;case"webp":i="image/webp";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+i+";base64,"+t;{let s=new Uint8Array(t);return URL.createObjectURL(new Blob([s],{type:i}))}}parseTextures(e){let t=new Map;if("Texture"in w.Objects){let n=w.Objects.Texture;for(let r in n){let i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}parseTexture(e,t){let n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;let r=e.WrapModeU,i=e.WrapModeV,s=r!==void 0?r.value:0,o=i!==void 0?i.value:0;if(n.wrapS=s===0?u.RepeatWrapping:u.ClampToEdgeWrapping,n.wrapT=o===0?u.RepeatWrapping:u.ClampToEdgeWrapping,"Scaling"in e){let c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}if("Translation"in e){let c=e.Translation.value;n.offset.x=c[0],n.offset.y=c[1]}return n}loadTexture(e,t){let n=e.FileName.split(".").pop().toLowerCase(),r=this.manager.getHandler(`.${n}`);r===null&&(r=this.textureLoader);let i=r.path;i||r.setPath(this.textureLoader.path);let s=F.get(e.id).children,o;if(s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(o=t[s[0].ID],(o.indexOf("blob:")===0||o.indexOf("data:")===0)&&r.setPath(void 0)),o===void 0)return console.warn("FBXLoader: Undefined filename, creating placeholder texture."),new u.Texture;let c=r.load(o);return r.setPath(i),c}parseMaterials(e){let t=new Map;if("Material"in w.Objects){let n=w.Objects.Material;for(let r in n){let i=this.parseMaterial(n[r],e);i!==null&&t.set(parseInt(r),i)}}return t}parseMaterial(e,t){let n=e.id,r=e.attrName,i=e.ShadingModel;if(typeof i=="object"&&(i=i.value),!F.has(n))return null;let s=this.parseParameters(e,t,n),o;switch(i.toLowerCase()){case"phong":o=new u.MeshPhongMaterial;break;case"lambert":o=new u.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),o=new u.MeshPhongMaterial;break}o.setValues(s),o.name=r;let c=Bt(e);c!==void 0&&(o.userData.fbxMetalness=c);let f=Rt(e);return f!==void 0&&(o.userData.fbxRoughness=f),o}parseParameters(e,t,n){let r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=u.ColorManagement.colorSpaceToWorking(new u.Color().fromArray(e.Diffuse.value),u.SRGBColorSpace):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=u.ColorManagement.colorSpaceToWorking(new u.Color().fromArray(e.DiffuseColor.value),u.SRGBColorSpace)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=u.ColorManagement.colorSpaceToWorking(new u.Color().fromArray(e.Emissive.value),u.SRGBColorSpace):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=u.ColorManagement.colorSpaceToWorking(new u.Color().fromArray(e.EmissiveColor.value),u.SRGBColorSpace)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),r.opacity=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0),(r.opacity===1||r.opacity===0)&&(r.opacity=e.Opacity?parseFloat(e.Opacity.value):null,r.opacity===null&&(r.opacity=1)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=u.ColorManagement.colorSpaceToWorking(new u.Color().fromArray(e.Specular.value),u.SRGBColorSpace):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=u.ColorManagement.colorSpaceToWorking(new u.Color().fromArray(e.SpecularColor.value),u.SRGBColorSpace));let i=this;return F.get(n).children.forEach(function(s){let o=s.relationship;switch(o){case"Bump":r.bumpMap=i.getTexture(t,s.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,s.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,s.ID),r.map!==void 0&&(r.map.colorSpace=u.SRGBColorSpace);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,s.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,s.ID),r.emissiveMap!==void 0&&(r.emissiveMap.colorSpace=u.SRGBColorSpace);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,s.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,s.ID),r.envMap!==void 0&&(r.envMap.mapping=u.EquirectangularReflectionMapping,r.envMap.colorSpace=u.SRGBColorSpace);break;case"SpecularColor":r.specularMap=i.getTexture(t,s.ID),r.specularMap!==void 0&&(r.specularMap.colorSpace=u.SRGBColorSpace);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,s.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",o);break}}),r}getTexture(e,t){return"LayeredTexture"in w.Objects&&t in w.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=F.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in w.Objects){let n=w.Objects.Deformer;for(let r in n){let i=n[r],s=F.get(parseInt(r));if(i.attrType==="Skin"){let o=this.parseSkeleton(s,n);o.ID=r,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=s.parents[0].ID,e[r]=o}else if(i.attrType==="BlendShape"){let o={id:r};o.rawTargets=this.parseMorphTargets(s,n),o.id=r,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=o}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(r){let i=t[r.ID];if(i.attrType!=="Cluster")return;let s={ID:r.ID,indices:[],weights:[],transformLink:new u.Matrix4().fromArray(i.TransformLink.a)};"Indexes"in i&&(s.indices=i.Indexes.a,s.weights=i.Weights.a),n.push(s)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){let n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r],s=t[i.ID],o={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if(s.attrType!=="BlendShapeChannel")return;o.geoID=F.get(parseInt(i.ID)).children.filter(function(c){return c.relationship===void 0})[0].ID,n.push(o)}return n}parseScene(e,t,n){M=new u.Group;let r=this.parseModels(e.skeletons,t,n),i=w.Objects.Model,s=this;r.forEach(function(l){let p=i[l.ID];s.setLookAtProperties(l,p),F.get(l.ID).parents.forEach(function(d){let m=r.get(d.ID);m!==void 0&&m.add(l)}),l.parent===null&&M.add(l)}),this.addGlobalSceneSettings(),M.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);let p=qe(l.userData.transformData);l.applyMatrix4(p),l.updateWorldMatrix()}});let o=this.parsePoseNodes(),c=new Set;for(let l in e.skeletons)e.skeletons[l].rawBones.forEach(function(p,g){let d=e.skeletons[l].bones[g];d&&c.add(d.ID)});let f=new u.Matrix4;M.traverse(function(l){if(l.isBone&&l.ID!==void 0&&!c.has(l.ID)){let p=o[l.ID];p!==void 0&&(l.parent?(f.copy(l.parent.matrixWorld).invert(),f.multiply(p)):f.copy(p),f.decompose(l.position,l.quaternion,l.scale),l.updateMatrix(),l.matrixWorld.copy(p))}}),this.bindSkeleton(e.skeletons,t,r);let h=new we(this.trimAnimationClips).parse();M.children.length===1&&M.children[0].isGroup&&(M.children[0].animations=h,Object.assign(M.children[0].userData,M.userData),M=M.children[0]),M.animations=h,"GlobalSettings"in w&&"UpAxis"in w.GlobalSettings&&w.GlobalSettings.UpAxis.value===2&&M.rotation.set(-Math.PI/2,0,0)}parseModels(e,t,n){let r=new Map,i=w.Objects.Model;for(let s in i){let o=parseInt(s),c=i[s],f=F.get(o),h=this.buildSkeleton(f,e,o,c.attrName);if(!h){switch(c.attrType){case"Camera":h=this.createCamera(f);break;case"Light":h=this.createLight(f);break;case"Mesh":h=this.createMesh(f,t,n);break;case"NurbsCurve":h=this.createCurve(f,t);break;case"LimbNode":case"Root":h=new u.Bone;break;default:h=new u.Group;break}h.name=c.attrName?u.PropertyBinding.sanitizeNodeName(c.attrName):"",h.userData.originalName=c.attrName,h.ID=o}this.getTransformData(h,c),r.set(o,h)}return r}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach(function(s){for(let o in t){let c=t[o];c.rawBones.forEach(function(f,h){if(f.ID===s.ID){let l=i;i=new u.Bone,i.matrixWorld.copy(f.transformLink),i.name=r?u.PropertyBinding.sanitizeNodeName(r):"",i.userData.originalName=r,i.ID=n,c.bones[h]=i,l!==null&&i.add(l)}})}}),i}createCamera(e){let t,n;if(e.children.forEach(function(r){let i=w.Objects.NodeAttribute[r.ID];i!==void 0&&(n=i)}),n===void 0)t=new u.Object3D;else{let r=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(r=1);let i=1;n.NearPlane!==void 0&&(i=n.NearPlane.value/1e3);let s=1e3;n.FarPlane!==void 0&&(s=n.FarPlane.value/1e3);let o=window.innerWidth,c=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(o=n.AspectWidth.value,c=n.AspectHeight.value);let f=o/c,h=45;n.FieldOfView!==void 0&&(h=n.FieldOfView.value);let l=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:t=new u.PerspectiveCamera(h,f,i,s),l!==null&&t.setFocalLength(l);break;case 1:t=new u.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new u.Object3D;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(r){let i=w.Objects.NodeAttribute[r.ID];i!==void 0&&(n=i)}),n===void 0)t=new u.Object3D;else{let r;n.LightType===void 0?r=0:r=n.LightType.value;let i=16777215;n.Color!==void 0&&(i=u.ColorManagement.colorSpaceToWorking(new u.Color().fromArray(n.Color.value),u.SRGBColorSpace));let s=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(s=0);let o=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?o=0:o=n.FarAttenuationEnd.value);let c=1;switch(r){case 0:t=new u.PointLight(i,s,o,c);break;case 1:t=new u.DirectionalLight(i,s);break;case 2:let f=Math.PI/3,h=0;n.OuterAngle!==void 0?(f=u.MathUtils.degToRad(n.OuterAngle.value),n.InnerAngle!==void 0&&(h=1-n.InnerAngle.value/n.OuterAngle.value,h=Math.max(0,h))):n.InnerAngle!==void 0&&(f=u.MathUtils.degToRad(n.InnerAngle.value)),t=new u.SpotLight(i,s,o,f,h,c);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new u.PointLight(i,s);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let r,i=null,s=null,o=[];if(e.children.forEach(function(c){t.has(c.ID)&&(i=t.get(c.ID)),n.has(c.ID)&&o.push(n.get(c.ID))}),o.length>1?s=o:o.length>0?s=o[0]:(s=new u.MeshPhongMaterial({name:u.Loader.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(s)),"color"in i.attributes&&o.forEach(function(c){c.vertexColors=!0}),i.groups.length>0){let c=!1;for(let f=0,h=i.groups.length;f<h;f++){let l=i.groups[f];(l.materialIndex<0||l.materialIndex>=o.length)&&(l.materialIndex=o.length,c=!0)}if(c){let f=new u.MeshPhongMaterial;o.push(f)}}return i.FBX_Deformer?(r=new u.SkinnedMesh(i,s),r.normalizeSkinWeights()):r=new u.Mesh(i,s),r}createCurve(e,t){let n=e.children.reduce(function(i,s){return t.has(s.ID)&&(i=t.get(s.ID)),i},null),r=new u.LineBasicMaterial({name:u.Loader.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new u.Line(n,r)}getTransformData(e,t){let n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=_(t.RotationOrder.value):n.eulerOrder=_(0),"Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&F.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){let i=w.Objects.Model[r.ID];if("Lcl_Translation"in i){let s=i.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(s),M.add(e.target)):e.lookAt(new u.Vector3().fromArray(s))}}})}bindSkeleton(e,t,n){for(let r in e){let i=e[r],s=[];for(let c=0,f=i.bones.length;c<f;c++){let h=new u.Matrix4;i.bones[c]&&i.rawBones[c]&&h.copy(i.rawBones[c].transformLink).invert(),s.push(h)}F.get(parseInt(i.ID)).parents.forEach(function(c){if(t.has(c.ID)){let f=c.ID;F.get(f).parents.forEach(function(l){if(n.has(l.ID)){let p=n.get(l.ID);p.updateMatrixWorld(!0),p.bind(new u.Skeleton(i.bones,s),p.matrixWorld)}})}})}}parsePoseNodes(){let e={};if("Pose"in w.Objects){let t=w.Objects.Pose;for(let n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){let r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(i){e[i.Node]=new u.Matrix4().fromArray(i.Matrix.a)}):e[r.Node]=new u.Matrix4().fromArray(r.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in w){if("AmbientColor"in w.GlobalSettings){let e=w.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){let i=new u.Color().setRGB(t,n,r,u.SRGBColorSpace);M.add(new u.AmbientLight(i,1))}}"UnitScaleFactor"in w.GlobalSettings&&(M.userData.unitScaleFactor=w.GlobalSettings.UnitScaleFactor.value)}}},ye=class{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if("Geometry"in w.Objects){let n=w.Objects.Geometry;for(let r in n){let i=F.get(parseInt(r)),s=this.parseGeometry(i,n[r],e);t.set(parseInt(r),s)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){let r=n.skeletons,i=[],s=e.parents.map(function(l){return w.Objects.Model[l.ID]});if(s.length===0)return;let o=e.children.reduce(function(l,p){return r[p.ID]!==void 0&&(l=r[p.ID]),l},null);e.children.forEach(function(l){n.morphTargets[l.ID]!==void 0&&i.push(n.morphTargets[l.ID])});let c=s[0],f={};"RotationOrder"in c&&(f.eulerOrder=_(c.RotationOrder.value)),"InheritType"in c&&(f.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(f.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(f.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(f.scale=c.GeometricScaling.value);let h=qe(f);return this.genGeometry(t,o,i,h)}genGeometry(e,t,n,r){let i=new u.BufferGeometry;e.attrName&&(i.name=e.attrName);let s=this.parseGeoNode(e,t),o=this.genBuffers(s),c=new u.Float32BufferAttribute(o.vertex,3);if(c.applyMatrix4(r),i.setAttribute("position",c),o.colors.length>0&&i.setAttribute("color",new u.Float32BufferAttribute(o.colors,3)),t&&(i.setAttribute("skinIndex",new u.Uint16BufferAttribute(o.weightsIndices,4)),i.setAttribute("skinWeight",new u.Float32BufferAttribute(o.vertexWeights,4)),i.FBX_Deformer=t),o.normal.length>0){let f=new u.Matrix3().getNormalMatrix(r),h=new u.Float32BufferAttribute(o.normal,3);h.applyNormalMatrix(f),i.setAttribute("normal",h)}if(o.uvs.forEach(function(f,h){let l=h===0?"uv":`uv${h}`;i.setAttribute(l,new u.Float32BufferAttribute(o.uvs[h],2))}),s.material&&s.material.mappingType!=="AllSame"){let f=o.materialIndex[0],h=0;if(o.materialIndex.forEach(function(l,p){l!==f&&(i.addGroup(h,p-h,f),f=l,h=p)}),i.groups.length>0){let l=i.groups[i.groups.length-1],p=l.start+l.count;p!==o.materialIndex.length&&i.addGroup(p,o.materialIndex.length-p,f)}i.groups.length===0&&i.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&e.LayerElementColor[0].Colors&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,i){r.indices.forEach(function(s,o){n.weightTable[s]===void 0&&(n.weightTable[s]=[]),n.weightTable[s].push({id:i,weight:r.weights[o]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,s=[],o=[],c=[],f=[],h=[],l=[],p=this;return e.vertexIndices.forEach(function(g,d){let m,v=!1;g<0&&(g=g^-1,v=!0);let x=[],T=[];if(s.push(g*3,g*3+1,g*3+2),e.color){let y=ne(d,n,g,e.color);c.push(y[0],y[1],y[2])}if(e.skeleton){if(e.weightTable[g]!==void 0&&e.weightTable[g].forEach(function(y){T.push(y.weight),x.push(y.id)}),T.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);let y=[0,0,0,0],I=[0,0,0,0];T.forEach(function(E,b){let C=E,D=x[b];I.forEach(function(R,z,S){if(C>R){S[z]=C,C=R;let G=y[z];y[z]=D,D=G}})}),x=y,T=I}for(;T.length<4;)T.push(0),x.push(0);for(let y=0;y<4;++y)h.push(T[y]),l.push(x[y])}if(e.normal){let y=ne(d,n,g,e.normal);o.push(y[0],y[1],y[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=ne(d,n,g,e.material)[0],m<0&&(p.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(y,I){let E=ne(d,n,g,y);f[I]===void 0&&(f[I]=[]),f[I].push(E[0]),f[I].push(E[1])}),r++,v&&(p.genFace(t,e,s,m,o,c,f,h,l,r),n++,r=0,s=[],o=[],c=[],f=[],h=[],l=[])}),t}getNormalNewell(e){let t=new u.Vector3(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t.x+=(r.y-i.y)*(r.z+i.z),t.y+=(r.z-i.z)*(r.x+i.x),t.z+=(r.x-i.x)*(r.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),r=(Math.abs(t.z)>.5?new u.Vector3(0,1,0):new u.Vector3(0,0,1)).cross(t).normalize(),i=t.clone().cross(r).normalize();return{normal:t,tangent:r,bitangent:i}}flattenVertex(e,t,n){return new u.Vector2(e.dot(t),e.dot(n))}genFace(e,t,n,r,i,s,o,c,f,h){let l;if(h>3){let p=[],g=t.baseVertexPositions||t.vertexPositions;for(let x=0;x<n.length;x+=3)p.push(new u.Vector3(g[n[x]],g[n[x+1]],g[n[x+2]]));let{tangent:d,bitangent:m}=this.getNormalTangentAndBitangent(p),v=[];for(let x of p)v.push(this.flattenVertex(x,d,m));l=u.ShapeUtils.triangulateShape(v,[])}else l=[[0,1,2]];for(let[p,g,d]of l)e.vertex.push(t.vertexPositions[n[p*3]]),e.vertex.push(t.vertexPositions[n[p*3+1]]),e.vertex.push(t.vertexPositions[n[p*3+2]]),e.vertex.push(t.vertexPositions[n[g*3]]),e.vertex.push(t.vertexPositions[n[g*3+1]]),e.vertex.push(t.vertexPositions[n[g*3+2]]),e.vertex.push(t.vertexPositions[n[d*3]]),e.vertex.push(t.vertexPositions[n[d*3+1]]),e.vertex.push(t.vertexPositions[n[d*3+2]]),t.skeleton&&(e.vertexWeights.push(c[p*4]),e.vertexWeights.push(c[p*4+1]),e.vertexWeights.push(c[p*4+2]),e.vertexWeights.push(c[p*4+3]),e.vertexWeights.push(c[g*4]),e.vertexWeights.push(c[g*4+1]),e.vertexWeights.push(c[g*4+2]),e.vertexWeights.push(c[g*4+3]),e.vertexWeights.push(c[d*4]),e.vertexWeights.push(c[d*4+1]),e.vertexWeights.push(c[d*4+2]),e.vertexWeights.push(c[d*4+3]),e.weightsIndices.push(f[p*4]),e.weightsIndices.push(f[p*4+1]),e.weightsIndices.push(f[p*4+2]),e.weightsIndices.push(f[p*4+3]),e.weightsIndices.push(f[g*4]),e.weightsIndices.push(f[g*4+1]),e.weightsIndices.push(f[g*4+2]),e.weightsIndices.push(f[g*4+3]),e.weightsIndices.push(f[d*4]),e.weightsIndices.push(f[d*4+1]),e.weightsIndices.push(f[d*4+2]),e.weightsIndices.push(f[d*4+3])),t.color&&(e.colors.push(s[p*3]),e.colors.push(s[p*3+1]),e.colors.push(s[p*3+2]),e.colors.push(s[g*3]),e.colors.push(s[g*3+1]),e.colors.push(s[g*3+2]),e.colors.push(s[d*3]),e.colors.push(s[d*3+1]),e.colors.push(s[d*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[p*3]),e.normal.push(i[p*3+1]),e.normal.push(i[p*3+2]),e.normal.push(i[g*3]),e.normal.push(i[g*3+1]),e.normal.push(i[g*3+2]),e.normal.push(i[d*3]),e.normal.push(i[d*3+1]),e.normal.push(i[d*3+2])),t.uv&&t.uv.forEach(function(m,v){e.uvs[v]===void 0&&(e.uvs[v]=[]),e.uvs[v].push(o[v][p*2]),e.uvs[v].push(o[v][p*2+1]),e.uvs[v].push(o[v][g*2]),e.uvs[v].push(o[v][g*2+1]),e.uvs[v].push(o[v][d*2]),e.uvs[v].push(o[v][d*2+1])})}addMorphTargets(e,t,n,r){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];let i=r.clone().setPosition(0,0,0),s=this;n.forEach(function(o){o.rawTargets.forEach(function(c){let f=w.Objects.Geometry[c.geoID];f!==void 0&&s.genMorphGeometry(e,t,f,i,c.name)})})}genMorphGeometry(e,t,n,r,i){let s=t.Vertices!==void 0?t.Vertices.a:[],o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],c=n.Vertices!==void 0?n.Vertices.a:[],f=n.Indexes!==void 0?n.Indexes.a:[],h=e.attributes.position.count*3,l=new Float32Array(h);for(let m=0;m<f.length;m++){let v=f[m]*3;l[v]=c[m*3],l[v+1]=c[m*3+1],l[v+2]=c[m*3+2]}let p={vertexIndices:o,vertexPositions:l,baseVertexPositions:s},g=this.genBuffers(p),d=new u.Float32BufferAttribute(g.vertex,3);d.name=i||n.attrName,d.applyMatrix4(r),e.morphAttributes.position.push(d)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n==="IndexToDirect"&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n==="IndexToDirect"&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];n==="IndexToDirect"&&(i=e.ColorIndex.a);for(let s=0,o=new u.Color;s<r.length;s+=4)o.fromArray(r,s),u.ColorManagement.colorSpaceToWorking(o,u.SRGBColorSpace),o.toArray(r,s);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};let r=e.Materials.a,i=[];for(let s=0;s<r.length;++s)i.push(s);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new u.BufferGeometry;let n=t-1,r=e.KnotVector.a,i=[],s=e.Points.a;for(let l=0,p=s.length;l<p;l+=4)i.push(new u.Vector4().fromArray(s,l));let o,c;if(e.Form==="Closed")i.push(i[0]);else if(e.Form==="Periodic"){o=n,c=r.length-1-o;for(let l=0;l<n;++l)i.push(i[l])}let h=new te(n,r,i,o,c).getPoints(i.length*12);return new u.BufferGeometry().setFromPoints(h)}},we=class{constructor(e){this.trimAnimationClips=e}parse(){let e=[],t=this.parseClips();if(t!==void 0)for(let n in t){let r=t[n],i=this.addClip(r);e.push(i)}return e}parseClips(){if(w.Objects.AnimationCurve===void 0)return;let e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);let t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){let e=w.Objects.AnimationCurveNode,t=new Map;for(let n in e){let r=e[n];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let i={id:r.id,attr:r.attrName,curves:{}};t.set(i.id,i)}}return t}parseAnimationCurves(e){let t=w.Objects.AnimationCurve;for(let n in t){let r={id:t[n].id,times:t[n].KeyTime.a.map(ge),values:t[n].KeyValueFloat.a},i=F.get(r.id);if(i!==void 0){let s=i.parents[0].ID,o=i.parents[0].relationship;o.match(/X/)?e.get(s).curves.x=r:o.match(/Y/)?e.get(s).curves.y=r:o.match(/Z/)?e.get(s).curves.z=r:o.match(/DeformPercent/)&&e.has(s)&&(e.get(s).curves.morph=r)}}}parseAnimationLayers(e){let t=w.Objects.AnimationLayer,n=new Map;for(let r in t){let i=[],s=F.get(parseInt(r));s!==void 0&&(s.children.forEach(function(c,f){if(e.has(c.ID)){let h=e.get(c.ID);if(h.curves.x!==void 0||h.curves.y!==void 0||h.curves.z!==void 0){if(i[f]===void 0){let l=F.get(c.ID).parents.filter(function(g){return g.relationship!==void 0});if(l.length===0)return;let p=l[0].ID;if(p!==void 0){let g=w.Objects.Model[p.toString()];if(g===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",c);return}let d={modelName:g.attrName?u.PropertyBinding.sanitizeNodeName(g.attrName):"",ID:g.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};M.traverse(function(m){m.ID===g.id&&(d.transform=m.matrix,m.userData.transformData&&(d.eulerOrder=m.userData.transformData.eulerOrder,m.userData.transformData.rotation&&(d.initialRotation=m.userData.transformData.rotation)))}),d.transform||(d.transform=new u.Matrix4),"PreRotation"in g&&(d.preRotation=g.PreRotation.value),"PostRotation"in g&&(d.postRotation=g.PostRotation.value),i[f]=d}}i[f]&&(i[f][h.attr]=h)}else if(h.curves.morph!==void 0){if(i[f]===void 0){let l=F.get(c.ID).parents.filter(function(T){return T.relationship!==void 0});if(l.length===0)return;let p=l[0].ID,g=F.get(p).parents[0].ID,d=F.get(g).parents[0].ID,m=F.get(d).parents[0].ID,v=w.Objects.Model[m],x={modelName:v.attrName?u.PropertyBinding.sanitizeNodeName(v.attrName):"",morphName:w.Objects.Deformer[p].attrName};i[f]=x}i[f][h.attr]=h}}}),n.set(parseInt(r),i))}return n}parseAnimStacks(e){let t=w.Objects.AnimationStack,n={};for(let r in t){let i=F.get(parseInt(r)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");let s=e.get(i[0].ID),o=t[r];n[r]={name:o.attrName,layer:s,localStart:o.LocalStart!==void 0?ge(Number(o.LocalStart.value)):0,localStop:o.LocalStop!==void 0?ge(Number(o.LocalStop.value)):0}}return n}addClip(e){let t=[],n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),this.trimAnimationClips===!0&&e.localStop>e.localStart&&(t=this.trimTracks(t,e.localStart,e.localStop)),new u.AnimationClip(e.name,-1,t)}trimTracks(e,t,n){let r=Math.fround(t),i=Math.fround(n),s=[];for(let o=0;o<e.length;o++){let c=e[o],f=c.getValueSize(),h=[],l=[];for(let p=0;p<c.times.length;p++){let g=c.times[p];if(!(g<r||g>i)){h.push(g-r);for(let d=0;d<f;d++)l.push(c.values[p*f+d])}}h.length!==0&&(c.times=new Float32Array(h),c.values=new Float32Array(l),s.push(c))}return s}generateTracks(e){let t=[],n=new u.Vector3,r=new u.Vector3;if(e.transform&&e.transform.decompose(n,new u.Quaternion,r),n=n.toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){let i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let i=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder,e.initialRotation);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let i=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){let i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(i,t,n);return new u.VectorKeyframeTrack(e+"."+r,i,s)}generateRotationTrack(e,t,n,r,i,s){let o,c;if(t.x!==void 0||t.y!==void 0||t.z!==void 0){let g=this.getTimesForAllAxes(t);if(g.length>0){let d=s||[0,0,0],m=this.synchronizeCurve(t.x,g,d[0]),v=this.synchronizeCurve(t.y,g,d[1]),x=this.synchronizeCurve(t.z,g,d[2]),T=this.interpolateRotations(m,v,x,i);o=T[0],c=T[1]}}let f=_(0);n!==void 0&&(n=n.map(u.MathUtils.degToRad),n.push(f),n=new u.Euler().fromArray(n),n=new u.Quaternion().setFromEuler(n)),r!==void 0&&(r=r.map(u.MathUtils.degToRad),r.push(f),r=new u.Euler().fromArray(r),r=new u.Quaternion().setFromEuler(r).invert());let h=new u.Quaternion,l=new u.Euler,p=[];if(!(!c||!o)){for(let g=0;g<c.length;g+=3)l.set(c[g],c[g+1],c[g+2],i),h.setFromEuler(l),n!==void 0&&h.premultiply(n),r!==void 0&&h.multiply(r),g>2&&new u.Quaternion().fromArray(p,(g-3)/3*4).dot(h)<0&&h.set(-h.x,-h.y,-h.z,-h.w),h.toArray(p,g/3*4);return new u.QuaternionKeyframeTrack(e+".quaternion",o,p)}}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,n=t.values.map(function(i){return i/100}),r=M.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new u.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,r){return n-r}),t.length>1){let n=1,r=t[0];for(let i=1;i<t.length;i++){let s=t[i];s!==r&&(t[n]=s,r=s,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],s=-1,o=-1,c=-1;return e.forEach(function(f){if(t.x&&(s=t.x.times.indexOf(f)),t.y&&(o=t.y.times.indexOf(f)),t.z&&(c=t.z.times.indexOf(f)),s!==-1){let h=t.x.values[s];i.push(h),r[0]=h}else i.push(r[0]);if(o!==-1){let h=t.y.values[o];i.push(h),r[1]=h}else i.push(r[1]);if(c!==-1){let h=t.z.values[c];i.push(h),r[2]=h}else i.push(r[2])}),i}synchronizeCurve(e,t,n){if(e===void 0)return{times:t,values:t.map(()=>n)};if(e.times.length===t.length)return e;let r=[];for(let i=0;i<t.length;i++)r.push(this.sampleCurveValue(e,t[i],n));return{times:t,values:r}}sampleCurveValue(e,t,n){let r=e.times,i=e.values;if(t<=r[0])return i[0];if(t>=r[r.length-1])return i[i.length-1];for(let s=0;s<r.length-1;s++)if(t>=r[s]&&t<=r[s+1]){if(r[s]===t)return i[s];let o=(t-r[s])/(r[s+1]-r[s]);return i[s]*(1-o)+i[s+1]*o}return n}interpolateRotations(e,t,n,r){let i=[],s=[];i.push(e.times[0]),s.push(u.MathUtils.degToRad(e.values[0])),s.push(u.MathUtils.degToRad(t.values[0])),s.push(u.MathUtils.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){let c=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))continue;let f=c.map(u.MathUtils.degToRad),h=[e.values[o],t.values[o],n.values[o]];if(isNaN(h[0])||isNaN(h[1])||isNaN(h[2]))continue;let l=h.map(u.MathUtils.degToRad),p=[h[0]-c[0],h[1]-c[1],h[2]-c[2]],g=[Math.abs(p[0]),Math.abs(p[1]),Math.abs(p[2])];if(g[0]>=180||g[1]>=180||g[2]>=180){let m=Math.max(...g)/180,v=new u.Euler(...f,r),x=new u.Euler(...l,r),T=new u.Quaternion().setFromEuler(v),y=new u.Quaternion().setFromEuler(x);T.dot(y)<0&&y.set(-y.x,-y.y,-y.z,-y.w);let I=e.times[o-1],E=e.times[o]-I,b=new u.Quaternion,C=new u.Euler;for(let D=0;D<1;D+=1/m)b.copy(T.clone().slerp(y.clone(),D)),i.push(I+D*E),C.setFromQuaternion(b,r),s.push(C.x),s.push(C.y),s.push(C.z)}else i.push(e.times[o]),s.push(u.MathUtils.degToRad(e.values[o])),s.push(u.MathUtils.degToRad(t.values[o])),s.push(u.MathUtils.degToRad(n.values[o]))}return[i,s]}},xe=class{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new ie,this.nodeStack=[],this.currentProp=[],this.currentPropName="";let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(r,i){let s=r.match(/^[\s\t]*;/),o=r.match(/^[\s\t]*$/);if(s||o)return;let c=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),f=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),h=r.match("^\\t{"+(t.currentIndent-1)+"}}");c?t.parseNodeBegin(r,c):f?t.parseNodeProperty(r,f,n[++i]):h?t.popStack():r.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),i={name:n},s=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n==="PoseNode"?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),s.id!==""&&(o[n][s.id]=i)):typeof s.id=="number"?(o[n]={},o[n][s.id]=i):n!=="Properties70"&&(n==="PoseNode"?o[n]=[i]:o[n]=i),typeof s.id=="number"&&(i.id=s.id),s.name!==""&&(i.attrName=s.name),s.type!==""&&(i.attrType=s.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&i===","&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());let s=this.getCurrentNode();if(s.name==="Properties70"){this.parseNodeSpecialProperty(e,r,i);return}if(r==="C"){let c=i.split(",").slice(1),f=parseInt(c[0]),h=parseInt(c[1]),l=i.split(",").slice(3);l=l.map(function(p){return p.trim().replace(/^"/,"")}),r="connections",i=[f,h],Vt(i,l),s[r]===void 0&&(s[r]=[])}r==="Node"&&(s.id=i),r in s&&Array.isArray(s[r])?s[r].push(i):r!=="a"?s[r]=i:s.a=i,this.setCurrentProp(s,r),r==="a"&&i.slice(-1)!==","&&(s.a=me(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=me(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split('",').map(function(h){return h.trim().replace(/^\"/,"").replace(/\s/,"_")}),i=r[0],s=r[1],o=r[2],c=r[3],f=r[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=me(f);break}this.getPrevNode()[i]={type:s,type2:o,flag:c,value:f},this.setCurrentProp(this.getPrevNode(),i)}},Ae=class{parse(e){let t=new re(e);t.skip(23);let n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);let r=new ie;for(;!this.endOfContent(t);){let i=this.parseNode(t,n);i!==null&&r.add(i.name,i)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let s=e.getUint8(),o=e.getString(s);if(r===0)return null;let c=[];for(let p=0;p<i;p++)c.push(this.parseProperty(e));let f=c.length>0?c[0]:"",h=c.length>1?c[1]:"",l=c.length>2?c[2]:"";for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let p=this.parseNode(e,t);p!==null&&this.parseSubNode(o,n,p)}return n.propertyList=c,typeof f=="number"&&(n.id=f),h!==""&&(n.attrName=h),l!==""&&(n.attrType=l),o!==""&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){let r=[];n.propertyList.forEach(function(i,s){s!==0&&r.push(i)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(i){t[i]=n[i]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],i=n.propertyList[1],s=n.propertyList[2],o=n.propertyList[3],c;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),i==="Color"||i==="ColorRGB"||i==="Vector"||i==="Vector3D"||i.indexOf("Lcl_")===0?c=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:c=n.propertyList[4],t[r]={type:i,type2:s,flag:o,value:c}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":let r=e.getUint32(),i=e.getUint32(),s=e.getUint32();if(i===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}let o=He(new Uint8Array(e.getArrayBuffer(s))),c=new re(o.buffer);switch(t){case"b":case"c":return c.getBooleanArray(r);case"d":return c.getFloat64Array(r);case"f":return c.getFloat32Array(r);case"i":return c.getInt32Array(r);case"l":return c.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},re=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},ie=class{add(e,t){this[e]=t}};function zt(a){let e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Qe(a,0,e.length)}function Ot(a){let e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],t=0;function n(r){let i=a[r-1];return a=a.slice(t+r),t++,i}for(let r=0;r<e.length;++r)if(n(1)===e[r])return!1;return!0}function $e(a){let e=/FBXVersion: (\d+)/,t=a.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ge(a){return a/46186158e3}var Ut=[];function ne(a,e,t,n){let r;switch(n.mappingType){case"ByPolygonVertex":r=a;break;case"ByPolygon":r=e;break;case"ByVertice":r=t;break;case"AllSame":r=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(r=n.indices[r]);let i=r*n.dataSize,s=i+n.dataSize;return jt(Ut,n.buffer,i,s)}var de=new u.Euler,K=new u.Vector3;function qe(a){let e=new u.Matrix4,t=new u.Matrix4,n=new u.Matrix4,r=new u.Matrix4,i=new u.Matrix4,s=new u.Matrix4,o=new u.Matrix4,c=new u.Matrix4,f=new u.Matrix4,h=new u.Matrix4,l=new u.Matrix4,p=new u.Matrix4,g=a.inheritType?a.inheritType:0;a.translation&&e.setPosition(K.fromArray(a.translation));let d=_(0);if(a.preRotation){let S=a.preRotation.map(u.MathUtils.degToRad);S.push(d),t.makeRotationFromEuler(de.fromArray(S))}if(a.rotation){let S=a.rotation.map(u.MathUtils.degToRad);S.push(a.eulerOrder||d),n.makeRotationFromEuler(de.fromArray(S))}if(a.postRotation){let S=a.postRotation.map(u.MathUtils.degToRad);S.push(d),r.makeRotationFromEuler(de.fromArray(S)),r.invert()}a.scale&&i.scale(K.fromArray(a.scale)),a.scalingOffset&&o.setPosition(K.fromArray(a.scalingOffset)),a.scalingPivot&&s.setPosition(K.fromArray(a.scalingPivot)),a.rotationOffset&&c.setPosition(K.fromArray(a.rotationOffset)),a.rotationPivot&&f.setPosition(K.fromArray(a.rotationPivot)),a.parentMatrixWorld&&(l.copy(a.parentMatrix),h.copy(a.parentMatrixWorld));let m=t.clone().multiply(n).multiply(r),v=new u.Matrix4;v.extractRotation(h);let x=new u.Matrix4;x.copyPosition(h);let T=x.clone().invert().multiply(h),y=v.clone().invert().multiply(T),I=i,E=new u.Matrix4;if(g===0)E.copy(v).multiply(m).multiply(y).multiply(I);else if(g===1)E.copy(v).multiply(y).multiply(m).multiply(I);else{let G=new u.Matrix4().scale(new u.Vector3().setFromMatrixScale(l)).clone().invert(),se=y.clone().multiply(G);E.copy(v).multiply(m).multiply(se).multiply(I)}let b=f.clone().invert(),C=s.clone().invert(),D=e.clone().multiply(c).multiply(f).multiply(t).multiply(n).multiply(r).multiply(b).multiply(o).multiply(s).multiply(i).multiply(C),R=new u.Matrix4().copyPosition(D),z=h.clone().multiply(R);return p.copyPosition(z),D=p.clone().multiply(E),D.premultiply(h.invert()),D}function _(a){a=a||0;let e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return a===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[a]}function me(a){return a.split(",").map(function(t){return parseFloat(t)})}function Qe(a,e,t){return e===void 0&&(e=0),t===void 0&&(t=a.byteLength),new TextDecoder().decode(new Uint8Array(a,e,t))}function Vt(a,e){for(let t=0,n=a.length,r=e.length;t<r;t++,n++)a[n]=e[t]}function jt(a,e,t,n){for(let r=t,i=0;r<n;r++,i++)a[i]=e[r];return a}var P=require("three");function Je(a){let e=globalThis.__DSH3DV_REQUIRE__;return e===void 0||typeof e.async!="function"?Promise.reject(new Error("The DSH module loader is unavailable for 3D format chunks.")):e.async(a)}var Gt=/^(?!data:|blob:|https?:|file:|\/\/).+$/i,Wt=5e3,Xt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4////fwAJ+wP9KobjigAAAABJRU5ErkJggg==",Ht=new P.ImageLoader(new P.LoadingManager),Te=new Map;function Kt(a){let e=String(a).split(/[?#]/,1)[0].toLowerCase();return e.endsWith(".tga")?"tga":e.endsWith(".exr")?"exr":e.endsWith(".hdr")?"hdr":null}function Nt(a){let e=`./client.tex-${a}.js`,t=Te.get(e);return t===void 0&&(t=Je(e),Te.set(e,t),t.catch(()=>Te.delete(e))),t}async function Zt(a,e){let r=(await Nt(a))[{tga:"decodeTga",exr:"decodeExr",hdr:"decodeHdr"}[a]];if(typeof r!="function")throw new Error(`The ${a.toUpperCase()} decoder chunk is unavailable.`);return r(Z(e))}function $t(a,e){let t=e.userData?.dsh3dHdr===!0,n=a.colorSpace;a.image=e.image,a.mipmaps=e.mipmaps,a.mapping=e.mapping,a.channel=e.channel,a.format=e.format,a.internalFormat=e.internalFormat,a.type=e.type,a.colorSpace=t?e.colorSpace:n,a.flipY=e.flipY,a.unpackAlignment=e.unpackAlignment,a.minFilter=e.minFilter,a.magFilter=e.magFilter,a.generateMipmaps=e.generateMipmaps,a.anisotropy=e.anisotropy,a.userData={...e.userData},a.needsUpdate=!0,e.dispose()}async function Yt(a,e){let t=await a(e);if(t!==void 0&&t.ok===!0)return t;let n=String(e).replaceAll("\\","/");if(!ke.test(n))return t;let r=n.slice(n.lastIndexOf("/")+1);return r===""||r===n?t:a(r)}function _e(a,e,t){return new Promise((n,r)=>{if(t?.aborted===!0){r(j("Texture loading was cancelled."));return}Ht.load(e,i=>{a.image=i,a.needsUpdate=!0,n()},void 0,r)})}var Se=class extends P.Loader{constructor(e,t){super(e),this.readFile=t.readFile,this.signal=t.signal,this.onWarn=t.onWarn,this.pending=t.pending,this.blobUrls=t.blobUrls,this.listeners=t.listeners,this.disposed=t.isDisposed}load(e,t,n,r){let i=Le(e)?ue(e):null,s=i===null?null:Kt(i),o=s===null?new P.Texture:new P.DataTexture(new Uint8Array([255,255,255,255]),1,1,P.RGBAFormat,P.UnsignedByteType);o.name=e;let c=(async()=>{let f=null;try{if(this.signal?.aborted===!0||this.disposed?.()===!0)throw j("Texture loading was cancelled.");let h=e;if(i!==null){let l=i,p=await Yt(this.readFile,l);if(p===void 0||p.ok!==!0)throw new Error(p?.error?.message??`Could not read texture ${e}`);if(this.signal?.aborted===!0||this.disposed?.()===!0)throw j("Texture loading was cancelled.");if(s!==null){let g=await Zt(s,p.value.data);if(this.signal?.aborted===!0||this.disposed?.()===!0)throw g.dispose(),j("Texture loading was cancelled.");$t(o,g),t?.(o);return}f=URL.createObjectURL(new Blob([p.value.data],{type:Be(l)})),this.blobUrls.add(f),h=f}await _e(o,h,this.signal),t?.(o)}catch(h){if(f!==null&&this.blobUrls.has(f)&&(URL.revokeObjectURL(f),this.blobUrls.delete(f)),this.signal?.aborted!==!0&&this.disposed?.()!==!0){if(this.onWarn?.(`[dsh-3d-viewer] Could not load texture "${e}": ${String(h)}`),s!==null)o.image={data:new Uint8Array([255,255,255,255]),width:1,height:1},o.needsUpdate=!0;else try{await _e(o,Xt,this.signal)}catch{}t?.(o),r?.(h)}}finally{for(let h of this.listeners)try{h(o)}catch{}}})();return this.pending.add(c),c.then(()=>this.pending.delete(c),()=>this.pending.delete(c)),o}};function et({readFile:a,signal:e,onWarn:t=$}){let n=new Set,r=new Set,i=new Set,s=!1,o=new P.LoadingManager,c=new Se(o,{readFile:a,signal:e,onWarn:t,pending:n,blobUrls:r,listeners:i,isDisposed:()=>s});o.addHandler(Gt,c);async function f(p=Wt){if(n.size===0||e?.aborted===!0)return;let g,d,m=new Promise(x=>{g=setTimeout(x,p)}),v=new Promise(x=>{d=x,e?.addEventListener("abort",x,{once:!0})});try{await Promise.race([Promise.allSettled([...n]),m,v])}finally{clearTimeout(g),e?.removeEventListener("abort",d)}}function h(p){return i.add(p),()=>i.delete(p)}function l(){if(!s){s=!0;for(let p of r)P.Cache.remove(`image:${p}`),URL.revokeObjectURL(p);r.clear(),i.clear()}}return{manager:o,settle:f,onTextureLoad:h,dispose:l}}function qt(a){let e=new J;return e.manager.onError=t=>{$(`[dsh-3d-viewer] Could not load a referenced FBX texture: ${t}`)},e.parse(Z(a),"")}async function tt(a,e={}){let t=e.onWarn??$;if(typeof e.readWorkspaceFile!="function"||typeof e.resourceAddress!="string")return{object:qt(a),assets:null};let n=et({readFile:r=>e.readWorkspaceFile(e.resourceAddress,r,{signal:e.signal}),signal:e.signal,onWarn:t});try{let r=new J(n.manager);r.manager.onError=s=>{t(`[dsh-3d-viewer] Could not load a referenced FBX resource: ${s}`)};let i=r.parse(Z(a),"");if(await n.settle(),e.signal?.aborted===!0)throw n.dispose(),ze(i),j();return{object:i,assets:n}}catch(r){throw n.dispose(),r}}
|
|
11
|
+
})(localRequire, module, module.exports);
|
|
12
|
+
return module.exports;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! dsh-3d-viewer gltf loader chunk | bundles Three.js addons (MIT). See THIRD_PARTY_NOTICES.md. */
|
|
2
|
+
window.__ModuleLoader__.load({
|
|
3
|
+
id: "dsh-3d-viewer",
|
|
4
|
+
chunk: "client.gltf.js",
|
|
5
|
+
factory(require) {
|
|
6
|
+
var localRequire = (id) => id === 'three' ? globalThis.__DSH3DV_THREE__ : require(id);
|
|
7
|
+
var module = { exports: {} };
|
|
8
|
+
var exports = module.exports;
|
|
9
|
+
(function (require, module, exports) {
|
|
10
|
+
var W=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var je=(l,e)=>{for(var t in e)W(l,t,{get:e[t],enumerable:!0})},Ve=(l,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ge(e))!Ke.call(l,s)&&s!==t&&W(l,s,{get:()=>e[s],enumerable:!(n=ze(e,s))||n.enumerable});return l};var Xe=l=>Ve(W({},"__esModule",{value:!0}),l);var lt={};je(lt,{loadGltfModel:()=>De});module.exports=Xe(lt);var C=require("three");var a=require("three");var I=require("three");function q(l,e){if(e===I.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),l;if(e===I.TriangleFanDrawMode||e===I.TriangleStripDrawMode){let t=l.getIndex();if(t===null){let r=[],i=l.getAttribute("position");if(i!==void 0){for(let c=0;c<i.count;c++)r.push(c);l.setIndex(r),t=l.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),l}let n=t.count-2,s=[];if(e===I.TriangleFanDrawMode)for(let r=1;r<=n;r++)s.push(t.getX(0)),s.push(t.getX(r)),s.push(t.getX(r+1));else for(let r=0;r<n;r++)r%2===0?(s.push(t.getX(r)),s.push(t.getX(r+1)),s.push(t.getX(r+2))):(s.push(t.getX(r+2)),s.push(t.getX(r+1)),s.push(t.getX(r)));return s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),l.setIndex(s),l.clearGroups(),l}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),l}var k=require("three");function Le(l){let e=new Map,t=new Map,n=l.clone();return Ne(l,n,function(s,r){e.set(r,s),t.set(s,r)}),n.traverse(function(s){if(!s.isSkinnedMesh)return;let r=s,i=e.get(s),c=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=c.map(function(o){return t.get(o)}),r.bind(r.skeleton,r.bindMatrix)}),n}function Ne(l,e,t){t(l,e);for(let n=0;n<l.children.length;n++)Ne(l.children[n],e.children[n],t)}var z=class extends a.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new te(t)}),this.register(function(t){return new ne(t)}),this.register(function(t){return new se(t)}),this.register(function(t){return new de(t)}),this.register(function(t){return new he(t)}),this.register(function(t){return new pe(t)}),this.register(function(t){return new ie(t)}),this.register(function(t){return new oe(t)}),this.register(function(t){return new ae(t)}),this.register(function(t){return new ce(t)}),this.register(function(t){return new ee(t)}),this.register(function(t){return new ue(t)}),this.register(function(t){return new re(t)}),this.register(function(t){return new fe(t)}),this.register(function(t){return new le(t)}),this.register(function(t){return new Z(t)}),this.register(function(t){return new G(t,T.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new G(t,T.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new me(t)})}load(e,t,n,s){let r=this,i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){let u=a.LoaderUtils.extractUrlBase(e);i=a.LoaderUtils.resolveURL(u,this.path)}else i=a.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);let c=function(u){s?s(u):console.error(u),r.manager.itemError(e),r.manager.itemEnd(e)},o=new a.FileLoader(this.manager);o.setPriority(this.priority),o.setCache(this.cache),o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){try{r.parse(u,i,function(f){t(f),r.manager.itemEnd(e)},c)}catch(f){c(f)}},n,c)}setDRACOLoader(e){return this.dracoLoader=e,this}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,n,s){let r,i={},c={},o=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===Pe){try{i[T.KHR_BINARY_GLTF]=new ge(e)}catch(d){s&&s(d);return}r=JSON.parse(i[T.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let u=new Re(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,priority:this.priority,cache:this.cache,withCredentials:this.withCredentials,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){let d=this.pluginCallbacks[f](u);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[d.name]=d,i[d.name]=!0}if(r.extensionsUsed)for(let f=0;f<r.extensionsUsed.length;++f){let d=r.extensionsUsed[f],h=r.extensionsRequired||[];switch(d){case T.KHR_MATERIALS_UNLIT:i[d]=new Q;break;case T.KHR_DRACO_MESH_COMPRESSION:i[d]=new Te(r,this.dracoLoader);break;case T.KHR_TEXTURE_TRANSFORM:i[d]=new Ae;break;case T.KHR_MESH_QUANTIZATION:i[d]=new be;break;default:h.indexOf(d)>=0&&c[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(i),u.setPlugins(c),u.parse(n,s)}parseAsync(e,t){let n=this;return new Promise(function(s,r){n.parse(e,t,s,r)})}};function We(){let l={};return{get:function(e){return l[e]},add:function(e,t){l[e]=t},remove:function(e){delete l[e]},removeAll:function(){l={}}}}function M(l,e,t){let n=l.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}var T={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_DIFFUSE_ROUGHNESS:"KHR_materials_diffuse_roughness",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",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",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},Z=class{constructor(e){this.parser=e,this.name=T.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,s=t.cache.get(n);if(s)return s;let r=t.json,o=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],u,f=new a.Color(16777215);o.color!==void 0&&f.setRGB(o.color[0],o.color[1],o.color[2],a.LinearSRGBColorSpace);let d=o.range!==void 0?o.range:0;switch(o.type){case"directional":u=new a.DirectionalLight(f),u.target.position.set(0,0,-1),u.add(u.target);break;case"point":u=new a.PointLight(f),u.distance=d;break;case"spot":u=new a.SpotLight(f),u.distance=d,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,u.angle=o.spot.outerConeAngle,u.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,u.target.position.set(0,0,-1),u.add(u.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return u.position.set(0,0,0),N(u,o),o.intensity!==void 0&&(u.intensity=o.intensity),u.name=t.createUniqueName(o.name||"light_"+e),s=Promise.resolve(u),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],c=(r.extensions&&r.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(o){return n._getNodeRef(t.cache,c,o)})}},Q=class{constructor(){this.name=T.KHR_MATERIALS_UNLIT}getMaterialType(){return a.MeshBasicMaterial}extendParams(e,t,n){let s=[];e.color=new a.Color(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let i=r.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],a.LinearSRGBColorSpace),e.opacity=i[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",r.baseColorTexture,a.SRGBColorSpace))}return Promise.all(s)}},ee=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},te=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&s.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(s.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new a.Vector2(r,r)}return Promise.all(s)}},ne=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_DIFFUSE_ROUGHNESS}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return t.diffuseRoughness=n.diffuseRoughnessFactor!==void 0?n.diffuseRoughnessFactor:0,n.diffuseRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(t,"diffuseRoughnessMap",n.diffuseRoughnessTexture)),Promise.all(s)}},se=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_DISPERSION}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}},re=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&s.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessMinimum=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessMaximum=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&s.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(s)}},ie=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_SHEEN}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];if(t.sheenColor=new a.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],a.LinearSRGBColorSpace)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&s.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,a.SRGBColorSpace)),n.sheenRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(s)}},oe=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&s.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture)),Promise.all(s)}},ae=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_VOLUME}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&s.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new a.Color().setRGB(r[0],r[1],r[2],a.LinearSRGBColorSpace),Promise.all(s)}},ce=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_IOR}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);return n===null||(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}},ue=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_SPECULAR}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&s.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let r=n.specularColorFactor||[1,1,1];return t.specularColor=new a.Color().setRGB(r[0],r[1],r[2],a.LinearSRGBColorSpace),n.specularColorTexture!==void 0&&s.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,a.SRGBColorSpace)),Promise.all(s)}},le=class{constructor(e){this.parser=e,this.name=T.EXT_MATERIALS_BUMP}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&s.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture)),Promise.all(s)}},fe=class{constructor(e){this.parser=e,this.name=T.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return M(this.parser,e,this.name)!==null?a.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=M(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&s.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture)),Promise.all(s)}},de=class{constructor(e){this.parser=e,this.name=T.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;let r=s.extensions[this.name],i=t.options.ktx2Loader;if(!i){if(n.extensionsRequired&&n.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,i)}},he=class{constructor(e){this.parser=e,this.name=T.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;let i=r.extensions[t],c=s.images[i.source],o=n.textureLoader;if(c.uri){let u=n.options.manager.getHandler(c.uri);u!==null&&(o=u)}return n.loadTextureImage(e,i.source,o)}},pe=class{constructor(e){this.parser=e,this.name=T.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;let i=r.extensions[t],c=s.images[i.source],o=n.textureLoader;if(c.uri){let u=n.options.manager.getHandler(c.uri);u!==null&&(o=u)}return n.loadTextureImage(e,i.source,o)}},G=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.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(c){let o=s.byteOffset||0,u=s.byteLength||0,f=s.count,d=s.byteStride,h=new Uint8Array(c,o,u);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(f,d,h,s.mode,s.filter).then(function(p){return p.buffer}):i.ready.then(function(){let p=new ArrayBuffer(f*d);return i.decodeGltfBuffer(new Uint8Array(p),f,d,h,s.mode,s.filter),p})})}else return null}},me=class{constructor(e){this.name=T.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let s=t.meshes[n.mesh];for(let u of s.primitives)if(u.mode!==L.TRIANGLES&&u.mode!==L.TRIANGLE_STRIP&&u.mode!==L.TRIANGLE_FAN&&u.mode!==void 0)return null;let i=n.extensions[this.name].attributes,c=[],o={};for(let u in i)c.push(this.parser.getDependency("accessor",i[u]).then(f=>(o[u]=f,o[u])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(u=>{let f=u.pop(),d=f.isGroup?f.children:[f],h=u[0].count,p=[];for(let m of d){let A=new a.Matrix4,g=new a.Vector3,b=new a.Quaternion,w=new a.Vector3(1,1,1),R=new a.InstancedMesh(m.geometry,m.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&g.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&b.fromBufferAttribute(o.ROTATION,E),o.SCALE&&w.fromBufferAttribute(o.SCALE,E),R.setMatrixAt(E,A.compose(g,b,w));let x=null;for(let E in o)if(E==="_COLOR_0"){let S=o[E];R.instanceColor=new a.InstancedBufferAttribute(S.array,S.itemSize,S.normalized)}else if(E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"){if(x===null){let y=R.geometry;x=new a.BufferGeometry,x.name=y.name;for(let _ in y.attributes)x.setAttribute(_,y.attributes[_]);for(let _ in y.morphAttributes)x.morphAttributes[_]=y.morphAttributes[_];y.index!==null&&x.setIndex(y.index),x.morphTargetsRelative=y.morphTargetsRelative;for(let _ of y.groups)x.addGroup(_.start,_.count,_.materialIndex);y.boundingBox!==null&&(x.boundingBox=y.boundingBox.clone()),y.boundingSphere!==null&&(x.boundingSphere=y.boundingSphere.clone()),x.drawRange.start=y.drawRange.start,x.drawRange.count=y.drawRange.count,x.userData=Object.assign({},y.userData),R.geometry=x}let S=o[E];x.setAttribute(E,new a.InstancedBufferAttribute(S.array,S.itemSize,S.normalized))}a.Object3D.prototype.copy.call(R,m),this.parser.assignFinalMaterial(R),p.push(R)}return f.isGroup?(f.clear(),f.add(...p),f):p[0]}))}},Pe="glTF",H=12,Oe={JSON:1313821514,BIN:5130562},ge=class{constructor(e){this.name=T.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,H),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Pe)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let s=this.header.length-H,r=new DataView(e,H),i=0;for(;i<s;){let c=r.getUint32(i,!0);i+=4;let o=r.getUint32(i,!0);if(i+=4,o===Oe.JSON){let u=new Uint8Array(e,H+i,c);this.content=n.decode(u)}else if(o===Oe.BIN){let u=H+i;this.body=e.slice(u,u+c)}i+=c}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},Te=class{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=T.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,s=this.dracoLoader,r=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,c={},o={},u={};for(let f in i){let d=ye[f]||f.toLowerCase();c[d]=i[f]}for(let f in e.attributes){let d=ye[f]||f.toLowerCase();if(i[f]!==void 0){let h=n.accessors[e.attributes[f]],p=U[h.componentType];u[d]=p.name,o[d]=h.normalized===!0}}return t.getDependency("bufferView",r).then(function(f){return new Promise(function(d,h){s.decodeDracoFile(f,function(p){for(let m in p.attributes){let A=p.attributes[m],g=o[m];g!==void 0&&(A.normalized=g)}d(p)},c,u,a.LinearSRGBColorSpace,h)})})}},Ae=class{constructor(){this.name=T.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(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),t.rotation!==void 0){let n=Math.cos(e.rotation),s=Math.sin(e.rotation);e.matrix.set(e.repeat.x*n,e.repeat.y*s,e.offset.x,-e.repeat.x*s,e.repeat.y*n,e.offset.y,0,0,1),e.matrixAutoUpdate=!1}return e.needsUpdate=!0,e}},be=class{constructor(){this.name=T.KHR_MESH_QUANTIZATION}},K=class extends a.Interpolant{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let i=0;i!==s;i++)t[i]=n[r+i];return t}interpolate_(e,t,n,s){let r=this.resultBuffer,i=this.sampleValues,c=this.valueSize,o=c*2,u=c*3,f=s-t,d=(n-t)/f,h=d*d,p=h*d,m=e*u,A=m-u,g=-2*p+3*h,b=p-h,w=1-g,R=b-h+d;for(let x=0;x!==c;x++){let E=i[A+x+c],S=i[A+x+o]*f,y=i[m+x+c],_=i[m+x]*f;r[x]=w*E+R*S+g*y+b*_}return r}},qe=new a.Quaternion,xe=class extends K{interpolate_(e,t,n,s){let r=super.interpolate_(e,t,n,s);return qe.fromArray(r).normalize().toArray(r),r}},L={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},U={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ke={9728:a.NearestFilter,9729:a.LinearFilter,9984:a.NearestMipmapNearestFilter,9985:a.LinearMipmapNearestFilter,9986:a.NearestMipmapLinearFilter,9987:a.LinearMipmapLinearFilter},ve={33071:a.ClampToEdgeWrapping,33648:a.MirroredRepeatWrapping,10497:a.RepeatWrapping},Y={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ye={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"},v={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ye={CUBICSPLINE:void 0,LINEAR:a.InterpolateLinear,STEP:a.InterpolateDiscrete},$={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function $e(l){return l.DefaultMaterial===void 0&&(l.DefaultMaterial=new a.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:a.FrontSide})),l.DefaultMaterial}function P(l,e,t){for(let n in t.extensions)l[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function N(l,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(l.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Je(l,e,t){let n=!1,s=!1,r=!1;for(let u=0,f=e.length;u<f;u++){let d=e[u];if(d.POSITION!==void 0&&(n=!0),d.NORMAL!==void 0&&(s=!0),d.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(l);let i=[],c=[],o=[];for(let u=0,f=e.length;u<f;u++){let d=e[u];if(n){let h=d.POSITION!==void 0?t.getDependency("accessor",d.POSITION):l.attributes.position;i.push(h)}if(s){let h=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):l.attributes.normal;c.push(h)}if(r){let h=d.COLOR_0!==void 0?t.getDependency("accessor",d.COLOR_0):l.attributes.color;o.push(h)}}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(o)]).then(function(u){let f=u[0],d=u[1],h=u[2];return n&&(l.morphAttributes.position=f),s&&(l.morphAttributes.normal=d),r&&(l.morphAttributes.color=h),l.morphTargetsRelative=!0,l})}function Ze(l,e){if(l.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)l.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(l.morphTargetInfluences.length===t.length){l.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)l.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Qe(l){let e,t=l.extensions&&l.extensions[T.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+J(t.attributes):e=l.indices+":"+J(l.attributes)+":"+l.mode,l.targets!==void 0)for(let n=0,s=l.targets.length;n<s;n++)e+=":"+J(l.targets[n]);return e}function J(l){let e="",t=Object.keys(l).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+l[t[n]]+";";return e}function we(l){switch(l){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 et(l){return l.search(/\.jpe?g($|\?)/i)>0||l.search(/^data\:image\/jpeg/)===0?"image/jpeg":l.search(/\.webp($|\?)/i)>0||l.search(/^data\:image\/webp/)===0?"image/webp":l.search(/\.ktx2($|\?)/i)>0||l.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var tt=new a.Matrix4,Re=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new We,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 n=!1,s=-1,r=!1,i=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let c=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(c)===!0;let o=c.match(/Version\/(\d+)/);s=n&&o?parseInt(o[1],10):-1,r=c.indexOf("Firefox")>-1,i=r?c.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||r&&i<98?(this.textureLoader=new a.TextureLoader(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)):(this.textureLoader=new a.ImageBitmapLoader(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setWithCredentials(this.options.withCredentials),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new a.FileLoader(this.options.manager),this.fileLoader.setPriority(this.options.priority),this.fileLoader.setCache(this.options.cache),this.fileLoader.setResponseType("arraybuffer"),(this.options.withCredentials||this.options.crossOrigin==="use-credentials")&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(i){let c={scene:i[0][s.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:s.asset,parser:n,userData:{}};return P(r,c,s),N(c,s),Promise.all(n._invokeAll(function(o){return o.afterRoot&&o.afterRoot(c)})).then(function(){for(let o of c.scenes)o.updateMatrixWorld();e(c)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){let i=t[s].joints;for(let c=0,o=i.length;c<o;c++)e[i[c]].isBone=!0}for(let s=0,r=e.length;s<r;s++){let i=e[s];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(n[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.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,n){if(e.refs[t]<=1)return n;let s=n.clone(),r=(i,c)=>{let o=this.associations.get(i);o!=null&&this.associations.set(c,o);for(let[u,f]of i.children.entries())r(f,c.children[u])};return r(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let s=e(t[n]);if(s)return s}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let s=0;s<t.length;s++){let r=e(t[s]);r&&n.push(r)}return n}getDependency(e,t){let n=e+":"+t,s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(r,i){return n.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=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[T.KHR_BINARY_GLTF].body);let s=this.options;return new Promise(function(r,i){n.load(a.LoaderUtils.resolveURL(t.uri,s.path),r,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let s=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(e){let t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){let i=Y[s.type],c=U[s.componentType],o=s.normalized===!0,u=new c(s.count*i);return Promise.resolve(new a.BufferAttribute(u,i,o))}let r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(i){let c=i[0],o=Y[s.type],u=U[s.componentType],f=u.BYTES_PER_ELEMENT,d=f*o,h=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,m=s.normalized===!0,A,g;if(p&&p!==d){let b=Math.floor(h/p),w="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+b+":"+s.count,R=t.cache.get(w);R||(A=new u(c,b*p,s.count*p/f),R=new a.InterleavedBuffer(A,p/f),t.cache.add(w,R)),g=new a.InterleavedBufferAttribute(R,o,h%p/f,m)}else c===null?A=new u(s.count*o):A=new u(c,h,s.count*o),g=new a.BufferAttribute(A,o,m);if(s.sparse!==void 0){let b=Y.SCALAR,w=U[s.sparse.indices.componentType],R=s.sparse.indices.byteOffset||0,x=s.sparse.values.byteOffset||0,E=new w(i[1],R,s.sparse.count*b),S=new u(i[2],x,s.sparse.count*o);c!==null&&(g=new a.BufferAttribute(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let y=0,_=E.length;y<_;y++){let B=E[y];if(g.setX(B,S[y*o]),o>=2&&g.setY(B,S[y*o+1]),o>=3&&g.setZ(B,S[y*o+2]),o>=4&&g.setW(B,S[y*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=m}return g})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],c=this.textureLoader;if(i.uri){let o=n.manager.getHandler(i.uri);o!==null&&(c=o)}return this.loadTextureImage(e,r,c)}loadTextureImage(e,t,n){let s=this,r=this.json,i=r.textures[e],c=r.images[t],o=(c.uri||c.bufferView)+":"+i.sampler;if(this.textureCache[o])return this.textureCache[o];let u=this.loadImageSource(t,n).then(function(f){f.flipY=!1,f.name=i.name||c.name||"",f.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(f.name=c.uri);let h=(r.samplers||{})[i.sampler]||{};return f.magFilter=ke[h.magFilter]||a.LinearFilter,f.minFilter=ke[h.minFilter]||a.LinearMipmapLinearFilter,f.wrapS=ve[h.wrapS]||a.RepeatWrapping,f.wrapT=ve[h.wrapT]||a.RepeatWrapping,f.generateMipmaps=!f.isCompressedTexture&&f.minFilter!==a.NearestFilter&&f.minFilter!==a.LinearFilter,s.associations.set(f,{textures:e}),f}).catch(function(){return null});return this.textureCache[o]=u,u}loadImageSource(e,t){let n=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());let i=s.images[e],c=self.URL||self.webkitURL,o=i.uri||"",u=!1,f;if(t.isKTX2Loader===!0&&i.bufferView!==void 0)f=n.getDependency("bufferView",i.bufferView).then(function(h){return new Promise(function(p,m){t.parse(h,p,m)})});else{if(i.bufferView!==void 0)o=n.getDependency("bufferView",i.bufferView).then(function(h){u=!0;let p=new Blob([h],{type:i.mimeType});return o=c.createObjectURL(p),o});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");f=Promise.resolve(o).then(function(h){return new Promise(function(p,m){let A=p;t.isImageBitmapLoader===!0&&(A=function(g){let b=new a.Texture(g);b.needsUpdate=!0,p(b)}),t.load(a.LoaderUtils.resolveURL(h,r.path),A,void 0,m)})})}let d=f.then(function(h){return u===!0&&c.revokeObjectURL(o),N(h,i),h.userData.mimeType=i.mimeType||et(i.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),h});return this.sourceCache[e]=d,d}assignTexture(e,t,n,s){let r=this;return this.getDependency("texture",n.index).then(function(i){if(!i)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(i=i.clone(),i.channel=n.texCoord),r.extensions[T.KHR_TEXTURE_TRANSFORM]){let c=n.extensions!==void 0?n.extensions[T.KHR_TEXTURE_TRANSFORM]:void 0;if(c){let o=r.associations.get(i);i=r.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(i,c),r.associations.set(i,o)}}return s!==void 0&&(i.colorSpace=s),e[t]=i,i})}assignFinalMaterial(e){let t=e.geometry,n=e.material,s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,i=t.attributes.normal===void 0;if(e.isPoints){let c="PointsMaterial:"+n.uuid,o=this.cache.get(c);o||(o=new a.PointsMaterial,a.Material.prototype.copy.call(o,n),o.color.copy(n.color),o.map=n.map,o.sizeAttenuation=!1,this.cache.add(c,o)),n=o}else if(e.isLine){let c="LineBasicMaterial:"+n.uuid,o=this.cache.get(c);o||(o=new a.LineBasicMaterial,a.Material.prototype.copy.call(o,n),o.color.copy(n.color),o.map=n.map,this.cache.add(c,o)),n=o}if(s||r||i){let c="ClonedMaterial:"+n.uuid+":";s&&(c+="derivative-tangents:"),r&&(c+="vertex-colors:"),i&&(c+="flat-shading:");let o=this.cache.get(c);o||(o=n.clone(),r&&(o.vertexColors=!0),i&&(o.flatShading=!0),s&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(c,o),this.associations.set(o,this.associations.get(n))),n=o}e.material=n}getMaterialType(){return a.MeshStandardMaterial}loadMaterial(e){let t=this,n=this.json,s=this.extensions,r=n.materials[e],i,c={},o=r.extensions||{},u=[];if(o[T.KHR_MATERIALS_UNLIT]){let d=s[T.KHR_MATERIALS_UNLIT];i=d.getMaterialType(),u.push(d.extendParams(c,r,t))}else{let d=r.pbrMetallicRoughness||{};if(c.color=new a.Color(1,1,1),c.opacity=1,Array.isArray(d.baseColorFactor)){let h=d.baseColorFactor;c.color.setRGB(h[0],h[1],h[2],a.LinearSRGBColorSpace),c.opacity=h[3]}d.baseColorTexture!==void 0&&u.push(t.assignTexture(c,"map",d.baseColorTexture,a.SRGBColorSpace)),c.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,c.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(u.push(t.assignTexture(c,"metalnessMap",d.metallicRoughnessTexture)),u.push(t.assignTexture(c,"roughnessMap",d.metallicRoughnessTexture))),i=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,c)})))}r.doubleSided===!0&&(c.side=a.DoubleSide);let f=r.alphaMode||$.OPAQUE;if(f===$.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,f===$.MASK&&(c.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==a.MeshBasicMaterial&&(u.push(t.assignTexture(c,"normalMap",r.normalTexture)),c.normalScale=new a.Vector2(1,1),r.normalTexture.scale!==void 0)){let d=r.normalTexture.scale;c.normalScale.set(d,d)}if(r.occlusionTexture!==void 0&&i!==a.MeshBasicMaterial&&(u.push(t.assignTexture(c,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==a.MeshBasicMaterial){let d=r.emissiveFactor;c.emissive=new a.Color().setRGB(d[0],d[1],d[2],a.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&i!==a.MeshBasicMaterial&&u.push(t.assignTexture(c,"emissiveMap",r.emissiveTexture,a.SRGBColorSpace)),Promise.all(u).then(function(){let d=new i(c);return r.name&&(d.name=r.name),N(d,r),t.associations.set(d,{materials:e}),r.extensions&&P(s,d,r),d})}createUniqueName(e){let t=a.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,s=this.primitiveCache;function r(c){return n[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,t).then(function(o){return Ce(o,c,t)})}let i=[];for(let c=0,o=e.length;c<o;c++){let u=e[c],f=Qe(u),d=s[f];if(d)i.push(d.promise);else{let h;u.extensions&&u.extensions[T.KHR_DRACO_MESH_COMPRESSION]?h=r(u):h=Ce(new a.BufferGeometry,u,t),u.mode===L.TRIANGLE_STRIP?h=h.then(p=>q(p,a.TriangleStripDrawMode)):u.mode===L.TRIANGLE_FAN&&(h=h.then(p=>q(p,a.TriangleFanDrawMode))),s[f]={primitive:u,promise:h},i.push(h)}}return Promise.all(i)}loadMesh(e){let t=this,n=this.json,s=this.extensions,r=n.meshes[e],i=r.primitives,c=[];for(let o=0,u=i.length;o<u;o++){let f=i[o].material===void 0?$e(this.cache):this.getDependency("material",i[o].material);c.push(f)}return c.push(t.loadGeometries(i)),Promise.all(c).then(async function(o){let u=o.slice(0,o.length-1),f=o[o.length-1],d=[];for(let p=0,m=f.length;p<m;p++){let A=f[p],g=i[p],b,w=u[p];if(g.mode===L.TRIANGLES||g.mode===L.TRIANGLE_STRIP||g.mode===L.TRIANGLE_FAN||g.mode===void 0){let R=r.isSkinnedMesh===!0,x=A.hasAttribute("skinIndex")&&A.hasAttribute("skinWeight");R&&x===!1&&console.warn("THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled."),b=R&&x?new a.SkinnedMesh(A,w):new a.Mesh(A,w),b.isSkinnedMesh===!0&&b.normalizeSkinWeights()}else if(g.mode===L.LINES)b=new a.LineSegments(A,w);else if(g.mode===L.LINE_STRIP)b=new a.Line(A,w);else if(g.mode===L.LINE_LOOP)b=new a.LineLoop(A,w);else if(g.mode===L.POINTS)b=new a.Points(A,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(b.geometry.morphAttributes).length>0&&Ze(b,r),b.name=t.createUniqueName(r.name||"mesh_"+e),N(b,r),g.extensions&&P(s,b,g),t.assignFinalMaterial(b),d.push(b)}for(let p=0,m=d.length;p<m;p++)t.associations.set(d[p],{meshes:e,primitives:p});if(d.length===1)return r.extensions&&P(s,d[0],r),d[0];let h=new a.Group;r.extensions&&P(s,h,r),t.associations.set(h,{meshes:e});for(let p=0,m=d.length;p<m;p++)h.add(d[p]);return h})}loadCamera(e){let t,n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new a.PerspectiveCamera(a.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new a.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),N(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let s=0,r=t.joints.length;s<r;s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){let r=s.pop(),i=s,c=[],o=[];for(let u=0,f=i.length;u<f;u++){let d=i[u];if(d){c.push(d);let h=new a.Matrix4;r!==null&&h.fromArray(r.array,u*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[u])}return new a.Skeleton(c,o)})}loadAnimation(e){let t=this.json,n=this,s=t.animations[e],r=s.name?s.name:"animation_"+e,i=[],c=[],o=[],u=[],f=[];for(let d=0,h=s.channels.length;d<h;d++){let p=s.channels[d],m=s.samplers[p.sampler],A=p.target,g=A.node,b=s.parameters!==void 0?s.parameters[m.input]:m.input,w=s.parameters!==void 0?s.parameters[m.output]:m.output;A.node!==void 0&&(i.push(this.getDependency("node",g)),c.push(this.getDependency("accessor",b)),o.push(this.getDependency("accessor",w)),u.push(m),f.push(A))}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(o),Promise.all(u),Promise.all(f)]).then(function(d){let h=d[0],p=d[1],m=d[2],A=d[3],g=d[4],b=[];for(let R=0,x=h.length;R<x;R++){let E=h[R],S=p[R],y=m[R],_=A[R],B=g[R];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();let V=n._createAnimationTracks(E,S,y,_,B);if(V)for(let X=0;X<V.length;X++)b.push(V[X])}let w=new a.AnimationClip(r,void 0,b);return N(w,s),w})}createNodeMesh(e){let t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(r){let i=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&i.traverse(function(c){if(c.isMesh)for(let o=0,u=s.weights.length;o<u;o++)c.morphTargetInfluences[o]=s.weights[o]}),i})}loadNode(e){let t=this.json,n=this,s=t.nodes[e],r=n._loadNodeShallow(e),i=[],c=s.children||[];for(let u=0,f=c.length;u<f;u++)i.push(n.getDependency("node",c[u]));let o=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(i),o]).then(function(u){let f=u[0],d=u[1],h=u[2];h!==null&&f.traverse(function(p){p.isSkinnedMesh&&p.bind(h,tt)});for(let p=0,m=d.length;p<m;p++)f.add(d[p]);if(f.userData.pivot!==void 0&&d.length>0){let p=f.userData.pivot,m=d[0];f.pivot=new a.Vector3().fromArray(p),f.position.x-=p[0],f.position.y-=p[1],f.position.z-=p[2],m.position.set(0,0,0),delete f.userData.pivot}return f})}_loadNodeShallow(e){let t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],i=r.name?s.createUniqueName(r.name):"",c=[],o=s._invokeOne(function(u){return u.createNodeMesh&&u.createNodeMesh(e)});return o&&c.push(o),r.camera!==void 0&&c.push(s.getDependency("camera",r.camera).then(function(u){return s._getNodeRef(s.cameraCache,r.camera,u)})),s._invokeAll(function(u){return u.createNodeAttachment&&u.createNodeAttachment(e)}).forEach(function(u){c.push(u)}),this.nodeCache[e]=Promise.all(c).then(function(u){let f;if(r.isBone===!0?f=new a.Bone:u.length>1?f=new a.Group:u.length===1?f=u[0]:f=new a.Object3D,f!==u[0])for(let d=0,h=u.length;d<h;d++)f.add(u[d]);if(r.name&&(f.userData.name=r.name,f.name=i),N(f,r),r.extensions&&P(n,f,r),r.matrix!==void 0){let d=new a.Matrix4;d.fromArray(r.matrix),f.applyMatrix4(d)}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);if(!s.associations.has(f))s.associations.set(f,{});else if(r.mesh!==void 0&&s.meshCache.refs[r.mesh]>1){let d=s.associations.get(f);s.associations.set(f,{...d})}return s.associations.get(f).nodes=e,f}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],s=this,r=new a.Group;n.name&&(r.name=s.createUniqueName(n.name)),N(r,n),n.extensions&&P(t,r,n);let i=n.nodes||[],c=[];for(let o=0,u=i.length;o<u;o++)c.push(s.getDependency("node",i[o]));return Promise.all(c).then(function(o){for(let f=0,d=o.length;f<d;f++){let h=o[f];h.parent!==null?r.add(Le(h)):r.add(h)}let u=f=>{let d=new Map;for(let[h,p]of s.associations)(h instanceof a.Material||h instanceof a.Texture)&&d.set(h,p);return f.traverse(h=>{let p=s.associations.get(h);p!=null&&d.set(h,p)}),d};return s.associations=u(r),r})}_createAnimationTracks(e,t,n,s,r){let i=[],c=e.name?e.name:e.uuid,o=[];function u(p){p.morphTargetInfluences&&o.push(p.name?p.name:p.uuid)}v[r.path]===v.weights?(u(e),e.isGroup&&e.children.forEach(u)):o.push(c);let f;switch(v[r.path]){case v.weights:f=a.NumberKeyframeTrack;break;case v.rotation:f=a.QuaternionKeyframeTrack;break;case v.translation:case v.scale:f=a.VectorKeyframeTrack;break;default:n.itemSize===1?f=a.NumberKeyframeTrack:f=a.VectorKeyframeTrack;break}let d=s.interpolation!==void 0?Ye[s.interpolation]:a.InterpolateLinear,h=this._getArrayFromAccessor(n);for(let p=0,m=o.length;p<m;p++){let A=new f(o[p]+"."+v[r.path],t.array,h,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(A),i.push(A)}return i}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=we(t.constructor),s=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)s[r]=t[r]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){let s=this instanceof a.QuaternionKeyframeTrack?xe:K;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function nt(l,e,t){let n=e.attributes,s=new a.Box3;if(n.POSITION!==void 0){let c=t.json.accessors[n.POSITION],o=c.min,u=c.max;if(o!==void 0&&u!==void 0){if(s.set(new a.Vector3(o[0],o[1],o[2]),new a.Vector3(u[0],u[1],u[2])),c.normalized){let f=we(U[c.componentType]);s.min.multiplyScalar(f),s.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=e.targets;if(r!==void 0){let c=new a.Vector3,o=new a.Vector3;for(let u=0,f=r.length;u<f;u++){let d=r[u];if(d.POSITION!==void 0){let h=t.json.accessors[d.POSITION],p=h.min,m=h.max;if(p!==void 0&&m!==void 0){if(o.setX(Math.max(Math.abs(p[0]),Math.abs(m[0]))),o.setY(Math.max(Math.abs(p[1]),Math.abs(m[1]))),o.setZ(Math.max(Math.abs(p[2]),Math.abs(m[2]))),h.normalized){let A=we(U[h.componentType]);o.multiplyScalar(A)}c.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(c)}l.boundingBox=s;let i=new a.Sphere;s.getCenter(i.center),i.radius=s.min.distanceTo(s.max)/2,l.boundingSphere=i}function Ce(l,e,t){let n=e.attributes,s=[];function r(i,c){return t.getDependency("accessor",i).then(function(o){l.setAttribute(c,o)})}for(let i in n){let c=ye[i]||i.toLowerCase();c in l.attributes||s.push(r(n[i],c))}if(e.indices!==void 0&&!l.index){let i=t.getDependency("accessor",e.indices).then(function(c){l.setIndex(c)});s.push(i)}return a.ColorManagement.workingColorSpace!==a.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${a.ColorManagement.workingColorSpace}" not supported.`),N(l,e),nt(l,e,t),Promise.all(s).then(function(){return e.targets!==void 0?Je(l,e.targets,t):l})}var st=/^(?:data:|blob:|https?:|file:|\/\/)/iu;var rt=new Map([["bin","application/octet-stream"],["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["webp","image/webp"],["gif","image/gif"],["bmp","image/bmp"],["tga","image/x-tga"],["dds","image/vnd-ms.dds"],["exr","image/x-exr"],["hdr","image/vnd.radiance"]]),Be=new TextDecoder("utf-8");function Ee(l){if(l instanceof ArrayBuffer)return l;if(ArrayBuffer.isView(l))return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength);if(typeof l=="string")return new TextEncoder().encode(l).buffer;throw new TypeError("The 3D preview was not given binary data")}function Ue(l){if(l instanceof ArrayBuffer)return new Uint8Array(l);if(ArrayBuffer.isView(l))return new Uint8Array(l.buffer,l.byteOffset,l.byteLength);if(typeof l=="string")return new TextEncoder().encode(l);throw new TypeError("The 3D preview was not given model data")}function Me(l){if(typeof l=="string")return l;if(l instanceof ArrayBuffer||ArrayBuffer.isView(l))return Be.decode(l);throw new TypeError("The 3D preview was not given model data")}function D(l){let e=String(l).split(/[?#]/u,1)[0];try{return decodeURIComponent(e).replaceAll("\\","/")}catch{return e.replaceAll("\\","/")}}function j(l){return typeof l=="string"&&l!==""&&st.test(l)===!1}function Se(l){let e=D(l),t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return rt.get(t)??"application/octet-stream"}function F(l="Model loading was cancelled."){let e=new Error(l);return e.name="AbortError",e}function _e(l){typeof console<"u"&&console.warn(l)}var Fe=require("three");function He(l){let e=new Set,t=new Set,n=new Set,s=new Set,r=new Set;l.traverse(i=>{i.geometry!==void 0&&i.geometry!==null&&e.add(i.geometry),i.isSkinnedMesh===!0&&i.skeleton!==void 0&&i.skeleton!==null&&s.add(i.skeleton);let c=i.material;if(c!=null){for(let o of Array.isArray(c)?c:[c])if(o!=null){t.add(o);for(let u of Object.values(o))if(!(u===null||typeof u!="object")){if(u.isTexture===!0)n.add(u);else if(Array.isArray(u))for(let f of u)f!==null&&typeof f=="object"&&f.isTexture===!0&&n.add(f)}}}});for(let i of n){let c=i.image?.src;typeof c=="string"&&c.startsWith("blob:")&&r.add(c),i.dispose()}if(typeof URL.revokeObjectURL=="function")for(let i of r)try{URL.revokeObjectURL(i)}catch{}for(let i of s)i.dispose();for(let i of t)i.dispose();for(let i of e)i.dispose()}var O=require("three");var Ie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4////fwAJ+wP9KobjigAAAABJRU5ErkJggg==",Et=new O.ImageLoader(new O.LoadingManager);function it(l){let e=new DataView(l.buffer,l.byteOffset,l.byteLength),t=12;for(;t+8<=l.byteLength;){let n=e.getUint32(t,!0),s=e.getUint32(t+4,!0),r=t+8;if(r+n>l.byteLength)break;if(s===1313821514)return Me(l.subarray(r,r+n)).replace(/\0+$/u,"").trim();t=r+n}return null}function ot(l){let e=Ue(l);if(e.byteLength>=12&&e[0]===103&&e[1]===108&&e[2]===84&&e[3]===70){let t=it(e);return t===null?null:JSON.parse(t)}return JSON.parse(Me(e).replace(/^\uFEFF/u,""))}function at(l){let e=[];for(let t of Array.isArray(l.buffers)?l.buffers:[])j(t?.uri)&&e.push({uri:t.uri,kind:"buffer"});for(let t of Array.isArray(l.images)?l.images:[])j(t?.uri)&&e.push({uri:t.uri,kind:"image"});return e}function ct(){let l=new Set;return{onTextureLoad(){return()=>{}},track(e){l.add(e)},dispose(){for(let e of l)URL.revokeObjectURL(e);l.clear()}}}function ut(l){l.updateMatrixWorld(!0);let e=new C.Box3().setFromObject(l),t=e.getSize(new C.Vector3),n=Math.max(t.x,t.y,t.z);if(!Number.isFinite(n)||n<=0)return 0;let s=0;return l.traverse(r=>{if(r.isMesh!==!0||r.isSkinnedMesh===!0)return;let i=r.geometry,c=i?.getAttribute?.("position");if(c===void 0||c.count>8)return;let o=i.getIndex();if((o===null?c.count:o.count)/3>4)return;let f=Array.isArray(r.material)?r.material:[r.material];if(!f.some(w=>w!==null&&(w.transparent===!0||w.opacity<1)))return;let h=`${r.name} ${f.map(w=>w?.name??"").join(" ")}`;if(/plane|shadow|ground|contact|bake/iu.test(h)===!1)return;let p=new C.Box3().setFromObject(r),m=p.getSize(new C.Vector3),A=Math.min(m.x,m.y,m.z),g=m.x*m.z,b=t.x*t.z;A>n*.001||p.min.y-e.min.y>n*.005||g<b*.25||(r.visible=!1,r.castShadow=!1,r.receiveShadow=!1,s+=1)}),s}async function De(l,e={}){let t=e.onWarn??_e,n=ct(),s=new Map;try{let r=null;try{r=ot(l)}catch(u){throw new Error(`Invalid glTF JSON: ${u instanceof Error?u.message:String(u)}`)}if(r!==null&&typeof e.readWorkspaceFile=="function"&&typeof e.resourceAddress=="string"){let u=new Map;for(let f of at(r))u.set(`${f.kind}\0${f.uri}`,f);await Promise.all([...u.values()].map(async f=>{if(e.signal?.aborted===!0)throw F();try{let d=await e.readWorkspaceFile(e.resourceAddress,D(f.uri),{signal:e.signal});if(e.signal?.aborted===!0)throw F();if(d?.ok===!0){let h=URL.createObjectURL(new Blob([d.value.data],{type:f.kind==="image"?Se(f.uri):"application/octet-stream"}));n.track(h),s.set(f.uri,h);let p=D(f.uri);p!==f.uri&&s.set(p,h)}else f.kind==="image"?(t(`[dsh-3d-viewer] Could not read glTF image "${f.uri}"; using a white texture.`),s.set(f.uri,Ie)):t(`[dsh-3d-viewer] Could not read glTF buffer "${f.uri}".`)}catch(d){if(e.signal?.aborted===!0)throw F();f.kind==="image"?(t(`[dsh-3d-viewer] Could not read glTF image "${f.uri}"; using a white texture.`),s.set(f.uri,Ie)):t(`[dsh-3d-viewer] Could not read glTF buffer "${f.uri}": ${String(d)}`)}}))}let i=new C.LoadingManager;i.setURLModifier(u=>s.get(u)??u);let c=await new Promise((u,f)=>{let d=new z(i),h=!1,p=m=>{h||(h=!0,f(m instanceof Error?m:new Error(String(m))))};try{d.parse(Ee(l),"",m=>{if(!h){if(h=!0,e.signal?.aborted===!0){He(m.scene),f(F());return}u(m)}},p)}catch(m){p(m)}}),o=c.scene;return o.animations=Array.isArray(c.animations)?c.animations:[],ut(o),{object:o,assets:n}}catch(r){throw n.dispose(),r}}
|
|
11
|
+
})(localRequire, module, module.exports);
|
|
12
|
+
return module.exports;
|
|
13
|
+
},
|
|
14
|
+
});
|