/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Environmental } from "#environment/Environmental.js";
import { BasicSet } from "#util/Set.js";
class ConnectionlessTransportSet extends BasicSet {
  constructor(...initialInterfaces) {
    super(...initialInterfaces);
  }
  static [Environmental.create](env) {
    const instance = new ConnectionlessTransportSet();
    env.set(ConnectionlessTransportSet, instance);
    return instance;
  }
  /**
   * Closes all interfaces.
   */
  async close() {
    for (const transportInterface of this) {
      await transportInterface.close();
    }
    this.clear();
  }
  /**
   * Obtain an interface capable of routing an address.
   */
  interfaceFor(type, address) {
    return this.find((transportInterface) => transportInterface.supports(type, address));
  }
  /**
   * Obtain an interface of specific type.
   */
  hasInterfaceFor(type, address) {
    return this.interfaceFor(type, address) !== void 0;
  }
}
export {
  ConnectionlessTransportSet
};
//# sourceMappingURL=ConnectionlessTransport.js.map
