"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.Integer32ArrayT = exports.Integer32Array = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
class Integer32Array {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsInteger32Array(bb, obj) {
        return (obj || new Integer32Array()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsInteger32Array(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new Integer32Array()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    value(index) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.readInt32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
    }
    valueLength() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
    }
    valueArray() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? new Int32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
    }
    static startInteger32Array(builder) {
        builder.startObject(1);
    }
    static addValue(builder, valueOffset) {
        builder.addFieldOffset(0, valueOffset, 0);
    }
    static createValueVector(builder, data) {
        builder.startVector(4, data.length, 4);
        for (let i = data.length - 1; i >= 0; i--) {
            builder.addInt32(data[i]);
        }
        return builder.endVector();
    }
    static startValueVector(builder, numElems) {
        builder.startVector(4, numElems, 4);
    }
    static endInteger32Array(builder) {
        const offset = builder.endObject();
        return offset;
    }
    static createInteger32Array(builder, valueOffset) {
        Integer32Array.startInteger32Array(builder);
        Integer32Array.addValue(builder, valueOffset);
        return Integer32Array.endInteger32Array(builder);
    }
    unpack() {
        return new Integer32ArrayT(this.bb.createScalarList(this.value.bind(this), this.valueLength()));
    }
    unpackTo(_o) {
        _o.value = this.bb.createScalarList(this.value.bind(this), this.valueLength());
    }
}
exports.Integer32Array = Integer32Array;
class Integer32ArrayT {
    value;
    constructor(value = []) {
        this.value = value;
    }
    pack(builder) {
        const value = Integer32Array.createValueVector(builder, this.value);
        return Integer32Array.createInteger32Array(builder, value);
    }
}
exports.Integer32ArrayT = Integer32ArrayT;
