"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 user_management_service_exports = {};
__export(user_management_service_exports, {
  CreateUserRequest: () => CreateUserRequest,
  CreateUserResponse: () => CreateUserResponse,
  DeleteUserRequest: () => DeleteUserRequest,
  DeleteUserResponse: () => DeleteUserResponse,
  GetUserRequest: () => GetUserRequest,
  GetUserResponse: () => GetUserResponse,
  GrantUserRightsRequest: () => GrantUserRightsRequest,
  GrantUserRightsResponse: () => GrantUserRightsResponse,
  ListUserRightsRequest: () => ListUserRightsRequest,
  ListUserRightsResponse: () => ListUserRightsResponse,
  ListUsersRequest: () => ListUsersRequest,
  ListUsersResponse: () => ListUsersResponse,
  RevokeUserRightsRequest: () => RevokeUserRightsRequest,
  RevokeUserRightsResponse: () => RevokeUserRightsResponse,
  Right: () => Right,
  Right_CanActAs: () => Right_CanActAs,
  Right_CanReadAs: () => Right_CanReadAs,
  Right_CanReadAsAnyParty: () => Right_CanReadAsAnyParty,
  Right_IdentityProviderAdmin: () => Right_IdentityProviderAdmin,
  Right_ParticipantAdmin: () => Right_ParticipantAdmin,
  UpdateUserIdentityProviderIdRequest: () => UpdateUserIdentityProviderIdRequest,
  UpdateUserIdentityProviderIdResponse: () => UpdateUserIdentityProviderIdResponse,
  UpdateUserRequest: () => UpdateUserRequest,
  UpdateUserResponse: () => UpdateUserResponse,
  User: () => User,
  UserManagementService: () => UserManagementService
});
module.exports = __toCommonJS(user_management_service_exports);
var import_runtime_rpc = require("@protobuf-ts/runtime-rpc");
var import_runtime = require("@protobuf-ts/runtime");
var import_runtime2 = require("@protobuf-ts/runtime");
var import_runtime3 = require("@protobuf-ts/runtime");
var import_runtime4 = require("@protobuf-ts/runtime");
var import_field_mask = require("../../../../../../google/protobuf/field_mask.cjs");
var import_object_meta = require("./object_meta.cjs");
class User$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.User", [
      {
        no: 1,
        name: "id",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 2,
        name: "primary_party",
        kind: "scalar",
        T: 9
      },
      {
        no: 3,
        name: "is_deactivated",
        kind: "scalar",
        T: 8
      },
      { no: 4, name: "metadata", kind: "message", T: () => import_object_meta.ObjectMeta },
      {
        no: 5,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.id = "";
    message.primaryParty = "";
    message.isDeactivated = false;
    message.identityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string id */
        1:
          message.id = reader.string();
          break;
        case /* string primary_party */
        2:
          message.primaryParty = reader.string();
          break;
        case /* bool is_deactivated */
        3:
          message.isDeactivated = reader.bool();
          break;
        case /* com.daml.ledger.api.v2.admin.ObjectMeta metadata */
        4:
          message.metadata = import_object_meta.ObjectMeta.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.metadata
          );
          break;
        case /* string identity_provider_id */
        5:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.id !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.id);
    if (message.primaryParty !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.primaryParty);
    if (message.isDeactivated !== false)
      writer.tag(3, import_runtime.WireType.Varint).bool(message.isDeactivated);
    if (message.metadata)
      import_object_meta.ObjectMeta.internalBinaryWrite(
        message.metadata,
        writer.tag(4, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.identityProviderId !== "")
      writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const User = new User$Type();
class Right$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.Right", [
      {
        no: 1,
        name: "participant_admin",
        kind: "message",
        oneof: "kind",
        T: () => Right_ParticipantAdmin
      },
      {
        no: 2,
        name: "can_act_as",
        kind: "message",
        oneof: "kind",
        T: () => Right_CanActAs
      },
      {
        no: 3,
        name: "can_read_as",
        kind: "message",
        oneof: "kind",
        T: () => Right_CanReadAs
      },
      {
        no: 4,
        name: "identity_provider_admin",
        kind: "message",
        oneof: "kind",
        T: () => Right_IdentityProviderAdmin
      },
      {
        no: 5,
        name: "can_read_as_any_party",
        kind: "message",
        oneof: "kind",
        T: () => Right_CanReadAsAnyParty
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.kind = { oneofKind: void 0 };
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.Right.ParticipantAdmin participant_admin */
        1:
          message.kind = {
            oneofKind: "participantAdmin",
            participantAdmin: Right_ParticipantAdmin.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.kind.participantAdmin
            )
          };
          break;
        case /* com.daml.ledger.api.v2.admin.Right.CanActAs can_act_as */
        2:
          message.kind = {
            oneofKind: "canActAs",
            canActAs: Right_CanActAs.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.kind.canActAs
            )
          };
          break;
        case /* com.daml.ledger.api.v2.admin.Right.CanReadAs can_read_as */
        3:
          message.kind = {
            oneofKind: "canReadAs",
            canReadAs: Right_CanReadAs.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.kind.canReadAs
            )
          };
          break;
        case /* com.daml.ledger.api.v2.admin.Right.IdentityProviderAdmin identity_provider_admin */
        4:
          message.kind = {
            oneofKind: "identityProviderAdmin",
            identityProviderAdmin: Right_IdentityProviderAdmin.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.kind.identityProviderAdmin
            )
          };
          break;
        case /* com.daml.ledger.api.v2.admin.Right.CanReadAsAnyParty can_read_as_any_party */
        5:
          message.kind = {
            oneofKind: "canReadAsAnyParty",
            canReadAsAnyParty: Right_CanReadAsAnyParty.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.kind.canReadAsAnyParty
            )
          };
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.kind.oneofKind === "participantAdmin")
      Right_ParticipantAdmin.internalBinaryWrite(
        message.kind.participantAdmin,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.kind.oneofKind === "canActAs")
      Right_CanActAs.internalBinaryWrite(
        message.kind.canActAs,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.kind.oneofKind === "canReadAs")
      Right_CanReadAs.internalBinaryWrite(
        message.kind.canReadAs,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.kind.oneofKind === "identityProviderAdmin")
      Right_IdentityProviderAdmin.internalBinaryWrite(
        message.kind.identityProviderAdmin,
        writer.tag(4, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.kind.oneofKind === "canReadAsAnyParty")
      Right_CanReadAsAnyParty.internalBinaryWrite(
        message.kind.canReadAsAnyParty,
        writer.tag(5, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Right = new Right$Type();
class Right_ParticipantAdmin$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.Right.ParticipantAdmin", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Right_ParticipantAdmin = new Right_ParticipantAdmin$Type();
class Right_CanActAs$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.Right.CanActAs", [
      {
        no: 1,
        name: "party",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.party = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string party */
        1:
          message.party = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.party !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.party);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Right_CanActAs = new Right_CanActAs$Type();
class Right_CanReadAs$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.Right.CanReadAs", [
      {
        no: 1,
        name: "party",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.party = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string party */
        1:
          message.party = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.party !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.party);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Right_CanReadAs = new Right_CanReadAs$Type();
class Right_IdentityProviderAdmin$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.Right.IdentityProviderAdmin", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Right_IdentityProviderAdmin = new Right_IdentityProviderAdmin$Type();
class Right_CanReadAsAnyParty$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.Right.CanReadAsAnyParty", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Right_CanReadAsAnyParty = new Right_CanReadAsAnyParty$Type();
class CreateUserRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.CreateUserRequest", [
      { no: 1, name: "user", kind: "message", T: () => User },
      {
        no: 2,
        name: "rights",
        kind: "message",
        repeat: 2,
        T: () => Right
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.rights = [];
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.User user */
        1:
          message.user = User.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.user
          );
          break;
        case /* repeated com.daml.ledger.api.v2.admin.Right rights */
        2:
          message.rights.push(
            Right.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.user)
      User.internalBinaryWrite(
        message.user,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    for (let i = 0; i < message.rights.length; i++)
      Right.internalBinaryWrite(
        message.rights[i],
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const CreateUserRequest = new CreateUserRequest$Type();
class CreateUserResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.CreateUserResponse", [
      { no: 1, name: "user", kind: "message", T: () => User }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.User user */
        1:
          message.user = User.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.user
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.user)
      User.internalBinaryWrite(
        message.user,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const CreateUserResponse = new CreateUserResponse$Type();
class GetUserRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.GetUserRequest", [
      {
        no: 1,
        name: "user_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.userId = "";
    message.identityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string user_id */
        1:
          message.userId = reader.string();
          break;
        case /* string identity_provider_id */
        2:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.userId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.userId);
    if (message.identityProviderId !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUserRequest = new GetUserRequest$Type();
class GetUserResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.GetUserResponse", [
      { no: 1, name: "user", kind: "message", T: () => User }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.User user */
        1:
          message.user = User.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.user
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.user)
      User.internalBinaryWrite(
        message.user,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUserResponse = new GetUserResponse$Type();
class UpdateUserRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.UpdateUserRequest", [
      { no: 1, name: "user", kind: "message", T: () => User },
      { no: 2, name: "update_mask", kind: "message", T: () => import_field_mask.FieldMask }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.User user */
        1:
          message.user = User.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.user
          );
          break;
        case /* google.protobuf.FieldMask update_mask */
        2:
          message.updateMask = import_field_mask.FieldMask.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.updateMask
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.user)
      User.internalBinaryWrite(
        message.user,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.updateMask)
      import_field_mask.FieldMask.internalBinaryWrite(
        message.updateMask,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const UpdateUserRequest = new UpdateUserRequest$Type();
class UpdateUserResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.UpdateUserResponse", [
      { no: 1, name: "user", kind: "message", T: () => User }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.User user */
        1:
          message.user = User.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.user
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.user)
      User.internalBinaryWrite(
        message.user,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const UpdateUserResponse = new UpdateUserResponse$Type();
class DeleteUserRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.DeleteUserRequest", [
      {
        no: 1,
        name: "user_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.userId = "";
    message.identityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string user_id */
        1:
          message.userId = reader.string();
          break;
        case /* string identity_provider_id */
        2:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.userId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.userId);
    if (message.identityProviderId !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const DeleteUserRequest = new DeleteUserRequest$Type();
class DeleteUserResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.DeleteUserResponse", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const DeleteUserResponse = new DeleteUserResponse$Type();
class ListUsersRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.ListUsersRequest", [
      {
        no: 2,
        name: "page_token",
        kind: "scalar",
        T: 9
      },
      {
        no: 3,
        name: "page_size",
        kind: "scalar",
        T: 5
      },
      {
        no: 4,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.pageToken = "";
    message.pageSize = 0;
    message.identityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string page_token */
        2:
          message.pageToken = reader.string();
          break;
        case /* int32 page_size */
        3:
          message.pageSize = reader.int32();
          break;
        case /* string identity_provider_id */
        4:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.pageToken !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.pageToken);
    if (message.pageSize !== 0)
      writer.tag(3, import_runtime.WireType.Varint).int32(message.pageSize);
    if (message.identityProviderId !== "")
      writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const ListUsersRequest = new ListUsersRequest$Type();
class ListUsersResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.ListUsersResponse", [
      {
        no: 1,
        name: "users",
        kind: "message",
        repeat: 2,
        T: () => User
      },
      {
        no: 2,
        name: "next_page_token",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.users = [];
    message.nextPageToken = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* repeated com.daml.ledger.api.v2.admin.User users */
        1:
          message.users.push(
            User.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        case /* string next_page_token */
        2:
          message.nextPageToken = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    for (let i = 0; i < message.users.length; i++)
      User.internalBinaryWrite(
        message.users[i],
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.nextPageToken !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.nextPageToken);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const ListUsersResponse = new ListUsersResponse$Type();
class GrantUserRightsRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.GrantUserRightsRequest", [
      {
        no: 1,
        name: "user_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "rights",
        kind: "message",
        repeat: 2,
        T: () => Right
      },
      {
        no: 3,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.userId = "";
    message.rights = [];
    message.identityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string user_id */
        1:
          message.userId = reader.string();
          break;
        case /* repeated com.daml.ledger.api.v2.admin.Right rights */
        2:
          message.rights.push(
            Right.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        case /* string identity_provider_id */
        3:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.userId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.userId);
    for (let i = 0; i < message.rights.length; i++)
      Right.internalBinaryWrite(
        message.rights[i],
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.identityProviderId !== "")
      writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GrantUserRightsRequest = new GrantUserRightsRequest$Type();
class GrantUserRightsResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.GrantUserRightsResponse", [
      {
        no: 1,
        name: "newly_granted_rights",
        kind: "message",
        repeat: 2,
        T: () => Right
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.newlyGrantedRights = [];
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* repeated com.daml.ledger.api.v2.admin.Right newly_granted_rights */
        1:
          message.newlyGrantedRights.push(
            Right.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    for (let i = 0; i < message.newlyGrantedRights.length; i++)
      Right.internalBinaryWrite(
        message.newlyGrantedRights[i],
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GrantUserRightsResponse = new GrantUserRightsResponse$Type();
class RevokeUserRightsRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.RevokeUserRightsRequest", [
      {
        no: 1,
        name: "user_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "rights",
        kind: "message",
        repeat: 2,
        T: () => Right
      },
      {
        no: 3,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.userId = "";
    message.rights = [];
    message.identityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string user_id */
        1:
          message.userId = reader.string();
          break;
        case /* repeated com.daml.ledger.api.v2.admin.Right rights */
        2:
          message.rights.push(
            Right.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        case /* string identity_provider_id */
        3:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.userId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.userId);
    for (let i = 0; i < message.rights.length; i++)
      Right.internalBinaryWrite(
        message.rights[i],
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.identityProviderId !== "")
      writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const RevokeUserRightsRequest = new RevokeUserRightsRequest$Type();
class RevokeUserRightsResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.RevokeUserRightsResponse", [
      {
        no: 1,
        name: "newly_revoked_rights",
        kind: "message",
        repeat: 2,
        T: () => Right
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.newlyRevokedRights = [];
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* repeated com.daml.ledger.api.v2.admin.Right newly_revoked_rights */
        1:
          message.newlyRevokedRights.push(
            Right.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    for (let i = 0; i < message.newlyRevokedRights.length; i++)
      Right.internalBinaryWrite(
        message.newlyRevokedRights[i],
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const RevokeUserRightsResponse = new RevokeUserRightsResponse$Type();
class ListUserRightsRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.ListUserRightsRequest", [
      {
        no: 1,
        name: "user_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.userId = "";
    message.identityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string user_id */
        1:
          message.userId = reader.string();
          break;
        case /* string identity_provider_id */
        2:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.userId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.userId);
    if (message.identityProviderId !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const ListUserRightsRequest = new ListUserRightsRequest$Type();
class ListUserRightsResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.ListUserRightsResponse", [
      {
        no: 1,
        name: "rights",
        kind: "message",
        repeat: 2,
        T: () => Right
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.rights = [];
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* repeated com.daml.ledger.api.v2.admin.Right rights */
        1:
          message.rights.push(
            Right.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    for (let i = 0; i < message.rights.length; i++)
      Right.internalBinaryWrite(
        message.rights[i],
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const ListUserRightsResponse = new ListUserRightsResponse$Type();
class UpdateUserIdentityProviderIdRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.UpdateUserIdentityProviderIdRequest",
      [
        {
          no: 1,
          name: "user_id",
          kind: "scalar",
          T: 9
        },
        {
          no: 2,
          name: "source_identity_provider_id",
          kind: "scalar",
          T: 9
        },
        {
          no: 3,
          name: "target_identity_provider_id",
          kind: "scalar",
          T: 9
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.userId = "";
    message.sourceIdentityProviderId = "";
    message.targetIdentityProviderId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string user_id */
        1:
          message.userId = reader.string();
          break;
        case /* string source_identity_provider_id */
        2:
          message.sourceIdentityProviderId = reader.string();
          break;
        case /* string target_identity_provider_id */
        3:
          message.targetIdentityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.userId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.userId);
    if (message.sourceIdentityProviderId !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.sourceIdentityProviderId);
    if (message.targetIdentityProviderId !== "")
      writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.targetIdentityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const UpdateUserIdentityProviderIdRequest = new UpdateUserIdentityProviderIdRequest$Type();
class UpdateUserIdentityProviderIdResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.UpdateUserIdentityProviderIdResponse",
      []
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const UpdateUserIdentityProviderIdResponse = new UpdateUserIdentityProviderIdResponse$Type();
const UserManagementService = new import_runtime_rpc.ServiceType(
  "com.daml.ledger.api.v2.admin.UserManagementService",
  [
    {
      name: "CreateUser",
      options: {},
      I: CreateUserRequest,
      O: CreateUserResponse
    },
    { name: "GetUser", options: {}, I: GetUserRequest, O: GetUserResponse },
    {
      name: "UpdateUser",
      options: {},
      I: UpdateUserRequest,
      O: UpdateUserResponse
    },
    {
      name: "DeleteUser",
      options: {},
      I: DeleteUserRequest,
      O: DeleteUserResponse
    },
    {
      name: "ListUsers",
      options: {},
      I: ListUsersRequest,
      O: ListUsersResponse
    },
    {
      name: "GrantUserRights",
      options: {},
      I: GrantUserRightsRequest,
      O: GrantUserRightsResponse
    },
    {
      name: "RevokeUserRights",
      options: {},
      I: RevokeUserRightsRequest,
      O: RevokeUserRightsResponse
    },
    {
      name: "ListUserRights",
      options: {},
      I: ListUserRightsRequest,
      O: ListUserRightsResponse
    },
    {
      name: "UpdateUserIdentityProviderId",
      options: {},
      I: UpdateUserIdentityProviderIdRequest,
      O: UpdateUserIdentityProviderIdResponse
    }
  ]
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  CreateUserRequest,
  CreateUserResponse,
  DeleteUserRequest,
  DeleteUserResponse,
  GetUserRequest,
  GetUserResponse,
  GrantUserRightsRequest,
  GrantUserRightsResponse,
  ListUserRightsRequest,
  ListUserRightsResponse,
  ListUsersRequest,
  ListUsersResponse,
  RevokeUserRightsRequest,
  RevokeUserRightsResponse,
  Right,
  Right_CanActAs,
  Right_CanReadAs,
  Right_CanReadAsAnyParty,
  Right_IdentityProviderAdmin,
  Right_ParticipantAdmin,
  UpdateUserIdentityProviderIdRequest,
  UpdateUserIdentityProviderIdResponse,
  UpdateUserRequest,
  UpdateUserResponse,
  User,
  UserManagementService
});
//# sourceMappingURL=user_management_service.cjs.map