@j-kyoda/vue-three-vrm 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -114,6 +114,7 @@ const model_loaded = (name, vrm_model) => {
114
114
  THREE,
115
115
  VRMExpressionPresetName,
116
116
  VRMHumanBoneName,
117
+ VRMUtils,
117
118
  camera, // Instance of THREE.PerspectiveCamera
118
119
  controls, // Instance of OrbitControls
119
120
  renderer, // Instance of THREE.WebGLRenderer
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .box[data-v-81e1dabc]{display:block;width:100%;height:100%}
1
+ .box[data-v-60c3a6e5]{display:block;width:100%;height:100%}
@@ -1,8 +1,8 @@
1
- import { getCurrentInstance as Ve, useTemplateRef as Xe, watch as C, onMounted as $, createElementBlock as Ce, openBlock as me, ref as Z, Fragment as Ye, createVNode as ee, createBlock as We } from "vue";
1
+ import { getCurrentInstance as Xe, useTemplateRef as Ye, watch as C, onMounted as $, createElementBlock as Ie, openBlock as ge, ref as Z, Fragment as We, createVNode as ee, createBlock as Ze } from "vue";
2
2
  import * as L from "three";
3
- import { TrianglesDrawMode as Ze, TriangleFanDrawMode as ce, TriangleStripDrawMode as Ie, Loader as qe, LoaderUtils as X, FileLoader as ve, MeshPhysicalMaterial as O, Vector2 as S, Color as H, LinearSRGBColorSpace as I, SRGBColorSpace as Y, SpotLight as Qe, PointLight as $e, DirectionalLight as Je, Matrix4 as q, Vector3 as M, Quaternion as Q, InstancedMesh as et, InstancedBufferAttribute as tt, Object3D as ke, TextureLoader as st, ImageBitmapLoader as nt, BufferAttribute as te, InterleavedBuffer as it, InterleavedBufferAttribute as ot, LinearMipmapLinearFilter as je, NearestMipmapLinearFilter as rt, LinearMipmapNearestFilter as at, NearestMipmapNearestFilter as ct, LinearFilter as le, NearestFilter as Fe, RepeatWrapping as he, MirroredRepeatWrapping as lt, ClampToEdgeWrapping as ht, PointsMaterial as ut, Material as se, LineBasicMaterial as dt, MeshStandardMaterial as He, DoubleSide as pt, MeshBasicMaterial as V, PropertyBinding as ft, BufferGeometry as mt, SkinnedMesh as gt, Mesh as _t, LineSegments as Tt, Line as yt, LineLoop as xt, Points as Et, Group as ne, PerspectiveCamera as bt, MathUtils as Ge, OrthographicCamera as Rt, Skeleton as Mt, AnimationClip as wt, Bone as St, InterpolateDiscrete as At, InterpolateLinear as Ue, Texture as _e, VectorKeyframeTrack as Te, NumberKeyframeTrack as ye, QuaternionKeyframeTrack as xe, ColorManagement as Ee, FrontSide as Lt, Interpolant as Pt, Box3 as Nt, Sphere as Ot, Controls as Dt, MOUSE as U, TOUCH as G, Spherical as be, Ray as Ct, Plane as It } from "three";
4
- import { VRMHumanBoneName as Re, VRMExpressionPresetName as Me, VRMLoaderPlugin as vt, VRMUtils as kt } from "@pixiv/three-vrm";
5
- class ue {
3
+ import { TrianglesDrawMode as qe, TriangleFanDrawMode as ce, TriangleStripDrawMode as ve, Loader as Qe, LoaderUtils as X, FileLoader as ke, MeshPhysicalMaterial as O, Vector2 as S, Color as H, LinearSRGBColorSpace as I, SRGBColorSpace as Y, SpotLight as $e, PointLight as Je, DirectionalLight as et, Matrix4 as q, Vector3 as M, Quaternion as Q, InstancedMesh as tt, InstancedBufferAttribute as st, Object3D as je, TextureLoader as nt, ImageBitmapLoader as it, BufferAttribute as te, InterleavedBuffer as ot, InterleavedBufferAttribute as rt, LinearMipmapLinearFilter as Fe, NearestMipmapLinearFilter as at, LinearMipmapNearestFilter as ct, NearestMipmapNearestFilter as lt, LinearFilter as le, NearestFilter as He, RepeatWrapping as he, MirroredRepeatWrapping as ht, ClampToEdgeWrapping as ut, PointsMaterial as dt, Material as se, LineBasicMaterial as pt, MeshStandardMaterial as Ge, DoubleSide as ft, MeshBasicMaterial as V, PropertyBinding as mt, BufferGeometry as gt, SkinnedMesh as _t, Mesh as Tt, LineSegments as yt, Line as xt, LineLoop as Et, Points as bt, Group as ne, PerspectiveCamera as Rt, MathUtils as Ue, OrthographicCamera as Mt, Skeleton as wt, AnimationClip as St, Bone as At, InterpolateDiscrete as Lt, InterpolateLinear as Ke, Texture as Te, VectorKeyframeTrack as ye, NumberKeyframeTrack as xe, QuaternionKeyframeTrack as Ee, ColorManagement as be, FrontSide as Pt, Interpolant as Nt, Box3 as Ot, Sphere as Dt, Controls as Ct, MOUSE as U, TOUCH as G, Spherical as Re, Ray as It, Plane as vt } from "three";
4
+ import { VRMUtils as ue, VRMHumanBoneName as Me, VRMExpressionPresetName as we, VRMLoaderPlugin as kt } from "@pixiv/three-vrm";
5
+ class de {
6
6
  constructor() {
7
7
  }
8
8
  async fetchJSON(e) {
@@ -125,7 +125,7 @@ class jt {
125
125
  return null;
126
126
  }
127
127
  }
128
- class we {
128
+ class Se {
129
129
  /**
130
130
  * Returns `true` if WebGL 2 is available.
131
131
  *
@@ -190,10 +190,10 @@ class we {
190
190
  return console.warn("getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage() instead."), this._getErrorMessage(1);
191
191
  }
192
192
  }
193
- function Se(l, e) {
194
- if (e === Ze)
193
+ function Ae(l, e) {
194
+ if (e === qe)
195
195
  return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), l;
196
- if (e === ce || e === Ie) {
196
+ if (e === ce || e === ve) {
197
197
  let t = l.getIndex();
198
198
  if (t === null) {
199
199
  const o = [], a = l.getAttribute("position");
@@ -217,7 +217,7 @@ function Se(l, e) {
217
217
  } else
218
218
  return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), l;
219
219
  }
220
- class de extends qe {
220
+ class pe extends Qe {
221
221
  /**
222
222
  * Constructs a new glTF loader.
223
223
  *
@@ -282,7 +282,7 @@ class de extends qe {
282
282
  this.manager.itemStart(e);
283
283
  const a = function(c) {
284
284
  n ? n(c) : console.error(c), i.manager.itemError(e), i.manager.itemEnd(e);
285
- }, r = new ve(this.manager);
285
+ }, r = new ke(this.manager);
286
286
  r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, function(c) {
287
287
  try {
288
288
  i.parse(c, o, function(u) {
@@ -357,7 +357,7 @@ class de extends qe {
357
357
  if (typeof e == "string")
358
358
  i = JSON.parse(e);
359
359
  else if (e instanceof ArrayBuffer)
360
- if (r.decode(new Uint8Array(e, 0, 4)) === Ke) {
360
+ if (r.decode(new Uint8Array(e, 0, 4)) === Be) {
361
361
  try {
362
362
  o[y.KHR_BINARY_GLTF] = new ns(e);
363
363
  } catch (h) {
@@ -486,13 +486,13 @@ class Ht {
486
486
  const h = r.range !== void 0 ? r.range : 0;
487
487
  switch (r.type) {
488
488
  case "directional":
489
- c = new Je(u), c.target.position.set(0, 0, -1), c.add(c.target);
489
+ c = new et(u), c.target.position.set(0, 0, -1), c.add(c.target);
490
490
  break;
491
491
  case "point":
492
- c = new $e(u), c.distance = h;
492
+ c = new Je(u), c.distance = h;
493
493
  break;
494
494
  case "spot":
495
- c = new Qe(u), c.distance = h, r.spot = r.spot || {}, r.spot.innerConeAngle = r.spot.innerConeAngle !== void 0 ? r.spot.innerConeAngle : 0, r.spot.outerConeAngle = r.spot.outerConeAngle !== void 0 ? r.spot.outerConeAngle : Math.PI / 4, c.angle = r.spot.outerConeAngle, c.penumbra = 1 - r.spot.innerConeAngle / r.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
495
+ c = new $e(u), c.distance = h, r.spot = r.spot || {}, r.spot.innerConeAngle = r.spot.innerConeAngle !== void 0 ? r.spot.innerConeAngle : 0, r.spot.outerConeAngle = r.spot.outerConeAngle !== void 0 ? r.spot.outerConeAngle : Math.PI / 4, c.angle = r.spot.outerConeAngle, c.penumbra = 1 - r.spot.innerConeAngle / r.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
496
496
  break;
497
497
  default:
498
498
  throw new Error("THREE.GLTFLoader: Unexpected light type: " + r.type);
@@ -812,21 +812,21 @@ class ss {
812
812
  return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
813
813
  const u = c.pop(), h = u.isGroup ? u.children : [u], d = c[0].count, p = [];
814
814
  for (const m of h) {
815
- const _ = new q(), f = new M(), g = new Q(), x = new M(1, 1, 1), b = new et(m.geometry, m.material, d);
815
+ const _ = new q(), f = new M(), g = new Q(), x = new M(1, 1, 1), b = new tt(m.geometry, m.material, d);
816
816
  for (let T = 0; T < d; T++)
817
817
  r.TRANSLATION && f.fromBufferAttribute(r.TRANSLATION, T), r.ROTATION && g.fromBufferAttribute(r.ROTATION, T), r.SCALE && x.fromBufferAttribute(r.SCALE, T), b.setMatrixAt(T, _.compose(f, g, x));
818
818
  for (const T in r)
819
819
  if (T === "_COLOR_0") {
820
820
  const A = r[T];
821
- b.instanceColor = new tt(A.array, A.itemSize, A.normalized);
821
+ b.instanceColor = new st(A.array, A.itemSize, A.normalized);
822
822
  } else T !== "TRANSLATION" && T !== "ROTATION" && T !== "SCALE" && m.geometry.setAttribute(T, r[T]);
823
- ke.prototype.copy.call(b, m), this.parser.assignFinalMaterial(b), p.push(b);
823
+ je.prototype.copy.call(b, m), this.parser.assignFinalMaterial(b), p.push(b);
824
824
  }
825
825
  return u.isGroup ? (u.clear(), u.add(...p), u) : p[0];
826
826
  }));
827
827
  }
828
828
  }
829
- const Ke = "glTF", z = 12, Ae = { JSON: 1313821514, BIN: 5130562 };
829
+ const Be = "glTF", z = 12, Le = { JSON: 1313821514, BIN: 5130562 };
830
830
  class ns {
831
831
  constructor(e) {
832
832
  this.name = y.KHR_BINARY_GLTF, this.content = null, this.body = null;
@@ -835,7 +835,7 @@ class ns {
835
835
  magic: s.decode(new Uint8Array(e.slice(0, 4))),
836
836
  version: t.getUint32(4, !0),
837
837
  length: t.getUint32(8, !0)
838
- }, this.header.magic !== Ke)
838
+ }, this.header.magic !== Be)
839
839
  throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
840
840
  if (this.header.version < 2)
841
841
  throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
@@ -845,10 +845,10 @@ class ns {
845
845
  const a = i.getUint32(o, !0);
846
846
  o += 4;
847
847
  const r = i.getUint32(o, !0);
848
- if (o += 4, r === Ae.JSON) {
848
+ if (o += 4, r === Le.JSON) {
849
849
  const c = new Uint8Array(e, z + o, a);
850
850
  this.content = s.decode(c);
851
- } else if (r === Ae.BIN) {
851
+ } else if (r === Le.BIN) {
852
852
  const c = z + o;
853
853
  this.body = e.slice(c, c + a);
854
854
  }
@@ -867,11 +867,11 @@ class is {
867
867
  decodePrimitive(e, t) {
868
868
  const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, r = {}, c = {};
869
869
  for (const u in o) {
870
- const h = pe[u] || u.toLowerCase();
870
+ const h = fe[u] || u.toLowerCase();
871
871
  a[h] = o[u];
872
872
  }
873
873
  for (const u in e.attributes) {
874
- const h = pe[u] || u.toLowerCase();
874
+ const h = fe[u] || u.toLowerCase();
875
875
  if (o[u] !== void 0) {
876
876
  const d = s.accessors[e.attributes[u]], p = K[d.componentType];
877
877
  c[h] = p.name, r[h] = d.normalized === !0;
@@ -903,7 +903,7 @@ class rs {
903
903
  this.name = y.KHR_MESH_QUANTIZATION;
904
904
  }
905
905
  }
906
- class Be extends Pt {
906
+ class ze extends Nt {
907
907
  constructor(e, t, s, n) {
908
908
  super(e, t, s, n);
909
909
  }
@@ -923,7 +923,7 @@ class Be extends Pt {
923
923
  }
924
924
  }
925
925
  const as = new Q();
926
- class cs extends Be {
926
+ class cs extends ze {
927
927
  interpolate_(e, t, s, n) {
928
928
  const i = super.interpolate_(e, t, s, n);
929
929
  return as.fromArray(i).normalize().toArray(i), i;
@@ -944,16 +944,16 @@ const P = {
944
944
  5123: Uint16Array,
945
945
  5125: Uint32Array,
946
946
  5126: Float32Array
947
- }, Le = {
948
- 9728: Fe,
949
- 9729: le,
950
- 9984: ct,
951
- 9985: at,
952
- 9986: rt,
953
- 9987: je
954
947
  }, Pe = {
955
- 33071: ht,
956
- 33648: lt,
948
+ 9728: He,
949
+ 9729: le,
950
+ 9984: lt,
951
+ 9985: ct,
952
+ 9986: at,
953
+ 9987: Fe
954
+ }, Ne = {
955
+ 33071: ut,
956
+ 33648: ht,
957
957
  10497: he
958
958
  }, ie = {
959
959
  SCALAR: 1,
@@ -963,7 +963,7 @@ const P = {
963
963
  MAT2: 4,
964
964
  MAT3: 9,
965
965
  MAT4: 16
966
- }, pe = {
966
+ }, fe = {
967
967
  POSITION: "position",
968
968
  NORMAL: "normal",
969
969
  TANGENT: "tangent",
@@ -983,22 +983,22 @@ const P = {
983
983
  CUBICSPLINE: void 0,
984
984
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
985
985
  // keyframe track will be initialized with a default interpolation type, then modified.
986
- LINEAR: Ue,
987
- STEP: At
986
+ LINEAR: Ke,
987
+ STEP: Lt
988
988
  }, oe = {
989
989
  OPAQUE: "OPAQUE",
990
990
  MASK: "MASK",
991
991
  BLEND: "BLEND"
992
992
  };
993
993
  function hs(l) {
994
- return l.DefaultMaterial === void 0 && (l.DefaultMaterial = new He({
994
+ return l.DefaultMaterial === void 0 && (l.DefaultMaterial = new Ge({
995
995
  color: 16777215,
996
996
  emissive: 0,
997
997
  metalness: 1,
998
998
  roughness: 1,
999
999
  transparent: !1,
1000
1000
  depthTest: !0,
1001
- side: Lt
1001
+ side: Pt
1002
1002
  })), l.DefaultMaterial;
1003
1003
  }
1004
1004
  function F(l, e, t) {
@@ -1069,7 +1069,7 @@ function re(l) {
1069
1069
  e += t[s] + ":" + l[t[s]] + ";";
1070
1070
  return e;
1071
1071
  }
1072
- function fe(l) {
1072
+ function me(l) {
1073
1073
  switch (l) {
1074
1074
  case Int8Array:
1075
1075
  return 1 / 127;
@@ -1097,7 +1097,7 @@ class gs {
1097
1097
  const r = a.match(/Version\/(\d+)/);
1098
1098
  n = s && r ? parseInt(r[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
1099
1099
  }
1100
- typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new st(this.options.manager) : this.textureLoader = new nt(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new ve(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1100
+ typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new nt(this.options.manager) : this.textureLoader = new it(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new ke(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1101
1101
  }
1102
1102
  setExtensions(e) {
1103
1103
  this.extensions = e;
@@ -1347,7 +1347,7 @@ class gs {
1347
1347
  if (p && p !== h) {
1348
1348
  const g = Math.floor(d / p), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
1349
1349
  let b = t.cache.get(x);
1350
- b || (_ = new c(a, g * p, n.count * p / u), b = new it(_, p / u), t.cache.add(x, b)), f = new ot(b, r, d % p / u, m);
1350
+ b || (_ = new c(a, g * p, n.count * p / u), b = new ot(_, p / u), t.cache.add(x, b)), f = new rt(b, r, d % p / u, m);
1351
1351
  } else
1352
1352
  a === null ? _ = new c(n.count * r) : _ = new c(a, d, n.count * r), f = new te(_, r, m);
1353
1353
  if (n.sparse !== void 0) {
@@ -1385,7 +1385,7 @@ class gs {
1385
1385
  const c = this.loadImageSource(t, s).then(function(u) {
1386
1386
  u.flipY = !1, u.name = o.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
1387
1387
  const d = (i.samplers || {})[o.sampler] || {};
1388
- return u.magFilter = Le[d.magFilter] || le, u.minFilter = Le[d.minFilter] || je, u.wrapS = Pe[d.wrapS] || he, u.wrapT = Pe[d.wrapT] || he, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== Fe && u.minFilter !== le, n.associations.set(u, { textures: e }), u;
1388
+ return u.magFilter = Pe[d.magFilter] || le, u.minFilter = Pe[d.minFilter] || Fe, u.wrapS = Ne[d.wrapS] || he, u.wrapT = Ne[d.wrapT] || he, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== He && u.minFilter !== le, n.associations.set(u, { textures: e }), u;
1389
1389
  }).catch(function() {
1390
1390
  return null;
1391
1391
  });
@@ -1409,7 +1409,7 @@ class gs {
1409
1409
  return new Promise(function(d, p) {
1410
1410
  let m = d;
1411
1411
  t.isImageBitmapLoader === !0 && (m = function(_) {
1412
- const f = new _e(_);
1412
+ const f = new Te(_);
1413
1413
  f.needsUpdate = !0, d(f);
1414
1414
  }), t.load(X.resolveURL(h, i.path), m, void 0, p);
1415
1415
  });
@@ -1461,11 +1461,11 @@ class gs {
1461
1461
  if (e.isPoints) {
1462
1462
  const a = "PointsMaterial:" + s.uuid;
1463
1463
  let r = this.cache.get(a);
1464
- r || (r = new ut(), se.prototype.copy.call(r, s), r.color.copy(s.color), r.map = s.map, r.sizeAttenuation = !1, this.cache.add(a, r)), s = r;
1464
+ r || (r = new dt(), se.prototype.copy.call(r, s), r.color.copy(s.color), r.map = s.map, r.sizeAttenuation = !1, this.cache.add(a, r)), s = r;
1465
1465
  } else if (e.isLine) {
1466
1466
  const a = "LineBasicMaterial:" + s.uuid;
1467
1467
  let r = this.cache.get(a);
1468
- r || (r = new dt(), se.prototype.copy.call(r, s), r.color.copy(s.color), r.map = s.map, this.cache.add(a, r)), s = r;
1468
+ r || (r = new pt(), se.prototype.copy.call(r, s), r.color.copy(s.color), r.map = s.map, this.cache.add(a, r)), s = r;
1469
1469
  }
1470
1470
  if (n || i || o) {
1471
1471
  let a = "ClonedMaterial:" + s.uuid + ":";
@@ -1476,7 +1476,7 @@ class gs {
1476
1476
  e.material = s;
1477
1477
  }
1478
1478
  getMaterialType() {
1479
- return He;
1479
+ return Ge;
1480
1480
  }
1481
1481
  /**
1482
1482
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
@@ -1504,7 +1504,7 @@ class gs {
1504
1504
  return d.extendMaterialParams && d.extendMaterialParams(e, a);
1505
1505
  })));
1506
1506
  }
1507
- i.doubleSided === !0 && (a.side = pt);
1507
+ i.doubleSided === !0 && (a.side = ft);
1508
1508
  const u = i.alphaMode || oe.OPAQUE;
1509
1509
  if (u === oe.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === oe.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== V && (c.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new S(1, 1), i.normalTexture.scale !== void 0)) {
1510
1510
  const h = i.normalTexture.scale;
@@ -1527,7 +1527,7 @@ class gs {
1527
1527
  * @return {string}
1528
1528
  */
1529
1529
  createUniqueName(e) {
1530
- const t = ft.sanitizeNodeName(e || "");
1530
+ const t = mt.sanitizeNodeName(e || "");
1531
1531
  return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
1532
1532
  }
1533
1533
  /**
@@ -1543,7 +1543,7 @@ class gs {
1543
1543
  const t = this, s = this.extensions, n = this.primitiveCache;
1544
1544
  function i(a) {
1545
1545
  return s[y.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(r) {
1546
- return Ne(r, a, t);
1546
+ return Oe(r, a, t);
1547
1547
  });
1548
1548
  }
1549
1549
  const o = [];
@@ -1553,7 +1553,7 @@ class gs {
1553
1553
  o.push(h.promise);
1554
1554
  else {
1555
1555
  let d;
1556
- c.extensions && c.extensions[y.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d = Ne(new mt(), c, t), n[u] = { primitive: c, promise: d }, o.push(d);
1556
+ c.extensions && c.extensions[y.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d = Oe(new gt(), c, t), n[u] = { primitive: c, promise: d }, o.push(d);
1557
1557
  }
1558
1558
  }
1559
1559
  return Promise.all(o);
@@ -1578,15 +1578,15 @@ class gs {
1578
1578
  let g;
1579
1579
  const x = c[p];
1580
1580
  if (f.mode === P.TRIANGLES || f.mode === P.TRIANGLE_STRIP || f.mode === P.TRIANGLE_FAN || f.mode === void 0)
1581
- g = i.isSkinnedMesh === !0 ? new gt(_, x) : new _t(_, x), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), f.mode === P.TRIANGLE_STRIP ? g.geometry = Se(g.geometry, Ie) : f.mode === P.TRIANGLE_FAN && (g.geometry = Se(g.geometry, ce));
1581
+ g = i.isSkinnedMesh === !0 ? new _t(_, x) : new Tt(_, x), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), f.mode === P.TRIANGLE_STRIP ? g.geometry = Ae(g.geometry, ve) : f.mode === P.TRIANGLE_FAN && (g.geometry = Ae(g.geometry, ce));
1582
1582
  else if (f.mode === P.LINES)
1583
- g = new Tt(_, x);
1584
- else if (f.mode === P.LINE_STRIP)
1585
1583
  g = new yt(_, x);
1586
- else if (f.mode === P.LINE_LOOP)
1584
+ else if (f.mode === P.LINE_STRIP)
1587
1585
  g = new xt(_, x);
1588
- else if (f.mode === P.POINTS)
1586
+ else if (f.mode === P.LINE_LOOP)
1589
1587
  g = new Et(_, x);
1588
+ else if (f.mode === P.POINTS)
1589
+ g = new bt(_, x);
1590
1590
  else
1591
1591
  throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + f.mode);
1592
1592
  Object.keys(g.geometry.morphAttributes).length > 0 && ds(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), D(g, i), f.extensions && F(n, g, f), t.assignFinalMaterial(g), h.push(g);
@@ -1619,7 +1619,7 @@ class gs {
1619
1619
  console.warn("THREE.GLTFLoader: Missing camera parameters.");
1620
1620
  return;
1621
1621
  }
1622
- return s.type === "perspective" ? t = new bt(Ge.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Rt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), D(t, s), Promise.resolve(t);
1622
+ return s.type === "perspective" ? t = new Rt(Ue.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Mt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), D(t, s), Promise.resolve(t);
1623
1623
  }
1624
1624
  /**
1625
1625
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -1643,7 +1643,7 @@ class gs {
1643
1643
  } else
1644
1644
  console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
1645
1645
  }
1646
- return new Mt(a, r);
1646
+ return new wt(a, r);
1647
1647
  });
1648
1648
  }
1649
1649
  /**
@@ -1676,7 +1676,7 @@ class gs {
1676
1676
  for (let J = 0; J < k.length; J++)
1677
1677
  g.push(k[J]);
1678
1678
  }
1679
- return new wt(i, void 0, g);
1679
+ return new St(i, void 0, g);
1680
1680
  });
1681
1681
  }
1682
1682
  createNodeMesh(e) {
@@ -1733,7 +1733,7 @@ class gs {
1733
1733
  a.push(c);
1734
1734
  }), this.nodeCache[e] = Promise.all(a).then(function(c) {
1735
1735
  let u;
1736
- if (i.isBone === !0 ? u = new St() : c.length > 1 ? u = new ne() : c.length === 1 ? u = c[0] : u = new ke(), u !== c[0])
1736
+ if (i.isBone === !0 ? u = new At() : c.length > 1 ? u = new ne() : c.length === 1 ? u = c[0] : u = new je(), u !== c[0])
1737
1737
  for (let h = 0, d = c.length; h < d; h++)
1738
1738
  u.add(c[h]);
1739
1739
  if (i.name && (u.userData.name = i.name, u.name = o), D(u, i), i.extensions && F(s, u, i), i.matrix !== void 0) {
@@ -1769,7 +1769,7 @@ class gs {
1769
1769
  const c = (u) => {
1770
1770
  const h = /* @__PURE__ */ new Map();
1771
1771
  for (const [d, p] of n.associations)
1772
- (d instanceof se || d instanceof _e) && h.set(d, p);
1772
+ (d instanceof se || d instanceof Te) && h.set(d, p);
1773
1773
  return u.traverse((d) => {
1774
1774
  const p = n.associations.get(d);
1775
1775
  p != null && h.set(d, p);
@@ -1786,29 +1786,29 @@ class gs {
1786
1786
  let c;
1787
1787
  switch (j[i.path]) {
1788
1788
  case j.weights:
1789
- c = ye;
1789
+ c = xe;
1790
1790
  break;
1791
1791
  case j.rotation:
1792
- c = xe;
1792
+ c = Ee;
1793
1793
  break;
1794
1794
  case j.translation:
1795
1795
  case j.scale:
1796
- c = Te;
1796
+ c = ye;
1797
1797
  break;
1798
1798
  default:
1799
1799
  switch (s.itemSize) {
1800
1800
  case 1:
1801
- c = ye;
1801
+ c = xe;
1802
1802
  break;
1803
1803
  case 2:
1804
1804
  case 3:
1805
1805
  default:
1806
- c = Te;
1806
+ c = ye;
1807
1807
  break;
1808
1808
  }
1809
1809
  break;
1810
1810
  }
1811
- const u = n.interpolation !== void 0 ? ls[n.interpolation] : Ue, h = this._getArrayFromAccessor(s);
1811
+ const u = n.interpolation !== void 0 ? ls[n.interpolation] : Ke, h = this._getArrayFromAccessor(s);
1812
1812
  for (let d = 0, p = r.length; d < p; d++) {
1813
1813
  const m = new c(
1814
1814
  r[d] + "." + j[i.path],
@@ -1823,7 +1823,7 @@ class gs {
1823
1823
  _getArrayFromAccessor(e) {
1824
1824
  let t = e.array;
1825
1825
  if (e.normalized) {
1826
- const s = fe(t.constructor), n = new Float32Array(t.length);
1826
+ const s = me(t.constructor), n = new Float32Array(t.length);
1827
1827
  for (let i = 0, o = t.length; i < o; i++)
1828
1828
  n[i] = t[i] * s;
1829
1829
  t = n;
@@ -1832,13 +1832,13 @@ class gs {
1832
1832
  }
1833
1833
  _createCubicSplineTrackInterpolant(e) {
1834
1834
  e.createInterpolant = function(s) {
1835
- const n = this instanceof xe ? cs : Be;
1835
+ const n = this instanceof Ee ? cs : ze;
1836
1836
  return new n(this.times, this.values, this.getValueSize() / 3, s);
1837
1837
  }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1838
1838
  }
1839
1839
  }
1840
1840
  function _s(l, e, t) {
1841
- const s = e.attributes, n = new Nt();
1841
+ const s = e.attributes, n = new Ot();
1842
1842
  if (s.POSITION !== void 0) {
1843
1843
  const a = t.json.accessors[s.POSITION], r = a.min, c = a.max;
1844
1844
  if (r !== void 0 && c !== void 0) {
@@ -1846,7 +1846,7 @@ function _s(l, e, t) {
1846
1846
  new M(r[0], r[1], r[2]),
1847
1847
  new M(c[0], c[1], c[2])
1848
1848
  ), a.normalized) {
1849
- const u = fe(K[a.componentType]);
1849
+ const u = me(K[a.componentType]);
1850
1850
  n.min.multiplyScalar(u), n.max.multiplyScalar(u);
1851
1851
  }
1852
1852
  } else {
@@ -1864,7 +1864,7 @@ function _s(l, e, t) {
1864
1864
  const d = t.json.accessors[h.POSITION], p = d.min, m = d.max;
1865
1865
  if (p !== void 0 && m !== void 0) {
1866
1866
  if (r.setX(Math.max(Math.abs(p[0]), Math.abs(m[0]))), r.setY(Math.max(Math.abs(p[1]), Math.abs(m[1]))), r.setZ(Math.max(Math.abs(p[2]), Math.abs(m[2]))), d.normalized) {
1867
- const _ = fe(K[d.componentType]);
1867
+ const _ = me(K[d.componentType]);
1868
1868
  r.multiplyScalar(_);
1869
1869
  }
1870
1870
  a.max(r);
@@ -1875,10 +1875,10 @@ function _s(l, e, t) {
1875
1875
  n.expandByVector(a);
1876
1876
  }
1877
1877
  l.boundingBox = n;
1878
- const o = new Ot();
1878
+ const o = new Dt();
1879
1879
  n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, l.boundingSphere = o;
1880
1880
  }
1881
- function Ne(l, e, t) {
1881
+ function Oe(l, e, t) {
1882
1882
  const s = e.attributes, n = [];
1883
1883
  function i(o, a) {
1884
1884
  return t.getDependency("accessor", o).then(function(r) {
@@ -1886,7 +1886,7 @@ function Ne(l, e, t) {
1886
1886
  });
1887
1887
  }
1888
1888
  for (const o in s) {
1889
- const a = pe[o] || o.toLowerCase();
1889
+ const a = fe[o] || o.toLowerCase();
1890
1890
  a in l.attributes || n.push(i(s[o], a));
1891
1891
  }
1892
1892
  if (e.indices !== void 0 && !l.index) {
@@ -1895,11 +1895,11 @@ function Ne(l, e, t) {
1895
1895
  });
1896
1896
  n.push(o);
1897
1897
  }
1898
- return Ee.workingColorSpace !== I && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ee.workingColorSpace}" not supported.`), D(l, e), _s(l, e, t), Promise.all(n).then(function() {
1898
+ return be.workingColorSpace !== I && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${be.workingColorSpace}" not supported.`), D(l, e), _s(l, e, t), Promise.all(n).then(function() {
1899
1899
  return e.targets !== void 0 ? us(l, e.targets, t) : l;
1900
1900
  });
1901
1901
  }
1902
- const Oe = { type: "change" }, ge = { type: "start" }, ze = { type: "end" }, W = new Ct(), De = new It(), Ts = Math.cos(70 * Ge.DEG2RAD), R = new M(), w = 2 * Math.PI, E = {
1902
+ const De = { type: "change" }, _e = { type: "start" }, Ve = { type: "end" }, W = new It(), Ce = new vt(), Ts = Math.cos(70 * Ue.DEG2RAD), R = new M(), w = 2 * Math.PI, E = {
1903
1903
  NONE: -1,
1904
1904
  ROTATE: 0,
1905
1905
  DOLLY: 1,
@@ -1909,7 +1909,7 @@ const Oe = { type: "change" }, ge = { type: "start" }, ze = { type: "end" }, W =
1909
1909
  TOUCH_DOLLY_PAN: 5,
1910
1910
  TOUCH_DOLLY_ROTATE: 6
1911
1911
  }, ae = 1e-6;
1912
- class ys extends Dt {
1912
+ class ys extends Ct {
1913
1913
  /**
1914
1914
  * Constructs a new controls instance.
1915
1915
  *
@@ -1917,7 +1917,7 @@ class ys extends Dt {
1917
1917
  * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
1918
1918
  */
1919
1919
  constructor(e, t = null) {
1920
- super(e, t), this.state = E.NONE, this.target = new M(), this.cursor = new M(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: U.ROTATE, MIDDLE: U.DOLLY, RIGHT: U.PAN }, this.touches = { ONE: G.ROTATE, TWO: G.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new Q(), this._lastTargetPosition = new M(), this._quat = new Q().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new be(), this._sphericalDelta = new be(), this._scale = 1, this._panOffset = new M(), this._rotateStart = new S(), this._rotateEnd = new S(), this._rotateDelta = new S(), this._panStart = new S(), this._panEnd = new S(), this._panDelta = new S(), this._dollyStart = new S(), this._dollyEnd = new S(), this._dollyDelta = new S(), this._dollyDirection = new M(), this._mouse = new S(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Es.bind(this), this._onPointerDown = xs.bind(this), this._onPointerUp = bs.bind(this), this._onContextMenu = Ps.bind(this), this._onMouseWheel = ws.bind(this), this._onKeyDown = Ss.bind(this), this._onTouchStart = As.bind(this), this._onTouchMove = Ls.bind(this), this._onMouseDown = Rs.bind(this), this._onMouseMove = Ms.bind(this), this._interceptControlDown = Ns.bind(this), this._interceptControlUp = Os.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
1920
+ super(e, t), this.state = E.NONE, this.target = new M(), this.cursor = new M(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: U.ROTATE, MIDDLE: U.DOLLY, RIGHT: U.PAN }, this.touches = { ONE: G.ROTATE, TWO: G.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new Q(), this._lastTargetPosition = new M(), this._quat = new Q().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Re(), this._sphericalDelta = new Re(), this._scale = 1, this._panOffset = new M(), this._rotateStart = new S(), this._rotateEnd = new S(), this._rotateDelta = new S(), this._panStart = new S(), this._panEnd = new S(), this._panDelta = new S(), this._dollyStart = new S(), this._dollyEnd = new S(), this._dollyDelta = new S(), this._dollyDirection = new M(), this._mouse = new S(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Es.bind(this), this._onPointerDown = xs.bind(this), this._onPointerUp = bs.bind(this), this._onContextMenu = Ps.bind(this), this._onMouseWheel = ws.bind(this), this._onKeyDown = Ss.bind(this), this._onTouchStart = As.bind(this), this._onTouchMove = Ls.bind(this), this._onMouseDown = Rs.bind(this), this._onMouseMove = Ms.bind(this), this._interceptControlDown = Ns.bind(this), this._interceptControlUp = Os.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
1921
1921
  }
1922
1922
  connect(e) {
1923
1923
  super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
@@ -1978,7 +1978,7 @@ class ys extends Dt {
1978
1978
  * was called, or the initial state.
1979
1979
  */
1980
1980
  reset() {
1981
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Oe), this.update(), this.state = E.NONE;
1981
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(De), this.update(), this.state = E.NONE;
1982
1982
  }
1983
1983
  update(e = null) {
1984
1984
  const t = this.object.position;
@@ -2008,12 +2008,12 @@ class ys extends Dt {
2008
2008
  c.unproject(this.object), this.object.position.sub(c).add(a), this.object.updateMatrixWorld(), o = R.length();
2009
2009
  } else
2010
2010
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
2011
- o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (W.origin.copy(this.object.position), W.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(W.direction)) < Ts ? this.object.lookAt(this.target) : (De.setFromNormalAndCoplanarPoint(this.object.up, this.target), W.intersectPlane(De, this.target))));
2011
+ o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (W.origin.copy(this.object.position), W.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(W.direction)) < Ts ? this.object.lookAt(this.target) : (Ce.setFromNormalAndCoplanarPoint(this.object.up, this.target), W.intersectPlane(Ce, this.target))));
2012
2012
  } else if (this.object.isOrthographicCamera) {
2013
2013
  const o = this.object.zoom;
2014
2014
  this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
2015
2015
  }
2016
- return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > ae || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > ae || this._lastTargetPosition.distanceToSquared(this.target) > ae ? (this.dispatchEvent(Oe), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
2016
+ return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > ae || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > ae || this._lastTargetPosition.distanceToSquared(this.target) > ae ? (this.dispatchEvent(De), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
2017
2017
  }
2018
2018
  _getAutoRotationAngle(e) {
2019
2019
  return e !== null ? w / 60 * this.autoRotateSpeed * e : w / 60 / 60 * this.autoRotateSpeed;
@@ -2214,7 +2214,7 @@ function Es(l) {
2214
2214
  function bs(l) {
2215
2215
  switch (this._removePointer(l), this._pointers.length) {
2216
2216
  case 0:
2217
- this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ze), this.state = E.NONE;
2217
+ this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Ve), this.state = E.NONE;
2218
2218
  break;
2219
2219
  case 1:
2220
2220
  const e = this._pointers[0], t = this._pointerPositions[e];
@@ -2263,7 +2263,7 @@ function Rs(l) {
2263
2263
  default:
2264
2264
  this.state = E.NONE;
2265
2265
  }
2266
- this.state !== E.NONE && this.dispatchEvent(ge);
2266
+ this.state !== E.NONE && this.dispatchEvent(_e);
2267
2267
  }
2268
2268
  function Ms(l) {
2269
2269
  switch (this.state) {
@@ -2282,7 +2282,7 @@ function Ms(l) {
2282
2282
  }
2283
2283
  }
2284
2284
  function ws(l) {
2285
- this.enabled === !1 || this.enableZoom === !1 || this.state !== E.NONE || (l.preventDefault(), this.dispatchEvent(ge), this._handleMouseWheel(this._customWheelEvent(l)), this.dispatchEvent(ze));
2285
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== E.NONE || (l.preventDefault(), this.dispatchEvent(_e), this._handleMouseWheel(this._customWheelEvent(l)), this.dispatchEvent(Ve));
2286
2286
  }
2287
2287
  function Ss(l) {
2288
2288
  this.enabled !== !1 && this._handleKeyDown(l);
@@ -2320,7 +2320,7 @@ function As(l) {
2320
2320
  default:
2321
2321
  this.state = E.NONE;
2322
2322
  }
2323
- this.state !== E.NONE && this.dispatchEvent(ge);
2323
+ this.state !== E.NONE && this.dispatchEvent(_e);
2324
2324
  }
2325
2325
  function Ls(l) {
2326
2326
  switch (this._trackPointer(l), this.state) {
@@ -2392,14 +2392,15 @@ const Ds = (l, e) => {
2392
2392
  },
2393
2393
  emits: ["initialized", "animate"],
2394
2394
  setup(l, { emit: e }) {
2395
- const t = e, s = l, n = "dom" + Ve().uid, i = Xe(n);
2395
+ const t = e, s = l, n = "dom" + Xe().uid, i = Ye(n);
2396
2396
  let o = null, a = null, r = null, c = null, u = null;
2397
2397
  const h = () => {
2398
2398
  t("animate", {
2399
- GLTFLoader: de,
2399
+ GLTFLoader: pe,
2400
2400
  THREE: L,
2401
- VRMExpressionPresetName: Me,
2402
- VRMHumanBoneName: Re,
2401
+ VRMExpressionPresetName: we,
2402
+ VRMHumanBoneName: Me,
2403
+ VRMUtils: ue,
2403
2404
  camera: r,
2404
2405
  controls: u,
2405
2406
  renderer: c,
@@ -2445,10 +2446,11 @@ const Ds = (l, e) => {
2445
2446
  a.add(A);
2446
2447
  }
2447
2448
  t("initialized", {
2448
- GLTFLoader: de,
2449
+ GLTFLoader: pe,
2449
2450
  THREE: L,
2450
- VRMExpressionPresetName: Me,
2451
- VRMHumanBoneName: Re,
2451
+ VRMExpressionPresetName: we,
2452
+ VRMHumanBoneName: Me,
2453
+ VRMUtils: ue,
2452
2454
  camera: r,
2453
2455
  controls: u,
2454
2456
  renderer: c,
@@ -2456,8 +2458,8 @@ const Ds = (l, e) => {
2456
2458
  });
2457
2459
  };
2458
2460
  return $(async () => {
2459
- if (!we.isWebGL2Available()) {
2460
- const f = we.getWebGLErrorMessage();
2461
+ if (!Se.isWebGL2Available()) {
2462
+ const f = Se.getWebGLErrorMessage();
2461
2463
  console.error(f);
2462
2464
  return;
2463
2465
  }
@@ -2466,12 +2468,12 @@ const Ds = (l, e) => {
2466
2468
  c.setPixelRatio(window.devicePixelRatio), c.setSize(g, x), r.aspect = g / x, r.updateProjectionMatrix();
2467
2469
  };
2468
2470
  window.addEventListener("resize", _), m();
2469
- }), (_, f) => (me(), Ce("div", {
2471
+ }), (_, f) => (ge(), Ie("div", {
2470
2472
  ref: n,
2471
2473
  class: "box"
2472
2474
  }));
2473
2475
  }
2474
- }, Us = /* @__PURE__ */ Ds(Cs, [["__scopeId", "data-v-81e1dabc"]]), Is = {
2476
+ }, Us = /* @__PURE__ */ Ds(Cs, [["__scopeId", "data-v-60c3a6e5"]]), Is = {
2475
2477
  __name: "VroidExpression",
2476
2478
  props: {
2477
2479
  command: {
@@ -2494,7 +2496,7 @@ const Ds = (l, e) => {
2494
2496
  if (!o)
2495
2497
  return;
2496
2498
  t("loading", s.name, s.command);
2497
- const r = await new ue().fetchExpression(o);
2499
+ const r = await new de().fetchExpression(o);
2498
2500
  let c = !1;
2499
2501
  r && (c = !0), t("loaded", s.name, s.command, c, r);
2500
2502
  }, i = (o) => {
@@ -2533,12 +2535,12 @@ const Ds = (l, e) => {
2533
2535
  if (!o)
2534
2536
  return;
2535
2537
  t("loading", s.name, s.command);
2536
- const r = await new ue().fetchPose(o);
2538
+ const r = await new de().fetchPose(o);
2537
2539
  let c = !1;
2538
2540
  r && (c = !0), t("loaded", s.name, s.command, c, r);
2539
2541
  }, i = (o) => {
2540
2542
  t("loading", s.name, s.command);
2541
- const r = new ue().normalizePose(o);
2543
+ const r = new de().normalizePose(o);
2542
2544
  let c = !1;
2543
2545
  r && (c = !0), t("loaded", s.name, s.command, c, r);
2544
2546
  };
@@ -2570,10 +2572,10 @@ const Ds = (l, e) => {
2570
2572
  emits: ["loading", "loaded"],
2571
2573
  setup(l, { emit: e }) {
2572
2574
  const t = e, s = l, n = async (a) => {
2573
- const r = new de();
2574
- return r.register((c) => new vt(c)), await r.loadAsync(a).then((c) => {
2575
+ const r = new pe();
2576
+ return r.register((c) => new kt(c)), await r.loadAsync(a).then((c) => {
2575
2577
  const u = c.userData.vrm;
2576
- return kt.rotateVRM0(u), u;
2578
+ return ue.rotateVRM0(u), u;
2577
2579
  });
2578
2580
  }, i = async (a) => {
2579
2581
  if (!a)
@@ -2655,7 +2657,7 @@ const Ds = (l, e) => {
2655
2657
  delete i[b];
2656
2658
  }
2657
2659
  };
2658
- return (h, d) => (me(), Ce(Ye, null, [
2660
+ return (h, d) => (ge(), Ie(We, null, [
2659
2661
  ee(Is, {
2660
2662
  command: "load_expression",
2661
2663
  name: s.expression_name,
@@ -2735,7 +2737,7 @@ const Ds = (l, e) => {
2735
2737
  }, i = (o, a) => {
2736
2738
  "vrm" in a && s.value.setModel(a.vrm), "pose" in a && (s.value.resetPose(), s.value.setPose(a.pose), s.value.updatePose()), "expression" in a && (s.value.resetExpression(), s.value.importExpression(a.expression), s.value.updateExpression()), t("loaded", o, s.value);
2737
2739
  };
2738
- return (o, a) => (me(), We(js, {
2740
+ return (o, a) => (ge(), Ze(js, {
2739
2741
  name: l.model_name,
2740
2742
  expression_name: l.expression_name,
2741
2743
  expression_url: l.expression_url,
@@ -2752,7 +2754,7 @@ const Ds = (l, e) => {
2752
2754
  }
2753
2755
  };
2754
2756
  export {
2755
- ue as ResourceLoader,
2757
+ de as ResourceLoader,
2756
2758
  Us as ThreeFrame,
2757
2759
  jt as VrmModel,
2758
2760
  Ks as VroidControl,
@@ -1,2 +1,2 @@
1
- (function(A,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("vue"),require("three"),require("@pixiv/three-vrm")):typeof define=="function"&&define.amd?define(["exports","vue","three","@pixiv/three-vrm"],M):(A=typeof globalThis<"u"?globalThis:A||self,M(A.VueThreeVrm={},A.Vue,A.THREE,A.THREE_VRM))})(this,function(A,M,h,j){"use strict";var J=document.createElement("style");J.textContent=`.box[data-v-81e1dabc]{display:block;width:100%;height:100%}
2
- /*$vite$:1*/`,document.head.appendChild(J);function me(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const O=me(h);class V{constructor(){}async fetchJSON(e){const t=await fetch(e);return t.ok?await t.json():null}normalizePose(e){return e==null?null:"pose"in e?e.pose:e}async fetchPose(e){const t=await this.fetchJSON(e);return this.normalizePose(t)}async fetchExpression(e){const t=await this.fetchJSON(e);return t==null?null:"expressions"in t?t.expressions:t}}class H{constructor(){this.vrm=null}get scene(){return this.vrm?this.vrm.scene:null}setModel(e){this.vrm=e}setPosition(e){this.vrm.scene.position.x=e.x,this.vrm.scene.position.y=e.y,this.vrm.scene.position.z=e.z}getPosition(){return{x:this.vrm.scene.position.x,y:this.vrm.scene.position.y,z:this.vrm.scene.position.z}}setPose(e){this.vrm&&this.vrm.humanoid.setNormalizedPose(e)}getPose(){return this.vrm?this.vrm.humanoid.getNormalizedPose():null}updatePose(){this.vrm&&this.vrm.humanoid.update()}resetPose(){this.vrm&&this.vrm.humanoid.resetNormalizedPose()}getBoneNode(e){return this.vrm?this.vrm.humanoid.getNormalizedBoneNode(e):null}isValid(){return!!this.vrm}getBoneRotate(e){const t=this.getBoneNode(e);return t?{x:t.rotation.x,y:t.rotation.y,z:t.rotation.z}:null}setBoneRotate(e,t,s,n){const i=this.getBoneNode(e);i&&(i.rotation.x=t,i.rotation.y=s,i.rotation.z=n)}getBonePosition(e){const t=this.getBoneNode(e);return t?{x:t.position.x,y:t.position.y,z:t.position.z}:null}setBonePosition(e,t,s,n){const i=this.getBoneNode(e);i&&(i.position.x=t,i.position.y=s,i.position.z=n)}getMetaVersion(){return this.vrm?this.vrm.meta.metaVersion:null}setExpression(e,t){this.vrm&&this.vrm.expressionManager.setValue(e,t)}getExpression(e){return this.vrm?this.vrm.expressionManager.getValue(e):null}updateExpression(){return this.vrm?this.vrm.expressionManager.update():null}resetExpression(){return this.vrm?this.vrm.expressionManager.resetValues():null}getExpressionNames(){if(this.vrm){let e=[];for(const t in this.vrm.expressionManager.expressionMap)e.push(t);return e}return null}importExpression(e){if(this.vrm)for(const t in e)this.vrm.expressionManager.setValue(t,e[t])}exportExpression(){if(this.vrm){let e={};const t=this.getExpressionNames();for(const s in t)e[s]=this.getExpression(s);return e}return null}}class ee{static isWebGL2Available(){try{const e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}}static isColorSpaceAvailable(e){try{const t=document.createElement("canvas"),s=window.WebGL2RenderingContext&&t.getContext("webgl2");return s.drawingBufferColorSpace=e,s.drawingBufferColorSpace===e}catch{return!1}}static getWebGL2ErrorMessage(){return this._getErrorMessage(2)}static _getErrorMessage(e){const t={1:"WebGL",2:"WebGL 2"},s={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext};let n='Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';const i=document.createElement("div");return i.id="webglmessage",i.style.fontFamily="monospace",i.style.fontSize="13px",i.style.fontWeight="normal",i.style.textAlign="center",i.style.background="#fff",i.style.color="#000",i.style.padding="1.5em",i.style.width="400px",i.style.margin="5em auto 0",s[e]?n=n.replace("$0","graphics card"):n=n.replace("$0","browser"),n=n.replace("$1",t[e]),i.innerHTML=n,i}static isWebGLAvailable(){console.warn("isWebGLAvailable() has been deprecated and will be removed in r178. Use isWebGL2Available() instead.");try{const e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}static getWebGLErrorMessage(){return console.warn("getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage() instead."),this._getErrorMessage(1)}}function te(l,e){if(e===h.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),l;if(e===h.TriangleFanDrawMode||e===h.TriangleStripDrawMode){let t=l.getIndex();if(t===null){const o=[],a=l.getAttribute("position");if(a!==void 0){for(let r=0;r<a.count;r++)o.push(r);l.setIndex(o),t=l.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),l}const s=t.count-2,n=[];if(e===h.TriangleFanDrawMode)for(let o=1;o<=s;o++)n.push(t.getX(0)),n.push(t.getX(o)),n.push(t.getX(o+1));else for(let o=0;o<s;o++)o%2===0?(n.push(t.getX(o)),n.push(t.getX(o+1)),n.push(t.getX(o+2))):(n.push(t.getX(o+2)),n.push(t.getX(o+1)),n.push(t.getX(o)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=l.clone();return i.setIndex(n),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),l}class K extends h.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new be(t)}),this.register(function(t){return new Me(t)}),this.register(function(t){return new Ce(t)}),this.register(function(t){return new De(t)}),this.register(function(t){return new Re(t)}),this.register(function(t){return new Se(t)}),this.register(function(t){return new we(t)}),this.register(function(t){return new Le(t)}),this.register(function(t){return new Ae(t)}),this.register(function(t){return new xe(t)}),this.register(function(t){return new Pe(t)}),this.register(function(t){return new Te(t)}),this.register(function(t){return new Ne(t)}),this.register(function(t){return new Oe(t)}),this.register(function(t){return new _e(t)}),this.register(function(t){return new Ie(t)}),this.register(function(t){return new ke(t)})}load(e,t,s,n){const i=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=h.LoaderUtils.extractUrlBase(e);o=h.LoaderUtils.resolveURL(c,this.path)}else o=h.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){n?n(c):console.error(c),i.manager.itemError(e),i.manager.itemEnd(e)},r=new h.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,function(c){try{i.parse(c,o,function(d){t(d),i.manager.itemEnd(e)},a)}catch(d){a(d)}},s,a)}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,s,n){let i;const o={},a={},r=new TextDecoder;if(typeof e=="string")i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(r.decode(new Uint8Array(e,0,4))===se){try{o[b.KHR_BINARY_GLTF]=new ve(e)}catch(u){n&&n(u);return}i=JSON.parse(o[b.KHR_BINARY_GLTF].content)}else i=JSON.parse(r.decode(e));else i=e;if(i.asset===void 0||i.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new qe(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const u=this.pluginCallbacks[d](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,o[u.name]=!0}if(i.extensionsUsed)for(let d=0;d<i.extensionsUsed.length;++d){const u=i.extensionsUsed[d],p=i.extensionsRequired||[];switch(u){case b.KHR_MATERIALS_UNLIT:o[u]=new ye;break;case b.KHR_DRACO_MESH_COMPRESSION:o[u]=new Fe(i,this.dracoLoader);break;case b.KHR_TEXTURE_TRANSFORM:o[u]=new je;break;case b.KHR_MESH_QUANTIZATION:o[u]=new Ue;break;default:p.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,i){s.parse(e,t,n,i)})}}function ge(){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={}}}}const b={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_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",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class _e{constructor(e){this.parser=e,this.name=b.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const i=t[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const i=t.json,r=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let c;const d=new h.Color(16777215);r.color!==void 0&&d.setRGB(r.color[0],r.color[1],r.color[2],h.LinearSRGBColorSpace);const u=r.range!==void 0?r.range:0;switch(r.type){case"directional":c=new h.DirectionalLight(d),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new h.PointLight(d),c.distance=u;break;case"spot":c=new h.SpotLight(d),c.distance=u,r.spot=r.spot||{},r.spot.innerConeAngle=r.spot.innerConeAngle!==void 0?r.spot.innerConeAngle:0,r.spot.outerConeAngle=r.spot.outerConeAngle!==void 0?r.spot.outerConeAngle:Math.PI/4,c.angle=r.spot.outerConeAngle,c.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+r.type)}return c.position.set(0,0,0),R(c,r),r.intensity!==void 0&&(c.intensity=r.intensity),c.name=t.createUniqueName(r.name||"light_"+e),n=Promise.resolve(c),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,i=s.json.nodes[e],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(r){return s._getNodeRef(t.cache,a,r)})}}class ye{constructor(){this.name=b.KHR_MATERIALS_UNLIT}getMaterialType(){return h.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new h.Color(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const o=i.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],h.LinearSRGBColorSpace),e.opacity=o[3]}i.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",i.baseColorTexture,h.SRGBColorSpace))}return Promise.all(n)}}class xe{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}}class be{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(i.push(s.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new h.Vector2(a,a)}return Promise.all(i)}}class Me{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}}class Te{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}class Se{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new h.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=n.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&i.push(s.assignTexture(t,"sheenColorMap",o.sheenColorTexture,h.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}class we{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&i.push(s.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}class Le{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&i.push(s.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),Promise.all(i)}}class Ae{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class Pe{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&i.push(s.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&i.push(s.assignTexture(t,"specularColorMap",o.specularColorTexture,h.SRGBColorSpace)),Promise.all(i)}}class Oe{constructor(e){this.parser=e,this.name=b.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&i.push(s.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(i)}}class Ne{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&i.push(s.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}class Ce{constructor(e){this.parser=e,this.name=b.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,o)}}class De{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let r=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(r=c)}return s.loadTextureImage(e,o.source,r)}}class Re{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let r=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(r=c)}return s.loadTextureImage(e,o.source,r)}}class Ie{constructor(e){this.name=b.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.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 i.then(function(a){const r=n.byteOffset||0,c=n.byteLength||0,d=n.count,u=n.byteStride,p=new Uint8Array(a,r,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,u,p,n.mode,n.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(d*u);return o.decodeGltfBuffer(new Uint8Array(f),d,u,p,n.mode,n.filter),f})})}else return null}}class ke{constructor(e){this.name=b.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const c of n.primitives)if(c.mode!==N.TRIANGLES&&c.mode!==N.TRIANGLE_STRIP&&c.mode!==N.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=s.extensions[this.name].attributes,a=[],r={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(r[c]=d,r[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),u=d.isGroup?d.children:[d],p=c[0].count,f=[];for(const g of u){const _=new h.Matrix4,m=new h.Vector3,y=new h.Quaternion,T=new h.Vector3(1,1,1),w=new h.InstancedMesh(g.geometry,g.material,p);for(let x=0;x<p;x++)r.TRANSLATION&&m.fromBufferAttribute(r.TRANSLATION,x),r.ROTATION&&y.fromBufferAttribute(r.ROTATION,x),r.SCALE&&T.fromBufferAttribute(r.SCALE,x),w.setMatrixAt(x,_.compose(m,y,T));for(const x in r)if(x==="_COLOR_0"){const C=r[x];w.instanceColor=new h.InstancedBufferAttribute(C.array,C.itemSize,C.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,r[x]);h.Object3D.prototype.copy.call(w,g),this.parser.assignFinalMaterial(w),f.push(w)}return d.isGroup?(d.clear(),d.add(...f),d):f[0]}))}}const se="glTF",G=12,ne={JSON:1313821514,BIN:5130562};class ve{constructor(e){this.name=b.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,G),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==se)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-G,i=new DataView(e,G);let o=0;for(;o<n;){const a=i.getUint32(o,!0);o+=4;const r=i.getUint32(o,!0);if(o+=4,r===ne.JSON){const c=new Uint8Array(e,G+o,a);this.content=s.decode(c)}else if(r===ne.BIN){const c=G+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Fe{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=b.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},r={},c={};for(const d in o){const u=X[d]||d.toLowerCase();a[u]=o[d]}for(const d in e.attributes){const u=X[d]||d.toLowerCase();if(o[d]!==void 0){const p=s.accessors[e.attributes[d]],f=U[p.componentType];c[u]=f.name,r[u]=p.normalized===!0}}return t.getDependency("bufferView",i).then(function(d){return new Promise(function(u,p){n.decodeDracoFile(d,function(f){for(const g in f.attributes){const _=f.attributes[g],m=r[g];m!==void 0&&(_.normalized=m)}u(f)},a,c,h.LinearSRGBColorSpace,p)})})}}class je{constructor(){this.name=b.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Ue{constructor(){this.name=b.KHR_MESH_QUANTIZATION}}class ie extends h.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=e*n*3+n;for(let o=0;o!==n;o++)t[o]=s[i+o];return t}interpolate_(e,t,s,n){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,r=a*2,c=a*3,d=n-t,u=(s-t)/d,p=u*u,f=p*u,g=e*c,_=g-c,m=-2*f+3*p,y=f-p,T=1-m,w=y-p+u;for(let x=0;x!==a;x++){const C=o[_+x+a],k=o[_+x+r]*d,D=o[g+x+a],B=o[g+x]*d;i[x]=T*C+w*k+m*D+y*B}return i}}const Ge=new h.Quaternion;class Be extends ie{interpolate_(e,t,s,n){const i=super.interpolate_(e,t,s,n);return Ge.fromArray(i).normalize().toArray(i),i}}const N={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},U={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},oe={9728:h.NearestFilter,9729:h.LinearFilter,9984:h.NearestMipmapNearestFilter,9985:h.LinearMipmapNearestFilter,9986:h.NearestMipmapLinearFilter,9987:h.LinearMipmapLinearFilter},re={33071:h.ClampToEdgeWrapping,33648:h.MirroredRepeatWrapping,10497:h.RepeatWrapping},z={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},X={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"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ve={CUBICSPLINE:void 0,LINEAR:h.InterpolateLinear,STEP:h.InterpolateDiscrete},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ee(l){return l.DefaultMaterial===void 0&&(l.DefaultMaterial=new h.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:h.FrontSide})),l.DefaultMaterial}function F(l,e,t){for(const s in t.extensions)l[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function R(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 Ke(l,e,t){let s=!1,n=!1,i=!1;for(let c=0,d=e.length;c<d;c++){const u=e[c];if(u.POSITION!==void 0&&(s=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(l);const o=[],a=[],r=[];for(let c=0,d=e.length;c<d;c++){const u=e[c];if(s){const p=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):l.attributes.position;o.push(p)}if(n){const p=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):l.attributes.normal;a.push(p)}if(i){const p=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):l.attributes.color;r.push(p)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(r)]).then(function(c){const d=c[0],u=c[1],p=c[2];return s&&(l.morphAttributes.position=d),n&&(l.morphAttributes.normal=u),i&&(l.morphAttributes.color=p),l.morphTargetsRelative=!0,l})}function ze(l,e){if(l.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)l.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(l.morphTargetInfluences.length===t.length){l.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)l.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Xe(l){let e;const t=l.extensions&&l.extensions[b.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Y(t.attributes):e=l.indices+":"+Y(l.attributes)+":"+l.mode,l.targets!==void 0)for(let s=0,n=l.targets.length;s<n;s++)e+=":"+Y(l.targets[s]);return e}function Y(l){let e="";const t=Object.keys(l).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+l[t[s]]+";";return e}function q(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 We(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"}const Ye=new h.Matrix4;class qe{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ge,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 s=!1,n=-1,i=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const r=a.match(/Version\/(\d+)/);n=s&&r?parseInt(r[1],10):-1,i=a.indexOf("Firefox")>-1,o=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||i&&o<98?this.textureLoader=new h.TextureLoader(this.options.manager):this.textureLoader=new h.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new h.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(o){const a={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:s,userData:{}};return F(i,a,n),R(a,n),Promise.all(s._invokeAll(function(r){return r.afterRoot&&r.afterRoot(a)})).then(function(){for(const r of a.scenes)r.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n].joints;for(let a=0,r=o.length;a<r;a++)e[o[a]].isBone=!0}for(let n=0,i=e.length;n<i;n++){const o=e[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(s[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.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,s){if(e.refs[t]<=1)return s;const n=s.clone(),i=(o,a)=>{const r=this.associations.get(o);r!=null&&this.associations.set(a,r);for(const[c,d]of o.children.entries())i(d,a.children[c])};return i(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i&&s.push(i)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":n=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(i,o){return s.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=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[b.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(i,o){s.load(h.LoaderUtils.resolveURL(t.uri,n.path),i,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,i=t.byteOffset||0;return s.slice(i,i+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const o=z[n.type],a=U[n.componentType],r=n.normalized===!0,c=new a(n.count*o);return Promise.resolve(new h.BufferAttribute(c,o,r))}const i=[];return n.bufferView!==void 0?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),n.sparse!==void 0&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(o){const a=o[0],r=z[n.type],c=U[n.componentType],d=c.BYTES_PER_ELEMENT,u=d*r,p=n.byteOffset||0,f=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,g=n.normalized===!0;let _,m;if(f&&f!==u){const y=Math.floor(p/f),T="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+y+":"+n.count;let w=t.cache.get(T);w||(_=new c(a,y*f,n.count*f/d),w=new h.InterleavedBuffer(_,f/d),t.cache.add(T,w)),m=new h.InterleavedBufferAttribute(w,r,p%f/d,g)}else a===null?_=new c(n.count*r):_=new c(a,p,n.count*r),m=new h.BufferAttribute(_,r,g);if(n.sparse!==void 0){const y=z.SCALAR,T=U[n.sparse.indices.componentType],w=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,C=new T(o[1],w,n.sparse.count*y),k=new c(o[2],x,n.sparse.count*r);a!==null&&(m=new h.BufferAttribute(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let D=0,B=C.length;D<B;D++){const v=C[D];if(m.setX(v,k[D*r]),r>=2&&m.setY(v,k[D*r+1]),r>=3&&m.setZ(v,k[D*r+2]),r>=4&&m.setW(v,k[D*r+3]),r>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,o=t.images[i];let a=this.textureLoader;if(o.uri){const r=s.manager.getHandler(o.uri);r!==null&&(a=r)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,s){const n=this,i=this.json,o=i.textures[e],a=i.images[t],r=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[r])return this.textureCache[r];const c=this.loadImageSource(t,s).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const p=(i.samplers||{})[o.sampler]||{};return d.magFilter=oe[p.magFilter]||h.LinearFilter,d.minFilter=oe[p.minFilter]||h.LinearMipmapLinearFilter,d.wrapS=re[p.wrapS]||h.RepeatWrapping,d.wrapT=re[p.wrapT]||h.RepeatWrapping,d.generateMipmaps=!d.isCompressedTexture&&d.minFilter!==h.NearestFilter&&d.minFilter!==h.LinearFilter,n.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[r]=c,c}loadImageSource(e,t){const s=this,n=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=n.images[e],a=self.URL||self.webkitURL;let r=o.uri||"",c=!1;if(o.bufferView!==void 0)r=s.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const p=new Blob([u],{type:o.mimeType});return r=a.createObjectURL(p),r});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(r).then(function(u){return new Promise(function(p,f){let g=p;t.isImageBitmapLoader===!0&&(g=function(_){const m=new h.Texture(_);m.needsUpdate=!0,p(m)}),t.load(h.LoaderUtils.resolveURL(u,i.path),g,void 0,f)})}).then(function(u){return c===!0&&a.revokeObjectURL(r),R(u,o),u.userData.mimeType=o.mimeType||We(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",r),u});return this.sourceCache[e]=d,d}assignTexture(e,t,s,n){const i=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(o=o.clone(),o.channel=s.texCoord),i.extensions[b.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[b.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const r=i.associations.get(o);o=i.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),i.associations.set(o,r)}}return n!==void 0&&(o.colorSpace=n),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+s.uuid;let r=this.cache.get(a);r||(r=new h.PointsMaterial,h.Material.prototype.copy.call(r,s),r.color.copy(s.color),r.map=s.map,r.sizeAttenuation=!1,this.cache.add(a,r)),s=r}else if(e.isLine){const a="LineBasicMaterial:"+s.uuid;let r=this.cache.get(a);r||(r=new h.LineBasicMaterial,h.Material.prototype.copy.call(r,s),r.color.copy(s.color),r.map=s.map,this.cache.add(a,r)),s=r}if(n||i||o){let a="ClonedMaterial:"+s.uuid+":";n&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let r=this.cache.get(a);r||(r=s.clone(),i&&(r.vertexColors=!0),o&&(r.flatShading=!0),n&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(a,r),this.associations.set(r,this.associations.get(s))),s=r}e.material=s}getMaterialType(){return h.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,i=s.materials[e];let o;const a={},r=i.extensions||{},c=[];if(r[b.KHR_MATERIALS_UNLIT]){const u=n[b.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,i,t))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new h.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const p=u.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],h.LinearSRGBColorSpace),a.opacity=p[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,h.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}i.doubleSided===!0&&(a.side=h.DoubleSide);const d=i.alphaMode||W.OPAQUE;if(d===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==h.MeshBasicMaterial&&(c.push(t.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new h.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&o!==h.MeshBasicMaterial&&(c.push(t.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&o!==h.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new h.Color().setRGB(u[0],u[1],u[2],h.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&o!==h.MeshBasicMaterial&&c.push(t.assignTexture(a,"emissiveMap",i.emissiveTexture,h.SRGBColorSpace)),Promise.all(c).then(function(){const u=new o(a);return i.name&&(u.name=i.name),R(u,i),t.associations.set(u,{materials:e}),i.extensions&&F(n,u,i),u})}createUniqueName(e){const t=h.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function i(a){return s[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(r){return ae(r,a,t)})}const o=[];for(let a=0,r=e.length;a<r;a++){const c=e[a],d=Xe(c),u=n[d];if(u)o.push(u.promise);else{let p;c.extensions&&c.extensions[b.KHR_DRACO_MESH_COMPRESSION]?p=i(c):p=ae(new h.BufferGeometry,c,t),n[d]={primitive:c,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,s=this.json,n=this.extensions,i=s.meshes[e],o=i.primitives,a=[];for(let r=0,c=o.length;r<c;r++){const d=o[r].material===void 0?Ee(this.cache):this.getDependency("material",o[r].material);a.push(d)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(r){const c=r.slice(0,r.length-1),d=r[r.length-1],u=[];for(let f=0,g=d.length;f<g;f++){const _=d[f],m=o[f];let y;const T=c[f];if(m.mode===N.TRIANGLES||m.mode===N.TRIANGLE_STRIP||m.mode===N.TRIANGLE_FAN||m.mode===void 0)y=i.isSkinnedMesh===!0?new h.SkinnedMesh(_,T):new h.Mesh(_,T),y.isSkinnedMesh===!0&&y.normalizeSkinWeights(),m.mode===N.TRIANGLE_STRIP?y.geometry=te(y.geometry,h.TriangleStripDrawMode):m.mode===N.TRIANGLE_FAN&&(y.geometry=te(y.geometry,h.TriangleFanDrawMode));else if(m.mode===N.LINES)y=new h.LineSegments(_,T);else if(m.mode===N.LINE_STRIP)y=new h.Line(_,T);else if(m.mode===N.LINE_LOOP)y=new h.LineLoop(_,T);else if(m.mode===N.POINTS)y=new h.Points(_,T);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(y.geometry.morphAttributes).length>0&&ze(y,i),y.name=t.createUniqueName(i.name||"mesh_"+e),R(y,i),m.extensions&&F(n,y,m),t.assignFinalMaterial(y),u.push(y)}for(let f=0,g=u.length;f<g;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return i.extensions&&F(n,u[0],i),u[0];const p=new h.Group;i.extensions&&F(n,p,i),t.associations.set(p,{meshes:e});for(let f=0,g=u.length;f<g;f++)p.add(u[f]);return p})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new h.PerspectiveCamera(h.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new h.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),R(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,i=t.joints.length;n<i;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const i=n.pop(),o=n,a=[],r=[];for(let c=0,d=o.length;c<d;c++){const u=o[c];if(u){a.push(u);const p=new h.Matrix4;i!==null&&p.fromArray(i.array,c*16),r.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new h.Skeleton(a,r)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,o=[],a=[],r=[],c=[],d=[];for(let u=0,p=n.channels.length;u<p;u++){const f=n.channels[u],g=n.samplers[f.sampler],_=f.target,m=_.node,y=n.parameters!==void 0?n.parameters[g.input]:g.input,T=n.parameters!==void 0?n.parameters[g.output]:g.output;_.node!==void 0&&(o.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",y)),r.push(this.getDependency("accessor",T)),c.push(g),d.push(_))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(r),Promise.all(c),Promise.all(d)]).then(function(u){const p=u[0],f=u[1],g=u[2],_=u[3],m=u[4],y=[];for(let T=0,w=p.length;T<w;T++){const x=p[T],C=f[T],k=g[T],D=_[T],B=m[T];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const v=s._createAnimationTracks(x,C,k,D,B);if(v)for(let $=0;$<v.length;$++)y.push(v[$])}return new h.AnimationClip(i,void 0,y)})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(i){const o=s._getNodeRef(s.meshCache,n.mesh,i);return n.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let r=0,c=n.weights.length;r<c;r++)a.morphTargetInfluences[r]=n.weights[r]}),o})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],i=s._loadNodeShallow(e),o=[],a=n.children||[];for(let c=0,d=a.length;c<d;c++)o.push(s.getDependency("node",a[c]));const r=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([i,Promise.all(o),r]).then(function(c){const d=c[0],u=c[1],p=c[2];p!==null&&d.traverse(function(f){f.isSkinnedMesh&&f.bind(p,Ye)});for(let f=0,g=u.length;f<g;f++)d.add(u[f]);return d})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",a=[],r=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return r&&a.push(r),i.camera!==void 0&&a.push(n.getDependency("camera",i.camera).then(function(c){return n._getNodeRef(n.cameraCache,i.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let d;if(i.isBone===!0?d=new h.Bone:c.length>1?d=new h.Group:c.length===1?d=c[0]:d=new h.Object3D,d!==c[0])for(let u=0,p=c.length;u<p;u++)d.add(c[u]);if(i.name&&(d.userData.name=i.name,d.name=o),R(d,i),i.extensions&&F(s,d,i),i.matrix!==void 0){const u=new h.Matrix4;u.fromArray(i.matrix),d.applyMatrix4(u)}else i.translation!==void 0&&d.position.fromArray(i.translation),i.rotation!==void 0&&d.quaternion.fromArray(i.rotation),i.scale!==void 0&&d.scale.fromArray(i.scale);if(!n.associations.has(d))n.associations.set(d,{});else if(i.mesh!==void 0&&n.meshCache.refs[i.mesh]>1){const u=n.associations.get(d);n.associations.set(d,{...u})}return n.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,i=new h.Group;s.name&&(i.name=n.createUniqueName(s.name)),R(i,s),s.extensions&&F(t,i,s);const o=s.nodes||[],a=[];for(let r=0,c=o.length;r<c;r++)a.push(n.getDependency("node",o[r]));return Promise.all(a).then(function(r){for(let d=0,u=r.length;d<u;d++)i.add(r[d]);const c=d=>{const u=new Map;for(const[p,f]of n.associations)(p instanceof h.Material||p instanceof h.Texture)&&u.set(p,f);return d.traverse(p=>{const f=n.associations.get(p);f!=null&&u.set(p,f)}),u};return n.associations=c(i),i})}_createAnimationTracks(e,t,s,n,i){const o=[],a=e.name?e.name:e.uuid,r=[];I[i.path]===I.weights?e.traverse(function(p){p.morphTargetInfluences&&r.push(p.name?p.name:p.uuid)}):r.push(a);let c;switch(I[i.path]){case I.weights:c=h.NumberKeyframeTrack;break;case I.rotation:c=h.QuaternionKeyframeTrack;break;case I.translation:case I.scale:c=h.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:c=h.NumberKeyframeTrack;break;case 2:case 3:default:c=h.VectorKeyframeTrack;break}break}const d=n.interpolation!==void 0?Ve[n.interpolation]:h.InterpolateLinear,u=this._getArrayFromAccessor(s);for(let p=0,f=r.length;p<f;p++){const g=new c(r[p]+"."+I[i.path],t.array,u,d);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),o.push(g)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=q(t.constructor),n=new Float32Array(t.length);for(let i=0,o=t.length;i<o;i++)n[i]=t[i]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof h.QuaternionKeyframeTrack?Be:ie;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ze(l,e,t){const s=e.attributes,n=new h.Box3;if(s.POSITION!==void 0){const a=t.json.accessors[s.POSITION],r=a.min,c=a.max;if(r!==void 0&&c!==void 0){if(n.set(new h.Vector3(r[0],r[1],r[2]),new h.Vector3(c[0],c[1],c[2])),a.normalized){const d=q(U[a.componentType]);n.min.multiplyScalar(d),n.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const a=new h.Vector3,r=new h.Vector3;for(let c=0,d=i.length;c<d;c++){const u=i[c];if(u.POSITION!==void 0){const p=t.json.accessors[u.POSITION],f=p.min,g=p.max;if(f!==void 0&&g!==void 0){if(r.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),r.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),r.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),p.normalized){const _=q(U[p.componentType]);r.multiplyScalar(_)}a.max(r)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}l.boundingBox=n;const o=new h.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,l.boundingSphere=o}function ae(l,e,t){const s=e.attributes,n=[];function i(o,a){return t.getDependency("accessor",o).then(function(r){l.setAttribute(a,r)})}for(const o in s){const a=X[o]||o.toLowerCase();a in l.attributes||n.push(i(s[o],a))}if(e.indices!==void 0&&!l.index){const o=t.getDependency("accessor",e.indices).then(function(a){l.setIndex(a)});n.push(o)}return h.ColorManagement.workingColorSpace!==h.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${h.ColorManagement.workingColorSpace}" not supported.`),R(l,e),Ze(l,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Ke(l,e.targets,t):l})}const ce={type:"change"},Z={type:"start"},le={type:"end"},E=new h.Ray,he=new h.Plane,Qe=Math.cos(70*h.MathUtils.DEG2RAD),L=new h.Vector3,P=2*Math.PI,S={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Q=1e-6;class $e extends h.Controls{constructor(e,t=null){super(e,t),this.state=S.NONE,this.target=new h.Vector3,this.cursor=new h.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:h.MOUSE.ROTATE,MIDDLE:h.MOUSE.DOLLY,RIGHT:h.MOUSE.PAN},this.touches={ONE:h.TOUCH.ROTATE,TWO:h.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new h.Vector3,this._lastQuaternion=new h.Quaternion,this._lastTargetPosition=new h.Vector3,this._quat=new h.Quaternion().setFromUnitVectors(e.up,new h.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new h.Spherical,this._sphericalDelta=new h.Spherical,this._scale=1,this._panOffset=new h.Vector3,this._rotateStart=new h.Vector2,this._rotateEnd=new h.Vector2,this._rotateDelta=new h.Vector2,this._panStart=new h.Vector2,this._panEnd=new h.Vector2,this._panDelta=new h.Vector2,this._dollyStart=new h.Vector2,this._dollyEnd=new h.Vector2,this._dollyDelta=new h.Vector2,this._dollyDirection=new h.Vector3,this._mouse=new h.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=He.bind(this),this._onPointerDown=Je.bind(this),this._onPointerUp=et.bind(this),this._onContextMenu=at.bind(this),this._onMouseWheel=nt.bind(this),this._onKeyDown=it.bind(this),this._onTouchStart=ot.bind(this),this._onTouchMove=rt.bind(this),this._onMouseDown=tt.bind(this),this._onMouseMove=st.bind(this),this._interceptControlDown=ct.bind(this),this._interceptControlUp=lt.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(ce),this.update(),this.state=S.NONE}update(e=null){const t=this.object.position;L.copy(t).sub(this.target),L.applyQuaternion(this._quat),this._spherical.setFromVector3(L),this.autoRotate&&this.state===S.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let s=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(s)&&isFinite(n)&&(s<-Math.PI?s+=P:s>Math.PI&&(s-=P),n<-Math.PI?n+=P:n>Math.PI&&(n-=P),s<=n?this._spherical.theta=Math.max(s,Math.min(n,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+n)/2?Math.max(s,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=o!=this._spherical.radius}if(L.setFromSpherical(this._spherical),L.applyQuaternion(this._quatInverse),t.copy(this.target).add(L),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=L.length();o=this._clampDistance(a*this._scale);const r=a-o;this.object.position.addScaledVector(this._dollyDirection,r),this.object.updateMatrixWorld(),i=!!r}else if(this.object.isOrthographicCamera){const a=new h.Vector3(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const r=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=r!==this.object.zoom;const c=new h.Vector3(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(E.origin.copy(this.object.position),E.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(E.direction))<Qe?this.object.lookAt(this.target):(he.setFromNormalAndCoplanarPoint(this.object.up,this.target),E.intersectPlane(he,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),i=!0)}return this._scale=1,this._performCursorZoom=!1,i||this._lastPosition.distanceToSquared(this.object.position)>Q||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Q||this._lastTargetPosition.distanceToSquared(this.target)>Q?(this.dispatchEvent(ce),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?P/60*this.autoRotateSpeed*e:P/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){L.setFromMatrixColumn(t,0),L.multiplyScalar(-e),this._panOffset.add(L)}_panUp(e,t){this.screenSpacePanning===!0?L.setFromMatrixColumn(t,1):(L.setFromMatrixColumn(t,0),L.crossVectors(this.object.up,L)),L.multiplyScalar(e),this._panOffset.add(L)}_pan(e,t){const s=this.domElement;if(this.object.isPerspectiveCamera){const n=this.object.position;L.copy(n).sub(this.target);let i=L.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/s.clientHeight,this.object.matrix),this._panUp(2*t*i/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/s.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const s=this.domElement.getBoundingClientRect(),n=e-s.left,i=t-s.top,o=s.width,a=s.height;this._mouse.x=n/o*2-1,this._mouse.y=-(i/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(P*this._rotateDelta.x/t.clientHeight),this._rotateUp(P*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._rotateStart.set(s,n)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panStart.set(s,n)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,n=e.pageY-t.y,i=Math.sqrt(s*s+n*n);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const s=this._getSecondPointerPosition(e),n=.5*(e.pageX+s.x),i=.5*(e.pageY+s.y);this._rotateEnd.set(n,i)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(P*this._rotateDelta.x/t.clientHeight),this._rotateUp(P*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panEnd.set(s,n)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,n=e.pageY-t.y,i=Math.sqrt(s*s+n*n);this._dollyEnd.set(0,i),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new h.Vector2,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,s={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function Je(l){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(l.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(l)&&(this._addPointer(l),l.pointerType==="touch"?this._onTouchStart(l):this._onMouseDown(l)))}function He(l){this.enabled!==!1&&(l.pointerType==="touch"?this._onTouchMove(l):this._onMouseMove(l))}function et(l){switch(this._removePointer(l),this._pointers.length){case 0:this.domElement.releasePointerCapture(l.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(le),this.state=S.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function tt(l){let e;switch(l.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case h.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(l),this.state=S.DOLLY;break;case h.MOUSE.ROTATE:if(l.ctrlKey||l.metaKey||l.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(l),this.state=S.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(l),this.state=S.ROTATE}break;case h.MOUSE.PAN:if(l.ctrlKey||l.metaKey||l.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(l),this.state=S.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(l),this.state=S.PAN}break;default:this.state=S.NONE}this.state!==S.NONE&&this.dispatchEvent(Z)}function st(l){switch(this.state){case S.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(l);break;case S.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(l);break;case S.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(l);break}}function nt(l){this.enabled===!1||this.enableZoom===!1||this.state!==S.NONE||(l.preventDefault(),this.dispatchEvent(Z),this._handleMouseWheel(this._customWheelEvent(l)),this.dispatchEvent(le))}function it(l){this.enabled!==!1&&this._handleKeyDown(l)}function ot(l){switch(this._trackPointer(l),this._pointers.length){case 1:switch(this.touches.ONE){case h.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(l),this.state=S.TOUCH_ROTATE;break;case h.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(l),this.state=S.TOUCH_PAN;break;default:this.state=S.NONE}break;case 2:switch(this.touches.TWO){case h.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(l),this.state=S.TOUCH_DOLLY_PAN;break;case h.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(l),this.state=S.TOUCH_DOLLY_ROTATE;break;default:this.state=S.NONE}break;default:this.state=S.NONE}this.state!==S.NONE&&this.dispatchEvent(Z)}function rt(l){switch(this._trackPointer(l),this.state){case S.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(l),this.update();break;case S.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(l),this.update();break;case S.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(l),this.update();break;case S.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(l),this.update();break;default:this.state=S.NONE}}function at(l){this.enabled!==!1&&l.preventDefault()}function ct(l){l.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function lt(l){l.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const ht=((l,e)=>{const t=l.__vccOpts||l;for(const[s,n]of e)t[s]=n;return t})({__name:"ThreeFrame",props:{animation:{type:Boolean,default:!1},clearAlpha:{type:[String,Number],default:1},clearColor:{type:String,default:"#7fbfff"},useOrbitControls:{type:Boolean,default:!1},useGridHelper:{type:Boolean,default:!1},useAxesHelper:{type:Boolean,default:!1},useDefaultLight:{type:Boolean,default:!1}},emits:["initialized","animate"],setup(l,{emit:e}){const t=e,s=l,n="dom"+M.getCurrentInstance().uid,i=M.useTemplateRef(n);let o=null,a=null,r=null,c=null,d=null;const u=()=>{const _={GLTFLoader:K,THREE:O,VRMExpressionPresetName:j.VRMExpressionPresetName,VRMHumanBoneName:j.VRMHumanBoneName,camera:r,controls:d,renderer:c,scene:a};t("animate",_),o!=null&&(cancelAnimationFrame(o),o=null),s.animation&&(o=requestAnimationFrame(u)),c.render(a,r)},p=()=>{o!=null&&(cancelAnimationFrame(o),o=null),o=requestAnimationFrame(u)},f=()=>{o!=null&&(cancelAnimationFrame(o),o=null)};M.watch(()=>s.animation,_=>{_==!0?p():f()}),M.watch(()=>s.clearAlpha,_=>{c&&c.setClearAlpha(parseFloat(_))}),M.watch(()=>s.clearColor,_=>{if(c){const m=new O.Color(_),y=c.getClearAlpha();c.setClearColor(m,y)}});const g=()=>{const _=i.value,m=_.clientWidth,y=_.clientHeight,T={antialias:!0,alpha:!1};if(O.ColorManagement.enabled=!1,c=new O.WebGLRenderer(T),c.setPixelRatio(window.devicePixelRatio),c.setSize(m,y),c.setClearColor(s.clearColor,s.clearAlpha),c.outputColorSpace=O.SRGBColorSpace,_.appendChild(c.domElement),a=new O.Scene,r=new O.PerspectiveCamera(45,m/y,.1,1e3),r.position.set(0,1.25,1),s.useOrbitControls&&(d=new $e(r,_),d.screenSpacePanning=!0,d.target.set(0,1.25,0),d.update()),s.useGridHelper){const x=new O.GridHelper(10,10);a.add(x),x.visible=!0}if(s.useAxesHelper){const x=new O.AxesHelper(5);a.add(x)}if(s.useDefaultLight){const x=new O.DirectionalLight(16777215);x.intensity=3,x.position.set(1,1,1).normalize(),a.add(x);const C=new O.AmbientLight(4210752);a.add(C)}const w={GLTFLoader:K,THREE:O,VRMExpressionPresetName:j.VRMExpressionPresetName,VRMHumanBoneName:j.VRMHumanBoneName,camera:r,controls:d,renderer:c,scene:a};t("initialized",w)};return M.onMounted(async()=>{if(!ee.isWebGL2Available()){const m=ee.getWebGLErrorMessage();console.error(m);return}const _=()=>{const m=i.value,y=m.clientWidth,T=m.clientHeight;c.setPixelRatio(window.devicePixelRatio),c.setSize(y,T),r.aspect=y/T,r.updateProjectionMatrix()};window.addEventListener("resize",_),g()}),(_,m)=>(M.openBlock(),M.createElementBlock("div",{ref:n,class:"box"}))}},[["__scopeId","data-v-81e1dabc"]]),ue={__name:"VroidExpression",props:{command:{type:String},name:{type:String},url:{type:String},data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n=async o=>{if(!o)return;t("loading",s.name,s.command);const r=await new V().fetchExpression(o);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)},i=o=>{t("loading",s.name,s.command);let a=!1;o&&(a=!0),t("loaded",s.name,s.command,a,o)};return M.onMounted(async()=>{s.data!=null?i(s.data):n(s.url)}),M.watch(()=>s.data,()=>{s.data!=null&&i(s.data)}),M.watch(()=>s.url,()=>{s.url&&n(s.url)}),(o,a)=>null}},de={__name:"VroidPose",props:{command:{type:String},name:{type:String},url:{type:String},data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n=async o=>{if(!o)return;t("loading",s.name,s.command);const r=await new V().fetchPose(o);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)},i=o=>{t("loading",s.name,s.command);const r=new V().normalizePose(o);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)};return M.onMounted(async()=>{s.data!=null?i(s.data):n(s.url)}),M.watch(()=>s.data,()=>{s.data!=null&&i(s.data)}),M.watch(()=>s.url,()=>{s.url&&n(s.url)}),(o,a)=>null}},pe={__name:"VroidVrm",props:{url:{type:String},data:{type:[Object,null],default:null},name:{type:String},command:{type:String}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n=async a=>{const r=new K;return r.register(c=>new j.VRMLoaderPlugin(c)),await r.loadAsync(a).then(c=>{const d=c.userData.vrm;return j.VRMUtils.rotateVRM0(d),d})},i=async a=>{if(!a)return;t("loading",s.name,s.command);const r=await n(a);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)},o=a=>{t("loading",s.name,s.command);let r=!1;a&&(r=!0),t("loaded",s.name,s.command,r,a)};return M.onMounted(async()=>{s.data!=null?o(s.data):i(s.url)}),M.watch(()=>s.data,()=>{s.data!=null&&o(s.data)}),M.watch(()=>s.url,()=>{s.url&&i(s.url)}),(a,r)=>null}},fe={__name:"VroidModel",props:{name:{type:String},expression_name:{type:String},expression_url:{type:String},expression_data:{type:[Object,null],default:null},pose_name:{type:String},pose_url:{type:String},pose_data:{type:[Object,null],default:null},vrm_name:{type:String},vrm_url:{type:String},vrm_data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n={},i={},o=M.ref(null),a=M.ref(null),r=M.ref(null),c=(u,p)=>{const f=Object.keys(n).length;n[u]=p;const g=Object.keys(n).length;f==0&&g&&t("loading",s.name)},d=(u,p,f,g)=>{const _=Object.keys(n).length;f&&(p=="load_expression"&&(o.value=g),p=="load_pose"&&(a.value=g),p=="load_vrm"&&(r.value=g),i[u]=p),delete n[u];const m=Object.keys(n).length;if(_&&m==0){const y={};for(const w in i){const x=i[w];x=="load_expression"&&(y.expression=o.value),x=="load_pose"&&(y.pose=a.value),x=="load_vrm"&&(y.vrm=r.value)}t("loaded",s.name,y);const T=Object.keys(i);for(const w of T)delete i[w]}};return(u,p)=>(M.openBlock(),M.createElementBlock(M.Fragment,null,[M.createVNode(ue,{command:"load_expression",name:s.expression_name,url:s.expression_url,data:s.expression_data,onLoading:c,onLoaded:d},null,8,["name","url","data"]),M.createVNode(de,{command:"load_pose",name:s.pose_name,url:s.pose_url,data:s.pose_data,onLoading:c,onLoaded:d},null,8,["name","url","data"]),M.createVNode(pe,{command:"load_vrm",name:s.vrm_name,url:s.vrm_url,data:s.vrm_data,onLoading:c,onLoaded:d},null,8,["name","url","data"])],64))}},ut={__name:"VroidControl",props:{model_name:{type:String,required:!0},expression_name:{type:String,default:"expression"},expression_url:{type:String,default:""},expression_data:{type:[Object,null],default:null},pose_name:{type:String,default:"pose"},pose_url:{type:String,default:""},pose_data:{type:[Object,null],default:null},vrm_name:{type:String,default:"vrm"},vrm_url:{type:String,default:""},vrm_data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=M.ref(null);s.value=new H;const n=o=>{t("loading",o)},i=(o,a)=>{"vrm"in a&&s.value.setModel(a.vrm),"pose"in a&&(s.value.resetPose(),s.value.setPose(a.pose),s.value.updatePose()),"expression"in a&&(s.value.resetExpression(),s.value.importExpression(a.expression),s.value.updateExpression()),t("loaded",o,s.value)};return(o,a)=>(M.openBlock(),M.createBlock(fe,{name:l.model_name,expression_name:l.expression_name,expression_url:l.expression_url,expression_data:l.expression_data,pose_name:l.pose_name,pose_url:l.pose_url,pose_data:l.pose_data,vrm_name:l.vrm_name,vrm_url:l.vrm_url,vrm_data:l.vrm_data,onLoading:n,onLoaded:i},null,8,["name","expression_name","expression_url","expression_data","pose_name","pose_url","pose_data","vrm_name","vrm_url","vrm_data"]))}};A.ResourceLoader=V,A.ThreeFrame=ht,A.VrmModel=H,A.VroidControl=ut,A.VroidExpression=ue,A.VroidModel=fe,A.VroidPose=de,A.VroidVrm=pe,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
1
+ (function(A,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("vue"),require("three"),require("@pixiv/three-vrm")):typeof define=="function"&&define.amd?define(["exports","vue","three","@pixiv/three-vrm"],M):(A=typeof globalThis<"u"?globalThis:A||self,M(A.VueThreeVrm={},A.Vue,A.THREE,A.THREE_VRM))})(this,function(A,M,h,I){"use strict";var J=document.createElement("style");J.textContent=`.box[data-v-60c3a6e5]{display:block;width:100%;height:100%}
2
+ /*$vite$:1*/`,document.head.appendChild(J);function me(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const O=me(h);class V{constructor(){}async fetchJSON(e){const t=await fetch(e);return t.ok?await t.json():null}normalizePose(e){return e==null?null:"pose"in e?e.pose:e}async fetchPose(e){const t=await this.fetchJSON(e);return this.normalizePose(t)}async fetchExpression(e){const t=await this.fetchJSON(e);return t==null?null:"expressions"in t?t.expressions:t}}class H{constructor(){this.vrm=null}get scene(){return this.vrm?this.vrm.scene:null}setModel(e){this.vrm=e}setPosition(e){this.vrm.scene.position.x=e.x,this.vrm.scene.position.y=e.y,this.vrm.scene.position.z=e.z}getPosition(){return{x:this.vrm.scene.position.x,y:this.vrm.scene.position.y,z:this.vrm.scene.position.z}}setPose(e){this.vrm&&this.vrm.humanoid.setNormalizedPose(e)}getPose(){return this.vrm?this.vrm.humanoid.getNormalizedPose():null}updatePose(){this.vrm&&this.vrm.humanoid.update()}resetPose(){this.vrm&&this.vrm.humanoid.resetNormalizedPose()}getBoneNode(e){return this.vrm?this.vrm.humanoid.getNormalizedBoneNode(e):null}isValid(){return!!this.vrm}getBoneRotate(e){const t=this.getBoneNode(e);return t?{x:t.rotation.x,y:t.rotation.y,z:t.rotation.z}:null}setBoneRotate(e,t,s,n){const i=this.getBoneNode(e);i&&(i.rotation.x=t,i.rotation.y=s,i.rotation.z=n)}getBonePosition(e){const t=this.getBoneNode(e);return t?{x:t.position.x,y:t.position.y,z:t.position.z}:null}setBonePosition(e,t,s,n){const i=this.getBoneNode(e);i&&(i.position.x=t,i.position.y=s,i.position.z=n)}getMetaVersion(){return this.vrm?this.vrm.meta.metaVersion:null}setExpression(e,t){this.vrm&&this.vrm.expressionManager.setValue(e,t)}getExpression(e){return this.vrm?this.vrm.expressionManager.getValue(e):null}updateExpression(){return this.vrm?this.vrm.expressionManager.update():null}resetExpression(){return this.vrm?this.vrm.expressionManager.resetValues():null}getExpressionNames(){if(this.vrm){let e=[];for(const t in this.vrm.expressionManager.expressionMap)e.push(t);return e}return null}importExpression(e){if(this.vrm)for(const t in e)this.vrm.expressionManager.setValue(t,e[t])}exportExpression(){if(this.vrm){let e={};const t=this.getExpressionNames();for(const s in t)e[s]=this.getExpression(s);return e}return null}}class ee{static isWebGL2Available(){try{const e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}}static isColorSpaceAvailable(e){try{const t=document.createElement("canvas"),s=window.WebGL2RenderingContext&&t.getContext("webgl2");return s.drawingBufferColorSpace=e,s.drawingBufferColorSpace===e}catch{return!1}}static getWebGL2ErrorMessage(){return this._getErrorMessage(2)}static _getErrorMessage(e){const t={1:"WebGL",2:"WebGL 2"},s={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext};let n='Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';const i=document.createElement("div");return i.id="webglmessage",i.style.fontFamily="monospace",i.style.fontSize="13px",i.style.fontWeight="normal",i.style.textAlign="center",i.style.background="#fff",i.style.color="#000",i.style.padding="1.5em",i.style.width="400px",i.style.margin="5em auto 0",s[e]?n=n.replace("$0","graphics card"):n=n.replace("$0","browser"),n=n.replace("$1",t[e]),i.innerHTML=n,i}static isWebGLAvailable(){console.warn("isWebGLAvailable() has been deprecated and will be removed in r178. Use isWebGL2Available() instead.");try{const e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}static getWebGLErrorMessage(){return console.warn("getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage() instead."),this._getErrorMessage(1)}}function te(l,e){if(e===h.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),l;if(e===h.TriangleFanDrawMode||e===h.TriangleStripDrawMode){let t=l.getIndex();if(t===null){const o=[],a=l.getAttribute("position");if(a!==void 0){for(let r=0;r<a.count;r++)o.push(r);l.setIndex(o),t=l.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),l}const s=t.count-2,n=[];if(e===h.TriangleFanDrawMode)for(let o=1;o<=s;o++)n.push(t.getX(0)),n.push(t.getX(o)),n.push(t.getX(o+1));else for(let o=0;o<s;o++)o%2===0?(n.push(t.getX(o)),n.push(t.getX(o+1)),n.push(t.getX(o+2))):(n.push(t.getX(o+2)),n.push(t.getX(o+1)),n.push(t.getX(o)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=l.clone();return i.setIndex(n),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),l}class K extends h.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new be(t)}),this.register(function(t){return new Me(t)}),this.register(function(t){return new Ce(t)}),this.register(function(t){return new De(t)}),this.register(function(t){return new Re(t)}),this.register(function(t){return new Se(t)}),this.register(function(t){return new we(t)}),this.register(function(t){return new Le(t)}),this.register(function(t){return new Ae(t)}),this.register(function(t){return new xe(t)}),this.register(function(t){return new Pe(t)}),this.register(function(t){return new Te(t)}),this.register(function(t){return new Ne(t)}),this.register(function(t){return new Oe(t)}),this.register(function(t){return new _e(t)}),this.register(function(t){return new Ie(t)}),this.register(function(t){return new ke(t)})}load(e,t,s,n){const i=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=h.LoaderUtils.extractUrlBase(e);o=h.LoaderUtils.resolveURL(c,this.path)}else o=h.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){n?n(c):console.error(c),i.manager.itemError(e),i.manager.itemEnd(e)},r=new h.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,function(c){try{i.parse(c,o,function(d){t(d),i.manager.itemEnd(e)},a)}catch(d){a(d)}},s,a)}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,s,n){let i;const o={},a={},r=new TextDecoder;if(typeof e=="string")i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(r.decode(new Uint8Array(e,0,4))===se){try{o[b.KHR_BINARY_GLTF]=new ve(e)}catch(u){n&&n(u);return}i=JSON.parse(o[b.KHR_BINARY_GLTF].content)}else i=JSON.parse(r.decode(e));else i=e;if(i.asset===void 0||i.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new qe(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const u=this.pluginCallbacks[d](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,o[u.name]=!0}if(i.extensionsUsed)for(let d=0;d<i.extensionsUsed.length;++d){const u=i.extensionsUsed[d],p=i.extensionsRequired||[];switch(u){case b.KHR_MATERIALS_UNLIT:o[u]=new ye;break;case b.KHR_DRACO_MESH_COMPRESSION:o[u]=new Fe(i,this.dracoLoader);break;case b.KHR_TEXTURE_TRANSFORM:o[u]=new je;break;case b.KHR_MESH_QUANTIZATION:o[u]=new Ue;break;default:p.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,i){s.parse(e,t,n,i)})}}function ge(){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={}}}}const b={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_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",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class _e{constructor(e){this.parser=e,this.name=b.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const i=t[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const i=t.json,r=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let c;const d=new h.Color(16777215);r.color!==void 0&&d.setRGB(r.color[0],r.color[1],r.color[2],h.LinearSRGBColorSpace);const u=r.range!==void 0?r.range:0;switch(r.type){case"directional":c=new h.DirectionalLight(d),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new h.PointLight(d),c.distance=u;break;case"spot":c=new h.SpotLight(d),c.distance=u,r.spot=r.spot||{},r.spot.innerConeAngle=r.spot.innerConeAngle!==void 0?r.spot.innerConeAngle:0,r.spot.outerConeAngle=r.spot.outerConeAngle!==void 0?r.spot.outerConeAngle:Math.PI/4,c.angle=r.spot.outerConeAngle,c.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+r.type)}return c.position.set(0,0,0),R(c,r),r.intensity!==void 0&&(c.intensity=r.intensity),c.name=t.createUniqueName(r.name||"light_"+e),n=Promise.resolve(c),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,i=s.json.nodes[e],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(r){return s._getNodeRef(t.cache,a,r)})}}class ye{constructor(){this.name=b.KHR_MATERIALS_UNLIT}getMaterialType(){return h.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new h.Color(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const o=i.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],h.LinearSRGBColorSpace),e.opacity=o[3]}i.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",i.baseColorTexture,h.SRGBColorSpace))}return Promise.all(n)}}class xe{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}}class be{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(i.push(s.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new h.Vector2(a,a)}return Promise.all(i)}}class Me{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}}class Te{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}class Se{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new h.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=n.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&i.push(s.assignTexture(t,"sheenColorMap",o.sheenColorTexture,h.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}class we{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&i.push(s.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}class Le{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&i.push(s.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),Promise.all(i)}}class Ae{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class Pe{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&i.push(s.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new h.Color().setRGB(a[0],a[1],a[2],h.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&i.push(s.assignTexture(t,"specularColorMap",o.specularColorTexture,h.SRGBColorSpace)),Promise.all(i)}}class Oe{constructor(e){this.parser=e,this.name=b.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&i.push(s.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(i)}}class Ne{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:h.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&i.push(s.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}class Ce{constructor(e){this.parser=e,this.name=b.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,o)}}class De{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let r=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(r=c)}return s.loadTextureImage(e,o.source,r)}}class Re{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let r=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(r=c)}return s.loadTextureImage(e,o.source,r)}}class Ie{constructor(e){this.name=b.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.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 i.then(function(a){const r=n.byteOffset||0,c=n.byteLength||0,d=n.count,u=n.byteStride,p=new Uint8Array(a,r,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,u,p,n.mode,n.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(d*u);return o.decodeGltfBuffer(new Uint8Array(f),d,u,p,n.mode,n.filter),f})})}else return null}}class ke{constructor(e){this.name=b.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const c of n.primitives)if(c.mode!==N.TRIANGLES&&c.mode!==N.TRIANGLE_STRIP&&c.mode!==N.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=s.extensions[this.name].attributes,a=[],r={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(r[c]=d,r[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),u=d.isGroup?d.children:[d],p=c[0].count,f=[];for(const g of u){const _=new h.Matrix4,m=new h.Vector3,y=new h.Quaternion,T=new h.Vector3(1,1,1),w=new h.InstancedMesh(g.geometry,g.material,p);for(let x=0;x<p;x++)r.TRANSLATION&&m.fromBufferAttribute(r.TRANSLATION,x),r.ROTATION&&y.fromBufferAttribute(r.ROTATION,x),r.SCALE&&T.fromBufferAttribute(r.SCALE,x),w.setMatrixAt(x,_.compose(m,y,T));for(const x in r)if(x==="_COLOR_0"){const C=r[x];w.instanceColor=new h.InstancedBufferAttribute(C.array,C.itemSize,C.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,r[x]);h.Object3D.prototype.copy.call(w,g),this.parser.assignFinalMaterial(w),f.push(w)}return d.isGroup?(d.clear(),d.add(...f),d):f[0]}))}}const se="glTF",G=12,ne={JSON:1313821514,BIN:5130562};class ve{constructor(e){this.name=b.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,G),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==se)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-G,i=new DataView(e,G);let o=0;for(;o<n;){const a=i.getUint32(o,!0);o+=4;const r=i.getUint32(o,!0);if(o+=4,r===ne.JSON){const c=new Uint8Array(e,G+o,a);this.content=s.decode(c)}else if(r===ne.BIN){const c=G+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Fe{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=b.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},r={},c={};for(const d in o){const u=X[d]||d.toLowerCase();a[u]=o[d]}for(const d in e.attributes){const u=X[d]||d.toLowerCase();if(o[d]!==void 0){const p=s.accessors[e.attributes[d]],f=U[p.componentType];c[u]=f.name,r[u]=p.normalized===!0}}return t.getDependency("bufferView",i).then(function(d){return new Promise(function(u,p){n.decodeDracoFile(d,function(f){for(const g in f.attributes){const _=f.attributes[g],m=r[g];m!==void 0&&(_.normalized=m)}u(f)},a,c,h.LinearSRGBColorSpace,p)})})}}class je{constructor(){this.name=b.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Ue{constructor(){this.name=b.KHR_MESH_QUANTIZATION}}class ie extends h.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=e*n*3+n;for(let o=0;o!==n;o++)t[o]=s[i+o];return t}interpolate_(e,t,s,n){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,r=a*2,c=a*3,d=n-t,u=(s-t)/d,p=u*u,f=p*u,g=e*c,_=g-c,m=-2*f+3*p,y=f-p,T=1-m,w=y-p+u;for(let x=0;x!==a;x++){const C=o[_+x+a],v=o[_+x+r]*d,D=o[g+x+a],B=o[g+x]*d;i[x]=T*C+w*v+m*D+y*B}return i}}const Ge=new h.Quaternion;class Be extends ie{interpolate_(e,t,s,n){const i=super.interpolate_(e,t,s,n);return Ge.fromArray(i).normalize().toArray(i),i}}const N={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},U={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},oe={9728:h.NearestFilter,9729:h.LinearFilter,9984:h.NearestMipmapNearestFilter,9985:h.LinearMipmapNearestFilter,9986:h.NearestMipmapLinearFilter,9987:h.LinearMipmapLinearFilter},re={33071:h.ClampToEdgeWrapping,33648:h.MirroredRepeatWrapping,10497:h.RepeatWrapping},z={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},X={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"},k={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ve={CUBICSPLINE:void 0,LINEAR:h.InterpolateLinear,STEP:h.InterpolateDiscrete},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ee(l){return l.DefaultMaterial===void 0&&(l.DefaultMaterial=new h.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:h.FrontSide})),l.DefaultMaterial}function j(l,e,t){for(const s in t.extensions)l[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function R(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 Ke(l,e,t){let s=!1,n=!1,i=!1;for(let c=0,d=e.length;c<d;c++){const u=e[c];if(u.POSITION!==void 0&&(s=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(l);const o=[],a=[],r=[];for(let c=0,d=e.length;c<d;c++){const u=e[c];if(s){const p=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):l.attributes.position;o.push(p)}if(n){const p=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):l.attributes.normal;a.push(p)}if(i){const p=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):l.attributes.color;r.push(p)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(r)]).then(function(c){const d=c[0],u=c[1],p=c[2];return s&&(l.morphAttributes.position=d),n&&(l.morphAttributes.normal=u),i&&(l.morphAttributes.color=p),l.morphTargetsRelative=!0,l})}function ze(l,e){if(l.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)l.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(l.morphTargetInfluences.length===t.length){l.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)l.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Xe(l){let e;const t=l.extensions&&l.extensions[b.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Y(t.attributes):e=l.indices+":"+Y(l.attributes)+":"+l.mode,l.targets!==void 0)for(let s=0,n=l.targets.length;s<n;s++)e+=":"+Y(l.targets[s]);return e}function Y(l){let e="";const t=Object.keys(l).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+l[t[s]]+";";return e}function q(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 We(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"}const Ye=new h.Matrix4;class qe{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ge,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 s=!1,n=-1,i=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const r=a.match(/Version\/(\d+)/);n=s&&r?parseInt(r[1],10):-1,i=a.indexOf("Firefox")>-1,o=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||i&&o<98?this.textureLoader=new h.TextureLoader(this.options.manager):this.textureLoader=new h.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new h.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(o){const a={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:s,userData:{}};return j(i,a,n),R(a,n),Promise.all(s._invokeAll(function(r){return r.afterRoot&&r.afterRoot(a)})).then(function(){for(const r of a.scenes)r.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n].joints;for(let a=0,r=o.length;a<r;a++)e[o[a]].isBone=!0}for(let n=0,i=e.length;n<i;n++){const o=e[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(s[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.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,s){if(e.refs[t]<=1)return s;const n=s.clone(),i=(o,a)=>{const r=this.associations.get(o);r!=null&&this.associations.set(a,r);for(const[c,d]of o.children.entries())i(d,a.children[c])};return i(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i&&s.push(i)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":n=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(i,o){return s.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=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[b.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(i,o){s.load(h.LoaderUtils.resolveURL(t.uri,n.path),i,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,i=t.byteOffset||0;return s.slice(i,i+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const o=z[n.type],a=U[n.componentType],r=n.normalized===!0,c=new a(n.count*o);return Promise.resolve(new h.BufferAttribute(c,o,r))}const i=[];return n.bufferView!==void 0?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),n.sparse!==void 0&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(o){const a=o[0],r=z[n.type],c=U[n.componentType],d=c.BYTES_PER_ELEMENT,u=d*r,p=n.byteOffset||0,f=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,g=n.normalized===!0;let _,m;if(f&&f!==u){const y=Math.floor(p/f),T="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+y+":"+n.count;let w=t.cache.get(T);w||(_=new c(a,y*f,n.count*f/d),w=new h.InterleavedBuffer(_,f/d),t.cache.add(T,w)),m=new h.InterleavedBufferAttribute(w,r,p%f/d,g)}else a===null?_=new c(n.count*r):_=new c(a,p,n.count*r),m=new h.BufferAttribute(_,r,g);if(n.sparse!==void 0){const y=z.SCALAR,T=U[n.sparse.indices.componentType],w=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,C=new T(o[1],w,n.sparse.count*y),v=new c(o[2],x,n.sparse.count*r);a!==null&&(m=new h.BufferAttribute(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let D=0,B=C.length;D<B;D++){const F=C[D];if(m.setX(F,v[D*r]),r>=2&&m.setY(F,v[D*r+1]),r>=3&&m.setZ(F,v[D*r+2]),r>=4&&m.setW(F,v[D*r+3]),r>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,o=t.images[i];let a=this.textureLoader;if(o.uri){const r=s.manager.getHandler(o.uri);r!==null&&(a=r)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,s){const n=this,i=this.json,o=i.textures[e],a=i.images[t],r=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[r])return this.textureCache[r];const c=this.loadImageSource(t,s).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const p=(i.samplers||{})[o.sampler]||{};return d.magFilter=oe[p.magFilter]||h.LinearFilter,d.minFilter=oe[p.minFilter]||h.LinearMipmapLinearFilter,d.wrapS=re[p.wrapS]||h.RepeatWrapping,d.wrapT=re[p.wrapT]||h.RepeatWrapping,d.generateMipmaps=!d.isCompressedTexture&&d.minFilter!==h.NearestFilter&&d.minFilter!==h.LinearFilter,n.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[r]=c,c}loadImageSource(e,t){const s=this,n=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=n.images[e],a=self.URL||self.webkitURL;let r=o.uri||"",c=!1;if(o.bufferView!==void 0)r=s.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const p=new Blob([u],{type:o.mimeType});return r=a.createObjectURL(p),r});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(r).then(function(u){return new Promise(function(p,f){let g=p;t.isImageBitmapLoader===!0&&(g=function(_){const m=new h.Texture(_);m.needsUpdate=!0,p(m)}),t.load(h.LoaderUtils.resolveURL(u,i.path),g,void 0,f)})}).then(function(u){return c===!0&&a.revokeObjectURL(r),R(u,o),u.userData.mimeType=o.mimeType||We(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",r),u});return this.sourceCache[e]=d,d}assignTexture(e,t,s,n){const i=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(o=o.clone(),o.channel=s.texCoord),i.extensions[b.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[b.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const r=i.associations.get(o);o=i.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),i.associations.set(o,r)}}return n!==void 0&&(o.colorSpace=n),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+s.uuid;let r=this.cache.get(a);r||(r=new h.PointsMaterial,h.Material.prototype.copy.call(r,s),r.color.copy(s.color),r.map=s.map,r.sizeAttenuation=!1,this.cache.add(a,r)),s=r}else if(e.isLine){const a="LineBasicMaterial:"+s.uuid;let r=this.cache.get(a);r||(r=new h.LineBasicMaterial,h.Material.prototype.copy.call(r,s),r.color.copy(s.color),r.map=s.map,this.cache.add(a,r)),s=r}if(n||i||o){let a="ClonedMaterial:"+s.uuid+":";n&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let r=this.cache.get(a);r||(r=s.clone(),i&&(r.vertexColors=!0),o&&(r.flatShading=!0),n&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(a,r),this.associations.set(r,this.associations.get(s))),s=r}e.material=s}getMaterialType(){return h.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,i=s.materials[e];let o;const a={},r=i.extensions||{},c=[];if(r[b.KHR_MATERIALS_UNLIT]){const u=n[b.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,i,t))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new h.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const p=u.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],h.LinearSRGBColorSpace),a.opacity=p[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,h.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}i.doubleSided===!0&&(a.side=h.DoubleSide);const d=i.alphaMode||W.OPAQUE;if(d===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==h.MeshBasicMaterial&&(c.push(t.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new h.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&o!==h.MeshBasicMaterial&&(c.push(t.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&o!==h.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new h.Color().setRGB(u[0],u[1],u[2],h.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&o!==h.MeshBasicMaterial&&c.push(t.assignTexture(a,"emissiveMap",i.emissiveTexture,h.SRGBColorSpace)),Promise.all(c).then(function(){const u=new o(a);return i.name&&(u.name=i.name),R(u,i),t.associations.set(u,{materials:e}),i.extensions&&j(n,u,i),u})}createUniqueName(e){const t=h.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function i(a){return s[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(r){return ae(r,a,t)})}const o=[];for(let a=0,r=e.length;a<r;a++){const c=e[a],d=Xe(c),u=n[d];if(u)o.push(u.promise);else{let p;c.extensions&&c.extensions[b.KHR_DRACO_MESH_COMPRESSION]?p=i(c):p=ae(new h.BufferGeometry,c,t),n[d]={primitive:c,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,s=this.json,n=this.extensions,i=s.meshes[e],o=i.primitives,a=[];for(let r=0,c=o.length;r<c;r++){const d=o[r].material===void 0?Ee(this.cache):this.getDependency("material",o[r].material);a.push(d)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(r){const c=r.slice(0,r.length-1),d=r[r.length-1],u=[];for(let f=0,g=d.length;f<g;f++){const _=d[f],m=o[f];let y;const T=c[f];if(m.mode===N.TRIANGLES||m.mode===N.TRIANGLE_STRIP||m.mode===N.TRIANGLE_FAN||m.mode===void 0)y=i.isSkinnedMesh===!0?new h.SkinnedMesh(_,T):new h.Mesh(_,T),y.isSkinnedMesh===!0&&y.normalizeSkinWeights(),m.mode===N.TRIANGLE_STRIP?y.geometry=te(y.geometry,h.TriangleStripDrawMode):m.mode===N.TRIANGLE_FAN&&(y.geometry=te(y.geometry,h.TriangleFanDrawMode));else if(m.mode===N.LINES)y=new h.LineSegments(_,T);else if(m.mode===N.LINE_STRIP)y=new h.Line(_,T);else if(m.mode===N.LINE_LOOP)y=new h.LineLoop(_,T);else if(m.mode===N.POINTS)y=new h.Points(_,T);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(y.geometry.morphAttributes).length>0&&ze(y,i),y.name=t.createUniqueName(i.name||"mesh_"+e),R(y,i),m.extensions&&j(n,y,m),t.assignFinalMaterial(y),u.push(y)}for(let f=0,g=u.length;f<g;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return i.extensions&&j(n,u[0],i),u[0];const p=new h.Group;i.extensions&&j(n,p,i),t.associations.set(p,{meshes:e});for(let f=0,g=u.length;f<g;f++)p.add(u[f]);return p})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new h.PerspectiveCamera(h.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new h.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),R(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,i=t.joints.length;n<i;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const i=n.pop(),o=n,a=[],r=[];for(let c=0,d=o.length;c<d;c++){const u=o[c];if(u){a.push(u);const p=new h.Matrix4;i!==null&&p.fromArray(i.array,c*16),r.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new h.Skeleton(a,r)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,o=[],a=[],r=[],c=[],d=[];for(let u=0,p=n.channels.length;u<p;u++){const f=n.channels[u],g=n.samplers[f.sampler],_=f.target,m=_.node,y=n.parameters!==void 0?n.parameters[g.input]:g.input,T=n.parameters!==void 0?n.parameters[g.output]:g.output;_.node!==void 0&&(o.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",y)),r.push(this.getDependency("accessor",T)),c.push(g),d.push(_))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(r),Promise.all(c),Promise.all(d)]).then(function(u){const p=u[0],f=u[1],g=u[2],_=u[3],m=u[4],y=[];for(let T=0,w=p.length;T<w;T++){const x=p[T],C=f[T],v=g[T],D=_[T],B=m[T];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const F=s._createAnimationTracks(x,C,v,D,B);if(F)for(let $=0;$<F.length;$++)y.push(F[$])}return new h.AnimationClip(i,void 0,y)})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(i){const o=s._getNodeRef(s.meshCache,n.mesh,i);return n.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let r=0,c=n.weights.length;r<c;r++)a.morphTargetInfluences[r]=n.weights[r]}),o})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],i=s._loadNodeShallow(e),o=[],a=n.children||[];for(let c=0,d=a.length;c<d;c++)o.push(s.getDependency("node",a[c]));const r=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([i,Promise.all(o),r]).then(function(c){const d=c[0],u=c[1],p=c[2];p!==null&&d.traverse(function(f){f.isSkinnedMesh&&f.bind(p,Ye)});for(let f=0,g=u.length;f<g;f++)d.add(u[f]);return d})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",a=[],r=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return r&&a.push(r),i.camera!==void 0&&a.push(n.getDependency("camera",i.camera).then(function(c){return n._getNodeRef(n.cameraCache,i.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let d;if(i.isBone===!0?d=new h.Bone:c.length>1?d=new h.Group:c.length===1?d=c[0]:d=new h.Object3D,d!==c[0])for(let u=0,p=c.length;u<p;u++)d.add(c[u]);if(i.name&&(d.userData.name=i.name,d.name=o),R(d,i),i.extensions&&j(s,d,i),i.matrix!==void 0){const u=new h.Matrix4;u.fromArray(i.matrix),d.applyMatrix4(u)}else i.translation!==void 0&&d.position.fromArray(i.translation),i.rotation!==void 0&&d.quaternion.fromArray(i.rotation),i.scale!==void 0&&d.scale.fromArray(i.scale);if(!n.associations.has(d))n.associations.set(d,{});else if(i.mesh!==void 0&&n.meshCache.refs[i.mesh]>1){const u=n.associations.get(d);n.associations.set(d,{...u})}return n.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,i=new h.Group;s.name&&(i.name=n.createUniqueName(s.name)),R(i,s),s.extensions&&j(t,i,s);const o=s.nodes||[],a=[];for(let r=0,c=o.length;r<c;r++)a.push(n.getDependency("node",o[r]));return Promise.all(a).then(function(r){for(let d=0,u=r.length;d<u;d++)i.add(r[d]);const c=d=>{const u=new Map;for(const[p,f]of n.associations)(p instanceof h.Material||p instanceof h.Texture)&&u.set(p,f);return d.traverse(p=>{const f=n.associations.get(p);f!=null&&u.set(p,f)}),u};return n.associations=c(i),i})}_createAnimationTracks(e,t,s,n,i){const o=[],a=e.name?e.name:e.uuid,r=[];k[i.path]===k.weights?e.traverse(function(p){p.morphTargetInfluences&&r.push(p.name?p.name:p.uuid)}):r.push(a);let c;switch(k[i.path]){case k.weights:c=h.NumberKeyframeTrack;break;case k.rotation:c=h.QuaternionKeyframeTrack;break;case k.translation:case k.scale:c=h.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:c=h.NumberKeyframeTrack;break;case 2:case 3:default:c=h.VectorKeyframeTrack;break}break}const d=n.interpolation!==void 0?Ve[n.interpolation]:h.InterpolateLinear,u=this._getArrayFromAccessor(s);for(let p=0,f=r.length;p<f;p++){const g=new c(r[p]+"."+k[i.path],t.array,u,d);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),o.push(g)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=q(t.constructor),n=new Float32Array(t.length);for(let i=0,o=t.length;i<o;i++)n[i]=t[i]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof h.QuaternionKeyframeTrack?Be:ie;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ze(l,e,t){const s=e.attributes,n=new h.Box3;if(s.POSITION!==void 0){const a=t.json.accessors[s.POSITION],r=a.min,c=a.max;if(r!==void 0&&c!==void 0){if(n.set(new h.Vector3(r[0],r[1],r[2]),new h.Vector3(c[0],c[1],c[2])),a.normalized){const d=q(U[a.componentType]);n.min.multiplyScalar(d),n.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const a=new h.Vector3,r=new h.Vector3;for(let c=0,d=i.length;c<d;c++){const u=i[c];if(u.POSITION!==void 0){const p=t.json.accessors[u.POSITION],f=p.min,g=p.max;if(f!==void 0&&g!==void 0){if(r.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),r.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),r.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),p.normalized){const _=q(U[p.componentType]);r.multiplyScalar(_)}a.max(r)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}l.boundingBox=n;const o=new h.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,l.boundingSphere=o}function ae(l,e,t){const s=e.attributes,n=[];function i(o,a){return t.getDependency("accessor",o).then(function(r){l.setAttribute(a,r)})}for(const o in s){const a=X[o]||o.toLowerCase();a in l.attributes||n.push(i(s[o],a))}if(e.indices!==void 0&&!l.index){const o=t.getDependency("accessor",e.indices).then(function(a){l.setIndex(a)});n.push(o)}return h.ColorManagement.workingColorSpace!==h.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${h.ColorManagement.workingColorSpace}" not supported.`),R(l,e),Ze(l,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Ke(l,e.targets,t):l})}const ce={type:"change"},Z={type:"start"},le={type:"end"},E=new h.Ray,he=new h.Plane,Qe=Math.cos(70*h.MathUtils.DEG2RAD),L=new h.Vector3,P=2*Math.PI,S={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Q=1e-6;class $e extends h.Controls{constructor(e,t=null){super(e,t),this.state=S.NONE,this.target=new h.Vector3,this.cursor=new h.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:h.MOUSE.ROTATE,MIDDLE:h.MOUSE.DOLLY,RIGHT:h.MOUSE.PAN},this.touches={ONE:h.TOUCH.ROTATE,TWO:h.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new h.Vector3,this._lastQuaternion=new h.Quaternion,this._lastTargetPosition=new h.Vector3,this._quat=new h.Quaternion().setFromUnitVectors(e.up,new h.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new h.Spherical,this._sphericalDelta=new h.Spherical,this._scale=1,this._panOffset=new h.Vector3,this._rotateStart=new h.Vector2,this._rotateEnd=new h.Vector2,this._rotateDelta=new h.Vector2,this._panStart=new h.Vector2,this._panEnd=new h.Vector2,this._panDelta=new h.Vector2,this._dollyStart=new h.Vector2,this._dollyEnd=new h.Vector2,this._dollyDelta=new h.Vector2,this._dollyDirection=new h.Vector3,this._mouse=new h.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=He.bind(this),this._onPointerDown=Je.bind(this),this._onPointerUp=et.bind(this),this._onContextMenu=at.bind(this),this._onMouseWheel=nt.bind(this),this._onKeyDown=it.bind(this),this._onTouchStart=ot.bind(this),this._onTouchMove=rt.bind(this),this._onMouseDown=tt.bind(this),this._onMouseMove=st.bind(this),this._interceptControlDown=ct.bind(this),this._interceptControlUp=lt.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(ce),this.update(),this.state=S.NONE}update(e=null){const t=this.object.position;L.copy(t).sub(this.target),L.applyQuaternion(this._quat),this._spherical.setFromVector3(L),this.autoRotate&&this.state===S.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let s=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(s)&&isFinite(n)&&(s<-Math.PI?s+=P:s>Math.PI&&(s-=P),n<-Math.PI?n+=P:n>Math.PI&&(n-=P),s<=n?this._spherical.theta=Math.max(s,Math.min(n,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+n)/2?Math.max(s,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=o!=this._spherical.radius}if(L.setFromSpherical(this._spherical),L.applyQuaternion(this._quatInverse),t.copy(this.target).add(L),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=L.length();o=this._clampDistance(a*this._scale);const r=a-o;this.object.position.addScaledVector(this._dollyDirection,r),this.object.updateMatrixWorld(),i=!!r}else if(this.object.isOrthographicCamera){const a=new h.Vector3(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const r=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=r!==this.object.zoom;const c=new h.Vector3(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(E.origin.copy(this.object.position),E.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(E.direction))<Qe?this.object.lookAt(this.target):(he.setFromNormalAndCoplanarPoint(this.object.up,this.target),E.intersectPlane(he,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),i=!0)}return this._scale=1,this._performCursorZoom=!1,i||this._lastPosition.distanceToSquared(this.object.position)>Q||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Q||this._lastTargetPosition.distanceToSquared(this.target)>Q?(this.dispatchEvent(ce),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?P/60*this.autoRotateSpeed*e:P/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){L.setFromMatrixColumn(t,0),L.multiplyScalar(-e),this._panOffset.add(L)}_panUp(e,t){this.screenSpacePanning===!0?L.setFromMatrixColumn(t,1):(L.setFromMatrixColumn(t,0),L.crossVectors(this.object.up,L)),L.multiplyScalar(e),this._panOffset.add(L)}_pan(e,t){const s=this.domElement;if(this.object.isPerspectiveCamera){const n=this.object.position;L.copy(n).sub(this.target);let i=L.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/s.clientHeight,this.object.matrix),this._panUp(2*t*i/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/s.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const s=this.domElement.getBoundingClientRect(),n=e-s.left,i=t-s.top,o=s.width,a=s.height;this._mouse.x=n/o*2-1,this._mouse.y=-(i/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(P*this._rotateDelta.x/t.clientHeight),this._rotateUp(P*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-P*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._rotateStart.set(s,n)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panStart.set(s,n)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,n=e.pageY-t.y,i=Math.sqrt(s*s+n*n);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const s=this._getSecondPointerPosition(e),n=.5*(e.pageX+s.x),i=.5*(e.pageY+s.y);this._rotateEnd.set(n,i)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(P*this._rotateDelta.x/t.clientHeight),this._rotateUp(P*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panEnd.set(s,n)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,n=e.pageY-t.y,i=Math.sqrt(s*s+n*n);this._dollyEnd.set(0,i),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new h.Vector2,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,s={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function Je(l){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(l.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(l)&&(this._addPointer(l),l.pointerType==="touch"?this._onTouchStart(l):this._onMouseDown(l)))}function He(l){this.enabled!==!1&&(l.pointerType==="touch"?this._onTouchMove(l):this._onMouseMove(l))}function et(l){switch(this._removePointer(l),this._pointers.length){case 0:this.domElement.releasePointerCapture(l.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(le),this.state=S.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function tt(l){let e;switch(l.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case h.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(l),this.state=S.DOLLY;break;case h.MOUSE.ROTATE:if(l.ctrlKey||l.metaKey||l.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(l),this.state=S.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(l),this.state=S.ROTATE}break;case h.MOUSE.PAN:if(l.ctrlKey||l.metaKey||l.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(l),this.state=S.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(l),this.state=S.PAN}break;default:this.state=S.NONE}this.state!==S.NONE&&this.dispatchEvent(Z)}function st(l){switch(this.state){case S.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(l);break;case S.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(l);break;case S.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(l);break}}function nt(l){this.enabled===!1||this.enableZoom===!1||this.state!==S.NONE||(l.preventDefault(),this.dispatchEvent(Z),this._handleMouseWheel(this._customWheelEvent(l)),this.dispatchEvent(le))}function it(l){this.enabled!==!1&&this._handleKeyDown(l)}function ot(l){switch(this._trackPointer(l),this._pointers.length){case 1:switch(this.touches.ONE){case h.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(l),this.state=S.TOUCH_ROTATE;break;case h.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(l),this.state=S.TOUCH_PAN;break;default:this.state=S.NONE}break;case 2:switch(this.touches.TWO){case h.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(l),this.state=S.TOUCH_DOLLY_PAN;break;case h.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(l),this.state=S.TOUCH_DOLLY_ROTATE;break;default:this.state=S.NONE}break;default:this.state=S.NONE}this.state!==S.NONE&&this.dispatchEvent(Z)}function rt(l){switch(this._trackPointer(l),this.state){case S.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(l),this.update();break;case S.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(l),this.update();break;case S.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(l),this.update();break;case S.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(l),this.update();break;default:this.state=S.NONE}}function at(l){this.enabled!==!1&&l.preventDefault()}function ct(l){l.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function lt(l){l.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const ht=((l,e)=>{const t=l.__vccOpts||l;for(const[s,n]of e)t[s]=n;return t})({__name:"ThreeFrame",props:{animation:{type:Boolean,default:!1},clearAlpha:{type:[String,Number],default:1},clearColor:{type:String,default:"#7fbfff"},useOrbitControls:{type:Boolean,default:!1},useGridHelper:{type:Boolean,default:!1},useAxesHelper:{type:Boolean,default:!1},useDefaultLight:{type:Boolean,default:!1}},emits:["initialized","animate"],setup(l,{emit:e}){const t=e,s=l,n="dom"+M.getCurrentInstance().uid,i=M.useTemplateRef(n);let o=null,a=null,r=null,c=null,d=null;const u=()=>{const _={GLTFLoader:K,THREE:O,VRMExpressionPresetName:I.VRMExpressionPresetName,VRMHumanBoneName:I.VRMHumanBoneName,VRMUtils:I.VRMUtils,camera:r,controls:d,renderer:c,scene:a};t("animate",_),o!=null&&(cancelAnimationFrame(o),o=null),s.animation&&(o=requestAnimationFrame(u)),c.render(a,r)},p=()=>{o!=null&&(cancelAnimationFrame(o),o=null),o=requestAnimationFrame(u)},f=()=>{o!=null&&(cancelAnimationFrame(o),o=null)};M.watch(()=>s.animation,_=>{_==!0?p():f()}),M.watch(()=>s.clearAlpha,_=>{c&&c.setClearAlpha(parseFloat(_))}),M.watch(()=>s.clearColor,_=>{if(c){const m=new O.Color(_),y=c.getClearAlpha();c.setClearColor(m,y)}});const g=()=>{const _=i.value,m=_.clientWidth,y=_.clientHeight,T={antialias:!0,alpha:!1};if(O.ColorManagement.enabled=!1,c=new O.WebGLRenderer(T),c.setPixelRatio(window.devicePixelRatio),c.setSize(m,y),c.setClearColor(s.clearColor,s.clearAlpha),c.outputColorSpace=O.SRGBColorSpace,_.appendChild(c.domElement),a=new O.Scene,r=new O.PerspectiveCamera(45,m/y,.1,1e3),r.position.set(0,1.25,1),s.useOrbitControls&&(d=new $e(r,_),d.screenSpacePanning=!0,d.target.set(0,1.25,0),d.update()),s.useGridHelper){const x=new O.GridHelper(10,10);a.add(x),x.visible=!0}if(s.useAxesHelper){const x=new O.AxesHelper(5);a.add(x)}if(s.useDefaultLight){const x=new O.DirectionalLight(16777215);x.intensity=3,x.position.set(1,1,1).normalize(),a.add(x);const C=new O.AmbientLight(4210752);a.add(C)}const w={GLTFLoader:K,THREE:O,VRMExpressionPresetName:I.VRMExpressionPresetName,VRMHumanBoneName:I.VRMHumanBoneName,VRMUtils:I.VRMUtils,camera:r,controls:d,renderer:c,scene:a};t("initialized",w)};return M.onMounted(async()=>{if(!ee.isWebGL2Available()){const m=ee.getWebGLErrorMessage();console.error(m);return}const _=()=>{const m=i.value,y=m.clientWidth,T=m.clientHeight;c.setPixelRatio(window.devicePixelRatio),c.setSize(y,T),r.aspect=y/T,r.updateProjectionMatrix()};window.addEventListener("resize",_),g()}),(_,m)=>(M.openBlock(),M.createElementBlock("div",{ref:n,class:"box"}))}},[["__scopeId","data-v-60c3a6e5"]]),ue={__name:"VroidExpression",props:{command:{type:String},name:{type:String},url:{type:String},data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n=async o=>{if(!o)return;t("loading",s.name,s.command);const r=await new V().fetchExpression(o);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)},i=o=>{t("loading",s.name,s.command);let a=!1;o&&(a=!0),t("loaded",s.name,s.command,a,o)};return M.onMounted(async()=>{s.data!=null?i(s.data):n(s.url)}),M.watch(()=>s.data,()=>{s.data!=null&&i(s.data)}),M.watch(()=>s.url,()=>{s.url&&n(s.url)}),(o,a)=>null}},de={__name:"VroidPose",props:{command:{type:String},name:{type:String},url:{type:String},data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n=async o=>{if(!o)return;t("loading",s.name,s.command);const r=await new V().fetchPose(o);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)},i=o=>{t("loading",s.name,s.command);const r=new V().normalizePose(o);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)};return M.onMounted(async()=>{s.data!=null?i(s.data):n(s.url)}),M.watch(()=>s.data,()=>{s.data!=null&&i(s.data)}),M.watch(()=>s.url,()=>{s.url&&n(s.url)}),(o,a)=>null}},pe={__name:"VroidVrm",props:{url:{type:String},data:{type:[Object,null],default:null},name:{type:String},command:{type:String}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n=async a=>{const r=new K;return r.register(c=>new I.VRMLoaderPlugin(c)),await r.loadAsync(a).then(c=>{const d=c.userData.vrm;return I.VRMUtils.rotateVRM0(d),d})},i=async a=>{if(!a)return;t("loading",s.name,s.command);const r=await n(a);let c=!1;r&&(c=!0),t("loaded",s.name,s.command,c,r)},o=a=>{t("loading",s.name,s.command);let r=!1;a&&(r=!0),t("loaded",s.name,s.command,r,a)};return M.onMounted(async()=>{s.data!=null?o(s.data):i(s.url)}),M.watch(()=>s.data,()=>{s.data!=null&&o(s.data)}),M.watch(()=>s.url,()=>{s.url&&i(s.url)}),(a,r)=>null}},fe={__name:"VroidModel",props:{name:{type:String},expression_name:{type:String},expression_url:{type:String},expression_data:{type:[Object,null],default:null},pose_name:{type:String},pose_url:{type:String},pose_data:{type:[Object,null],default:null},vrm_name:{type:String},vrm_url:{type:String},vrm_data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=l,n={},i={},o=M.ref(null),a=M.ref(null),r=M.ref(null),c=(u,p)=>{const f=Object.keys(n).length;n[u]=p;const g=Object.keys(n).length;f==0&&g&&t("loading",s.name)},d=(u,p,f,g)=>{const _=Object.keys(n).length;f&&(p=="load_expression"&&(o.value=g),p=="load_pose"&&(a.value=g),p=="load_vrm"&&(r.value=g),i[u]=p),delete n[u];const m=Object.keys(n).length;if(_&&m==0){const y={};for(const w in i){const x=i[w];x=="load_expression"&&(y.expression=o.value),x=="load_pose"&&(y.pose=a.value),x=="load_vrm"&&(y.vrm=r.value)}t("loaded",s.name,y);const T=Object.keys(i);for(const w of T)delete i[w]}};return(u,p)=>(M.openBlock(),M.createElementBlock(M.Fragment,null,[M.createVNode(ue,{command:"load_expression",name:s.expression_name,url:s.expression_url,data:s.expression_data,onLoading:c,onLoaded:d},null,8,["name","url","data"]),M.createVNode(de,{command:"load_pose",name:s.pose_name,url:s.pose_url,data:s.pose_data,onLoading:c,onLoaded:d},null,8,["name","url","data"]),M.createVNode(pe,{command:"load_vrm",name:s.vrm_name,url:s.vrm_url,data:s.vrm_data,onLoading:c,onLoaded:d},null,8,["name","url","data"])],64))}},ut={__name:"VroidControl",props:{model_name:{type:String,required:!0},expression_name:{type:String,default:"expression"},expression_url:{type:String,default:""},expression_data:{type:[Object,null],default:null},pose_name:{type:String,default:"pose"},pose_url:{type:String,default:""},pose_data:{type:[Object,null],default:null},vrm_name:{type:String,default:"vrm"},vrm_url:{type:String,default:""},vrm_data:{type:[Object,null],default:null}},emits:["loading","loaded"],setup(l,{emit:e}){const t=e,s=M.ref(null);s.value=new H;const n=o=>{t("loading",o)},i=(o,a)=>{"vrm"in a&&s.value.setModel(a.vrm),"pose"in a&&(s.value.resetPose(),s.value.setPose(a.pose),s.value.updatePose()),"expression"in a&&(s.value.resetExpression(),s.value.importExpression(a.expression),s.value.updateExpression()),t("loaded",o,s.value)};return(o,a)=>(M.openBlock(),M.createBlock(fe,{name:l.model_name,expression_name:l.expression_name,expression_url:l.expression_url,expression_data:l.expression_data,pose_name:l.pose_name,pose_url:l.pose_url,pose_data:l.pose_data,vrm_name:l.vrm_name,vrm_url:l.vrm_url,vrm_data:l.vrm_data,onLoading:n,onLoaded:i},null,8,["name","expression_name","expression_url","expression_data","pose_name","pose_url","pose_data","vrm_name","vrm_url","vrm_data"]))}};A.ResourceLoader=V,A.ThreeFrame=ht,A.VrmModel=H,A.VroidControl=ut,A.VroidExpression=ue,A.VroidModel=fe,A.VroidPose=de,A.VroidVrm=pe,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j-kyoda/vue-three-vrm",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "A Vue 3 component designed to render and display VRM models on your web pages.",
5
5
  "type": "module",
6
6
  "private": false,