class Servicer {
  constructor(config) {
    this.listenerMap = /* @__PURE__ */ new Map();
  }
  addMessageListener(messageType, callback) {
    const { listenerMap } = this;
    if (!listenerMap.has(messageType)) {
      listenerMap.set(messageType, []);
    }
    const listeners = listenerMap.get(messageType);
    if (!listeners.includes(callback)) {
      listeners.push(callback);
    }
  }
  removeMessageListener(messageType, callback) {
    const { listenerMap } = this;
    if (listenerMap.has(messageType)) {
      const listeners = listenerMap.get(messageType);
      const index = listeners.indexOf(callback);
      if (index >= 0) {
        listeners.splice(index, 1);
      }
    }
  }
}
export { Servicer as S };
