+ const o = this.sceneManager.cameraComponent.MainCamera.getFrontPosition(1).subtract(this.sceneManager.cameraComponent.MainCamera.position).normalize()
+ , a = e.rootNode.position.subtract(this.sceneManager.cameraComponent.MainCamera.position).normalize();
+ (o = t.controller) == null || o.onPlayObservable.addOnce(()=>{
+ var a, s;
+ if (!this.getAvatarById(t.id)) {
+ t.isInLoadingList = !1,
+ t.removeAvatarFromScene(),
+ this.currentLODUsers[t.distLevel]--;
+ return
+ }
+ if (this.getAvatarById(t.id).rootNode.getChildMeshes().length < e.size) {
+ log$D.error(`this avatar does not have complete components, render failed. current list ${(a = this.getAvatarById(t.id)) == null ? void 0 : a.clothesList},avatar: ${t.id},${t.nickName}`),
+ t.isInLoadingList = !1,
+ t.removeAvatarFromScene(),
+ this.currentLODUsers[t.distLevel]--;
+ return
+ }
+ t.setIsPickable(!0),
+ t.isInLoadingList = !1,
+ t.setAvatarVisible(!0),
+ (s = this._sceneManager) == null || s.lightComponent.setShadow(t),
+ log$D.warn(`component ${o.id} uri error, type ${o.type}, avatar has been hided` + a)
+ }
+ ) : t += 100
+ }
+ , 0)
+ }
+ }
+ _validateContainer(e) {
+ return !e.meshes || e.meshes.length <= 1 ? (log$D.warn("import container has no valid meshes"),
+ !1) : !e.skeletons || e.skeletons.length == 0 ? (log$D.warn("import container has no valid skeletons"),
+ !1) : !0
+ }
+ _getAssetContainer(e, t) {
+ return new Promise((r,n)=>{
+ const o = this._getSourceKey(e, t || 0)
+ , a = avatarLoader.containers.get(o);
+ if (a)
+ return r(a);
+ avatarLoader.load(this.sceneManager, e, t).then(s=>s ? this._validateContainer(s) ? (avatarLoader.containers.set(o, s),
+ r(s)) : n(new ContainerLoadingFailedError(`[Engine] :: cannot load body type ${e}.`)) : n(new ContainerLoadingFailedError(`[Engine] container load failed cannot load body type ${e}.`))).catch(s=>n(new ContainerLoadingFailedError(`[Engine] ${s} :: cannot load body type ${e}.`)))
+ }
+ )
+ }
+ _clipContainerRes(e) {
+ e.transformNodes.forEach(t=>{
+ t.dispose()
+ }
+ ),
+ e.transformNodes = [],
+ e.skeletons.forEach(t=>{
+ t.dispose()
+ }
+ ),
+ e.skeletons = []
+ }
+ loadBody(e, t, r) {
+ return new Promise((n,o)=>avatarLoader.load(this.sceneManager, t, r).then(a=>{
+ constructor({id: e, jsonPath: t, type: r, room: n, scale: o=1}) {
+ super();
+ E(this, "_id");
+ E(this, "type");
+ E(this, "effect");
+ E(this, "avatarEffect");
+ E(this, "_room");
+ E(this, "_isLoading", !0);
+ E(this, "_failed", !1);
+ E(this, "_scale", 1);
+ this._room = n,
+ this._id = e,
+ this.type = r,
+ this._scale = o,
+ this.effect = e === "Rain" || e === "Boom" ? new XRain(this._room.scene,t,urlTransformer) : r === IEffectType.Sequence ? new XSequence(this._room.scene,t,"",urlTransformer) : new XSubSequence(this._room.scene,t,urlTransformer),
+ this.avatarEffect = new XSubSequence(this._room.scene,t,urlTransformer)