/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class NamedHandler {
  handler = [];
  hasHandler(action) {
    return this.handler.some(({ action: a }) => a === action);
  }
  addHandler(action, handler) {
    this.handler.push({ action, handler });
  }
  async executeHandler(action, ...args) {
    for (const { action: a, handler } of this.handler) {
      if (a === action) {
        return await handler(...args);
      }
    }
  }
  removeHandler(action, handler) {
    this.handler = this.handler.filter(({ action: a, handler: h }) => {
      return a !== action && h !== handler;
    });
  }
}
function extendPublicHandlerMethods(parentClass) {
  return parentClass;
}
export {
  NamedHandler,
  extendPublicHandlerMethods
};
//# sourceMappingURL=NamedHandler.js.map
