{"ast":null,"code":"export class ObjectWriter {\n #output;\n #isFirst;\n constructor(output) {\n this.#output = output;\n this.#isFirst = false;\n }\n begin() {\n this.#output.push('{');\n this.#isFirst = true;\n }\n end() {\n this.#output.push('}');\n this.#isFirst = false;\n }\n #key(name) {\n if (this.#isFirst) {\n this.#output.push('\"');\n this.#isFirst = false;\n } else {\n this.#output.push(',\"');\n }\n this.#output.push(name);\n this.#output.push('\":');\n }\n string(name, value) {\n this.#key(name);\n this.#output.push(JSON.stringify(value));\n }\n stringRaw(name, value) {\n this.#key(name);\n this.#output.push('\"');\n this.#output.push(value);\n this.#output.push('\"');\n }\n number(name, value) {\n this.#key(name);\n this.#output.push(\"\" + value);\n }\n boolean(name, value) {\n this.#key(name);\n this.#output.push(value ? \"true\" : \"false\");\n }\n object(name, value, valueFun) {\n this.#key(name);\n this.begin();\n valueFun(this, value);\n this.end();\n }\n arrayObjects(name, values, valueFun) {\n this.#key(name);\n this.#output.push('[');\n for (let i = 0; i < values.length; ++i) {\n if (i !== 0) {\n this.#output.push(',');\n }\n this.begin();\n valueFun(this, values[i]);\n this.end();\n }\n this.#output.push(']');\n }\n}\nexport function writeJsonObject(value, fun) {\n const output = [];\n const writer = new ObjectWriter(output);\n writer.begin();\n fun(writer, value);\n writer.end();\n return output.join(\"\");\n}","map":{"version":3,"names":["ObjectWriter","output","isFirst","constructor","begin","push","end","key","#key","name","string","value","JSON","stringify","stringRaw","number","boolean","object","valueFun","arrayObjects","values","i","length","writeJsonObject","fun","writer","join"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/encoding/json/encode.js"],"sourcesContent":["export class ObjectWriter {\n #output;\n #isFirst;\n constructor(output) {\n this.#output = output;\n this.#isFirst = false;\n }\n begin() {\n this.#output.push('{');\n this.#isFirst = true;\n }\n end() {\n this.#output.push('}');\n this.#isFirst = false;\n }\n #key(name) {\n if (this.#isFirst) {\n this.#output.push('\"');\n this.#isFirst = false;\n }\n else {\n this.#output.push(',\"');\n }\n this.#output.push(name);\n this.#output.push('\":');\n }\n string(name, value) {\n this.#key(name);\n this.#output.push(JSON.stringify(value));\n }\n stringRaw(name, value) {\n this.#key(name);\n this.#output.push('\"');\n this.#output.push(value);\n this.#output.push('\"');\n }\n number(name, value) {\n this.#key(name);\n this.#output.push(\"\" + value);\n }\n boolean(name, value) {\n this.#key(name);\n this.#output.push(value ? \"true\" : \"false\");\n }\n object(name, value, valueFun) {\n this.#key(name);\n this.begin();\n valueFun(this, value);\n this.end();\n }\n arrayObjects(name, values, valueFun) {\n this.#key(name);\n this.#output.push('[');\n for (let i = 0; i < values.length; ++i) {\n if (i !== 0) {\n this.#output.push(',');\n }\n this.begin();\n valueFun(this, values[i]);\n this.end();\n }\n this.#output.push(']');\n }\n}\nexport function writeJsonObject(value, fun) {\n const output = [];\n const writer = new ObjectWriter(output);\n writer.begin();\n fun(writer, value);\n writer.end();\n return output.join(\"\");\n}\n"],"mappings":"AAAA,OAAO,MAAMA,YAAY,CAAC;EACtB,CAACC,MAAM;EACP,CAACC,OAAO;EACRC,WAAWA,CAACF,MAAM,EAAE;IAChB,IAAI,CAAC,CAACA,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACC,OAAO,GAAG,KAAK;EACzB;EACAE,KAAKA,CAAA,EAAG;IACJ,IAAI,CAAC,CAACH,MAAM,CAACI,IAAI,CAAC,GAAG,CAAC;IACtB,IAAI,CAAC,CAACH,OAAO,GAAG,IAAI;EACxB;EACAI,GAAGA,CAAA,EAAG;IACF,IAAI,CAAC,CAACL,MAAM,CAACI,IAAI,CAAC,GAAG,CAAC;IACtB,IAAI,CAAC,CAACH,OAAO,GAAG,KAAK;EACzB;EACA,CAACK,GAAGC,CAACC,IAAI,EAAE;IACP,IAAI,IAAI,CAAC,CAACP,OAAO,EAAE;MACf,IAAI,CAAC,CAACD,MAAM,CAACI,IAAI,CAAC,GAAG,CAAC;MACtB,IAAI,CAAC,CAACH,OAAO,GAAG,KAAK;IACzB,CAAC,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