{"ast":null,"code":"export class ByteQueue {\n #array;\n #shiftPos;\n #pushPos;\n constructor(initialCap) {\n this.#array = new Uint8Array(new ArrayBuffer(initialCap));\n this.#shiftPos = 0;\n this.#pushPos = 0;\n }\n get length() {\n return this.#pushPos - this.#shiftPos;\n }\n data() {\n return this.#array.slice(this.#shiftPos, this.#pushPos);\n }\n push(chunk) {\n this.#ensurePush(chunk.byteLength);\n this.#array.set(chunk, this.#pushPos);\n this.#pushPos += chunk.byteLength;\n }\n #ensurePush(pushLength) {\n if (this.#pushPos + pushLength <= this.#array.byteLength) {\n return;\n }\n const filledLength = this.#pushPos - this.#shiftPos;\n if (filledLength + pushLength <= this.#array.byteLength && 2 * this.#pushPos >= this.#array.byteLength) {\n this.#array.copyWithin(0, this.#shiftPos, this.#pushPos);\n } else {\n let newCap = this.#array.byteLength;\n do {\n newCap *= 2;\n } while (filledLength + pushLength > newCap);\n const newArray = new Uint8Array(new ArrayBuffer(newCap));\n newArray.set(this.#array.slice(this.#shiftPos, this.#pushPos), 0);\n this.#array = newArray;\n }\n this.#pushPos = filledLength;\n this.#shiftPos = 0;\n }\n shift(length) {\n this.#shiftPos += length;\n }\n}","map":{"version":3,"names":["ByteQueue","array","shiftPos","pushPos","constructor","initialCap","Uint8Array","ArrayBuffer","length","data","slice","push","chunk","ensurePush","byteLength","set","#ensurePush","pushLength","filledLength","copyWithin","newCap","newArray","shift"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/byte_queue.js"],"sourcesContent":["export class ByteQueue {\n #array;\n #shiftPos;\n #pushPos;\n constructor(initialCap) {\n this.#array = new Uint8Array(new ArrayBuffer(initialCap));\n this.#shiftPos = 0;\n this.#pushPos = 0;\n }\n get length() {\n return this.#pushPos - this.#shiftPos;\n }\n data() {\n return this.#array.slice(this.#shiftPos, this.#pushPos);\n }\n push(chunk) {\n this.#ensurePush(chunk.byteLength);\n this.#array.set(chunk, this.#pushPos);\n this.#pushPos += chunk.byteLength;\n }\n #ensurePush(pushLength) {\n if (this.#pushPos + pushLength <= this.#array.byteLength) {\n return;\n }\n const filledLength = this.#pushPos - this.#shiftPos;\n if (filledLength + pushLength <= this.#array.byteLength &&\n 2 * this.#pushPos >= this.#array.byteLength) {\n this.#array.copyWithin(0, this.#shiftPos, this.#pushPos);\n }\n else {\n let newCap = this.#array.byteLength;\n do {\n newCap *= 2;\n } while (filledLength + pushLength > newCap);\n const newArray = new Uint8Array(new ArrayBuffer(newCap));\n newArray.set(this.#array.slice(this.#shiftPos, this.#pushPos), 0);\n this.#array = newArray;\n }\n this.#pushPos = filledLength;\n this.#shiftPos = 0;\n }\n shift(length) {\n this.#shiftPos += length;\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,SAAS,CAAC;EACnB,CAACC,KAAK;EACN,CAACC,QAAQ;EACT,CAACC,OAAO;EACRC,WAAWA,CAACC,UAAU,EAAE;IACpB,IAAI,CAAC,CAACJ,KAAK,GAAG,IAAIK,UAAU,CAAC,IAAIC,WAAW,CAACF,UAAU,CAAC,CAAC;IACzD,IAAI,CAAC,CAACH,QAAQ,GAAG,CAAC;IAClB,IAAI,CAAC,CAACC,OAAO,GAAG,CAAC;EACrB;EACA,IAAIK,MAAMA,CAAA,EAAG;IACT,OAAO,IAAI,CAAC,CAACL,OAAO,GAAG,IAAI,CAAC,CAACD,QAAQ;EACzC;EACAO,IAAIA,CAAA,EAAG;IACH,OAAO,IAAI,CAAC,CAACR,KAAK,CAACS,KAAK,CAAC,IAAI,CAAC,CAACR,QAAQ,EAAE,IAAI,CAAC,CAACC,OAAO,CAAC;EAC3D;EACAQ,IAAIA,CAACC,KAAK,EAAE;IACR,IAAI,CAAC,CAACC,UAAU,CAACD,KAAK,CAACE,UAAU,CAAC;IAClC,IAAI,CAAC,CAACb,KAAK,CAACc,GAAG,CAACH,KAAK,EAAE,IAAI,CAAC,CAACT,OAAO,CAAC;IACrC,IAAI,CAAC,CAACA,OAAO,IAAIS,KAAK,CAACE,UAAU;EACrC;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