/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { hex } from "#util/String.js";
import { MockNetwork } from "./MockNetwork.js";
import { MockRouter } from "./MockRouter.js";
class NetworkSimulator {
  router = MockRouter();
  #hosts = /* @__PURE__ */ new Set();
  addHost(lastIdentifierByte) {
    const host = new MockNetwork(this, `00:11:22:33:44:${hex.byte(lastIdentifierByte)}`, [
      `abcd::${lastIdentifierByte.toString(16)}`,
      `10.10.10.${lastIdentifierByte}`
    ]);
    this.#hosts.add(host);
    return host;
  }
  removeHost(host) {
    this.#hosts.delete(host);
  }
  /**
   * Find the MockNetwork that owns a given IP address.
   */
  findNetwork(ip) {
    for (const host of this.#hosts) {
      if (host.shouldReceive(ip)) {
        return host;
      }
    }
    return void 0;
  }
}
export {
  NetworkSimulator
};
//# sourceMappingURL=NetworkSimulator.js.map
