{"version":3,"file":"ParticipantTrackPermission.mjs","sources":["../../../../src/room/participant/ParticipantTrackPermission.ts"],"sourcesContent":["import { TrackPermission } from '@livekit/protocol';\n\nexport interface ParticipantTrackPermission {\n  /**\n   * The participant identity this permission applies to.\n   * You can either provide this or `participantSid`\n   */\n  participantIdentity?: string;\n\n  /**\n   * The participant server id this permission applies to.\n   * You can either provide this or `participantIdentity`\n   */\n  participantSid?: string;\n\n  /**\n   * Grant permission to all all tracks. Takes precedence over allowedTrackSids.\n   * false if unset.\n   */\n  allowAll?: boolean;\n\n  /**\n   * The list of track ids that the target participant can subscribe to.\n   * When unset, it'll allow all tracks to be subscribed by the participant.\n   * When empty, this participant is disallowed from subscribing to any tracks.\n   */\n  allowedTrackSids?: string[];\n}\n\nexport function trackPermissionToProto(perms: ParticipantTrackPermission): TrackPermission {\n  if (!perms.participantSid && !perms.participantIdentity) {\n    throw new Error(\n      'Invalid track permission, must provide at least one of participantIdentity and participantSid',\n    );\n  }\n  return new TrackPermission({\n    participantIdentity: perms.participantIdentity ?? '',\n    participantSid: perms.participantSid ?? '',\n    allTracks: perms.allowAll ?? false,\n    trackSids: perms.allowedTrackSids || [],\n  });\n}\n"],"names":["trackPermissionToProto","perms","participantSid","participantIdentity","Error","TrackPermission","_a","_b","allTracks","_c","allowAll","trackSids","allowedTrackSids"],"mappings":"gDA6BM,SAAUA,sBAAsBA,CAACC,KAAiC,EAAA;;EACtE,IAAI,CAACA,KAAK,CAACC,cAAc,IAAI,CAACD,KAAK,CAACE,mBAAmB,EAAE;AACvD,IAAA,MAAM,IAAIC,KAAK,CACb,+FAA+F,CAChG;AACH,EAAA;EACA,OAAO,IAAIC,eAAe,CAAC;AACzBF,IAAAA,mBAAmB,EAAE,CAAAG,EAAA,GAAAL,KAAK,CAACE,mBAAmB,mCAAI,EAAE;AACpDD,IAAAA,cAAc,EAAE,CAAAK,EAAA,GAAAN,KAAK,CAACC,cAAc,mCAAI,EAAE;AAC1CM,IAAAA,SAAS,EAAE,CAAAC,EAAA,GAAAR,KAAK,CAACS,QAAQ,mCAAI,KAAK;AAClCC,IAAAA,SAAS,EAAEV,KAAK,CAACW,gBAAgB,IAAI;AACtC,GAAA,CAAC;AACJ"}