/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Hours, merge as mergeObjects, Millis, Minutes, Seconds } from "@matter/general";
const complete = /* @__PURE__ */ Symbol("complete-timing-parameters");
function PeerTimingParameters(options) {
  if (options && options[complete]) {
    return options;
  }
  const result = { ...PeerTimingParameters.defaults };
  if (options) {
    for (const key of Object.keys(options)) {
      const value = options[key];
      if (value !== void 0) {
        result[key] = value;
      }
    }
  }
  result[complete] = true;
  return result;
}
((PeerTimingParameters2) => {
  function merge(base, overrides) {
    const result = mergeObjects(base, overrides);
    result[complete] = true;
    return result;
  }
  PeerTimingParameters2.merge = merge;
  const maxInitialContactRetryInterval = Minutes(2);
  PeerTimingParameters2.defaults = {
    defaultConnectionTimeout: Seconds(90),
    maxDelayBetweenInitialContactRetries: maxInitialContactRetryInterval,
    // We assume 30s processing time on peer for single Sigma actions, so give one IP a bit of time
    // to have a chance before potentially adding a load with a second try
    delayBeforeNextAddress: Seconds(45),
    delayAfterNetworkError: Seconds(15),
    delayAfterPeerError: Minutes(5),
    delayAfterUnhandledError: Minutes(2),
    kickThrottleInterval: Seconds(3),
    kickMinRetransmissions: 2,
    kickMinRestartSaving: Millis(maxInitialContactRetryInterval / 2),
    kickRestartCooldown: {
      addressChange: Minutes(30),
      connect: Minutes(10)
    },
    addressChangeStabilizationDelay: Seconds(10),
    addressChangeProbeCooldown: {
      minimum: Minutes(10),
      maximum: Hours(24)
    }
  };
})(PeerTimingParameters || (PeerTimingParameters = {}));
export {
  PeerTimingParameters
};
//# sourceMappingURL=PeerTimingParameters.js.map
