{"version":3,"file":"well-known-parser14.cjs","sources":["../src/binaryreader.ts"],"sourcesContent":["/**\n * A class for reading binary data with support for different endianness\n */\nexport class BinaryReader {\n  buffer: Buffer;\n  position: number;\n  isBigEndian: boolean;\n\n  constructor(buffer: Buffer, isBigEndian: boolean = false) {\n    this.buffer = buffer;\n    this.position = 0;\n    this.isBigEndian = isBigEndian;\n  }\n\n  readUInt8(): number {\n    const value = this.buffer.readUInt8(this.position);\n    this.position += 1;\n    return value;\n  }\n\n  readUInt16(): number {\n    const value = this.isBigEndian\n      ? this.buffer.readUInt16BE(this.position)\n      : this.buffer.readUInt16LE(this.position);\n    this.position += 2;\n    return value;\n  }\n\n  readUInt32(): number {\n    const value = this.isBigEndian\n      ? this.buffer.readUInt32BE(this.position)\n      : this.buffer.readUInt32LE(this.position);\n    this.position += 4;\n    return value;\n  }\n\n  readInt8(): number {\n    const value = this.buffer.readInt8(this.position);\n    this.position += 1;\n    return value;\n  }\n\n  readInt16(): number {\n    const value = this.isBigEndian\n      ? this.buffer.readInt16BE(this.position)\n      : this.buffer.readInt16LE(this.position);\n    this.position += 2;\n    return value;\n  }\n\n  readInt32(): number {\n    const value = this.isBigEndian\n      ? this.buffer.readInt32BE(this.position)\n      : this.buffer.readInt32LE(this.position);\n    this.position += 4;\n    return value;\n  }\n\n  readFloat(): number {\n    const value = this.isBigEndian\n      ? this.buffer.readFloatBE(this.position)\n      : this.buffer.readFloatLE(this.position);\n    this.position += 4;\n    return value;\n  }\n\n  readDouble(): number {\n    const value = this.isBigEndian\n      ? this.buffer.readDoubleBE(this.position)\n      : this.buffer.readDoubleLE(this.position);\n    this.position += 8;\n    return value;\n  }\n\n  readVarInt(): number {\n    let nextByte: number;\n    let result = 0;\n    let bytesRead = 0;\n\n    do {\n      nextByte = this.buffer[this.position + bytesRead];\n      result += (nextByte & 0x7F) << (7 * bytesRead);\n      bytesRead++;\n    } while (nextByte >= 0x80);\n\n    this.position += bytesRead;\n\n    return result;\n  }\n}"],"names":["Bina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