'use strict';
// automatically generated by the FlatBuffers compiler, do not modify
var __createBinding =
  (this && this.__createBinding) ||
  (Object.create
    ? function (o, m, k, k2) {
        if (k2 === undefined) k2 = k;
        var desc = Object.getOwnPropertyDescriptor(m, k);
        if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
          desc = {
            enumerable: true,
            get: function () {
              return m[k];
            },
          };
        }
        Object.defineProperty(o, k2, desc);
      }
    : function (o, m, k, k2) {
        if (k2 === undefined) k2 = k;
        o[k2] = m[k];
      });
var __setModuleDefault =
  (this && this.__setModuleDefault) ||
  (Object.create
    ? function (o, v) {
        Object.defineProperty(o, 'default', { enumerable: true, value: v });
      }
    : function (o, v) {
        o['default'] = v;
      });
var __importStar =
  (this && this.__importStar) ||
  (function () {
    var ownKeys = function (o) {
      ownKeys =
        Object.getOwnPropertyNames ||
        function (o) {
          var ar = [];
          for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
          return ar;
        };
      return ownKeys(o);
    };
    return function (mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null)
        for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== 'default') __createBinding(result, mod, k[i]);
      __setModuleDefault(result, mod);
      return result;
    };
  })();
Object.defineProperty(exports, '__esModule', { value: true });
exports.DeprecatedSessionState = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = __importStar(require('flatbuffers'));
const deprecated_kernel_create_infos_js_1 = require('../../onnxruntime/fbs/deprecated-kernel-create-infos.js');
const deprecated_sub_graph_session_state_js_1 = require('../../onnxruntime/fbs/deprecated-sub-graph-session-state.js');
/**
 * deprecated: no longer using kernel def hashes
 */
class DeprecatedSessionState {
  constructor() {
    this.bb = null;
    this.bb_pos = 0;
  }
  __init(i, bb) {
    this.bb_pos = i;
    this.bb = bb;
    return this;
  }
  static getRootAsDeprecatedSessionState(bb, obj) {
    return (obj || new DeprecatedSessionState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  }
  static getSizePrefixedRootAsDeprecatedSessionState(bb, obj) {
    bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
    return (obj || new DeprecatedSessionState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  }
  kernels(obj) {
    const offset = this.bb.__offset(this.bb_pos, 4);
    return offset
      ? (obj || new deprecated_kernel_create_infos_js_1.DeprecatedKernelCreateInfos()).__init(
          this.bb.__indirect(this.bb_pos + offset),
          this.bb,
        )
      : null;
  }
  subGraphSessionStates(index, obj) {
    const offset = this.bb.__offset(this.bb_pos, 6);
    return offset
      ? (obj || new deprecated_sub_graph_session_state_js_1.DeprecatedSubGraphSessionState()).__init(
          this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4),
          this.bb,
        )
      : null;
  }
  subGraphSessionStatesLength() {
    const offset = this.bb.__offset(this.bb_pos, 6);
    return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  }
  static startDeprecatedSessionState(builder) {
    builder.startObject(2);
  }
  static addKernels(builder, kernelsOffset) {
    builder.addFieldOffset(0, kernelsOffset, 0);
  }
  static addSubGraphSessionStates(builder, subGraphSessionStatesOffset) {
    builder.addFieldOffset(1, subGraphSessionStatesOffset, 0);
  }
  static createSubGraphSessionStatesVector(builder, data) {
    builder.startVector(4, data.length, 4);
    for (let i = data.length - 1; i >= 0; i--) {
      builder.addOffset(data[i]);
    }
    return builder.endVector();
  }
  static startSubGraphSessionStatesVector(builder, numElems) {
    builder.startVector(4, numElems, 4);
  }
  static endDeprecatedSessionState(builder) {
    const offset = builder.endObject();
    return offset;
  }
  static createDeprecatedSessionState(builder, kernelsOffset, subGraphSessionStatesOffset) {
    DeprecatedSessionState.startDeprecatedSessionState(builder);
    DeprecatedSessionState.addKernels(builder, kernelsOffset);
    DeprecatedSessionState.addSubGraphSessionStates(builder, subGraphSessionStatesOffset);
    return DeprecatedSessionState.endDeprecatedSessionState(builder);
  }
}
exports.DeprecatedSessionState = DeprecatedSessionState;
//# sourceMappingURL=deprecated-session-state.js.map
