"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 value_exports = {};
__export(value_exports, {
  Enum: () => Enum,
  GenMap: () => GenMap,
  GenMap_Entry: () => GenMap_Entry,
  Identifier: () => Identifier,
  List: () => List,
  Optional: () => Optional,
  Record: () => Record,
  RecordField: () => RecordField,
  TextMap: () => TextMap,
  TextMap_Entry: () => TextMap_Entry,
  Value: () => Value,
  Variant: () => Variant
});
module.exports = __toCommonJS(value_exports);
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_empty = require("../../../../../google/protobuf/empty.cjs");
class Value$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.Value", [
      {
        no: 1,
        name: "unit",
        kind: "message",
        oneof: "sum",
        T: () => import_empty.Empty
      },
      {
        no: 2,
        name: "bool",
        kind: "scalar",
        oneof: "sum",
        T: 8
      },
      {
        no: 3,
        name: "int64",
        kind: "scalar",
        oneof: "sum",
        T: 18
      },
      {
        no: 4,
        name: "date",
        kind: "scalar",
        oneof: "sum",
        T: 5
      },
      {
        no: 5,
        name: "timestamp",
        kind: "scalar",
        oneof: "sum",
        T: 16
      },
      {
        no: 6,
        name: "numeric",
        kind: "scalar",
        oneof: "sum",
        T: 9
      },
      {
        no: 7,
        name: "party",
        kind: "scalar",
        oneof: "sum",
        T: 9
      },
      {
        no: 8,
        name: "text",
        kind: "scalar",
        oneof: "sum",
        T: 9
      },
      {
        no: 9,
        name: "contract_id",
        kind: "scalar",
        oneof: "sum",
        T: 9
      },
      {
        no: 10,
        name: "optional",
        kind: "message",
        oneof: "sum",
        T: () => Optional
      },
      {
        no: 11,
        name: "list",
        kind: "message",
        oneof: "sum",
        T: () => List
      },
      {
        no: 12,
        name: "text_map",
        kind: "message",
        oneof: "sum",
        T: () => TextMap
      },
      {
        no: 13,
        name: "gen_map",
        kind: "message",
        oneof: "sum",
        T: () => GenMap
      },
      {
        no: 14,
        name: "record",
        kind: "message",
        oneof: "sum",
        T: () => Record
      },
      {
        no: 15,
        name: "variant",
        kind: "message",
        oneof: "sum",
        T: () => Variant
      },
      {
        no: 16,
        name: "enum",
        kind: "message",
        oneof: "sum",
        T: () => Enum
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.sum = { 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 /* google.protobuf.Empty unit */
        1:
          message.sum = {
            oneofKind: "unit",
            unit: import_empty.Empty.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.unit
            )
          };
          break;
        case /* bool bool */
        2:
          message.sum = {
            oneofKind: "bool",
            bool: reader.bool()
          };
          break;
        case /* sint64 int64 = 3 [jstype = JS_STRING] */
        3:
          message.sum = {
            oneofKind: "int64",
            int64: reader.sint64().toString()
          };
          break;
        case /* int32 date */
        4:
          message.sum = {
            oneofKind: "date",
            date: reader.int32()
          };
          break;
        case /* sfixed64 timestamp = 5 [jstype = JS_STRING] */
        5:
          message.sum = {
            oneofKind: "timestamp",
            timestamp: reader.sfixed64().toString()
          };
          break;
        case /* string numeric */
        6:
          message.sum = {
            oneofKind: "numeric",
            numeric: reader.string()
          };
          break;
        case /* string party */
        7:
          message.sum = {
            oneofKind: "party",
            party: reader.string()
          };
          break;
        case /* string text */
        8:
          message.sum = {
            oneofKind: "text",
            text: reader.string()
          };
          break;
        case /* string contract_id */
        9:
          message.sum = {
            oneofKind: "contractId",
            contractId: reader.string()
          };
          break;
        case /* com.daml.ledger.api.v2.Optional optional */
        10:
          message.sum = {
            oneofKind: "optional",
            optional: Optional.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.optional
            )
          };
          break;
        case /* com.daml.ledger.api.v2.List list */
        11:
          message.sum = {
            oneofKind: "list",
            list: List.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.list
            )
          };
          break;
        case /* com.daml.ledger.api.v2.TextMap text_map */
        12:
          message.sum = {
            oneofKind: "textMap",
            textMap: TextMap.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.textMap
            )
          };
          break;
        case /* com.daml.ledger.api.v2.GenMap gen_map */
        13:
          message.sum = {
            oneofKind: "genMap",
            genMap: GenMap.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.genMap
            )
          };
          break;
        case /* com.daml.ledger.api.v2.Record record */
        14:
          message.sum = {
            oneofKind: "record",
            record: Record.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.record
            )
          };
          break;
        case /* com.daml.ledger.api.v2.Variant variant */
        15:
          message.sum = {
            oneofKind: "variant",
            variant: Variant.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.variant
            )
          };
          break;
        case /* com.daml.ledger.api.v2.Enum enum */
        16:
          message.sum = {
            oneofKind: "enum",
            enum: Enum.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.sum.enum
            )
          };
          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.sum.oneofKind === "unit")
      import_empty.Empty.internalBinaryWrite(
        message.sum.unit,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.sum.oneofKind === "bool")
      writer.tag(2, import_runtime.WireType.Varint).bool(message.sum.bool);
    if (message.sum.oneofKind === "int64")
      writer.tag(3, import_runtime.WireType.Varint).sint64(message.sum.int64);
    if (message.sum.oneofKind === "date")
      writer.tag(4, import_runtime.WireType.Varint).int32(message.sum.date);
    if (message.sum.oneofKind === "timestamp")
      writer.tag(5, import_runtime.WireType.Bit64).sfixed64(message.sum.timestamp);
    if (message.sum.oneofKind === "numeric")
      writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.sum.numeric);
    if (message.sum.oneofKind === "party")
      writer.tag(7, import_runtime.WireType.LengthDelimited).string(message.sum.party);
    if (message.sum.oneofKind === "text")
      writer.tag(8, import_runtime.WireType.LengthDelimited).string(message.sum.text);
    if (message.sum.oneofKind === "contractId")
      writer.tag(9, import_runtime.WireType.LengthDelimited).string(message.sum.contractId);
    if (message.sum.oneofKind === "optional")
      Optional.internalBinaryWrite(
        message.sum.optional,
        writer.tag(10, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.sum.oneofKind === "list")
      List.internalBinaryWrite(
        message.sum.list,
        writer.tag(11, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.sum.oneofKind === "textMap")
      TextMap.internalBinaryWrite(
        message.sum.textMap,
        writer.tag(12, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.sum.oneofKind === "genMap")
      GenMap.internalBinaryWrite(
        message.sum.genMap,
        writer.tag(13, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.sum.oneofKind === "record")
      Record.internalBinaryWrite(
        message.sum.record,
        writer.tag(14, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.sum.oneofKind === "variant")
      Variant.internalBinaryWrite(
        message.sum.variant,
        writer.tag(15, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.sum.oneofKind === "enum")
      Enum.internalBinaryWrite(
        message.sum.enum,
        writer.tag(16, 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 Value = new Value$Type();
class Record$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.Record", [
      { no: 1, name: "record_id", kind: "message", T: () => Identifier },
      {
        no: 2,
        name: "fields",
        kind: "message",
        repeat: 2,
        T: () => RecordField
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.fields = [];
    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.Identifier record_id */
        1:
          message.recordId = Identifier.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.recordId
          );
          break;
        case /* repeated com.daml.ledger.api.v2.RecordField fields */
        2:
          message.fields.push(
            RecordField.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.recordId)
      Identifier.internalBinaryWrite(
        message.recordId,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    for (let i = 0; i < message.fields.length; i++)
      RecordField.internalBinaryWrite(
        message.fields[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 Record = new Record$Type();
class RecordField$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.RecordField", [
      {
        no: 1,
        name: "label",
        kind: "scalar",
        T: 9
      },
      { no: 2, name: "value", kind: "message", T: () => Value }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.label = "";
    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 label */
        1:
          message.label = reader.string();
          break;
        case /* com.daml.ledger.api.v2.Value value */
        2:
          message.value = Value.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.value
          );
          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.label !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.label);
    if (message.value)
      Value.internalBinaryWrite(
        message.value,
        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 RecordField = new RecordField$Type();
class Identifier$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.Identifier", [
      {
        no: 1,
        name: "package_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "module_name",
        kind: "scalar",
        T: 9
      },
      {
        no: 3,
        name: "entity_name",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.packageId = "";
    message.moduleName = "";
    message.entityName = "";
    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 package_id */
        1:
          message.packageId = reader.string();
          break;
        case /* string module_name */
        2:
          message.moduleName = reader.string();
          break;
        case /* string entity_name */
        3:
          message.entityName = 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.packageId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.packageId);
    if (message.moduleName !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.moduleName);
    if (message.entityName !== "")
      writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.entityName);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Identifier = new Identifier$Type();
class Variant$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.Variant", [
      { no: 1, name: "variant_id", kind: "message", T: () => Identifier },
      {
        no: 2,
        name: "constructor",
        kind: "scalar",
        T: 9
      },
      { no: 3, name: "value", kind: "message", T: () => Value }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.constructor = "";
    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.Identifier variant_id */
        1:
          message.variantId = Identifier.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.variantId
          );
          break;
        case /* string constructor */
        2:
          message.constructor = reader.string();
          break;
        case /* com.daml.ledger.api.v2.Value value */
        3:
          message.value = Value.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.value
          );
          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.variantId)
      Identifier.internalBinaryWrite(
        message.variantId,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.constructor !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.constructor);
    if (message.value)
      Value.internalBinaryWrite(
        message.value,
        writer.tag(3, 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 Variant = new Variant$Type();
class Enum$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.Enum", [
      { no: 1, name: "enum_id", kind: "message", T: () => Identifier },
      {
        no: 2,
        name: "constructor",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.constructor = "";
    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.Identifier enum_id */
        1:
          message.enumId = Identifier.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.enumId
          );
          break;
        case /* string constructor */
        2:
          message.constructor = 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.enumId)
      Identifier.internalBinaryWrite(
        message.enumId,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.constructor !== "")
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.constructor);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const Enum = new Enum$Type();
class List$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.List", [
      {
        no: 1,
        name: "elements",
        kind: "message",
        repeat: 2,
        T: () => Value
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.elements = [];
    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.Value elements */
        1:
          message.elements.push(
            Value.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.elements.length; i++)
      Value.internalBinaryWrite(
        message.elements[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 List = new List$Type();
class Optional$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.Optional", [
      { no: 1, name: "value", kind: "message", T: () => Value }
    ]);
  }
  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.Value value */
        1:
          message.value = Value.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.value
          );
          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.value)
      Value.internalBinaryWrite(
        message.value,
        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 Optional = new Optional$Type();
class TextMap$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.TextMap", [
      {
        no: 1,
        name: "entries",
        kind: "message",
        repeat: 2,
        T: () => TextMap_Entry
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.entries = [];
    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.TextMap.Entry entries */
        1:
          message.entries.push(
            TextMap_Entry.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.entries.length; i++)
      TextMap_Entry.internalBinaryWrite(
        message.entries[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 TextMap = new TextMap$Type();
class TextMap_Entry$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.TextMap.Entry", [
      {
        no: 1,
        name: "key",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 2, name: "value", kind: "message", T: () => Value }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.key = "";
    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 key */
        1:
          message.key = reader.string();
          break;
        case /* com.daml.ledger.api.v2.Value value */
        2:
          message.value = Value.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.value
          );
          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.key !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.key);
    if (message.value)
      Value.internalBinaryWrite(
        message.value,
        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 TextMap_Entry = new TextMap_Entry$Type();
class GenMap$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GenMap", [
      {
        no: 1,
        name: "entries",
        kind: "message",
        repeat: 2,
        T: () => GenMap_Entry
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.entries = [];
    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.GenMap.Entry entries */
        1:
          message.entries.push(
            GenMap_Entry.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.entries.length; i++)
      GenMap_Entry.internalBinaryWrite(
        message.entries[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 GenMap = new GenMap$Type();
class GenMap_Entry$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GenMap.Entry", [
      { no: 1, name: "key", kind: "message", T: () => Value },
      { no: 2, name: "value", kind: "message", T: () => Value }
    ]);
  }
  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.Value key */
        1:
          message.key = Value.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.key
          );
          break;
        case /* com.daml.ledger.api.v2.Value value */
        2:
          message.value = Value.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.value
          );
          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.key)
      Value.internalBinaryWrite(
        message.key,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.value)
      Value.internalBinaryWrite(
        message.value,
        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 GenMap_Entry = new GenMap_Entry$Type();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Enum,
  GenMap,
  GenMap_Entry,
  Identifier,
  List,
  Optional,
  Record,
  RecordField,
  TextMap,
  TextMap_Entry,
  Value,
  Variant
});
//# sourceMappingURL=value.cjs.map