"use strict";
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);
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index = require("../../utils/common/logger/index.js");
const componentNames = [
  "SwitchTheme",
  "LayoutControl",
  "RoomInfo",
  "RoomLink",
  "Language",
  "UserInfo",
  "ScreenShare",
  "FullScreen",
  "ManageMemberControl",
  "InviteControl",
  "ChatControl",
  "MoreControl",
  "VirtualBackground",
  "BasicBeauty"
];
const logPrefix = "[RoomService ComponentManager]";
const defaultConfig = {
  SwitchTheme: { visible: true },
  LayoutControl: { visible: true },
  RoomInfo: { visible: true },
  RoomLink: { visible: true },
  Language: { visible: true },
  UserInfo: { visible: true },
  ScreenShare: { visible: true },
  FullScreen: { visible: true },
  ManageMemberControl: { visible: true },
  InviteControl: { visible: true },
  ChatControl: { visible: true },
  MoreControl: { visible: true },
  VirtualBackground: { visible: false },
  BasicBeauty: { visible: false }
};
const _ComponentManager = class _ComponentManager {
  constructor(service) {
    __publicField(this, "service");
    __publicField(this, "componentConfig", Object.fromEntries(
      componentNames.map((name) => [
        name,
        {
          ...defaultConfig[name]
        }
      ])
    ));
    this.service = service;
  }
  static getInstance(ctx) {
    if (!_ComponentManager.instance) {
      _ComponentManager.instance = new _ComponentManager(ctx);
    }
    return _ComponentManager.instance;
  }
  static destroyInstance() {
    if (!_ComponentManager.instance) return;
    _ComponentManager.instance = void 0;
  }
  getComponentConfig(name) {
    return this.componentConfig[name];
  }
  setComponentConfig(options) {
    try {
      Object.entries(options).forEach(([name, current]) => {
        this.componentConfig[name] = Object.assign(
          {},
          this.componentConfig[name],
          current
        );
      });
      return true;
    } catch (error) {
      index.default.error(`${logPrefix}setComponentConfig error: ${error}`);
      return false;
    }
  }
};
__publicField(_ComponentManager, "instance");
let ComponentManager = _ComponentManager;
exports.ComponentManager = ComponentManager;
