var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  return value;
};
import { LoadingManager, TextureLoader } from "../../../../../../../../node_modules/.pnpm/three@0.145.0/node_modules/three/build/three.module.mjs";
import "../../../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import "../../../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.mjs";
import "../../../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.mjs";
import "../../../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.mjs";
import "../../../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs";
import "../../../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.mjs";
import "../../../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.mjs";
import "../../../../../../../enums/pageEnum.mjs";
import "../../../../../../../router/index.mjs";
import "../../../../../../../store/modules/designStore/designStore.mjs";
import { loadingStart, loadingFinish, loadingError } from "../../../../../../../utils/plugin.mjs";
import "../../../../../../../components/GoLoading/index.mjs";
import { resources } from "./Assets.mjs";
class Resources {
  constructor(callback) {
    __publicField(this, "manager");
    __publicField(this, "callback");
    __publicField(this, "textureLoader");
    __publicField(this, "textures");
    this.callback = callback;
    this.textures = {};
    this.setLoadingManager();
    this.loadResources();
  }
  /**
   * 管理加载状态
   */
  setLoadingManager() {
    this.manager = new LoadingManager();
    this.manager.onStart = () => {
      loadingStart();
    };
    this.manager.onLoad = () => {
      this.callback();
    };
    this.manager.onProgress = (url) => {
      loadingFinish();
    };
    this.manager.onError = (url) => {
      loadingError();
      window["$message"].error("数据加载失败，请刷新重试！");
    };
  }
  /**
   * 加载资源
   */
  loadResources() {
    var _a;
    this.textureLoader = new TextureLoader(this.manager);
    (_a = resources.textures) == null ? void 0 : _a.forEach((item) => {
      this.textureLoader.load(item.url, (t) => {
        this.textures[item.name] = t;
      });
    });
  }
}
export {
  Resources
};
