{"version":3,"sources":["jsdelivr-header.js","/npm/@clockworklabs/spacetimedb-sdk@1.3.3/dist/browser/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNS,YAAa,gBAAmB,8BAChC,kBAAqB,YAG9B,IAAI,aAAe,MACjB,GACA,GAAU,EACV,WAAA,CAAY,GACV,MAAK,EAAU,IAAI,SAAS,EAAM,QAClC,MAAK,EAAU,EAAM,UACvB,CACA,UAAI,GACF,OAAO,MAAK,CACd,CACA,cAAA,GACE,MAAM,EAAS,KAAK,UACd,EAAQ,IAAI,WAChB,MAAK,EAAQ,OACb,MAAK,EACL,GAGF,OADA,MAAK,GAAW,EACT,CACT,CACA,QAAA,GACE,MAAM,EAAQ,MAAK,EAAQ,SAAS,MAAK,GAEzC,OADA,MAAK,GAAW,EACC,IAAV,CACT,CACA,QAAA,GACE,MAAM,EAAQ,MAAK,EAAQ,SAAS,MAAK,GAEzC,OADA,MAAK,GAAW,EACT,CACT,CACA,SAAA,CAAU,GACR,MAAM,EAAQ,IAAI,SAChB,MAAK,EAAQ,OACb,MAAK,EACL,GAGF,OADA,MAAK,GAAW,EACT,IAAI,WAAW,EAAM,OAC9B,CACA,MAAA,GACE,MAAM,EAAQ,MAAK,EAAQ,QAAQ,MAAK,GAExC,OADA,MAAK,GAAW,EACT,CACT,CACA,MAAA,GACE,MAAM,EAAQ,MAAK,EAAQ,SAAS,MAAK,GAEzC,OADA,MAAK,GAAW,EACT,CACT,CACA,OAAA,GACE,MAAM,EAAQ,MAAK,EAAQ,SAAS,MAAK,GAAS,GAElD,OADA,MAAK,GAAW,EACT,CACT,CACA,OAAA,GACE,MAAM,EAAQ,MAAK,EAAQ,UAAU,MAAK,GAAS,GAEnD,OADA,MAAK,GAAW,EACT,CACT,CACA,OAAA,GACE,MAAM,EAAQ,MAAK,EAAQ,SAAS,MAAK,GAAS,GAElD,OADA,MAAK,GAAW,EACT,CACT,CACA,OAAA,GACE,MAAM,EAAQ,MAAK,EAA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,EAAS,GAAG,aAAc,EACjC,CACA,EAAA,CAAgB,GACd,MAAK,EAAS,GAAG,eAAgB,EACnC,CACA,EAAA,CAAiB,GACf,MAAK,EAAS,IAAI,UAAW,EAC/B,CACA,EAAA,CAAoB,GAClB,MAAK,EAAS,IAAI,aAAc,EAClC,CACA,EAAA,CAAsB,GACpB,MAAK,EAAS,IAAI,eAAgB,EACpC,CAGA,SAAA,CAAU,EAAa,GACrB,MAAK,EAAgB,GAAG,EAAa,EACvC,CAGA,UAAA,CAAW,EAAa,GACtB,MAAK,EAAgB,IAAI,EAAa,EACxC,UAGO,cAAe,eAAgB,aAAc,aAAc,YAAa,aAAc,6CAA8C,uCAAwC,SAAU,YAAa,mBAAoB,aAAc,WAAY,qDAAsD,QAAS,eAAgB,2BAA4B,aAAc,UAAW","file":"/npm/@clockworklabs/spacetimedb-sdk@1.3.3/dist/browser/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@clockworklabs/spacetimedb-sdk@1.3.3/dist/browser/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { TextDecoder, TextEncoder } from '@zxing/text-encoding';\nimport { fromByteArray } from 'base64-js';\n\n// src/binary_reader.ts\nvar BinaryReader = class {\n  #buffer;\n  #offset = 0;\n  constructor(input) {\n    this.#buffer = new DataView(input.buffer);\n    this.#offset = input.byteOffset;\n  }\n  get offset() {\n    return this.#offset;\n  }\n  readUInt8Array() {\n    const length = this.readU32();\n    const value = new Uint8Array(\n      this.#buffer.buffer,\n      this.#offset,\n      length\n    );\n    this.#offset += length;\n    return value;\n  }\n  readBool() {\n    const value = this.#buffer.getUint8(this.#offset);\n    this.#offset += 1;\n    return value !== 0;\n  }\n  readByte() {\n    const value = this.#buffer.getUint8(this.#offset);\n    this.#offset += 1;\n    return value;\n  }\n  readBytes(length) {\n    const value = new DataView(\n      this.#buffer.buffer,\n      this.#offset,\n      length\n    );\n    this.#offset += length;\n    return new Uint8Array(value.buffer);\n  }\n  readI8() {\n    const value = this.#buffer.getInt8(this.#offset);\n    this.#offset += 1;\n    return value;\n  }\n  readU8() {\n    const value = this.#buffer.getUint8(this.#offset);\n    this.#offset += 1;\n    return value;\n  }\n  readI16() {\n    const value = this.#buffer.getInt16(this.#offset, true);\n    this.#offset += 2;\n    return value;\n  }\n  readU16() {\n    const value = this.#buffer.getUint16(this.#offset, true);\n    this.#offset += 2;\n    return value;\n  }\n  readI32() {\n    const value = this.#buffer.getInt32(this.#offset, true);\n    this.#offset += 4;\n    return value;\n  }\n  readU32() {\n    const value = this.#buffer.getUint32(this.#offset, true);\n    this.#offset += 4;\n    return value;\n  }\n  readI64() {\n    const value = this.#buffer.getBigInt64(this.#offset, true);\n    this.#offset += 8;\n    return value;\n  }\n  readU64() {\n    const value = this.#buffer.getBigUint64(this.#offset, true);\n    this.#offset += 8;\n    return value;\n  }\n  readU128() {\n    const lowerPart = this.#buffer.getBigUint64(this.#offset, true);\n    const upperPart = this.#buffer.getBigUint64(this.#offset + 8, true);\n    this.#offset += 16;\n    return (upperPart << BigInt(64)) + lowerPart;\n  }\n  readI128() {\n    const lowerPart = this.#buffer.getBigUint64(this.#offset, true);\n    const upperPart = this.#buffer.getBigInt64(this.#offset + 8, true);\n    this.#offset += 16;\n    return (upperPart << BigInt(64)) + lowerPart;\n  }\n  readU256() {\n    const p0 = this.#buffer.getBigUint64(this.#offset, true);\n    const p1 = this.#buffer.getBigUint64(this.#offset + 8, true);\n    const p2 = this.#buffer.getBigUint64(this.#offset + 16, true);\n    const p3 = this.#buffer.getBigUint64(this.#offset + 24, true);\n    this.#offset += 32;\n    return (p3 << BigInt(3 * 64)) + (p2 << BigInt(2 * 64)) + (p1 << BigInt(1 * 64)) + p0;\n  }\n  readI256() {\n    const p0 = this.#buffer.getBigUint64(this.#offset, true);\n    const p1 = this.#buffer.getBigUint64(this.#offset + 8, true);\n    const p2 = this.#buffer.getBigUint64(this.#offset + 16, true);\n    const p3 = this.#buffer.getBigInt64(this.#offset + 24, true);\n    this.#offset += 32;\n    return (p3 << BigInt(3 * 64)) + (p2 << BigInt(2 * 64)) + (p1 << BigInt(1 * 64)) + p0;\n  }\n  readF32() {\n    const value = this.#buffer.getFloat32(this.#offset, true);\n    this.#offset += 4;\n    return value;\n  }\n  readF64() {\n    const value = this.#buffer.getFloat64(this.#offset, true);\n    this.#offset += 8;\n    return value;\n  }\n  readString() {\n    const length = this.readU32();\n    const uint8Array = new Uint8Array(\n      this.#buffer.buffer,\n      this.#offset,\n      length\n    );\n    const decoder = new TextDecoder(\"utf-8\");\n    const value = decoder.decode(uint8Array);\n    this.#offset += length;\n    return value;\n  }\n};\nvar BinaryWriter = class {\n  #buffer;\n  #view;\n  #offset = 0;\n  constructor(size) {\n    this.#buffer = new Uint8Array(size);\n    this.#view = new DataView(this.#buffer.buffer);\n  }\n  #expandBuffer(additionalCapacity) {\n    const minCapacity = this.#offset + additionalCapacity + 1;\n    if (minCapacity <= this.#buffer.length) return;\n    let newCapacity = this.#buffer.length * 2;\n    if (newCapacity < minCapacity) newCapacity = minCapacity;\n    const newBuffer = new Uint8Array(newCapacity);\n    newBuffer.set(this.#buffer);\n    this.#buffer = newBuffer;\n    this.#view = new DataView(this.#buffer.buffer);\n  }\n  toBase64() {\n    return fromByteArray(this.#buffer.subarray(0, this.#offset));\n  }\n  getBuffer() {\n    return this.#buffer.slice(0, this.#offset);\n  }\n  writeUInt8Array(value) {\n    const length = value.length;\n    this.#expandBuffer(4 + length);\n    this.writeU32(length);\n    this.#buffer.set(value, this.#offset);\n    this.#offset += value.length;\n  }\n  writeBool(value) {\n    this.#expandBuffer(1);\n    this.#view.setUint8(this.#offset, value ? 1 : 0);\n    this.#offset += 1;\n  }\n  writeByte(value) {\n    this.#expandBuffer(1);\n    this.#view.setUint8(this.#offset, value);\n    this.#offset += 1;\n  }\n  writeI8(value) {\n    this.#expandBuffer(1);\n    this.#view.setInt8(this.#offset, value);\n    this.#offset += 1;\n  }\n  writeU8(value) {\n    this.#expandBuffer(1);\n    this.#view.setUint8(this.#offset, value);\n    this.#offset += 1;\n  }\n  writeI16(value) {\n    this.#expandBuffer(2);\n    this.#view.setInt16(this.#offset, value, true);\n    this.#offset += 2;\n  }\n  writeU16(value) {\n    this.#expandBuffer(2);\n    this.#view.setUint16(this.#offset, value, true);\n    this.#offset += 2;\n  }\n  writeI32(value) {\n    this.#expandBuffer(4);\n    this.#view.setInt32(this.#offset, value, true);\n    this.#offset += 4;\n  }\n  writeU32(value) {\n    this.#expandBuffer(4);\n    this.#view.setUint32(this.#offset, value, true);\n    this.#offset += 4;\n  }\n  writeI64(value) {\n    this.#expandBuffer(8);\n    this.#view.setBigInt64(this.#offset, value, true);\n    this.#offset += 8;\n  }\n  writeU64(value) {\n    this.#expandBuffer(8);\n    this.#view.setBigUint64(this.#offset, value, true);\n    this.#offset += 8;\n  }\n  writeU128(value) {\n    this.#expandBuffer(16);\n    const lowerPart = value & BigInt(\"0xFFFFFFFFFFFFFFFF\");\n    const upperPart = value >> BigInt(64);\n    this.#view.setBigUint64(this.#offset, lowerPart, true);\n    this.#view.setBigUint64(this.#offset + 8, upperPart, true);\n    this.#offset += 16;\n  }\n  writeI128(value) {\n    this.#expandBuffer(16);\n    const lowerPart = value & BigInt(\"0xFFFFFFFFFFFFFFFF\");\n    const upperPart = value >> BigInt(64);\n    this.#view.setBigInt64(this.#offset, lowerPart, true);\n    this.#view.setBigInt64(this.#offset + 8, upperPart, true);\n    this.#offset += 16;\n  }\n  writeU256(value) {\n    this.#expandBuffer(32);\n    const low_64_mask = BigInt(\"0xFFFFFFFFFFFFFFFF\");\n    const p0 = value & low_64_mask;\n    const p1 = value >> BigInt(64 * 1) & low_64_mask;\n    const p2 = value >> BigInt(64 * 2) & low_64_mask;\n    const p3 = value >> BigInt(64 * 3);\n    this.#view.setBigUint64(this.#offset + 8 * 0, p0, true);\n    this.#view.setBigUint64(this.#offset + 8 * 1, p1, true);\n    this.#view.setBigUint64(this.#offset + 8 * 2, p2, true);\n    this.#view.setBigUint64(this.#offset + 8 * 3, p3, true);\n    this.#offset += 32;\n  }\n  writeI256(value) {\n    this.#expandBuffer(32);\n    const low_64_mask = BigInt(\"0xFFFFFFFFFFFFFFFF\");\n    const p0 = value & low_64_mask;\n    const p1 = value >> BigInt(64 * 1) & low_64_mask;\n    const p2 = value >> BigInt(64 * 2) & low_64_mask;\n    const p3 = value >> BigInt(64 * 3);\n    this.#view.setBigUint64(this.#offset + 8 * 0, p0, true);\n    this.#view.setBigUint64(this.#offset + 8 * 1, p1, true);\n    this.#view.setBigUint64(this.#offset + 8 * 2, p2, true);\n    this.#view.setBigInt64(this.#offset + 8 * 3, p3, true);\n    this.#offset += 32;\n  }\n  writeF32(value) {\n    this.#expandBuffer(4);\n    this.#view.setFloat32(this.#offset, value, true);\n    this.#offset += 4;\n  }\n  writeF64(value) {\n    this.#expandBuffer(8);\n    this.#view.setFloat64(this.#offset, value, true);\n    this.#offset += 8;\n  }\n  writeString(value) {\n    const encoder = new TextEncoder();\n    const encodedString = encoder.encode(value);\n    this.writeU32(encodedString.length);\n    this.#expandBuffer(encodedString.length);\n    this.#buffer.set(encodedString, this.#offset);\n    this.#offset += encodedString.length;\n  }\n};\n\n// src/utils.ts\nfunction deepEqual(obj1, obj2) {\n  if (obj1 === obj2) return true;\n  if (typeof obj1 !== \"object\" || obj1 === null || typeof obj2 !== \"object\" || obj2 === null) {\n    return false;\n  }\n  const keys1 = Object.keys(obj1);\n  const keys2 = Object.keys(obj2);\n  if (keys1.length !== keys2.length) return false;\n  for (let key of keys1) {\n    if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) {\n      return false;\n    }\n  }\n  return true;\n}\nfunction uint8ArrayToHexString(array) {\n  return Array.prototype.map.call(array.reverse(), (x) => (\"00\" + x.toString(16)).slice(-2)).join(\"\");\n}\nfunction uint8ArrayToU128(array) {\n  if (array.length != 16) {\n    throw new Error(`Uint8Array is not 16 bytes long: ${array}`);\n  }\n  return new BinaryReader(array).readU128();\n}\nfunction uint8ArrayToU256(array) {\n  if (array.length != 32) {\n    throw new Error(`Uint8Array is not 32 bytes long: [${array}]`);\n  }\n  return new BinaryReader(array).readU256();\n}\nfunction hexStringToUint8Array(str) {\n  if (str.startsWith(\"0x\")) {\n    str = str.slice(2);\n  }\n  let matches = str.match(/.{1,2}/g) || [];\n  let data = Uint8Array.from(matches.map((byte) => parseInt(byte, 16)));\n  if (data.length != 32) {\n    return new Uint8Array(0);\n  }\n  return data.reverse();\n}\nfunction hexStringToU128(str) {\n  return uint8ArrayToU128(hexStringToUint8Array(str));\n}\nfunction hexStringToU256(str) {\n  return uint8ArrayToU256(hexStringToUint8Array(str));\n}\nfunction u128ToUint8Array(data) {\n  let writer = new BinaryWriter(16);\n  writer.writeU128(data);\n  return writer.getBuffer();\n}\nfunction u128ToHexString(data) {\n  return uint8ArrayToHexString(u128ToUint8Array(data));\n}\nfunction u256ToUint8Array(data) {\n  let writer = new BinaryWriter(32);\n  writer.writeU256(data);\n  return writer.getBuffer();\n}\nfunction u256ToHexString(data) {\n  return uint8ArrayToHexString(u256ToUint8Array(data));\n}\n\n// src/connection_id.ts\nvar ConnectionId = class _ConnectionId {\n  data;\n  get __connection_id__() {\n    return this.data;\n  }\n  /**\n   * Creates a new `ConnectionId`.\n   */\n  constructor(data) {\n    this.data = data;\n  }\n  isZero() {\n    return this.data === BigInt(0);\n  }\n  static nullIfZero(addr) {\n    if (addr.isZero()) {\n      return null;\n    } else {\n      return addr;\n    }\n  }\n  static random() {\n    function randomU8() {\n      return Math.floor(Math.random() * 255);\n    }\n    let result = BigInt(0);\n    for (let i = 0; i < 16; i++) {\n      result = result << BigInt(8) | BigInt(randomU8());\n    }\n    return new _ConnectionId(result);\n  }\n  /**\n   * Compare two connection IDs for equality.\n   */\n  isEqual(other) {\n    return this.data == other.data;\n  }\n  /**\n   * Print the connection ID as a hexadecimal string.\n   */\n  toHexString() {\n    return u128ToHexString(this.data);\n  }\n  /**\n   * Convert the connection ID to a Uint8Array.\n   */\n  toUint8Array() {\n    return u128ToUint8Array(this.data);\n  }\n  /**\n   * Parse a connection ID from a hexadecimal string.\n   */\n  static fromString(str) {\n    return new _ConnectionId(hexStringToU128(str));\n  }\n  static fromStringOrNull(str) {\n    let addr = _ConnectionId.fromString(str);\n    if (addr.isZero()) {\n      return null;\n    } else {\n      return addr;\n    }\n  }\n};\n\n// src/time_duration.ts\nvar TimeDuration = class _TimeDuration {\n  __time_duration_micros__;\n  static MICROS_PER_MILLIS = 1000n;\n  get micros() {\n    return this.__time_duration_micros__;\n  }\n  get millis() {\n    return Number(this.micros / _TimeDuration.MICROS_PER_MILLIS);\n  }\n  constructor(micros) {\n    this.__time_duration_micros__ = micros;\n  }\n  static fromMillis(millis) {\n    return new _TimeDuration(BigInt(millis) * _TimeDuration.MICROS_PER_MILLIS);\n  }\n};\n\n// src/timestamp.ts\nvar Timestamp = class _Timestamp {\n  __timestamp_micros_since_unix_epoch__;\n  static MICROS_PER_MILLIS = 1000n;\n  get microsSinceUnixEpoch() {\n    return this.__timestamp_micros_since_unix_epoch__;\n  }\n  constructor(micros) {\n    this.__timestamp_micros_since_unix_epoch__ = micros;\n  }\n  /**\n   * The Unix epoch, the midnight at the beginning of January 1, 1970, UTC.\n   */\n  static UNIX_EPOCH = new _Timestamp(0n);\n  /**\n   * Get a `Timestamp` representing the execution environment's belief of the current moment in time.\n   */\n  static now() {\n    return _Timestamp.fromDate(/* @__PURE__ */ new Date());\n  }\n  /**\n   * Get a `Timestamp` representing the same point in time as `date`.\n   */\n  static fromDate(date) {\n    const millis = date.getTime();\n    const micros = BigInt(millis) * _Timestamp.MICROS_PER_MILLIS;\n    return new _Timestamp(micros);\n  }\n  /**\n   * Get a `Date` representing approximately the same point in time as `this`.\n   *\n   * This method truncates to millisecond precision,\n   * and throws `RangeError` if the `Timestamp` is outside the range representable as a `Date`.\n   */\n  toDate() {\n    const micros = this.__timestamp_micros_since_unix_epoch__;\n    const millis = micros / _Timestamp.MICROS_PER_MILLIS;\n    if (millis > BigInt(Number.MAX_SAFE_INTEGER) || millis < BigInt(Number.MIN_SAFE_INTEGER)) {\n      throw new RangeError(\n        \"Timestamp is outside of the representable range of JS's Date\"\n      );\n    }\n    return new Date(Number(millis));\n  }\n};\n\n// src/identity.ts\nvar Identity = class _Identity {\n  data;\n  get __identity__() {\n    return this.data;\n  }\n  /**\n   * Creates a new `Identity`.\n   *\n   * `data` can be a hexadecimal string or a `bigint`.\n   */\n  constructor(data) {\n    this.data = typeof data === \"string\" ? hexStringToU256(data) : data;\n  }\n  /**\n   * Compare two identities for equality.\n   */\n  isEqual(other) {\n    return this.toHexString() === other.toHexString();\n  }\n  /**\n   * Print the identity as a hexadecimal string.\n   */\n  toHexString() {\n    return u256ToHexString(this.data);\n  }\n  /**\n   * Convert the address to a Uint8Array.\n   */\n  toUint8Array() {\n    return u256ToUint8Array(this.data);\n  }\n  /**\n   * Parse an Identity from a hexadecimal string.\n   */\n  static fromString(str) {\n    return new _Identity(str);\n  }\n};\n\n// src/schedule_at.ts\nvar ScheduleAt;\n((ScheduleAt2) => {\n  function getAlgebraicType() {\n    return AlgebraicType.createSumType([\n      new SumTypeVariant(\"Interval\", AlgebraicType.createTimeDurationType()),\n      new SumTypeVariant(\"Time\", AlgebraicType.createTimestampType())\n    ]);\n  }\n  ScheduleAt2.getAlgebraicType = getAlgebraicType;\n  ScheduleAt2.Interval = (value) => ({\n    tag: \"Interval\",\n    value: { __time_duration_micros__: value }\n  });\n  ScheduleAt2.Time = (value) => ({\n    tag: \"Time\",\n    value: { __timestamp_micros_since_unix_epoch__: value }\n  });\n  function fromValue(value) {\n    let sumValue = value.asSumValue();\n    switch (sumValue.tag) {\n      case 0:\n        return {\n          tag: \"Interval\",\n          value: {\n            __time_duration_micros__: sumValue.value.asProductValue().elements[0].asBigInt()\n          }\n        };\n      case 1:\n        return {\n          tag: \"Time\",\n          value: {\n            __timestamp_micros_since_unix_epoch__: sumValue.value.asBigInt()\n          }\n        };\n      default:\n        throw \"unreachable\";\n    }\n  }\n  ScheduleAt2.fromValue = fromValue;\n})(ScheduleAt || (ScheduleAt = {}));\nvar schedule_at_default = ScheduleAt;\n\n// src/algebraic_type.ts\nvar SumTypeVariant = class {\n  name;\n  algebraicType;\n  constructor(name, algebraicType) {\n    this.name = name;\n    this.algebraicType = algebraicType;\n  }\n};\nvar SumType = class {\n  variants;\n  constructor(variants) {\n    this.variants = variants;\n  }\n  serialize = (writer, value) => {\n    if (this.variants.length == 2 && this.variants[0].name === \"some\" && this.variants[1].name === \"none\") {\n      if (value !== null && value !== void 0) {\n        writer.writeByte(0);\n        this.variants[0].algebraicType.serialize(writer, value);\n      } else {\n        writer.writeByte(1);\n      }\n    } else {\n      let variant = value[\"tag\"];\n      const index = this.variants.findIndex((v) => v.name === variant);\n      if (index < 0) {\n        throw `Can't serialize a sum type, couldn't find ${value.tag} tag`;\n      }\n      writer.writeU8(index);\n      this.variants[index].algebraicType.serialize(writer, value[\"value\"]);\n    }\n  };\n  deserialize = (reader) => {\n    let tag = reader.readU8();\n    if (this.variants.length == 2 && this.variants[0].name === \"some\" && this.variants[1].name === \"none\") {\n      if (tag === 0) {\n        return this.variants[0].algebraicType.deserialize(reader);\n      } else if (tag === 1) {\n        return void 0;\n      } else {\n        throw `Can't deserialize an option type, couldn't find ${tag} tag`;\n      }\n    } else {\n      let variant = this.variants[tag];\n      let value = variant.algebraicType.deserialize(reader);\n      return { tag: variant.name, value };\n    }\n  };\n};\nvar ProductTypeElement = class {\n  name;\n  algebraicType;\n  constructor(name, algebraicType) {\n    this.name = name;\n    this.algebraicType = algebraicType;\n  }\n};\nvar ProductType = class {\n  elements;\n  constructor(elements) {\n    this.elements = elements;\n  }\n  isEmpty() {\n    return this.elements.length === 0;\n  }\n  serialize = (writer, value) => {\n    for (let element of this.elements) {\n      element.algebraicType.serialize(writer, value[element.name]);\n    }\n  };\n  intoMapKey(value) {\n    if (this.elements.length === 1) {\n      if (this.elements[0].name === \"__time_duration_micros__\") {\n        return value.__time_duration_micros__;\n      }\n      if (this.elements[0].name === \"__timestamp_micros_since_unix_epoch__\") {\n        return value.__timestamp_micros_since_unix_epoch__;\n      }\n      if (this.elements[0].name === \"__identity__\") {\n        return value.__identity__;\n      }\n      if (this.elements[0].name === \"__connection_id__\") {\n        return value.__connection_id__;\n      }\n    }\n    const writer = new BinaryWriter(10);\n    this.serialize(writer, value);\n    return writer.toBase64();\n  }\n  deserialize = (reader) => {\n    let result = {};\n    if (this.elements.length === 1) {\n      if (this.elements[0].name === \"__time_duration_micros__\") {\n        return new TimeDuration(reader.readI64());\n      }\n      if (this.elements[0].name === \"__timestamp_micros_since_unix_epoch__\") {\n        return new Timestamp(reader.readI64());\n      }\n      if (this.elements[0].name === \"__identity__\") {\n        return new Identity(reader.readU256());\n      }\n      if (this.elements[0].name === \"__connection_id__\") {\n        return new ConnectionId(reader.readU128());\n      }\n    }\n    for (let element of this.elements) {\n      result[element.name] = element.algebraicType.deserialize(reader);\n    }\n    return result;\n  };\n};\nvar MapType = class {\n  keyType;\n  valueType;\n  constructor(keyType, valueType) {\n    this.keyType = keyType;\n    this.valueType = valueType;\n  }\n};\nvar AlgebraicType = class _AlgebraicType {\n  type;\n  type_;\n  #setter(type, payload) {\n    this.type_ = payload;\n    this.type = payload === void 0 ? Type.None : type;\n  }\n  get product() {\n    if (this.type !== Type.ProductType) {\n      throw \"product type was requested, but the type is not ProductType\";\n    }\n    return this.type_;\n  }\n  set product(value) {\n    this.#setter(Type.ProductType, value);\n  }\n  get sum() {\n    if (this.type !== Type.SumType) {\n      throw \"sum type was requested, but the type is not SumType\";\n    }\n    return this.type_;\n  }\n  set sum(value) {\n    this.#setter(Type.SumType, value);\n  }\n  get array() {\n    if (this.type !== Type.ArrayType) {\n      throw \"array type was requested, but the type is not ArrayType\";\n    }\n    return this.type_;\n  }\n  set array(value) {\n    this.#setter(Type.ArrayType, value);\n  }\n  get map() {\n    if (this.type !== Type.MapType) {\n      throw \"map type was requested, but the type is not MapType\";\n    }\n    return this.type_;\n  }\n  set map(value) {\n    this.#setter(Type.MapType, value);\n  }\n  static #createType(type, payload) {\n    let at = new _AlgebraicType();\n    at.#setter(type, payload);\n    return at;\n  }\n  static createProductType(elements) {\n    return this.#createType(Type.ProductType, new ProductType(elements));\n  }\n  static createSumType(variants) {\n    return this.#createType(Type.SumType, new SumType(variants));\n  }\n  static createArrayType(elementType) {\n    return this.#createType(Type.ArrayType, elementType);\n  }\n  static createMapType(key, val) {\n    return this.#createType(Type.MapType, new MapType(key, val));\n  }\n  static createBoolType() {\n    return this.#createType(Type.Bool, null);\n  }\n  static createI8Type() {\n    return this.#createType(Type.I8, null);\n  }\n  static createU8Type() {\n    return this.#createType(Type.U8, null);\n  }\n  static createI16Type() {\n    return this.#createType(Type.I16, null);\n  }\n  static createU16Type() {\n    return this.#createType(Type.U16, null);\n  }\n  static createI32Type() {\n    return this.#createType(Type.I32, null);\n  }\n  static createU32Type() {\n    return this.#createType(Type.U32, null);\n  }\n  static createI64Type() {\n    return this.#createType(Type.I64, null);\n  }\n  static createU64Type() {\n    return this.#createType(Type.U64, null);\n  }\n  static createI128Type() {\n    return this.#createType(Type.I128, null);\n  }\n  static createU128Type() {\n    return this.#createType(Type.U128, null);\n  }\n  static createI256Type() {\n    return this.#createType(Type.I256, null);\n  }\n  static createU256Type() {\n    return this.#createType(Type.U256, null);\n  }\n  static createF32Type() {\n    return this.#createType(Type.F32, null);\n  }\n  static createF64Type() {\n    return this.#createType(Type.F64, null);\n  }\n  static createStringType() {\n    return this.#createType(Type.String, null);\n  }\n  static createBytesType() {\n    return this.createArrayType(this.createU8Type());\n  }\n  static createOptionType(innerType) {\n    return this.createSumType([\n      new SumTypeVariant(\"some\", innerType),\n      new SumTypeVariant(\"none\", this.createProductType([]))\n    ]);\n  }\n  static createIdentityType() {\n    return this.createProductType([\n      new ProductTypeElement(\"__identity__\", this.createU256Type())\n    ]);\n  }\n  static createConnectionIdType() {\n    return this.createProductType([\n      new ProductTypeElement(\"__connection_id__\", this.createU128Type())\n    ]);\n  }\n  static createScheduleAtType() {\n    return schedule_at_default.getAlgebraicType();\n  }\n  static createTimestampType() {\n    return this.createProductType([\n      new ProductTypeElement(\n        \"__timestamp_micros_since_unix_epoch__\",\n        this.createI64Type()\n      )\n    ]);\n  }\n  static createTimeDurationType() {\n    return this.createProductType([\n      new ProductTypeElement(\"__time_duration_micros__\", this.createI64Type())\n    ]);\n  }\n  isProductType() {\n    return this.type === Type.ProductType;\n  }\n  isSumType() {\n    return this.type === Type.SumType;\n  }\n  isArrayType() {\n    return this.type === Type.ArrayType;\n  }\n  isMapType() {\n    return this.type === Type.MapType;\n  }\n  #isBytes() {\n    return this.isArrayType() && this.array.type == Type.U8;\n  }\n  #isBytesNewtype(tag) {\n    return this.isProductType() && this.product.elements.length === 1 && (this.product.elements[0].algebraicType.type == Type.U128 || this.product.elements[0].algebraicType.type == Type.U256) && this.product.elements[0].name === tag;\n  }\n  #isI64Newtype(tag) {\n    return this.isProductType() && this.product.elements.length === 1 && this.product.elements[0].algebraicType.type === Type.I64 && this.product.elements[0].name === tag;\n  }\n  isIdentity() {\n    return this.#isBytesNewtype(\"__identity__\");\n  }\n  isConnectionId() {\n    return this.#isBytesNewtype(\"__connection_id__\");\n  }\n  isScheduleAt() {\n    return this.isSumType() && this.sum.variants.length === 2 && this.sum.variants[0].name === \"Interval\" && this.sum.variants[0].algebraicType.type === Type.U64 && this.sum.variants[1].name === \"Time\" && this.sum.variants[1].algebraicType.type === Type.U64;\n  }\n  isTimestamp() {\n    return this.#isI64Newtype(\"__timestamp_micros_since_unix_epoch__\");\n  }\n  isTimeDuration() {\n    return this.#isI64Newtype(\"__time_duration_micros__\");\n  }\n  /**\n   * Convert a value of the algebraic type into something that can be used as a key in a map.\n   * There are no guarantees about being able to order it.\n   * This is only guaranteed to be comparable to other values of the same type.\n   * @param value A value of the algebraic type\n   * @returns Something that can be used as a key in a map.\n   */\n  intoMapKey(value) {\n    switch (this.type) {\n      case Type.U8:\n      case Type.U16:\n      case Type.U32:\n      case Type.U64:\n      case Type.U128:\n      case Type.U256:\n      case Type.I8:\n      case Type.I16:\n      case Type.I64:\n      case Type.I128:\n      case Type.F32:\n      case Type.F64:\n      case Type.String:\n      case Type.Bool:\n        return value;\n      case Type.ProductType:\n        return this.product.intoMapKey(value);\n      default:\n        const writer = new BinaryWriter(10);\n        this.serialize(writer, value);\n        return writer.toBase64();\n    }\n  }\n  serialize(writer, value) {\n    switch (this.type) {\n      case Type.ProductType:\n        this.product.serialize(writer, value);\n        break;\n      case Type.SumType:\n        this.sum.serialize(writer, value);\n        break;\n      case Type.ArrayType:\n        if (this.#isBytes()) {\n          writer.writeUInt8Array(value);\n        } else {\n          const elemType = this.array;\n          writer.writeU32(value.length);\n          for (let elem of value) {\n            elemType.serialize(writer, elem);\n          }\n        }\n        break;\n      case Type.MapType:\n        throw new Error(\"not implemented\");\n      case Type.Bool:\n        writer.writeBool(value);\n        break;\n      case Type.I8:\n        writer.writeI8(value);\n        break;\n      case Type.U8:\n        writer.writeU8(value);\n        break;\n      case Type.I16:\n        writer.writeI16(value);\n        break;\n      case Type.U16:\n        writer.writeU16(value);\n        break;\n      case Type.I32:\n        writer.writeI32(value);\n        break;\n      case Type.U32:\n        writer.writeU32(value);\n        break;\n      case Type.I64:\n        writer.writeI64(value);\n        break;\n      case Type.U64:\n        writer.writeU64(value);\n        break;\n      case Type.I128:\n        writer.writeI128(value);\n        break;\n      case Type.U128:\n        writer.writeU128(value);\n        break;\n      case Type.I256:\n        writer.writeI256(value);\n        break;\n      case Type.U256:\n        writer.writeU256(value);\n        break;\n      case Type.F32:\n        writer.writeF32(value);\n        break;\n      case Type.F64:\n        writer.writeF64(value);\n        break;\n      case Type.String:\n        writer.writeString(value);\n        break;\n      default:\n        throw new Error(`not implemented, ${this.type}`);\n    }\n  }\n  deserialize(reader) {\n    switch (this.type) {\n      case Type.ProductType:\n        return this.product.deserialize(reader);\n      case Type.SumType:\n        return this.sum.deserialize(reader);\n      case Type.ArrayType:\n        if (this.#isBytes()) {\n          return reader.readUInt8Array();\n        } else {\n          const elemType = this.array;\n          const length = reader.readU32();\n          let result = [];\n          for (let i = 0; i < length; i++) {\n            result.push(elemType.deserialize(reader));\n          }\n          return result;\n        }\n      case Type.MapType:\n        throw new Error(\"not implemented\");\n      case Type.Bool:\n        return reader.readBool();\n      case Type.I8:\n        return reader.readI8();\n      case Type.U8:\n        return reader.readU8();\n      case Type.I16:\n        return reader.readI16();\n      case Type.U16:\n        return reader.readU16();\n      case Type.I32:\n        return reader.readI32();\n      case Type.U32:\n        return reader.readU32();\n      case Type.I64:\n        return reader.readI64();\n      case Type.U64:\n        return reader.readU64();\n      case Type.I128:\n        return reader.readI128();\n      case Type.U128:\n        return reader.readU128();\n      case Type.U256:\n        return reader.readU256();\n      case Type.F32:\n        return reader.readF32();\n      case Type.F64:\n        return reader.readF64();\n      case Type.String:\n        return reader.readString();\n      default:\n        throw new Error(`not implemented, ${this.type}`);\n    }\n  }\n};\n((AlgebraicType2) => {\n  ((Type3) => {\n    Type3[\"SumType\"] = \"SumType\";\n    Type3[\"ProductType\"] = \"ProductType\";\n    Type3[\"ArrayType\"] = \"ArrayType\";\n    Type3[\"MapType\"] = \"MapType\";\n    Type3[\"Bool\"] = \"Bool\";\n    Type3[\"I8\"] = \"I8\";\n    Type3[\"U8\"] = \"U8\";\n    Type3[\"I16\"] = \"I16\";\n    Type3[\"U16\"] = \"U16\";\n    Type3[\"I32\"] = \"I32\";\n    Type3[\"U32\"] = \"U32\";\n    Type3[\"I64\"] = \"I64\";\n    Type3[\"U64\"] = \"U64\";\n    Type3[\"I128\"] = \"I128\";\n    Type3[\"U128\"] = \"U128\";\n    Type3[\"I256\"] = \"I256\";\n    Type3[\"U256\"] = \"U256\";\n    Type3[\"F32\"] = \"F32\";\n    Type3[\"F64\"] = \"F64\";\n    Type3[\"String\"] = \"String\";\n    Type3[\"None\"] = \"None\";\n  })(AlgebraicType2.Type || (AlgebraicType2.Type = {}));\n})(AlgebraicType || (AlgebraicType = {}));\nvar Type = AlgebraicType.Type;\n\n// src/algebraic_value.ts\nvar SumValue = class {\n  /** A tag representing the choice of one variant of the sum type's variants. */\n  tag;\n  /**\n   * Given a variant `Var(Ty)` in a sum type `{ Var(Ty), ... }`,\n   * this provides the `value` for `Ty`.\n   */\n  value;\n  constructor(tag, value) {\n    this.tag = tag;\n    this.value = value;\n  }\n  static deserialize(type, adapter) {\n    return adapter.readSum(type);\n  }\n};\nvar ProductValue = class {\n  elements;\n  constructor(elements) {\n    this.elements = elements;\n  }\n  static deserialize(type, adapter) {\n    return adapter.readProduct(type);\n  }\n};\nvar AlgebraicValue = class {\n  value;\n  constructor(value) {\n    if (value === void 0) {\n      throw \"value is undefined\";\n    }\n    this.value = value;\n  }\n  callMethod(methodName) {\n    return this[methodName]();\n  }\n  static deserialize(type, adapter) {\n    switch (type.type) {\n      case AlgebraicType.Type.ProductType:\n        return new this(ProductValue.deserialize(type.product, adapter));\n      case AlgebraicType.Type.SumType:\n        return new this(SumValue.deserialize(type.sum, adapter));\n      case AlgebraicType.Type.ArrayType:\n        let elemType = type.array;\n        if (elemType.type === AlgebraicType.Type.U8) {\n          return new this(adapter.readUInt8Array());\n        } else {\n          return new this(adapter.readArray(elemType));\n        }\n      case AlgebraicType.Type.MapType:\n        let mapType = type.map;\n        return new this(adapter.readMap(mapType.keyType, mapType.valueType));\n      case AlgebraicType.Type.Bool:\n        return new this(adapter.readBool());\n      case AlgebraicType.Type.I8:\n        return new this(adapter.readI8());\n      case AlgebraicType.Type.U8:\n        return new this(adapter.readU8());\n      case AlgebraicType.Type.I16:\n        return new this(adapter.readI16());\n      case AlgebraicType.Type.U16:\n        return new this(adapter.readU16());\n      case AlgebraicType.Type.I32:\n        return new this(adapter.readI32());\n      case AlgebraicType.Type.U32:\n        return new this(adapter.readU32());\n      case AlgebraicType.Type.I64:\n        return new this(adapter.readI64());\n      case AlgebraicType.Type.U64:\n        return new this(adapter.readU64());\n      case AlgebraicType.Type.I128:\n        return new this(adapter.readI128());\n      case AlgebraicType.Type.U128:\n        return new this(adapter.readU128());\n      case AlgebraicType.Type.String:\n        return new this(adapter.readString());\n      default:\n        throw new Error(`not implemented, ${type.type}`);\n    }\n  }\n  // TODO: all of the following methods should actually check the type of `self.value`\n  // and throw if it does not match.\n  asProductValue() {\n    return this.value;\n  }\n  asField(index) {\n    return this.asProductValue().elements[index];\n  }\n  asSumValue() {\n    return this.value;\n  }\n  asArray() {\n    return this.value;\n  }\n  asMap() {\n    return this.value;\n  }\n  asString() {\n    return this.value;\n  }\n  asBoolean() {\n    return this.value;\n  }\n  asNumber() {\n    return this.value;\n  }\n  asBytes() {\n    return this.value;\n  }\n  asBigInt() {\n    return this.value;\n  }\n  asIdentity() {\n    return new Identity(this.asField(0).asBigInt());\n  }\n  asConnectionId() {\n    return new ConnectionId(this.asField(0).asBigInt());\n  }\n  asScheduleAt() {\n    return ScheduleAt.fromValue(this);\n  }\n};\nfunction parseValue(ty, src) {\n  const reader = new BinaryReader(src);\n  return ty.deserialize(reader);\n}\n\n// src/client_api/row_size_hint_type.ts\nvar RowSizeHint;\n((RowSizeHint2) => {\n  RowSizeHint2.FixedSize = (value) => ({\n    tag: \"FixedSize\",\n    value\n  });\n  RowSizeHint2.RowOffsets = (value) => ({\n    tag: \"RowOffsets\",\n    value\n  });\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createSumType([\n      new SumTypeVariant(\"FixedSize\", AlgebraicType.createU16Type()),\n      new SumTypeVariant(\n        \"RowOffsets\",\n        AlgebraicType.createArrayType(AlgebraicType.createU64Type())\n      )\n    ]);\n  }\n  RowSizeHint2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    RowSizeHint2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  RowSizeHint2.serialize = serialize;\n  function deserialize(reader) {\n    return RowSizeHint2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  RowSizeHint2.deserialize = deserialize;\n})(RowSizeHint || (RowSizeHint = {}));\n\n// src/client_api/bsatn_row_list_type.ts\nvar BsatnRowList;\n((BsatnRowList3) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"sizeHint\",\n        RowSizeHint.getTypeScriptAlgebraicType()\n      ),\n      new ProductTypeElement(\n        \"rowsData\",\n        AlgebraicType.createArrayType(AlgebraicType.createU8Type())\n      )\n    ]);\n  }\n  BsatnRowList3.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    BsatnRowList3.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  BsatnRowList3.serialize = serialize;\n  function deserialize(reader) {\n    return BsatnRowList3.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  BsatnRowList3.deserialize = deserialize;\n})(BsatnRowList || (BsatnRowList = {}));\n\n// src/client_api/call_reducer_type.ts\nvar CallReducer;\n((CallReducer2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"reducer\", AlgebraicType.createStringType()),\n      new ProductTypeElement(\n        \"args\",\n        AlgebraicType.createArrayType(AlgebraicType.createU8Type())\n      ),\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\"flags\", AlgebraicType.createU8Type())\n    ]);\n  }\n  CallReducer2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    CallReducer2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  CallReducer2.serialize = serialize;\n  function deserialize(reader) {\n    return CallReducer2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  CallReducer2.deserialize = deserialize;\n})(CallReducer || (CallReducer = {}));\n\n// src/client_api/subscribe_type.ts\nvar Subscribe;\n((Subscribe2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"queryStrings\",\n        AlgebraicType.createArrayType(AlgebraicType.createStringType())\n      ),\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type())\n    ]);\n  }\n  Subscribe2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    Subscribe2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  Subscribe2.serialize = serialize;\n  function deserialize(reader) {\n    return Subscribe2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  Subscribe2.deserialize = deserialize;\n})(Subscribe || (Subscribe = {}));\n\n// src/client_api/one_off_query_type.ts\nvar OneOffQuery;\n((OneOffQuery2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"messageId\",\n        AlgebraicType.createArrayType(AlgebraicType.createU8Type())\n      ),\n      new ProductTypeElement(\"queryString\", AlgebraicType.createStringType())\n    ]);\n  }\n  OneOffQuery2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    OneOffQuery2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  OneOffQuery2.serialize = serialize;\n  function deserialize(reader) {\n    return OneOffQuery2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  OneOffQuery2.deserialize = deserialize;\n})(OneOffQuery || (OneOffQuery = {}));\n\n// src/client_api/query_id_type.ts\nvar QueryId;\n((QueryId2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"id\", AlgebraicType.createU32Type())\n    ]);\n  }\n  QueryId2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    QueryId2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  QueryId2.serialize = serialize;\n  function deserialize(reader) {\n    return QueryId2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  QueryId2.deserialize = deserialize;\n})(QueryId || (QueryId = {}));\n\n// src/client_api/subscribe_single_type.ts\nvar SubscribeSingle;\n((SubscribeSingle2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"query\", AlgebraicType.createStringType()),\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType())\n    ]);\n  }\n  SubscribeSingle2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    SubscribeSingle2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  SubscribeSingle2.serialize = serialize;\n  function deserialize(reader) {\n    return SubscribeSingle2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  SubscribeSingle2.deserialize = deserialize;\n})(SubscribeSingle || (SubscribeSingle = {}));\n\n// src/client_api/subscribe_multi_type.ts\nvar SubscribeMulti;\n((SubscribeMulti2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"queryStrings\",\n        AlgebraicType.createArrayType(AlgebraicType.createStringType())\n      ),\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType())\n    ]);\n  }\n  SubscribeMulti2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    SubscribeMulti2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  SubscribeMulti2.serialize = serialize;\n  function deserialize(reader) {\n    return SubscribeMulti2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  SubscribeMulti2.deserialize = deserialize;\n})(SubscribeMulti || (SubscribeMulti = {}));\n\n// src/client_api/unsubscribe_type.ts\nvar Unsubscribe;\n((Unsubscribe2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType())\n    ]);\n  }\n  Unsubscribe2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    Unsubscribe2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  Unsubscribe2.serialize = serialize;\n  function deserialize(reader) {\n    return Unsubscribe2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  Unsubscribe2.deserialize = deserialize;\n})(Unsubscribe || (Unsubscribe = {}));\n\n// src/client_api/unsubscribe_multi_type.ts\nvar UnsubscribeMulti;\n((UnsubscribeMulti2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType())\n    ]);\n  }\n  UnsubscribeMulti2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    UnsubscribeMulti2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  UnsubscribeMulti2.serialize = serialize;\n  function deserialize(reader) {\n    return UnsubscribeMulti2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  UnsubscribeMulti2.deserialize = deserialize;\n})(UnsubscribeMulti || (UnsubscribeMulti = {}));\n\n// src/client_api/client_message_type.ts\nvar ClientMessage;\n((ClientMessage2) => {\n  ClientMessage2.CallReducer = (value) => ({\n    tag: \"CallReducer\",\n    value\n  });\n  ClientMessage2.Subscribe = (value) => ({\n    tag: \"Subscribe\",\n    value\n  });\n  ClientMessage2.OneOffQuery = (value) => ({\n    tag: \"OneOffQuery\",\n    value\n  });\n  ClientMessage2.SubscribeSingle = (value) => ({\n    tag: \"SubscribeSingle\",\n    value\n  });\n  ClientMessage2.SubscribeMulti = (value) => ({\n    tag: \"SubscribeMulti\",\n    value\n  });\n  ClientMessage2.Unsubscribe = (value) => ({\n    tag: \"Unsubscribe\",\n    value\n  });\n  ClientMessage2.UnsubscribeMulti = (value) => ({ tag: \"UnsubscribeMulti\", value });\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createSumType([\n      new SumTypeVariant(\n        \"CallReducer\",\n        CallReducer.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\"Subscribe\", Subscribe.getTypeScriptAlgebraicType()),\n      new SumTypeVariant(\n        \"OneOffQuery\",\n        OneOffQuery.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"SubscribeSingle\",\n        SubscribeSingle.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"SubscribeMulti\",\n        SubscribeMulti.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"Unsubscribe\",\n        Unsubscribe.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"UnsubscribeMulti\",\n        UnsubscribeMulti.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  ClientMessage2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    ClientMessage2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  ClientMessage2.serialize = serialize;\n  function deserialize(reader) {\n    return ClientMessage2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  ClientMessage2.deserialize = deserialize;\n})(ClientMessage || (ClientMessage = {}));\n\n// src/client_api/query_update_type.ts\nvar QueryUpdate;\n((QueryUpdate2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"deletes\",\n        BsatnRowList.getTypeScriptAlgebraicType()\n      ),\n      new ProductTypeElement(\n        \"inserts\",\n        BsatnRowList.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  QueryUpdate2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    QueryUpdate2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  QueryUpdate2.serialize = serialize;\n  function deserialize(reader) {\n    return QueryUpdate2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  QueryUpdate2.deserialize = deserialize;\n})(QueryUpdate || (QueryUpdate = {}));\n\n// src/client_api/compressable_query_update_type.ts\nvar CompressableQueryUpdate;\n((CompressableQueryUpdate2) => {\n  CompressableQueryUpdate2.Uncompressed = (value) => ({ tag: \"Uncompressed\", value });\n  CompressableQueryUpdate2.Brotli = (value) => ({\n    tag: \"Brotli\",\n    value\n  });\n  CompressableQueryUpdate2.Gzip = (value) => ({\n    tag: \"Gzip\",\n    value\n  });\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createSumType([\n      new SumTypeVariant(\n        \"Uncompressed\",\n        QueryUpdate.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"Brotli\",\n        AlgebraicType.createArrayType(AlgebraicType.createU8Type())\n      ),\n      new SumTypeVariant(\n        \"Gzip\",\n        AlgebraicType.createArrayType(AlgebraicType.createU8Type())\n      )\n    ]);\n  }\n  CompressableQueryUpdate2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    CompressableQueryUpdate2.getTypeScriptAlgebraicType().serialize(\n      writer,\n      value\n    );\n  }\n  CompressableQueryUpdate2.serialize = serialize;\n  function deserialize(reader) {\n    return CompressableQueryUpdate2.getTypeScriptAlgebraicType().deserialize(\n      reader\n    );\n  }\n  CompressableQueryUpdate2.deserialize = deserialize;\n})(CompressableQueryUpdate || (CompressableQueryUpdate = {}));\n\n// src/client_api/table_update_type.ts\nvar TableUpdate;\n((TableUpdate2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"tableId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\"tableName\", AlgebraicType.createStringType()),\n      new ProductTypeElement(\"numRows\", AlgebraicType.createU64Type()),\n      new ProductTypeElement(\n        \"updates\",\n        AlgebraicType.createArrayType(\n          CompressableQueryUpdate.getTypeScriptAlgebraicType()\n        )\n      )\n    ]);\n  }\n  TableUpdate2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    TableUpdate2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  TableUpdate2.serialize = serialize;\n  function deserialize(reader) {\n    return TableUpdate2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  TableUpdate2.deserialize = deserialize;\n})(TableUpdate || (TableUpdate = {}));\n\n// src/client_api/database_update_type.ts\nvar DatabaseUpdate;\n((DatabaseUpdate3) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"tables\",\n        AlgebraicType.createArrayType(\n          TableUpdate.getTypeScriptAlgebraicType()\n        )\n      )\n    ]);\n  }\n  DatabaseUpdate3.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    DatabaseUpdate3.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  DatabaseUpdate3.serialize = serialize;\n  function deserialize(reader) {\n    return DatabaseUpdate3.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  DatabaseUpdate3.deserialize = deserialize;\n})(DatabaseUpdate || (DatabaseUpdate = {}));\n\n// src/client_api/initial_subscription_type.ts\nvar InitialSubscription;\n((InitialSubscription2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"databaseUpdate\",\n        DatabaseUpdate.getTypeScriptAlgebraicType()\n      ),\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\n        \"totalHostExecutionDuration\",\n        AlgebraicType.createTimeDurationType()\n      )\n    ]);\n  }\n  InitialSubscription2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    InitialSubscription2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  InitialSubscription2.serialize = serialize;\n  function deserialize(reader) {\n    return InitialSubscription2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  InitialSubscription2.deserialize = deserialize;\n})(InitialSubscription || (InitialSubscription = {}));\n\n// src/client_api/update_status_type.ts\nvar UpdateStatus;\n((UpdateStatus2) => {\n  UpdateStatus2.Committed = (value) => ({\n    tag: \"Committed\",\n    value\n  });\n  UpdateStatus2.Failed = (value) => ({\n    tag: \"Failed\",\n    value\n  });\n  UpdateStatus2.OutOfEnergy = { tag: \"OutOfEnergy\" };\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createSumType([\n      new SumTypeVariant(\n        \"Committed\",\n        DatabaseUpdate.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\"Failed\", AlgebraicType.createStringType()),\n      new SumTypeVariant(\"OutOfEnergy\", AlgebraicType.createProductType([]))\n    ]);\n  }\n  UpdateStatus2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    UpdateStatus2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  UpdateStatus2.serialize = serialize;\n  function deserialize(reader) {\n    return UpdateStatus2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  UpdateStatus2.deserialize = deserialize;\n})(UpdateStatus || (UpdateStatus = {}));\n\n// src/client_api/reducer_call_info_type.ts\nvar ReducerCallInfo;\n((ReducerCallInfo2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"reducerName\", AlgebraicType.createStringType()),\n      new ProductTypeElement(\"reducerId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\n        \"args\",\n        AlgebraicType.createArrayType(AlgebraicType.createU8Type())\n      ),\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type())\n    ]);\n  }\n  ReducerCallInfo2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    ReducerCallInfo2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  ReducerCallInfo2.serialize = serialize;\n  function deserialize(reader) {\n    return ReducerCallInfo2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  ReducerCallInfo2.deserialize = deserialize;\n})(ReducerCallInfo || (ReducerCallInfo = {}));\n\n// src/client_api/energy_quanta_type.ts\nvar EnergyQuanta;\n((EnergyQuanta2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"quanta\", AlgebraicType.createU128Type())\n    ]);\n  }\n  EnergyQuanta2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    EnergyQuanta2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  EnergyQuanta2.serialize = serialize;\n  function deserialize(reader) {\n    return EnergyQuanta2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  EnergyQuanta2.deserialize = deserialize;\n})(EnergyQuanta || (EnergyQuanta = {}));\n\n// src/client_api/transaction_update_type.ts\nvar TransactionUpdate;\n((TransactionUpdate2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"status\",\n        UpdateStatus.getTypeScriptAlgebraicType()\n      ),\n      new ProductTypeElement(\"timestamp\", AlgebraicType.createTimestampType()),\n      new ProductTypeElement(\n        \"callerIdentity\",\n        AlgebraicType.createIdentityType()\n      ),\n      new ProductTypeElement(\n        \"callerConnectionId\",\n        AlgebraicType.createConnectionIdType()\n      ),\n      new ProductTypeElement(\n        \"reducerCall\",\n        ReducerCallInfo.getTypeScriptAlgebraicType()\n      ),\n      new ProductTypeElement(\n        \"energyQuantaUsed\",\n        EnergyQuanta.getTypeScriptAlgebraicType()\n      ),\n      new ProductTypeElement(\n        \"totalHostExecutionDuration\",\n        AlgebraicType.createTimeDurationType()\n      )\n    ]);\n  }\n  TransactionUpdate2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    TransactionUpdate2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  TransactionUpdate2.serialize = serialize;\n  function deserialize(reader) {\n    return TransactionUpdate2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  TransactionUpdate2.deserialize = deserialize;\n})(TransactionUpdate || (TransactionUpdate = {}));\n\n// src/client_api/transaction_update_light_type.ts\nvar TransactionUpdateLight;\n((TransactionUpdateLight2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\n        \"update\",\n        DatabaseUpdate.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  TransactionUpdateLight2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    TransactionUpdateLight2.getTypeScriptAlgebraicType().serialize(\n      writer,\n      value\n    );\n  }\n  TransactionUpdateLight2.serialize = serialize;\n  function deserialize(reader) {\n    return TransactionUpdateLight2.getTypeScriptAlgebraicType().deserialize(\n      reader\n    );\n  }\n  TransactionUpdateLight2.deserialize = deserialize;\n})(TransactionUpdateLight || (TransactionUpdateLight = {}));\n\n// src/client_api/identity_token_type.ts\nvar IdentityToken;\n((IdentityToken2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"identity\", AlgebraicType.createIdentityType()),\n      new ProductTypeElement(\"token\", AlgebraicType.createStringType()),\n      new ProductTypeElement(\n        \"connectionId\",\n        AlgebraicType.createConnectionIdType()\n      )\n    ]);\n  }\n  IdentityToken2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    IdentityToken2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  IdentityToken2.serialize = serialize;\n  function deserialize(reader) {\n    return IdentityToken2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  IdentityToken2.deserialize = deserialize;\n})(IdentityToken || (IdentityToken = {}));\n\n// src/client_api/one_off_table_type.ts\nvar OneOffTable;\n((OneOffTable2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"tableName\", AlgebraicType.createStringType()),\n      new ProductTypeElement(\n        \"rows\",\n        BsatnRowList.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  OneOffTable2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    OneOffTable2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  OneOffTable2.serialize = serialize;\n  function deserialize(reader) {\n    return OneOffTable2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  OneOffTable2.deserialize = deserialize;\n})(OneOffTable || (OneOffTable = {}));\n\n// src/client_api/one_off_query_response_type.ts\nvar OneOffQueryResponse;\n((OneOffQueryResponse2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"messageId\",\n        AlgebraicType.createArrayType(AlgebraicType.createU8Type())\n      ),\n      new ProductTypeElement(\n        \"error\",\n        AlgebraicType.createOptionType(AlgebraicType.createStringType())\n      ),\n      new ProductTypeElement(\n        \"tables\",\n        AlgebraicType.createArrayType(\n          OneOffTable.getTypeScriptAlgebraicType()\n        )\n      ),\n      new ProductTypeElement(\n        \"totalHostExecutionDuration\",\n        AlgebraicType.createTimeDurationType()\n      )\n    ]);\n  }\n  OneOffQueryResponse2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    OneOffQueryResponse2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  OneOffQueryResponse2.serialize = serialize;\n  function deserialize(reader) {\n    return OneOffQueryResponse2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  OneOffQueryResponse2.deserialize = deserialize;\n})(OneOffQueryResponse || (OneOffQueryResponse = {}));\n\n// src/client_api/subscribe_rows_type.ts\nvar SubscribeRows;\n((SubscribeRows2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"tableId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\"tableName\", AlgebraicType.createStringType()),\n      new ProductTypeElement(\n        \"tableRows\",\n        TableUpdate.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  SubscribeRows2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    SubscribeRows2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  SubscribeRows2.serialize = serialize;\n  function deserialize(reader) {\n    return SubscribeRows2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  SubscribeRows2.deserialize = deserialize;\n})(SubscribeRows || (SubscribeRows = {}));\n\n// src/client_api/subscribe_applied_type.ts\nvar SubscribeApplied;\n((SubscribeApplied2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\n        \"totalHostExecutionDurationMicros\",\n        AlgebraicType.createU64Type()\n      ),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType()),\n      new ProductTypeElement(\n        \"rows\",\n        SubscribeRows.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  SubscribeApplied2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    SubscribeApplied2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  SubscribeApplied2.serialize = serialize;\n  function deserialize(reader) {\n    return SubscribeApplied2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  SubscribeApplied2.deserialize = deserialize;\n})(SubscribeApplied || (SubscribeApplied = {}));\n\n// src/client_api/unsubscribe_applied_type.ts\nvar UnsubscribeApplied;\n((UnsubscribeApplied2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\n        \"totalHostExecutionDurationMicros\",\n        AlgebraicType.createU64Type()\n      ),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType()),\n      new ProductTypeElement(\n        \"rows\",\n        SubscribeRows.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  UnsubscribeApplied2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    UnsubscribeApplied2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  UnsubscribeApplied2.serialize = serialize;\n  function deserialize(reader) {\n    return UnsubscribeApplied2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  UnsubscribeApplied2.deserialize = deserialize;\n})(UnsubscribeApplied || (UnsubscribeApplied = {}));\n\n// src/client_api/subscription_error_type.ts\nvar SubscriptionError;\n((SubscriptionError2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\n        \"totalHostExecutionDurationMicros\",\n        AlgebraicType.createU64Type()\n      ),\n      new ProductTypeElement(\n        \"requestId\",\n        AlgebraicType.createOptionType(AlgebraicType.createU32Type())\n      ),\n      new ProductTypeElement(\n        \"queryId\",\n        AlgebraicType.createOptionType(AlgebraicType.createU32Type())\n      ),\n      new ProductTypeElement(\n        \"tableId\",\n        AlgebraicType.createOptionType(AlgebraicType.createU32Type())\n      ),\n      new ProductTypeElement(\"error\", AlgebraicType.createStringType())\n    ]);\n  }\n  SubscriptionError2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    SubscriptionError2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  SubscriptionError2.serialize = serialize;\n  function deserialize(reader) {\n    return SubscriptionError2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  SubscriptionError2.deserialize = deserialize;\n})(SubscriptionError || (SubscriptionError = {}));\n\n// src/client_api/subscribe_multi_applied_type.ts\nvar SubscribeMultiApplied;\n((SubscribeMultiApplied2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\n        \"totalHostExecutionDurationMicros\",\n        AlgebraicType.createU64Type()\n      ),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType()),\n      new ProductTypeElement(\n        \"update\",\n        DatabaseUpdate.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  SubscribeMultiApplied2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    SubscribeMultiApplied2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  SubscribeMultiApplied2.serialize = serialize;\n  function deserialize(reader) {\n    return SubscribeMultiApplied2.getTypeScriptAlgebraicType().deserialize(\n      reader\n    );\n  }\n  SubscribeMultiApplied2.deserialize = deserialize;\n})(SubscribeMultiApplied || (SubscribeMultiApplied = {}));\n\n// src/client_api/unsubscribe_multi_applied_type.ts\nvar UnsubscribeMultiApplied;\n((UnsubscribeMultiApplied2) => {\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createProductType([\n      new ProductTypeElement(\"requestId\", AlgebraicType.createU32Type()),\n      new ProductTypeElement(\n        \"totalHostExecutionDurationMicros\",\n        AlgebraicType.createU64Type()\n      ),\n      new ProductTypeElement(\"queryId\", QueryId.getTypeScriptAlgebraicType()),\n      new ProductTypeElement(\n        \"update\",\n        DatabaseUpdate.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  UnsubscribeMultiApplied2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    UnsubscribeMultiApplied2.getTypeScriptAlgebraicType().serialize(\n      writer,\n      value\n    );\n  }\n  UnsubscribeMultiApplied2.serialize = serialize;\n  function deserialize(reader) {\n    return UnsubscribeMultiApplied2.getTypeScriptAlgebraicType().deserialize(\n      reader\n    );\n  }\n  UnsubscribeMultiApplied2.deserialize = deserialize;\n})(UnsubscribeMultiApplied || (UnsubscribeMultiApplied = {}));\n\n// src/client_api/server_message_type.ts\nvar ServerMessage;\n((ServerMessage2) => {\n  ServerMessage2.InitialSubscription = (value) => ({ tag: \"InitialSubscription\", value });\n  ServerMessage2.TransactionUpdate = (value) => ({ tag: \"TransactionUpdate\", value });\n  ServerMessage2.TransactionUpdateLight = (value) => ({ tag: \"TransactionUpdateLight\", value });\n  ServerMessage2.IdentityToken = (value) => ({\n    tag: \"IdentityToken\",\n    value\n  });\n  ServerMessage2.OneOffQueryResponse = (value) => ({ tag: \"OneOffQueryResponse\", value });\n  ServerMessage2.SubscribeApplied = (value) => ({ tag: \"SubscribeApplied\", value });\n  ServerMessage2.UnsubscribeApplied = (value) => ({ tag: \"UnsubscribeApplied\", value });\n  ServerMessage2.SubscriptionError = (value) => ({ tag: \"SubscriptionError\", value });\n  ServerMessage2.SubscribeMultiApplied = (value) => ({ tag: \"SubscribeMultiApplied\", value });\n  ServerMessage2.UnsubscribeMultiApplied = (value) => ({ tag: \"UnsubscribeMultiApplied\", value });\n  function getTypeScriptAlgebraicType() {\n    return AlgebraicType.createSumType([\n      new SumTypeVariant(\n        \"InitialSubscription\",\n        InitialSubscription.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"TransactionUpdate\",\n        TransactionUpdate.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"TransactionUpdateLight\",\n        TransactionUpdateLight.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"IdentityToken\",\n        IdentityToken.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"OneOffQueryResponse\",\n        OneOffQueryResponse.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"SubscribeApplied\",\n        SubscribeApplied.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"UnsubscribeApplied\",\n        UnsubscribeApplied.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"SubscriptionError\",\n        SubscriptionError.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"SubscribeMultiApplied\",\n        SubscribeMultiApplied.getTypeScriptAlgebraicType()\n      ),\n      new SumTypeVariant(\n        \"UnsubscribeMultiApplied\",\n        UnsubscribeMultiApplied.getTypeScriptAlgebraicType()\n      )\n    ]);\n  }\n  ServerMessage2.getTypeScriptAlgebraicType = getTypeScriptAlgebraicType;\n  function serialize(writer, value) {\n    ServerMessage2.getTypeScriptAlgebraicType().serialize(writer, value);\n  }\n  ServerMessage2.serialize = serialize;\n  function deserialize(reader) {\n    return ServerMessage2.getTypeScriptAlgebraicType().deserialize(reader);\n  }\n  ServerMessage2.deserialize = deserialize;\n})(ServerMessage || (ServerMessage = {}));\n\n// src/event_emitter.ts\nvar EventEmitter = class {\n  #events = /* @__PURE__ */ new Map();\n  on(event, callback) {\n    let callbacks = this.#events.get(event);\n    if (!callbacks) {\n      callbacks = /* @__PURE__ */ new Set();\n      this.#events.set(event, callbacks);\n    }\n    callbacks.add(callback);\n  }\n  off(event, callback) {\n    let callbacks = this.#events.get(event);\n    if (!callbacks) {\n      return;\n    }\n    callbacks.delete(callback);\n  }\n  emit(event, ...args) {\n    let callbacks = this.#events.get(event);\n    if (!callbacks) {\n      return;\n    }\n    for (let callback of callbacks) {\n      callback(...args);\n    }\n  }\n};\n\n// src/logger.ts\nvar LogLevelIdentifierIcon = {\n  component: \"\\u{1F4E6}\",\n  info: \"\\u2139\\uFE0F\",\n  warn: \"\\u26A0\\uFE0F\",\n  error: \"\\u274C\",\n  debug: \"\\u{1F41B}\"\n};\nvar LogStyle = {\n  component: \"color: #fff; background-color: #8D6FDD; padding: 2px 5px; border-radius: 3px;\",\n  info: \"color: #fff; background-color: #007bff; padding: 2px 5px; border-radius: 3px;\",\n  warn: \"color: #fff; background-color: #ffc107; padding: 2px 5px; border-radius: 3px;\",\n  error: \"color: #fff; background-color: #dc3545; padding: 2px 5px; border-radius: 3px;\",\n  debug: \"color: #fff; background-color: #28a745; padding: 2px 5px; border-radius: 3px;\"\n};\nvar LogTextStyle = {\n  component: \"color: #8D6FDD;\",\n  info: \"color: #007bff;\",\n  warn: \"color: #ffc107;\",\n  error: \"color: #dc3545;\",\n  debug: \"color: #28a745;\"\n};\nvar stdbLogger = (level, message) => {\n  console.log(\n    `%c${LogLevelIdentifierIcon[level]} ${level.toUpperCase()}%c ${message}`,\n    LogStyle[level],\n    LogTextStyle[level]\n  );\n};\n\n// src/table_cache.ts\nvar TableCache32 = class {\n  rows;\n  tableTypeInfo;\n  emitter;\n  /**\n   * @param name the table name\n   * @param primaryKeyCol column index designated as `#[primarykey]`\n   * @param primaryKey column name designated as `#[primarykey]`\n   * @param entityClass the entityClass\n   */\n  constructor(tableTypeInfo) {\n    this.tableTypeInfo = tableTypeInfo;\n    this.rows = /* @__PURE__ */ new Map();\n    this.emitter = new EventEmitter();\n  }\n  /**\n   * @returns number of rows in the table\n   */\n  count() {\n    return this.rows.size;\n  }\n  /**\n   * @returns The values of the rows in the table\n   */\n  iter() {\n    return Array.from(this.rows.values()).map(([row]) => row);\n  }\n  applyOperations = (operations, ctx) => {\n    const pendingCallbacks = [];\n    if (this.tableTypeInfo.primaryKeyInfo !== void 0) {\n      const insertMap = /* @__PURE__ */ new Map();\n      const deleteMap = /* @__PURE__ */ new Map();\n      for (const op of operations) {\n        if (op.type === \"insert\") {\n          const [_, prevCount] = insertMap.get(op.rowId) || [op, 0];\n          insertMap.set(op.rowId, [op, prevCount + 1]);\n        } else {\n          const [_, prevCount] = deleteMap.get(op.rowId) || [op, 0];\n          deleteMap.set(op.rowId, [op, prevCount + 1]);\n        }\n      }\n      for (const [primaryKey, [insertOp, refCount]] of insertMap) {\n        const deleteEntry = deleteMap.get(primaryKey);\n        if (deleteEntry) {\n          const [_, deleteCount] = deleteEntry;\n          const refCountDelta = refCount - deleteCount;\n          const maybeCb = this.update(\n            ctx,\n            primaryKey,\n            insertOp.row,\n            refCountDelta\n          );\n          if (maybeCb) {\n            pendingCallbacks.push(maybeCb);\n          }\n          deleteMap.delete(primaryKey);\n        } else {\n          const maybeCb = this.insert(ctx, insertOp, refCount);\n          if (maybeCb) {\n            pendingCallbacks.push(maybeCb);\n          }\n        }\n      }\n      for (const [deleteOp, refCount] of deleteMap.values()) {\n        const maybeCb = this.delete(ctx, deleteOp, refCount);\n        if (maybeCb) {\n          pendingCallbacks.push(maybeCb);\n        }\n      }\n    } else {\n      for (const op of operations) {\n        if (op.type === \"insert\") {\n          const maybeCb = this.insert(ctx, op);\n          if (maybeCb) {\n            pendingCallbacks.push(maybeCb);\n          }\n        } else {\n          const maybeCb = this.delete(ctx, op);\n          if (maybeCb) {\n            pendingCallbacks.push(maybeCb);\n          }\n        }\n      }\n    }\n    return pendingCallbacks;\n  };\n  update = (ctx, rowId, newRow, refCountDelta = 0) => {\n    const existingEntry = this.rows.get(rowId);\n    if (!existingEntry) {\n      stdbLogger(\n        \"error\",\n        `Updating a row that was not present in the cache. Table: ${this.tableTypeInfo.tableName}, RowId: ${rowId}`\n      );\n      return void 0;\n    }\n    const [oldRow, previousCount] = existingEntry;\n    const refCount = Math.max(1, previousCount + refCountDelta);\n    if (previousCount + refCountDelta <= 0) {\n      stdbLogger(\n        \"error\",\n        `Negative reference count for in table ${this.tableTypeInfo.tableName} row ${rowId} (${previousCount} + ${refCountDelta})`\n      );\n      return void 0;\n    }\n    this.rows.set(rowId, [newRow, refCount]);\n    if (previousCount === 0) {\n      stdbLogger(\n        \"error\",\n        `Updating a row id in table ${this.tableTypeInfo.tableName} which was not present in the cache (rowId: ${rowId})`\n      );\n      return {\n        type: \"insert\",\n        table: this.tableTypeInfo.tableName,\n        cb: () => {\n          this.emitter.emit(\"insert\", ctx, newRow);\n        }\n      };\n    }\n    return {\n      type: \"update\",\n      table: this.tableTypeInfo.tableName,\n      cb: () => {\n        this.emitter.emit(\"update\", ctx, oldRow, newRow);\n      }\n    };\n  };\n  insert = (ctx, operation, count = 1) => {\n    const [_, previousCount] = this.rows.get(operation.rowId) || [\n      operation.row,\n      0\n    ];\n    this.rows.set(operation.rowId, [operation.row, previousCount + count]);\n    if (previousCount === 0) {\n      return {\n        type: \"insert\",\n        table: this.tableTypeInfo.tableName,\n        cb: () => {\n          this.emitter.emit(\"insert\", ctx, operation.row);\n        }\n      };\n    }\n    return void 0;\n  };\n  delete = (ctx, operation, count = 1) => {\n    const [_, previousCount] = this.rows.get(operation.rowId) || [\n      operation.row,\n      0\n    ];\n    if (previousCount === 0) {\n      stdbLogger(\"warn\", \"Deleting a row that was not present in the cache\");\n      return void 0;\n    }\n    if (previousCount <= count) {\n      this.rows.delete(operation.rowId);\n      return {\n        type: \"delete\",\n        table: this.tableTypeInfo.tableName,\n        cb: () => {\n          this.emitter.emit(\"delete\", ctx, operation.row);\n        }\n      };\n    }\n    this.rows.set(operation.rowId, [operation.row, previousCount - count]);\n    return void 0;\n  };\n  /**\n   * Register a callback for when a row is newly inserted into the database.\n   *\n   * ```ts\n   * User.onInsert((user, reducerEvent) => {\n   *   if (reducerEvent) {\n   *      console.log(\"New user on reducer\", reducerEvent, user);\n   *   } else {\n   *      console.log(\"New user received during subscription update on insert\", user);\n   *  }\n   * });\n   * ```\n   *\n   * @param cb Callback to be called when a new row is inserted\n   */\n  onInsert = (cb) => {\n    this.emitter.on(\"insert\", cb);\n  };\n  /**\n   * Register a callback for when a row is deleted from the database.\n   *\n   * ```ts\n   * User.onDelete((user, reducerEvent) => {\n   *   if (reducerEvent) {\n   *      console.log(\"Deleted user on reducer\", reducerEvent, user);\n   *   } else {\n   *      console.log(\"Deleted user received during subscription update on update\", user);\n   *  }\n   * });\n   * ```\n   *\n   * @param cb Callback to be called when a new row is inserted\n   */\n  onDelete = (cb) => {\n    this.emitter.on(\"delete\", cb);\n  };\n  /**\n   * Register a callback for when a row is updated into the database.\n   *\n   * ```ts\n   * User.onInsert((user, reducerEvent) => {\n   *   if (reducerEvent) {\n   *      console.log(\"Updated user on reducer\", reducerEvent, user);\n   *   } else {\n   *      console.log(\"Updated user received during subscription update on delete\", user);\n   *  }\n   * });\n   * ```\n   *\n   * @param cb Callback to be called when a new row is inserted\n   */\n  onUpdate = (cb) => {\n    this.emitter.on(\"update\", cb);\n  };\n  /**\n   * Remove a callback for when a row is newly inserted into the database.\n   *\n   * @param cb Callback to be removed\n   */\n  removeOnInsert = (cb) => {\n    this.emitter.off(\"insert\", cb);\n  };\n  /**\n   * Remove a callback for when a row is deleted from the database.\n   *\n   * @param cb Callback to be removed\n   */\n  removeOnDelete = (cb) => {\n    this.emitter.off(\"delete\", cb);\n  };\n  /**\n   * Remove a callback for when a row is updated into the database.\n   *\n   * @param cb Callback to be removed\n   */\n  removeOnUpdate = (cb) => {\n    this.emitter.off(\"update\", cb);\n  };\n};\n\n// src/client_cache.ts\nvar ClientCache = class {\n  /**\n   * The tables in the database.\n   */\n  tables;\n  constructor() {\n    this.tables = /* @__PURE__ */ new Map();\n  }\n  /**\n   * Returns the table with the given name.\n   * @param name The name of the table.\n   * @returns The table\n   */\n  getTable(name) {\n    const table = this.tables.get(name);\n    if (!table) {\n      console.error(\n        \"The table has not been registered for this client. Please register the table before using it. If you have registered global tables using the SpacetimeDBClient.registerTables() or `registerTable()` method, please make sure that is executed first!\"\n      );\n      throw new Error(`Table ${name} does not exist`);\n    }\n    return table;\n  }\n  getOrCreateTable(tableTypeInfo) {\n    let table;\n    if (!this.tables.has(tableTypeInfo.tableName)) {\n      table = new TableCache32(tableTypeInfo);\n      this.tables.set(tableTypeInfo.tableName, table);\n    } else {\n      table = this.tables.get(tableTypeInfo.tableName);\n    }\n    return table;\n  }\n};\n\n// src/version.ts\nfunction comparePreReleases(a, b) {\n  const len = Math.min(a.length, b.length);\n  for (let i = 0; i < len; i++) {\n    const aPart = a[i];\n    const bPart = b[i];\n    if (aPart === bPart) continue;\n    if (typeof aPart === \"number\" && typeof bPart === \"number\") {\n      return aPart - bPart;\n    }\n    if (typeof aPart === \"string\" && typeof bPart === \"string\") {\n      return aPart.localeCompare(bPart);\n    }\n    return typeof aPart === \"string\" ? 1 : -1;\n  }\n  return a.length - b.length;\n}\nvar SemanticVersion = class _SemanticVersion {\n  major;\n  minor;\n  patch;\n  preRelease;\n  buildInfo;\n  constructor(major, minor, patch, preRelease = null, buildInfo = null) {\n    this.major = major;\n    this.minor = minor;\n    this.patch = patch;\n    this.preRelease = preRelease;\n    this.buildInfo = buildInfo;\n  }\n  toString() {\n    let versionString = `${this.major}.${this.minor}.${this.patch}`;\n    if (this.preRelease) {\n      versionString += `-${this.preRelease.join(\".\")}`;\n    }\n    if (this.buildInfo) {\n      versionString += `+${this.buildInfo}`;\n    }\n    return versionString;\n  }\n  compare(other) {\n    if (this.major !== other.major) {\n      return this.major - other.major;\n    }\n    if (this.minor !== other.minor) {\n      return this.minor - other.minor;\n    }\n    if (this.patch !== other.patch) {\n      return this.patch - other.patch;\n    }\n    if (this.preRelease && other.preRelease) {\n      return comparePreReleases(this.preRelease, other.preRelease);\n    }\n    if (this.preRelease) {\n      return -1;\n    }\n    if (other.preRelease) {\n      return -1;\n    }\n    return 0;\n  }\n  clone() {\n    return new _SemanticVersion(\n      this.major,\n      this.minor,\n      this.patch,\n      this.preRelease ? [...this.preRelease] : null,\n      this.buildInfo\n    );\n  }\n  static parseVersionString(version) {\n    const regex = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-([\\da-zA-Z-]+(?:\\.[\\da-zA-Z-]+)*))?(?:\\+([\\da-zA-Z-]+(?:\\.[\\da-zA-Z-]+)*))?$/;\n    const match = version.match(regex);\n    if (!match) {\n      throw new Error(`Invalid version string: ${version}`);\n    }\n    const major = parseInt(match[1], 10);\n    const minor = parseInt(match[2], 10);\n    const patch = parseInt(match[3], 10);\n    const preRelease = match[4] ? match[4].split(\".\").map((id) => isNaN(Number(id)) ? id : Number(id)) : null;\n    const buildInfo = match[5] || null;\n    return new _SemanticVersion(major, minor, patch, preRelease, buildInfo);\n  }\n};\nvar _MINIMUM_CLI_VERSION = new SemanticVersion(\n  1,\n  2,\n  0\n);\nfunction ensureMinimumVersionOrThrow(versionString) {\n  if (versionString === void 0) {\n    throw new Error(versionErrorMessage(versionString));\n  }\n  const version = SemanticVersion.parseVersionString(versionString);\n  if (version.compare(_MINIMUM_CLI_VERSION) < 0) {\n    throw new Error(versionErrorMessage(versionString));\n  }\n}\nfunction versionErrorMessage(incompatibleVersion) {\n  return `Module code was generated with an incompatible version of the spacetimedb cli (${incompatibleVersion}).  Update the cli version to at least ${_MINIMUM_CLI_VERSION.toString()} and regenerate the bindings. You can upgrade to the latest cli version by running: spacetime version upgrade`;\n}\n\n// src/decompress.ts\nasync function decompress(buffer, type, chunkSize = 128 * 1024) {\n  let offset = 0;\n  const readableStream = new ReadableStream({\n    pull(controller) {\n      if (offset < buffer.length) {\n        const chunk = buffer.subarray(\n          offset,\n          Math.min(offset + chunkSize, buffer.length)\n        );\n        controller.enqueue(chunk);\n        offset += chunkSize;\n      } else {\n        controller.close();\n      }\n    }\n  });\n  const decompressionStream = new DecompressionStream(type);\n  const decompressedStream = readableStream.pipeThrough(decompressionStream);\n  const reader = decompressedStream.getReader();\n  const chunks = [];\n  let totalLength = 0;\n  let result;\n  while (!(result = await reader.read()).done) {\n    chunks.push(result.value);\n    totalLength += result.value.length;\n  }\n  const decompressedArray = new Uint8Array(totalLength);\n  let chunkOffset = 0;\n  for (const chunk of chunks) {\n    decompressedArray.set(chunk, chunkOffset);\n    chunkOffset += chunk.length;\n  }\n  return decompressedArray;\n}\n\n// src/websocket_decompress_adapter.ts\nvar WebsocketDecompressAdapter = class _WebsocketDecompressAdapter {\n  onclose;\n  onopen;\n  onmessage;\n  onerror;\n  #ws;\n  async #handleOnMessage(msg) {\n    const buffer = new Uint8Array(msg.data);\n    let decompressed;\n    if (buffer[0] === 0) {\n      decompressed = buffer.slice(1);\n    } else if (buffer[0] === 1) {\n      throw new Error(\n        \"Brotli Compression not supported. Please use gzip or none compression in withCompression method on DbConnection.\"\n      );\n    } else if (buffer[0] === 2) {\n      decompressed = await decompress(buffer.slice(1), \"gzip\");\n    } else {\n      throw new Error(\n        \"Unexpected Compression Algorithm. Please use `gzip` or `none`\"\n      );\n    }\n    this.onmessage?.({ data: decompressed });\n  }\n  #handleOnOpen(msg) {\n    this.onopen?.(msg);\n  }\n  #handleOnError(msg) {\n    this.onerror?.(msg);\n  }\n  send(msg) {\n    this.#ws.send(msg);\n  }\n  close() {\n    this.#ws.close();\n  }\n  constructor(ws) {\n    this.onmessage = void 0;\n    this.onopen = void 0;\n    this.onmessage = void 0;\n    this.onerror = void 0;\n    ws.onmessage = this.#handleOnMessage.bind(this);\n    ws.onerror = this.#handleOnError.bind(this);\n    ws.onclose = this.#handleOnError.bind(this);\n    ws.onopen = this.#handleOnOpen.bind(this);\n    ws.binaryType = \"arraybuffer\";\n    this.#ws = ws;\n  }\n  static async createWebSocketFn({\n    url,\n    nameOrAddress,\n    wsProtocol,\n    authToken,\n    compression,\n    lightMode\n  }) {\n    const headers = new Headers();\n    let WS;\n    {\n      WS = WebSocket;\n    }\n    let temporaryAuthToken = void 0;\n    if (authToken) {\n      headers.set(\"Authorization\", `Bearer ${authToken}`);\n      const tokenUrl = new URL(\"v1/identity/websocket-token\", url);\n      tokenUrl.protocol = url.protocol === \"wss:\" ? \"https:\" : \"http:\";\n      const response = await fetch(tokenUrl, { method: \"POST\", headers });\n      if (response.ok) {\n        const { token } = await response.json();\n        temporaryAuthToken = token;\n      } else {\n        return Promise.reject(\n          new Error(`Failed to verify token: ${response.statusText}`)\n        );\n      }\n    }\n    const databaseUrl = new URL(`v1/database/${nameOrAddress}/subscribe`, url);\n    if (temporaryAuthToken) {\n      databaseUrl.searchParams.set(\"token\", temporaryAuthToken);\n    }\n    databaseUrl.searchParams.set(\n      \"compression\",\n      compression === \"gzip\" ? \"Gzip\" : \"None\"\n    );\n    if (lightMode) {\n      databaseUrl.searchParams.set(\"light\", \"true\");\n    }\n    const ws = new WS(databaseUrl.toString(), wsProtocol);\n    return new _WebsocketDecompressAdapter(ws);\n  }\n};\n\n// src/db_connection_builder.ts\nvar DbConnectionBuilder32 = class {\n  /**\n   * Creates a new `DbConnectionBuilder` database client and set the initial parameters.\n   *\n   * Users are not expected to call this constructor directly. Instead, use the static method `DbConnection.builder()`.\n   *\n   * @param remoteModule The remote module to use to connect to the SpacetimeDB server.\n   * @param dbConnectionConstructor The constructor to use to create a new `DbConnection`.\n   */\n  constructor(remoteModule, dbConnectionConstructor) {\n    this.remoteModule = remoteModule;\n    this.dbConnectionConstructor = dbConnectionConstructor;\n    this.#createWSFn = WebsocketDecompressAdapter.createWebSocketFn;\n  }\n  #uri;\n  #nameOrAddress;\n  #identity;\n  #token;\n  #emitter = new EventEmitter();\n  #compression = \"gzip\";\n  #lightMode = false;\n  #createWSFn;\n  /**\n   * Set the URI of the SpacetimeDB server to connect to.\n   *\n   * @param uri The URI of the SpacetimeDB server to connect to.\n   *\n   **/\n  withUri(uri) {\n    this.#uri = new URL(uri);\n    return this;\n  }\n  /**\n   * Set the name or Identity of the database module to connect to.\n   *\n   * @param nameOrAddress\n   *\n   * @returns The `DbConnectionBuilder` instance.\n   */\n  withModuleName(nameOrAddress) {\n    this.#nameOrAddress = nameOrAddress;\n    return this;\n  }\n  /**\n   * Set the identity of the client to connect to the database.\n   *\n   * @param token The credentials to use to authenticate with SpacetimeDB. This\n   * is optional. You can store the token returned by the `onConnect` callback\n   * to use in future connections.\n   *\n   * @returns The `DbConnectionBuilder` instance.\n   */\n  withToken(token) {\n    this.#token = token;\n    return this;\n  }\n  withWSFn(createWSFn) {\n    this.#createWSFn = createWSFn;\n    return this;\n  }\n  /**\n   * Set the compression algorithm to use for the connection.\n   *\n   * @param compression The compression algorithm to use for the connection.\n   */\n  withCompression(compression) {\n    this.#compression = compression;\n    return this;\n  }\n  /**\n   * Sets the connection to operate in light mode.\n   *\n   * Light mode is a mode that reduces the amount of data sent over the network.\n   *\n   * @param lightMode The light mode for the connection.\n   */\n  withLightMode(lightMode) {\n    this.#lightMode = lightMode;\n    return this;\n  }\n  /**\n   * Register a callback to be invoked upon authentication with the database.\n   *\n   * @param identity A unique identifier for a client connected to a database.\n   * @param token The credentials to use to authenticate with SpacetimeDB.\n   *\n   * @returns The `DbConnectionBuilder` instance.\n   *\n   * The callback will be invoked with the `Identity` and private authentication `token` provided by the database to identify this connection.\n   *\n   * If credentials were supplied to connect, those passed to the callback will be equivalent to the ones used to connect.\n   *\n   * If the initial connection was anonymous, a new set of credentials will be generated by the database to identify this user.\n   *\n   * The credentials passed to the callback can be saved and used to authenticate the same user in future connections.\n   *\n   * @example\n   *\n   * ```ts\n   * DbConnection.builder().onConnect((ctx, identity, token) => {\n   *  console.log(\"Connected to SpacetimeDB with identity:\", identity.toHexString());\n   * });\n   * ```\n   */\n  onConnect(callback) {\n    this.#emitter.on(\"connect\", callback);\n    return this;\n  }\n  /**\n   * Register a callback to be invoked upon an error.\n   *\n   * @example\n   *\n   * ```ts\n   * DbConnection.builder().onConnectError((ctx, error) => {\n   *   console.log(\"Error connecting to SpacetimeDB:\", error);\n   * });\n   * ```\n   */\n  onConnectError(callback) {\n    this.#emitter.on(\"connectError\", callback);\n    return this;\n  }\n  /**\n   * Registers a callback to run when a {@link DbConnection} whose connection initially succeeded\n   * is disconnected, either after a {@link DbConnection.disconnect} call or due to an error.\n   *\n   * If the connection ended because of an error, the error is passed to the callback.\n   *\n   * The `callback` will be installed on the `DbConnection` created by `build`\n   * before initiating the connection, ensuring there's no opportunity for the disconnect to happen\n   * before the callback is installed.\n   *\n   * Note that this does not trigger if `build` fails\n   * or in cases where {@link DbConnectionBuilder.onConnectError} would trigger.\n   * This callback only triggers if the connection closes after `build` returns successfully\n   * and {@link DbConnectionBuilder.onConnect} is invoked, i.e., after the `IdentityToken` is received.\n   *\n   * To simplify SDK implementation, at most one such callback can be registered.\n   * Calling `onDisconnect` on the same `DbConnectionBuilder` multiple times throws an error.\n   *\n   * Unlike callbacks registered via {@link DbConnection},\n   * no mechanism is provided to unregister the provided callback.\n   * This is a concession to ergonomics; there's no clean place to return a `CallbackId` from this method\n   * or from `build`.\n   *\n   * @param {function(error?: Error): void} callback - The callback to invoke upon disconnection.\n   * @throws {Error} Throws an error if called multiple times on the same `DbConnectionBuilder`.\n   */\n  onDisconnect(callback) {\n    this.#emitter.on(\"disconnect\", callback);\n    return this;\n  }\n  /**\n   * Builds a new `DbConnection` with the parameters set on this `DbConnectionBuilder` and attempts to connect to the SpacetimeDB server.\n   *\n   * @returns A new `DbConnection` with the parameters set on this `DbConnectionBuilder`.\n   *\n   * @example\n   *\n   * ```ts\n   * const host = \"http://localhost:3000\";\n   * const name_or_address = \"database_name\"\n   * const auth_token = undefined;\n   * DbConnection.builder().withUri(host).withModuleName(name_or_address).withToken(auth_token).build();\n   * ```\n   */\n  build() {\n    if (!this.#uri) {\n      throw new Error(\"URI is required to connect to SpacetimeDB\");\n    }\n    if (!this.#nameOrAddress) {\n      throw new Error(\n        \"Database name or address is required to connect to SpacetimeDB\"\n      );\n    }\n    ensureMinimumVersionOrThrow(this.remoteModule.versionInfo?.cliVersion);\n    return this.dbConnectionConstructor(\n      new DbConnectionImpl32({\n        uri: this.#uri,\n        nameOrAddress: this.#nameOrAddress,\n        identity: this.#identity,\n        token: this.#token,\n        emitter: this.#emitter,\n        compression: this.#compression,\n        lightMode: this.#lightMode,\n        createWSFn: this.#createWSFn,\n        remoteModule: this.remoteModule\n      })\n    );\n  }\n};\n\n// src/subscription_builder_impl.ts\nvar SubscriptionBuilderImpl32 = class {\n  constructor(db) {\n    this.db = db;\n  }\n  #onApplied = void 0;\n  #onError = void 0;\n  /**\n   * Registers `callback` to run when this query is successfully added to our subscribed set,\n   * I.e. when its `SubscriptionApplied` message is received.\n   *\n   * The database state exposed via the `&EventContext` argument\n   * includes all the rows added to the client cache as a result of the new subscription.\n   *\n   * The event in the `&EventContext` argument is `Event::SubscribeApplied`.\n   *\n   * Multiple `on_applied` callbacks for the same query may coexist.\n   * No mechanism for un-registering `on_applied` callbacks is exposed.\n   *\n   * @param cb - Callback to run when the subscription is applied.\n   * @returns The current `SubscriptionBuilder` instance.\n   */\n  onApplied(cb) {\n    this.#onApplied = cb;\n    return this;\n  }\n  /**\n   * Registers `callback` to run when this query either:\n   * - Fails to be added to our subscribed set.\n   * - Is unexpectedly removed from our subscribed set.\n   *\n   * If the subscription had previously started and has been unexpectedly removed,\n   * the database state exposed via the `&EventContext` argument contains no rows\n   * from any subscriptions removed within the same error event.\n   * As proposed, it must therefore contain no rows.\n   *\n   * The event in the `&EventContext` argument is `Event::SubscribeError`,\n   * containing a dynamic error object with a human-readable description of the error\n   * for diagnostic purposes.\n   *\n   * Multiple `on_error` callbacks for the same query may coexist.\n   * No mechanism for un-registering `on_error` callbacks is exposed.\n   *\n   * @param cb - Callback to run when there is an error in subscription.\n   * @returns The current `SubscriptionBuilder` instance.\n   */\n  onError(cb) {\n    this.#onError = cb;\n    return this;\n  }\n  /**\n   * Subscribe to a single query. The results of the query will be merged into the client\n   * cache and deduplicated on the client.\n   *\n   * @param query_sql A `SQL` query to subscribe to.\n   *\n   * @example\n   *\n   * ```ts\n   * const subscription = connection.subscriptionBuilder().onApplied(() => {\n   *   console.log(\"SDK client cache initialized.\");\n   * }).subscribe(\"SELECT * FROM User\");\n   *\n   * subscription.unsubscribe();\n   * ```\n   */\n  subscribe(query_sql) {\n    const queries = Array.isArray(query_sql) ? query_sql : [query_sql];\n    if (queries.length === 0) {\n      throw new Error(\"Subscriptions must have at least one query\");\n    }\n    return new SubscriptionHandleImpl(\n      this.db,\n      queries,\n      this.#onApplied,\n      this.#onError\n    );\n  }\n  /**\n   * Subscribes to all rows from all tables.\n   *\n   * This method is intended as a convenience\n   * for applications where client-side memory use and network bandwidth are not concerns.\n   * Applications where these resources are a constraint\n   * should register more precise queries via `subscribe`\n   * in order to replicate only the subset of data which the client needs to function.\n   *\n   * This method should not be combined with `subscribe` on the same `DbConnection`.\n   * A connection may either `subscribe` to particular queries,\n   * or `subscribeToAllTables`, but not both.\n   * Attempting to call `subscribe`\n   * on a `DbConnection` that has previously used `subscribeToAllTables`,\n   * or vice versa, may misbehave in any number of ways,\n   * including dropping subscriptions, corrupting the client cache, or throwing errors.\n   */\n  subscribeToAllTables() {\n    this.subscribe(\"SELECT * FROM *\");\n  }\n};\nvar SubscriptionManager = class {\n  subscriptions = /* @__PURE__ */ new Map();\n};\nvar SubscriptionHandleImpl = class {\n  constructor(db, querySql, onApplied, onError) {\n    this.db = db;\n    this.#emitter.on(\n      \"applied\",\n      (ctx) => {\n        this.#activeState = true;\n        if (onApplied) {\n          onApplied(ctx);\n        }\n      }\n    );\n    this.#emitter.on(\n      \"error\",\n      (ctx, error) => {\n        this.#activeState = false;\n        this.#endedState = true;\n        if (onError) {\n          onError(ctx, error);\n        }\n      }\n    );\n    this.#queryId = this.db.registerSubscription(this, this.#emitter, querySql);\n  }\n  #queryId;\n  #unsubscribeCalled = false;\n  #endedState = false;\n  #activeState = false;\n  #emitter = new EventEmitter();\n  /**\n   * Consumes self and issues an `Unsubscribe` message,\n   * removing this query from the client's set of subscribed queries.\n   * It is only valid to call this method if `is_active()` is `true`.\n   */\n  unsubscribe() {\n    if (this.#unsubscribeCalled) {\n      throw new Error(\"Unsubscribe has already been called\");\n    }\n    this.#unsubscribeCalled = true;\n    this.db.unregisterSubscription(this.#queryId);\n    this.#emitter.on(\n      \"end\",\n      (_ctx) => {\n        this.#endedState = true;\n        this.#activeState = false;\n      }\n    );\n  }\n  /**\n   * Unsubscribes and also registers a callback to run upon success.\n   * I.e. when an `UnsubscribeApplied` message is received.\n   *\n   * If `Unsubscribe` returns an error,\n   * or if the `on_error` callback(s) are invoked before this subscription would end normally,\n   * the `on_end` callback is not invoked.\n   *\n   * @param onEnd - Callback to run upon successful unsubscribe.\n   */\n  unsubscribeThen(onEnd) {\n    if (this.#endedState) {\n      throw new Error(\"Subscription has already ended\");\n    }\n    if (this.#unsubscribeCalled) {\n      throw new Error(\"Unsubscribe has already been called\");\n    }\n    this.#unsubscribeCalled = true;\n    this.db.unregisterSubscription(this.#queryId);\n    this.#emitter.on(\n      \"end\",\n      (ctx) => {\n        this.#endedState = true;\n        this.#activeState = false;\n        onEnd(ctx);\n      }\n    );\n  }\n  /**\n   * True if this `SubscriptionHandle` has ended,\n   * either due to an error or a call to `unsubscribe`.\n   *\n   * This is initially false, and becomes true when either the `on_end` or `on_error` callback is invoked.\n   * A subscription which has not yet been applied is not active, but is also not ended.\n   */\n  isEnded() {\n    return this.#endedState;\n  }\n  /**\n   * True if this `SubscriptionHandle` is active, meaning it has been successfully applied\n   * and has not since ended, either due to an error or a complete `unsubscribe` request-response pair.\n   *\n   * This corresponds exactly to the interval bounded at the start by the `on_applied` callback\n   * and at the end by either the `on_end` or `on_error` callback.\n   */\n  isActive() {\n    return this.#activeState;\n  }\n};\nfunction callReducerFlagsToNumber(flags) {\n  switch (flags) {\n    case \"FullUpdate\":\n      return 0;\n    case \"NoSuccessNotify\":\n      return 1;\n  }\n}\nvar DbConnectionImpl32 = class {\n  /**\n   * Whether or not the connection is active.\n   */\n  isActive = false;\n  /**\n   * This connection's public identity.\n   */\n  identity = void 0;\n  /**\n   * This connection's private authentication token.\n   */\n  token = void 0;\n  /**\n   * The accessor field to access the tables in the database and associated\n   * callback functions.\n   */\n  db;\n  /**\n   * The accessor field to access the reducers in the database and associated\n   * callback functions.\n   */\n  reducers;\n  /**\n   * The accessor field to access functions related to setting flags on\n   * reducers regarding how the server should handle the reducer call and\n   * the events that it sends back to the client.\n   */\n  setReducerFlags;\n  /**\n   * The `ConnectionId` of the connection to to the database.\n   */\n  connectionId = ConnectionId.random();\n  // These fields are meant to be strictly private.\n  #queryId = 0;\n  #emitter;\n  #reducerEmitter = new EventEmitter();\n  #onApplied;\n  #remoteModule;\n  #messageQueue = Promise.resolve();\n  #subscriptionManager = new SubscriptionManager();\n  // These fields are not part of the public API, but in a pinch you\n  // could use JavaScript to access them by bypassing TypeScript's\n  // private fields.\n  // We use them in testing.\n  clientCache;\n  ws;\n  wsPromise;\n  constructor({\n    uri,\n    nameOrAddress,\n    identity,\n    token,\n    emitter,\n    remoteModule,\n    createWSFn,\n    compression,\n    lightMode\n  }) {\n    stdbLogger(\"info\", \"Connecting to SpacetimeDB WS...\");\n    let url = new URL(uri.toString());\n    if (!/^wss?:/.test(uri.protocol)) {\n      url.protocol = url.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n    }\n    this.identity = identity;\n    this.token = token;\n    this.#remoteModule = remoteModule;\n    this.#emitter = emitter;\n    let connectionId = this.connectionId.toHexString();\n    url.searchParams.set(\"connection_id\", connectionId);\n    this.clientCache = new ClientCache();\n    this.db = this.#remoteModule.dbViewConstructor(this);\n    this.setReducerFlags = this.#remoteModule.setReducerFlagsConstructor();\n    this.reducers = this.#remoteModule.reducersConstructor(\n      this,\n      this.setReducerFlags\n    );\n    this.wsPromise = createWSFn({\n      url,\n      nameOrAddress,\n      wsProtocol: \"v1.bsatn.spacetimedb\",\n      authToken: token,\n      compression,\n      lightMode\n    }).then((v) => {\n      this.ws = v;\n      this.ws.onclose = () => {\n        this.#emitter.emit(\"disconnect\", this);\n      };\n      this.ws.onerror = (e) => {\n        this.#emitter.emit(\"connectError\", this, e);\n      };\n      this.ws.onopen = this.#handleOnOpen.bind(this);\n      this.ws.onmessage = this.#handleOnMessage.bind(this);\n      return v;\n    }).catch((e) => {\n      stdbLogger(\"error\", \"Error connecting to SpacetimeDB WS\");\n      this.#emitter.emit(\"connectError\", this, e);\n      return void 0;\n    });\n  }\n  #getNextQueryId = () => {\n    const queryId = this.#queryId;\n    this.#queryId += 1;\n    return queryId;\n  };\n  // NOTE: This is very important!!! This is the actual function that\n  // gets called when you call `connection.subscriptionBuilder()`.\n  // The `subscriptionBuilder` function which is generated, just shadows\n  // this function in the type system, but not the actual implementation!\n  // Do not remove this function, or shoot yourself in the foot please.\n  // It's not clear what would be a better way to do this at this exact\n  // moment.\n  subscriptionBuilder = () => {\n    return new SubscriptionBuilderImpl32(this);\n  };\n  registerSubscription(handle, handleEmitter, querySql) {\n    const queryId = this.#getNextQueryId();\n    this.#subscriptionManager.subscriptions.set(queryId, {\n      handle,\n      emitter: handleEmitter\n    });\n    this.#sendMessage(\n      ClientMessage.SubscribeMulti({\n        queryStrings: querySql,\n        queryId: { id: queryId },\n        // The TypeScript SDK doesn't currently track `request_id`s,\n        // so always use 0.\n        requestId: 0\n      })\n    );\n    return queryId;\n  }\n  unregisterSubscription(queryId) {\n    this.#sendMessage(\n      ClientMessage.UnsubscribeMulti({\n        queryId: { id: queryId },\n        // The TypeScript SDK doesn't currently track `request_id`s,\n        // so always use 0.\n        requestId: 0\n      })\n    );\n  }\n  // This function is async because we decompress the message async\n  async #processParsedMessage(message) {\n    const parseRowList = (type, tableName, rowList) => {\n      const buffer = rowList.rowsData;\n      const reader = new BinaryReader(buffer);\n      const rows = [];\n      const rowType = this.#remoteModule.tables[tableName].rowType;\n      const primaryKeyInfo = this.#remoteModule.tables[tableName].primaryKeyInfo;\n      while (reader.offset < buffer.length + buffer.byteOffset) {\n        const initialOffset = reader.offset;\n        const row = rowType.deserialize(reader);\n        let rowId = void 0;\n        if (primaryKeyInfo !== void 0) {\n          rowId = primaryKeyInfo.colType.intoMapKey(\n            row[primaryKeyInfo.colName]\n          );\n        } else {\n          const rowBytes = buffer.subarray(\n            initialOffset - buffer.byteOffset,\n            reader.offset - buffer.byteOffset\n          );\n          const asBase64 = fromByteArray(rowBytes);\n          rowId = asBase64;\n        }\n        rows.push({\n          type,\n          rowId,\n          row\n        });\n      }\n      return rows;\n    };\n    const parseTableUpdate = async (rawTableUpdate) => {\n      const tableName = rawTableUpdate.tableName;\n      let operations = [];\n      for (const update of rawTableUpdate.updates) {\n        let decompressed;\n        if (update.tag === \"Gzip\") {\n          const decompressedBuffer = await decompress(update.value, \"gzip\");\n          decompressed = QueryUpdate.deserialize(\n            new BinaryReader(decompressedBuffer)\n          );\n        } else if (update.tag === \"Brotli\") {\n          throw new Error(\n            \"Brotli compression not supported. Please use gzip or none compression in withCompression method on DbConnection.\"\n          );\n        } else {\n          decompressed = update.value;\n        }\n        operations = operations.concat(\n          parseRowList(\"insert\", tableName, decompressed.inserts)\n        );\n        operations = operations.concat(\n          parseRowList(\"delete\", tableName, decompressed.deletes)\n        );\n      }\n      return {\n        tableName,\n        operations\n      };\n    };\n    const parseDatabaseUpdate = async (dbUpdate) => {\n      const tableUpdates = [];\n      for (const rawTableUpdate of dbUpdate.tables) {\n        tableUpdates.push(await parseTableUpdate(rawTableUpdate));\n      }\n      return tableUpdates;\n    };\n    switch (message.tag) {\n      case \"InitialSubscription\": {\n        const dbUpdate = message.value.databaseUpdate;\n        const tableUpdates = await parseDatabaseUpdate(dbUpdate);\n        const subscriptionUpdate = {\n          tag: \"InitialSubscription\",\n          tableUpdates\n        };\n        return subscriptionUpdate;\n      }\n      case \"TransactionUpdateLight\": {\n        const dbUpdate = message.value.update;\n        const tableUpdates = await parseDatabaseUpdate(dbUpdate);\n        const subscriptionUpdate = {\n          tag: \"TransactionUpdateLight\",\n          tableUpdates\n        };\n        return subscriptionUpdate;\n      }\n      case \"TransactionUpdate\": {\n        const txUpdate = message.value;\n        const identity = txUpdate.callerIdentity;\n        const connectionId = ConnectionId.nullIfZero(\n          txUpdate.callerConnectionId\n        );\n        const reducerName = txUpdate.reducerCall.reducerName;\n        const args = txUpdate.reducerCall.args;\n        const energyQuantaUsed = txUpdate.energyQuantaUsed;\n        let tableUpdates;\n        let errMessage = \"\";\n        switch (txUpdate.status.tag) {\n          case \"Committed\":\n            tableUpdates = await parseDatabaseUpdate(txUpdate.status.value);\n            break;\n          case \"Failed\":\n            tableUpdates = [];\n            errMessage = txUpdate.status.value;\n            break;\n          case \"OutOfEnergy\":\n            tableUpdates = [];\n            break;\n        }\n        if (reducerName === \"<none>\") {\n          let errorMessage = errMessage;\n          console.error(`Received an error from the database: ${errorMessage}`);\n          return;\n        }\n        let reducerInfo;\n        if (reducerName !== \"\") {\n          reducerInfo = {\n            reducerName,\n            args\n          };\n        }\n        const transactionUpdate = {\n          tag: \"TransactionUpdate\",\n          tableUpdates,\n          identity,\n          connectionId,\n          reducerInfo,\n          status: txUpdate.status,\n          energyConsumed: energyQuantaUsed.quanta,\n          message: errMessage,\n          timestamp: txUpdate.timestamp\n        };\n        return transactionUpdate;\n      }\n      case \"IdentityToken\": {\n        const identityTokenMessage = {\n          tag: \"IdentityToken\",\n          identity: message.value.identity,\n          token: message.value.token,\n          connectionId: message.value.connectionId\n        };\n        return identityTokenMessage;\n      }\n      case \"OneOffQueryResponse\": {\n        throw new Error(\n          `TypeScript SDK never sends one-off queries, but got OneOffQueryResponse ${message}`\n        );\n      }\n      case \"SubscribeMultiApplied\": {\n        const parsedTableUpdates = await parseDatabaseUpdate(\n          message.value.update\n        );\n        const subscribeAppliedMessage = {\n          tag: \"SubscribeApplied\",\n          queryId: message.value.queryId.id,\n          tableUpdates: parsedTableUpdates\n        };\n        return subscribeAppliedMessage;\n      }\n      case \"UnsubscribeMultiApplied\": {\n        const parsedTableUpdates = await parseDatabaseUpdate(\n          message.value.update\n        );\n        const unsubscribeAppliedMessage = {\n          tag: \"UnsubscribeApplied\",\n          queryId: message.value.queryId.id,\n          tableUpdates: parsedTableUpdates\n        };\n        return unsubscribeAppliedMessage;\n      }\n      case \"SubscriptionError\": {\n        return {\n          tag: \"SubscriptionError\",\n          queryId: message.value.queryId,\n          error: message.value.error\n        };\n      }\n    }\n  }\n  #sendMessage(message) {\n    this.wsPromise.then((wsResolved) => {\n      if (wsResolved) {\n        const writer = new BinaryWriter(1024);\n        ClientMessage.serialize(writer, message);\n        const encoded = writer.getBuffer();\n        wsResolved.send(encoded);\n      }\n    });\n  }\n  /**\n   * Handles WebSocket onOpen event.\n   */\n  #handleOnOpen() {\n    this.isActive = true;\n  }\n  #applyTableUpdates(tableUpdates, eventContext) {\n    let pendingCallbacks = [];\n    for (let tableUpdate of tableUpdates) {\n      const tableName = tableUpdate.tableName;\n      const tableTypeInfo = this.#remoteModule.tables[tableName];\n      const table = this.clientCache.getOrCreateTable(tableTypeInfo);\n      const newCallbacks = table.applyOperations(\n        tableUpdate.operations,\n        eventContext\n      );\n      for (const callback of newCallbacks) {\n        pendingCallbacks.push(callback);\n      }\n    }\n    return pendingCallbacks;\n  }\n  async #processMessage(data) {\n    const serverMessage = parseValue(ServerMessage, data);\n    const message = await this.#processParsedMessage(serverMessage);\n    if (!message) {\n      return;\n    }\n    switch (message.tag) {\n      case \"InitialSubscription\": {\n        let event = { tag: \"SubscribeApplied\" };\n        const eventContext = this.#remoteModule.eventContextConstructor(\n          this,\n          event\n        );\n        const { event: _, ...subscriptionEventContext } = eventContext;\n        const callbacks = this.#applyTableUpdates(\n          message.tableUpdates,\n          eventContext\n        );\n        if (this.#emitter) {\n          this.#onApplied?.(subscriptionEventContext);\n        }\n        for (const callback of callbacks) {\n          callback.cb();\n        }\n        break;\n      }\n      case \"TransactionUpdateLight\": {\n        let event = { tag: \"UnknownTransaction\" };\n        const eventContext = this.#remoteModule.eventContextConstructor(\n          this,\n          event\n        );\n        const callbacks = this.#applyTableUpdates(\n          message.tableUpdates,\n          eventContext\n        );\n        for (const callback of callbacks) {\n          callback.cb();\n        }\n        break;\n      }\n      case \"TransactionUpdate\": {\n        let reducerInfo = message.reducerInfo;\n        let unknownTransaction = false;\n        let reducerArgs;\n        let reducerTypeInfo;\n        if (!reducerInfo) {\n          unknownTransaction = true;\n        } else {\n          reducerTypeInfo = this.#remoteModule.reducers[reducerInfo.reducerName];\n          try {\n            const reader = new BinaryReader(reducerInfo.args);\n            reducerArgs = reducerTypeInfo.argsType.deserialize(reader);\n          } catch {\n            console.debug(\"Failed to deserialize reducer arguments\");\n            unknownTransaction = true;\n          }\n        }\n        if (unknownTransaction) {\n          const event2 = { tag: \"UnknownTransaction\" };\n          const eventContext2 = this.#remoteModule.eventContextConstructor(\n            this,\n            event2\n          );\n          const callbacks2 = this.#applyTableUpdates(\n            message.tableUpdates,\n            eventContext2\n          );\n          for (const callback of callbacks2) {\n            callback.cb();\n          }\n          return;\n        }\n        reducerInfo = reducerInfo;\n        reducerTypeInfo = reducerTypeInfo;\n        const reducerEvent = {\n          callerIdentity: message.identity,\n          status: message.status,\n          callerConnectionId: message.connectionId,\n          timestamp: message.timestamp,\n          energyConsumed: message.energyConsumed,\n          reducer: {\n            name: reducerInfo.reducerName,\n            args: reducerArgs\n          }\n        };\n        const event = {\n          tag: \"Reducer\",\n          value: reducerEvent\n        };\n        const eventContext = this.#remoteModule.eventContextConstructor(\n          this,\n          event\n        );\n        const reducerEventContext = {\n          ...eventContext,\n          event: reducerEvent\n        };\n        const callbacks = this.#applyTableUpdates(\n          message.tableUpdates,\n          eventContext\n        );\n        const argsArray = [];\n        reducerTypeInfo.argsType.product.elements.forEach((element, index) => {\n          argsArray.push(reducerArgs[element.name]);\n        });\n        this.#reducerEmitter.emit(\n          reducerInfo.reducerName,\n          reducerEventContext,\n          ...argsArray\n        );\n        for (const callback of callbacks) {\n          callback.cb();\n        }\n        break;\n      }\n      case \"IdentityToken\": {\n        this.identity = message.identity;\n        if (!this.token && message.token) {\n          this.token = message.token;\n        }\n        this.connectionId = message.connectionId;\n        this.#emitter.emit(\"connect\", this, this.identity, this.token);\n        break;\n      }\n      case \"SubscribeApplied\": {\n        const subscription = this.#subscriptionManager.subscriptions.get(\n          message.queryId\n        );\n        if (subscription === void 0) {\n          stdbLogger(\n            \"error\",\n            `Received SubscribeApplied for unknown queryId ${message.queryId}.`\n          );\n          break;\n        }\n        const event = { tag: \"SubscribeApplied\" };\n        const eventContext = this.#remoteModule.eventContextConstructor(\n          this,\n          event\n        );\n        const { event: _, ...subscriptionEventContext } = eventContext;\n        const callbacks = this.#applyTableUpdates(\n          message.tableUpdates,\n          eventContext\n        );\n        subscription?.emitter.emit(\"applied\", subscriptionEventContext);\n        for (const callback of callbacks) {\n          callback.cb();\n        }\n        break;\n      }\n      case \"UnsubscribeApplied\": {\n        const subscription = this.#subscriptionManager.subscriptions.get(\n          message.queryId\n        );\n        if (subscription === void 0) {\n          stdbLogger(\n            \"error\",\n            `Received UnsubscribeApplied for unknown queryId ${message.queryId}.`\n          );\n          break;\n        }\n        const event = { tag: \"UnsubscribeApplied\" };\n        const eventContext = this.#remoteModule.eventContextConstructor(\n          this,\n          event\n        );\n        const { event: _, ...subscriptionEventContext } = eventContext;\n        const callbacks = this.#applyTableUpdates(\n          message.tableUpdates,\n          eventContext\n        );\n        subscription?.emitter.emit(\"end\", subscriptionEventContext);\n        this.#subscriptionManager.subscriptions.delete(message.queryId);\n        for (const callback of callbacks) {\n          callback.cb();\n        }\n        break;\n      }\n      case \"SubscriptionError\": {\n        const error = Error(message.error);\n        const event = { tag: \"Error\", value: error };\n        const eventContext = this.#remoteModule.eventContextConstructor(\n          this,\n          event\n        );\n        const errorContext = {\n          ...eventContext,\n          event: error\n        };\n        if (message.queryId !== void 0) {\n          this.#subscriptionManager.subscriptions.get(message.queryId)?.emitter.emit(\"error\", errorContext, error);\n          this.#subscriptionManager.subscriptions.delete(message.queryId);\n        } else {\n          console.error(\"Received an error message without a queryId: \", error);\n          this.#subscriptionManager.subscriptions.forEach(({ emitter }) => {\n            emitter.emit(\"error\", errorContext, error);\n          });\n        }\n      }\n    }\n  }\n  /**\n   * Handles WebSocket onMessage event.\n   * @param wsMessage MessageEvent object.\n   */\n  #handleOnMessage(wsMessage) {\n    this.#messageQueue = this.#messageQueue.then(() => {\n      return this.#processMessage(wsMessage.data);\n    });\n  }\n  /**\n   * Call a reducer on your SpacetimeDB module.\n   *\n   * @param reducerName The name of the reducer to call\n   * @param argsSerializer The arguments to pass to the reducer\n   */\n  callReducer(reducerName, argsBuffer, flags) {\n    const message = ClientMessage.CallReducer({\n      reducer: reducerName,\n      args: argsBuffer,\n      // The TypeScript SDK doesn't currently track `request_id`s,\n      // so always use 0.\n      requestId: 0,\n      flags: callReducerFlagsToNumber(flags)\n    });\n    this.#sendMessage(message);\n  }\n  /**\n   * Close the current connection.\n   *\n   * @example\n   *\n   * ```ts\n   * const connection = DbConnection.builder().build();\n   * connection.disconnect()\n   * ```\n   */\n  disconnect() {\n    this.wsPromise.then((wsResolved) => {\n      if (wsResolved) {\n        wsResolved.close();\n      }\n    });\n  }\n  #on(eventName, callback) {\n    this.#emitter.on(eventName, callback);\n  }\n  #off(eventName, callback) {\n    this.#emitter.off(eventName, callback);\n  }\n  #onConnect(callback) {\n    this.#emitter.on(\"connect\", callback);\n  }\n  #onDisconnect(callback) {\n    this.#emitter.on(\"disconnect\", callback);\n  }\n  #onConnectError(callback) {\n    this.#emitter.on(\"connectError\", callback);\n  }\n  #removeOnConnect(callback) {\n    this.#emitter.off(\"connect\", callback);\n  }\n  #removeOnDisconnect(callback) {\n    this.#emitter.off(\"disconnect\", callback);\n  }\n  #removeOnConnectError(callback) {\n    this.#emitter.off(\"connectError\", callback);\n  }\n  // Note: This is required to be public because it needs to be\n  // called from the `RemoteReducers` class.\n  onReducer(reducerName, callback) {\n    this.#reducerEmitter.on(reducerName, callback);\n  }\n  // Note: This is required to be public because it needs to be\n  // called from the `RemoteReducers` class.\n  offReducer(reducerName, callback) {\n    this.#reducerEmitter.off(reducerName, callback);\n  }\n};\n\nexport { AlgebraicType, AlgebraicValue, BinaryReader, BinaryWriter, ClientCache, ConnectionId, DbConnectionBuilder32 as DbConnectionBuilder, DbConnectionImpl32 as DbConnectionImpl, Identity, ProductType, ProductTypeElement, ProductValue, ScheduleAt, SubscriptionBuilderImpl32 as SubscriptionBuilderImpl, SumType, SumTypeVariant, TableCache32 as TableCache, TimeDuration, Timestamp, deepEqual };\n"]}