/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Logger } from "#log/Logger.js";
import { MatterAggregateError } from "#MatterError.js";
const logger = Logger.get("HttpEndpointGroup");
class HttpEndpointGroup {
  #endpoints;
  constructor(endpoints) {
    this.#endpoints = endpoints;
  }
  set http(handler) {
    for (const endpoint of this.#endpoints) {
      endpoint.http = handler;
    }
  }
  set ws(handler) {
    for (const endpoint of this.#endpoints) {
      endpoint.ws = handler;
    }
  }
  async close() {
    try {
      await MatterAggregateError.allSettled(this.#endpoints.map((endpoint) => endpoint.close()));
    } catch (e) {
      logger.error("Error closing HTTP endpoints", e);
    }
    this.#endpoints = [];
  }
}
export {
  HttpEndpointGroup
};
//# sourceMappingURL=HttpEndpointGroup.js.map
