"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var utils_exports = {};
__export(utils_exports, {
  createSilenceFrame: () => createSilenceFrame,
  createSilenceFrameLike: () => createSilenceFrameLike,
  setParticipantSpanAttributes: () => setParticipantSpanAttributes
});
module.exports = __toCommonJS(utils_exports);
var import_rtc_node = require("@livekit/rtc-node");
var import_telemetry = require("../telemetry/index.cjs");
function createSilenceFrame(duration, sampleRate, numChannels = 1) {
  const samples = Math.floor(duration * sampleRate / 1e3);
  return new import_rtc_node.AudioFrame(new Int16Array(samples * numChannels), sampleRate, numChannels, samples);
}
function createSilenceFrameLike(frame) {
  return new import_rtc_node.AudioFrame(
    new Int16Array(frame.samplesPerChannel * frame.channels),
    frame.sampleRate,
    frame.channels,
    frame.samplesPerChannel
  );
}
function setParticipantSpanAttributes(span, participant) {
  if (participant.sid) {
    span.setAttribute(import_telemetry.traceTypes.ATTR_PARTICIPANT_ID, participant.sid);
  }
  span.setAttribute(import_telemetry.traceTypes.ATTR_PARTICIPANT_IDENTITY, participant.identity);
  span.setAttribute(import_telemetry.traceTypes.ATTR_PARTICIPANT_KIND, participantKindName(participant.kind));
}
function participantKindName(kind) {
  const names = {
    0: "STANDARD",
    1: "INGRESS",
    2: "EGRESS",
    3: "SIP",
    4: "AGENT",
    5: "CONNECTOR"
  };
  return names[kind] ?? String(kind);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  createSilenceFrame,
  createSilenceFrameLike,
  setParticipantSpanAttributes
});
//# sourceMappingURL=utils.cjs.map