1"use strict";
2var __create = Object.create;
3var __defProp = Object.defineProperty;
4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5var __getOwnPropNames = Object.getOwnPropertyNames;
6var __getProtoOf = Object.getPrototypeOf;
7var __hasOwnProp = Object.prototype.hasOwnProperty;
8var __export = (target, all) => {
9 for (var name in all)
10 __defProp(target, name, { get: all[name], enumerable: true });
11};
12var __copyProps = (to, from, except, desc) => {
13 if (from && typeof from === "object" || typeof from === "function") {
14 for (let key of __getOwnPropNames(from))
15 if (!__hasOwnProp.call(to, key) && key !== except)
16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17 }
18 return to;
19};
20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21 // If the importer is in node compatibility mode or this is not an ESM
22 // file that has been converted to a CommonJS file using a Babel-
23 // compatible transform (i.e. "__esModule" has not been set), then set
24 // "default" to the CommonJS "module.exports" for node compatibility.
25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26 mod
27));
28var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
30// arrays_test_complex/my-game/example.ts
31var example_exports = {};
32__export(example_exports, {
33 ArrayStruct: () => ArrayStruct,
34 ArrayStructT: () => ArrayStructT,
35 ArrayTable: () => ArrayTable,
36 ArrayTableT: () => ArrayTableT,
37 InnerStruct: () => InnerStruct,
38 InnerStructT: () => InnerStructT,
39 NestedStruct: () => NestedStruct,
40 NestedStructT: () => NestedStructT,
41 OuterStruct: () => OuterStruct,
42 OuterStructT: () => OuterStructT,
43 TestEnum: () => TestEnum
44});
45module.exports = __toCommonJS(example_exports);
46
47// arrays_test_complex/my-game/example/inner-struct.js
48var InnerStruct = class {
49 constructor() {
50 this.bb = null;
51 this.bb_pos = 0;
52 }
53 __init(i, bb) {
54 this.bb_pos = i;
55 this.bb = bb;
56 return this;
57 }
58 a() {
59 return this.bb.readFloat64(this.bb_pos);
60 }
61 b(index) {
62 return this.bb.readUint8(this.bb_pos + 8 + index);
63 }
64 c() {
65 return this.bb.readInt8(this.bb_pos + 21);
66 }
67 dUnderscore() {
68 return this.bb.readInt64(this.bb_pos + 24);
69 }
70 static getFullyQualifiedName() {
71 return "MyGame.Example.InnerStruct";
72 }
73 static sizeOf() {
74 return 32;
75 }
76 static createInnerStruct(builder, a, b, c, d_underscore) {
77 builder.prep(8, 32);
78 builder.writeInt64(BigInt(d_underscore ?? 0));
79 builder.pad(2);
80 builder.writeInt8(c);
81 for (let i = 12; i >= 0; --i) {
82 builder.writeInt8(b?.[i] ?? 0);
83 }
84 builder.writeFloat64(a);
85 return builder.offset();
86 }
87 unpack() {
88 return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
89 }
90 unpackTo(_o) {
91 _o.a = this.a();
92 _o.b = this.bb.createScalarList(this.b.bind(this), 13);
93 _o.c = this.c();
94 _o.dUnderscore = this.dUnderscore();
95 }
96};
97var InnerStructT = class {
98 constructor(a = 0, b = [], c = 0, dUnderscore = BigInt("0")) {
99 this.a = a;
100 this.b = b;
101 this.c = c;
102 this.dUnderscore = dUnderscore;
103 }
104 pack(builder) {
105 return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
106 }
107};
108
109// arrays_test_complex/my-game/example/outer-struct.js
110var OuterStruct = class {
111 constructor() {
112 this.bb = null;
113 this.bb_pos = 0;
114 }
115 __init(i, bb) {
116 this.bb_pos = i;
117 this.bb = bb;
118 return this;
119 }
120 a() {
121 return !!this.bb.readInt8(this.bb_pos);
122 }
123 b() {
124 return this.bb.readFloat64(this.bb_pos + 8);
125 }
126 cUnderscore(obj) {
127 return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
128 }
129 d(index, obj) {
130 return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
131 }
132 e(obj) {
133 return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
134 }
135 f(index) {
136 return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
137 }
138 static getFullyQualifiedName() {
139 return "MyGame.Example.OuterStruct";
140 }
141 static sizeOf() {
142 return 208;
143 }
144 static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
145 builder.prep(8, 208);
146 for (let i = 3; i >= 0; --i) {
147 builder.writeFloat64(f?.[i] ?? 0);
148 }
149 builder.prep(8, 32);
150 builder.writeInt64(BigInt(e_d_underscore ?? 0));
151 builder.pad(2);
152 builder.writeInt8(e_c);
153 for (let i = 12; i >= 0; --i) {
154 builder.writeInt8(e_b?.[i] ?? 0);
155 }
156 builder.writeFloat64(e_a);
157 for (let i = 2; i >= 0; --i) {
158 const item = d?.[i];
159 if (item instanceof InnerStructT) {
160 item.pack(builder);
161 continue;
162 }
163 InnerStruct.createInnerStruct(builder, item?.a, item?.b, item?.c, item?.dUnderscore);
164 }
165 builder.prep(8, 32);
166 builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
167 builder.pad(2);
168 builder.writeInt8(c_underscore_c);
169 for (let i = 12; i >= 0; --i) {
170 builder.writeInt8(c_underscore_b?.[i] ?? 0);
171 }
172 builder.writeFloat64(c_underscore_a);
173 builder.writeFloat64(b);
174 builder.pad(7);
175 builder.writeInt8(Number(Boolean(a)));
176 return builder.offset();
177 }
178 unpack() {
179 return new OuterStructT(this.a(), this.b(), this.cUnderscore() !== null ? this.cUnderscore().unpack() : null, this.bb.createObjList(this.d.bind(this), 3), this.e() !== null ? this.e().unpack() : null, this.bb.createScalarList(this.f.bind(this), 4));
180 }
181 unpackTo(_o) {
182 _o.a = this.a();
183 _o.b = this.b();
184 _o.cUnderscore = this.cUnderscore() !== null ? this.cUnderscore().unpack() : null;
185 _o.d = this.bb.createObjList(this.d.bind(this), 3);
186 _o.e = this.e() !== null ? this.e().unpack() : null;
187 _o.f = this.bb.createScalarList(this.f.bind(this), 4);
188 }
189};
190var OuterStructT = class {
191 constructor(a = false, b = 0, cUnderscore = null, d = [], e = null, f = []) {
192 this.a = a;
193 this.b = b;
194 this.cUnderscore = cUnderscore;
195 this.d = d;
196 this.e = e;
197 this.f = f;
198 }
199 pack(builder) {
200 return OuterStruct.createOuterStruct(builder, this.a, this.b, this.cUnderscore?.a ?? 0, this.cUnderscore?.b ?? [], this.cUnderscore?.c ?? 0, this.cUnderscore?.dUnderscore ?? BigInt(0), this.d, this.e?.a ?? 0, this.e?.b ?? [], this.e?.c ?? 0, this.e?.dUnderscore ?? BigInt(0), this.f);
201 }
202};
203
204// arrays_test_complex/my-game/example/test-enum.js
205var TestEnum;
206(function(TestEnum2) {
207 TestEnum2[TestEnum2["A"] = 0] = "A";
208 TestEnum2[TestEnum2["B"] = 1] = "B";
209 TestEnum2[TestEnum2["C"] = 2] = "C";
210})(TestEnum = TestEnum || (TestEnum = {}));
211
212// arrays_test_complex/my-game/example/nested-struct.js
213var NestedStruct = class {
214 constructor() {
215 this.bb = null;
216 this.bb_pos = 0;
217 }
218 __init(i, bb) {
219 this.bb_pos = i;
220 this.bb = bb;
221 return this;
222 }
223 a(index) {
224 return this.bb.readInt32(this.bb_pos + 0 + index * 4);
225 }
226 b() {
227 return this.bb.readInt8(this.bb_pos + 8);
228 }
229 cUnderscore(index) {
230 return this.bb.readInt8(this.bb_pos + 9 + index);
231 }
232 dOuter(index, obj) {
233 return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
234 }
235 e(index) {
236 return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
237 }
238 static getFullyQualifiedName() {
239 return "MyGame.Example.NestedStruct";
240 }
241 static sizeOf() {
242 return 1072;
243 }
244 static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
245 builder.prep(8, 1072);
246 for (let i = 1; i >= 0; --i) {
247 builder.writeInt64(BigInt(e?.[i] ?? 0));
248 }
249 for (let i = 4; i >= 0; --i) {
250 const item = d_outer?.[i];
251 if (item instanceof OuterStructT) {
252 item.pack(builder);
253 continue;
254 }
255 OuterStruct.createOuterStruct(builder, item?.a, item?.b, item?.cUnderscore?.a ?? 0, item?.cUnderscore?.b ?? [], item?.cUnderscore?.c ?? 0, item?.cUnderscore?.dUnderscore ?? BigInt(0), item?.d, item?.e?.a ?? 0, item?.e?.b ?? [], item?.e?.c ?? 0, item?.e?.dUnderscore ?? BigInt(0), item?.f);
256 }
257 builder.pad(5);
258 for (let i = 1; i >= 0; --i) {
259 builder.writeInt8(c_underscore?.[i] ?? 0);
260 }
261 builder.writeInt8(b);
262 for (let i = 1; i >= 0; --i) {
263 builder.writeInt32(a?.[i] ?? 0);
264 }
265 return builder.offset();
266 }
267 unpack() {
268 return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
269 }
270 unpackTo(_o) {
271 _o.a = this.bb.createScalarList(this.a.bind(this), 2);
272 _o.b = this.b();
273 _o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
274 _o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
275 _o.e = this.bb.createScalarList(this.e.bind(this), 2);
276 }
277};
278var NestedStructT = class {
279 constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
280 this.a = a;
281 this.b = b;
282 this.cUnderscore = cUnderscore;
283 this.dOuter = dOuter;
284 this.e = e;
285 }
286 pack(builder) {
287 return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
288 }
289};
290
291// arrays_test_complex/my-game/example/array-struct.js
292var ArrayStruct = class {
293 constructor() {
294 this.bb = null;
295 this.bb_pos = 0;
296 }
297 __init(i, bb) {
298 this.bb_pos = i;
299 this.bb = bb;
300 return this;
301 }
302 aUnderscore() {
303 return this.bb.readFloat32(this.bb_pos);
304 }
305 bUnderscore(index) {
306 return this.bb.readInt32(this.bb_pos + 4 + index * 4);
307 }
308 c() {
309 return this.bb.readInt8(this.bb_pos + 64);
310 }
311 d(index, obj) {
312 return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
313 }
314 e() {
315 return this.bb.readInt32(this.bb_pos + 2216);
316 }
317 f(index, obj) {
318 return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
319 }
320 g(index) {
321 return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
322 }
323 static getFullyQualifiedName() {
324 return "MyGame.Example.ArrayStruct";
325 }
326 static sizeOf() {
327 return 2656;
328 }
329 static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
330 builder.prep(8, 2656);
331 for (let i = 1; i >= 0; --i) {
332 builder.writeInt64(BigInt(g?.[i] ?? 0));
333 }
334 for (let i = 1; i >= 0; --i) {
335 const item = f?.[i];
336 if (item instanceof OuterStructT) {
337 item.pack(builder);
338 continue;
339 }
340 OuterStruct.createOuterStruct(builder, item?.a, item?.b, item?.cUnderscore?.a ?? 0, item?.cUnderscore?.b ?? [], item?.cUnderscore?.c ?? 0, item?.cUnderscore?.dUnderscore ?? BigInt(0), item?.d, item?.e?.a ?? 0, item?.e?.b ?? [], item?.e?.c ?? 0, item?.e?.dUnderscore ?? BigInt(0), item?.f);
341 }
342 builder.pad(4);
343 builder.writeInt32(e);
344 for (let i = 1; i >= 0; --i) {
345 const item = d?.[i];
346 if (item instanceof NestedStructT) {
347 item.pack(builder);
348 continue;
349 }
350 NestedStruct.createNestedStruct(builder, item?.a, item?.b, item?.cUnderscore, item?.dOuter, item?.e);
351 }
352 builder.pad(7);
353 builder.writeInt8(c);
354 for (let i = 14; i >= 0; --i) {
355 builder.writeInt32(b_underscore?.[i] ?? 0);
356 }
357 builder.writeFloat32(a_underscore);
358 return builder.offset();
359 }
360 unpack() {
361 return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
362 }
363 unpackTo(_o) {
364 _o.aUnderscore = this.aUnderscore();
365 _o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
366 _o.c = this.c();
367 _o.d = this.bb.createObjList(this.d.bind(this), 2);
368 _o.e = this.e();
369 _o.f = this.bb.createObjList(this.f.bind(this), 2);
370 _o.g = this.bb.createScalarList(this.g.bind(this), 2);
371 }
372};
373var ArrayStructT = class {
374 constructor(aUnderscore = 0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
375 this.aUnderscore = aUnderscore;
376 this.bUnderscore = bUnderscore;
377 this.c = c;
378 this.d = d;
379 this.e = e;
380 this.f = f;
381 this.g = g;
382 }
383 pack(builder) {
384 return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
385 }
386};
387
388// arrays_test_complex/my-game/example/array-table.js
389var flatbuffers = __toESM(require("flatbuffers"), 1);
390var ArrayTable = class {
391 constructor() {
392 this.bb = null;
393 this.bb_pos = 0;
394 }
395 __init(i, bb) {
396 this.bb_pos = i;
397 this.bb = bb;
398 return this;
399 }
400 static getRootAsArrayTable(bb, obj) {
401 return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
402 }
403 static getSizePrefixedRootAsArrayTable(bb, obj) {
404 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
405 return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
406 }
407 static bufferHasIdentifier(bb) {
408 return bb.__has_identifier("RHUB");
409 }
410 a(optionalEncoding) {
411 const offset = this.bb.__offset(this.bb_pos, 4);
412 return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
413 }
414 cUnderscore(obj) {
415 const offset = this.bb.__offset(this.bb_pos, 6);
416 return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
417 }
418 static getFullyQualifiedName() {
419 return "MyGame.Example.ArrayTable";
420 }
421 static startArrayTable(builder) {
422 builder.startObject(2);
423 }
424 static addA(builder, aOffset) {
425 builder.addFieldOffset(0, aOffset, 0);
426 }
427 static addCUnderscore(builder, cUnderscoreOffset) {
428 builder.addFieldStruct(1, cUnderscoreOffset, 0);
429 }
430 static endArrayTable(builder) {
431 const offset = builder.endObject();
432 return offset;
433 }
434 static finishArrayTableBuffer(builder, offset) {
435 builder.finish(offset, "RHUB");
436 }
437 static finishSizePrefixedArrayTableBuffer(builder, offset) {
438 builder.finish(offset, "RHUB", true);
439 }
440 unpack() {
441 return new ArrayTableT(this.a(), this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
442 }
443 unpackTo(_o) {
444 _o.a = this.a();
445 _o.cUnderscore = this.cUnderscore() !== null ? this.cUnderscore().unpack() : null;
446 }
447};
448var ArrayTableT = class {
449 constructor(a = null, cUnderscore = null) {
450 this.a = a;
451 this.cUnderscore = cUnderscore;
452 }
453 pack(builder) {
454 const a = this.a !== null ? builder.createString(this.a) : 0;
455 ArrayTable.startArrayTable(builder);
456 ArrayTable.addA(builder, a);
457 ArrayTable.addCUnderscore(builder, this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0);
458 return ArrayTable.endArrayTable(builder);
459 }
460};
View as plain text