"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ServiceCommandDescriptor_SubCommandsEntry = exports.ServiceCommandDescriptor = exports.RpcCommandOptions_FlagOptionsEntry = exports.RpcCommandOptions = exports.PositionalArgDescriptor = exports.ModuleOptions = exports.FlagOptions = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
var _helpers = require("../../../helpers");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } //@ts-nocheck
/** ModuleOptions describes the CLI options for a Cosmos SDK module. */

/** ModuleOptions describes the CLI options for a Cosmos SDK module. */

/** ServiceCommandDescriptor describes a CLI command based on a protobuf service. */

/** ServiceCommandDescriptor describes a CLI command based on a protobuf service. */

/**
 * RpcCommandOptions specifies options for commands generated from protobuf
 * rpc methods.
 */

/**
 * RpcCommandOptions specifies options for commands generated from protobuf
 * rpc methods.
 */

/**
 * FlagOptions are options for flags generated from rpc request fields.
 * By default, all request fields are configured as flags based on the
 * kebab-case name of the field. Fields can be turned into positional arguments
 * instead by using RpcCommandOptions.positional_args.
 */

/**
 * FlagOptions are options for flags generated from rpc request fields.
 * By default, all request fields are configured as flags based on the
 * kebab-case name of the field. Fields can be turned into positional arguments
 * instead by using RpcCommandOptions.positional_args.
 */

/** PositionalArgDescriptor describes a positional argument. */

/** PositionalArgDescriptor describes a positional argument. */

function createBaseModuleOptions() {
  return {
    tx: undefined,
    query: undefined
  };
}
var ModuleOptions = exports.ModuleOptions = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.tx !== undefined) {
      ServiceCommandDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim();
    }
    if (message.query !== undefined) {
      ServiceCommandDescriptor.encode(message.query, writer.uint32(18).fork()).ldelim();
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseModuleOptions();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.tx = ServiceCommandDescriptor.decode(reader, reader.uint32());
          break;
        case 2:
          message.query = ServiceCommandDescriptor.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      tx: (0, _helpers.isSet)(object.tx) ? ServiceCommandDescriptor.fromJSON(object.tx) : undefined,
      query: (0, _helpers.isSet)(object.query) ? ServiceCommandDescriptor.fromJSON(object.query) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.tx !== undefined && (obj.tx = message.tx ? ServiceCommandDescriptor.toJSON(message.tx) : undefined);
    message.query !== undefined && (obj.query = message.query ? ServiceCommandDescriptor.toJSON(message.query) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseModuleOptions();
    message.tx = object.tx !== undefined && object.tx !== null ? ServiceCommandDescriptor.fromPartial(object.tx) : undefined;
    message.query = object.query !== undefined && object.query !== null ? ServiceCommandDescriptor.fromPartial(object.query) : undefined;
    return message;
  }
};
function createBaseServiceCommandDescriptor_SubCommandsEntry() {
  return {
    key: "",
    value: undefined
  };
}
var ServiceCommandDescriptor_SubCommandsEntry = exports.ServiceCommandDescriptor_SubCommandsEntry = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== undefined) {
      ServiceCommandDescriptor.encode(message.value, writer.uint32(18).fork()).ldelim();
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseServiceCommandDescriptor_SubCommandsEntry();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.key = reader.string();
          break;
        case 2:
          message.value = ServiceCommandDescriptor.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      key: (0, _helpers.isSet)(object.key) ? String(object.key) : "",
      value: (0, _helpers.isSet)(object.value) ? ServiceCommandDescriptor.fromJSON(object.value) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.key !== undefined && (obj.key = message.key);
    message.value !== undefined && (obj.value = message.value ? ServiceCommandDescriptor.toJSON(message.value) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$key;
    var message = createBaseServiceCommandDescriptor_SubCommandsEntry();
    message.key = (_object$key = object.key) !== null && _object$key !== void 0 ? _object$key : "";
    message.value = object.value !== undefined && object.value !== null ? ServiceCommandDescriptor.fromPartial(object.value) : undefined;
    return message;
  }
};
function createBaseServiceCommandDescriptor() {
  return {
    service: "",
    rpcCommandOptions: [],
    subCommands: {}
  };
}
var ServiceCommandDescriptor = exports.ServiceCommandDescriptor = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.service !== "") {
      writer.uint32(10).string(message.service);
    }
    var _iterator = _createForOfIteratorHelper(message.rpcCommandOptions),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        RpcCommandOptions.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    Object.entries(message.subCommands).forEach(function (_ref) {
      var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
        key = _ref2[0],
        value = _ref2[1];
      ServiceCommandDescriptor_SubCommandsEntry.encode({
        key: key,
        value: value
      }, writer.uint32(26).fork()).ldelim();
    });
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseServiceCommandDescriptor();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.service = reader.string();
          break;
        case 2:
          message.rpcCommandOptions.push(RpcCommandOptions.decode(reader, reader.uint32()));
          break;
        case 3:
          var entry3 = ServiceCommandDescriptor_SubCommandsEntry.decode(reader, reader.uint32());
          if (entry3.value !== undefined) {
            message.subCommands[entry3.key] = entry3.value;
          }
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      service: (0, _helpers.isSet)(object.service) ? String(object.service) : "",
      rpcCommandOptions: Array.isArray(object === null || object === void 0 ? void 0 : object.rpcCommandOptions) ? object.rpcCommandOptions.map(function (e) {
        return RpcCommandOptions.fromJSON(e);
      }) : [],
      subCommands: (0, _helpers.isObject)(object.subCommands) ? Object.entries(object.subCommands).reduce(function (acc, _ref3) {
        var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
          key = _ref4[0],
          value = _ref4[1];
        acc[key] = ServiceCommandDescriptor.fromJSON(value);
        return acc;
      }, {}) : {}
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.service !== undefined && (obj.service = message.service);
    if (message.rpcCommandOptions) {
      obj.rpcCommandOptions = message.rpcCommandOptions.map(function (e) {
        return e ? RpcCommandOptions.toJSON(e) : undefined;
      });
    } else {
      obj.rpcCommandOptions = [];
    }
    obj.subCommands = {};
    if (message.subCommands) {
      Object.entries(message.subCommands).forEach(function (_ref5) {
        var _ref6 = (0, _slicedToArray2["default"])(_ref5, 2),
          k = _ref6[0],
          v = _ref6[1];
        obj.subCommands[k] = ServiceCommandDescriptor.toJSON(v);
      });
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$service, _object$rpcCommandOpt, _object$subCommands;
    var message = createBaseServiceCommandDescriptor();
    message.service = (_object$service = object.service) !== null && _object$service !== void 0 ? _object$service : "";
    message.rpcCommandOptions = ((_object$rpcCommandOpt = object.rpcCommandOptions) === null || _object$rpcCommandOpt === void 0 ? void 0 : _object$rpcCommandOpt.map(function (e) {
      return RpcCommandOptions.fromPartial(e);
    })) || [];
    message.subCommands = Object.entries((_object$subCommands = object.subCommands) !== null && _object$subCommands !== void 0 ? _object$subCommands : {}).reduce(function (acc, _ref7) {
      var _ref8 = (0, _slicedToArray2["default"])(_ref7, 2),
        key = _ref8[0],
        value = _ref8[1];
      if (value !== undefined) {
        acc[key] = ServiceCommandDescriptor.fromPartial(value);
      }
      return acc;
    }, {});
    return message;
  }
};
function createBaseRpcCommandOptions_FlagOptionsEntry() {
  return {
    key: "",
    value: undefined
  };
}
var RpcCommandOptions_FlagOptionsEntry = exports.RpcCommandOptions_FlagOptionsEntry = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== undefined) {
      FlagOptions.encode(message.value, writer.uint32(18).fork()).ldelim();
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseRpcCommandOptions_FlagOptionsEntry();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.key = reader.string();
          break;
        case 2:
          message.value = FlagOptions.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      key: (0, _helpers.isSet)(object.key) ? String(object.key) : "",
      value: (0, _helpers.isSet)(object.value) ? FlagOptions.fromJSON(object.value) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.key !== undefined && (obj.key = message.key);
    message.value !== undefined && (obj.value = message.value ? FlagOptions.toJSON(message.value) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$key2;
    var message = createBaseRpcCommandOptions_FlagOptionsEntry();
    message.key = (_object$key2 = object.key) !== null && _object$key2 !== void 0 ? _object$key2 : "";
    message.value = object.value !== undefined && object.value !== null ? FlagOptions.fromPartial(object.value) : undefined;
    return message;
  }
};
function createBaseRpcCommandOptions() {
  return {
    rpcMethod: "",
    use: "",
    "long": "",
    "short": "",
    example: "",
    alias: [],
    suggestFor: [],
    deprecated: "",
    version: "",
    flagOptions: {},
    positionalArgs: [],
    skip: false
  };
}
var RpcCommandOptions = exports.RpcCommandOptions = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.rpcMethod !== "") {
      writer.uint32(10).string(message.rpcMethod);
    }
    if (message.use !== "") {
      writer.uint32(18).string(message.use);
    }
    if (message["long"] !== "") {
      writer.uint32(26).string(message["long"]);
    }
    if (message["short"] !== "") {
      writer.uint32(34).string(message["short"]);
    }
    if (message.example !== "") {
      writer.uint32(42).string(message.example);
    }
    var _iterator2 = _createForOfIteratorHelper(message.alias),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var v = _step2.value;
        writer.uint32(50).string(v);
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    var _iterator3 = _createForOfIteratorHelper(message.suggestFor),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var _v = _step3.value;
        writer.uint32(58).string(_v);
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
    if (message.deprecated !== "") {
      writer.uint32(66).string(message.deprecated);
    }
    if (message.version !== "") {
      writer.uint32(74).string(message.version);
    }
    Object.entries(message.flagOptions).forEach(function (_ref9) {
      var _ref0 = (0, _slicedToArray2["default"])(_ref9, 2),
        key = _ref0[0],
        value = _ref0[1];
      RpcCommandOptions_FlagOptionsEntry.encode({
        key: key,
        value: value
      }, writer.uint32(82).fork()).ldelim();
    });
    var _iterator4 = _createForOfIteratorHelper(message.positionalArgs),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var _v2 = _step4.value;
        PositionalArgDescriptor.encode(_v2, writer.uint32(90).fork()).ldelim();
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }
    if (message.skip === true) {
      writer.uint32(96).bool(message.skip);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseRpcCommandOptions();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.rpcMethod = reader.string();
          break;
        case 2:
          message.use = reader.string();
          break;
        case 3:
          message["long"] = reader.string();
          break;
        case 4:
          message["short"] = reader.string();
          break;
        case 5:
          message.example = reader.string();
          break;
        case 6:
          message.alias.push(reader.string());
          break;
        case 7:
          message.suggestFor.push(reader.string());
          break;
        case 8:
          message.deprecated = reader.string();
          break;
        case 9:
          message.version = reader.string();
          break;
        case 10:
          var entry10 = RpcCommandOptions_FlagOptionsEntry.decode(reader, reader.uint32());
          if (entry10.value !== undefined) {
            message.flagOptions[entry10.key] = entry10.value;
          }
          break;
        case 11:
          message.positionalArgs.push(PositionalArgDescriptor.decode(reader, reader.uint32()));
          break;
        case 12:
          message.skip = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      rpcMethod: (0, _helpers.isSet)(object.rpcMethod) ? String(object.rpcMethod) : "",
      use: (0, _helpers.isSet)(object.use) ? String(object.use) : "",
      "long": (0, _helpers.isSet)(object["long"]) ? String(object["long"]) : "",
      "short": (0, _helpers.isSet)(object["short"]) ? String(object["short"]) : "",
      example: (0, _helpers.isSet)(object.example) ? String(object.example) : "",
      alias: Array.isArray(object === null || object === void 0 ? void 0 : object.alias) ? object.alias.map(function (e) {
        return String(e);
      }) : [],
      suggestFor: Array.isArray(object === null || object === void 0 ? void 0 : object.suggestFor) ? object.suggestFor.map(function (e) {
        return String(e);
      }) : [],
      deprecated: (0, _helpers.isSet)(object.deprecated) ? String(object.deprecated) : "",
      version: (0, _helpers.isSet)(object.version) ? String(object.version) : "",
      flagOptions: (0, _helpers.isObject)(object.flagOptions) ? Object.entries(object.flagOptions).reduce(function (acc, _ref1) {
        var _ref10 = (0, _slicedToArray2["default"])(_ref1, 2),
          key = _ref10[0],
          value = _ref10[1];
        acc[key] = FlagOptions.fromJSON(value);
        return acc;
      }, {}) : {},
      positionalArgs: Array.isArray(object === null || object === void 0 ? void 0 : object.positionalArgs) ? object.positionalArgs.map(function (e) {
        return PositionalArgDescriptor.fromJSON(e);
      }) : [],
      skip: (0, _helpers.isSet)(object.skip) ? Boolean(object.skip) : false
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.rpcMethod !== undefined && (obj.rpcMethod = message.rpcMethod);
    message.use !== undefined && (obj.use = message.use);
    message["long"] !== undefined && (obj["long"] = message["long"]);
    message["short"] !== undefined && (obj["short"] = message["short"]);
    message.example !== undefined && (obj.example = message.example);
    if (message.alias) {
      obj.alias = message.alias.map(function (e) {
        return e;
      });
    } else {
      obj.alias = [];
    }
    if (message.suggestFor) {
      obj.suggestFor = message.suggestFor.map(function (e) {
        return e;
      });
    } else {
      obj.suggestFor = [];
    }
    message.deprecated !== undefined && (obj.deprecated = message.deprecated);
    message.version !== undefined && (obj.version = message.version);
    obj.flagOptions = {};
    if (message.flagOptions) {
      Object.entries(message.flagOptions).forEach(function (_ref11) {
        var _ref12 = (0, _slicedToArray2["default"])(_ref11, 2),
          k = _ref12[0],
          v = _ref12[1];
        obj.flagOptions[k] = FlagOptions.toJSON(v);
      });
    }
    if (message.positionalArgs) {
      obj.positionalArgs = message.positionalArgs.map(function (e) {
        return e ? PositionalArgDescriptor.toJSON(e) : undefined;
      });
    } else {
      obj.positionalArgs = [];
    }
    message.skip !== undefined && (obj.skip = message.skip);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$rpcMethod, _object$use, _object$long, _object$short, _object$example, _object$alias, _object$suggestFor, _object$deprecated, _object$version, _object$flagOptions, _object$positionalArg, _object$skip;
    var message = createBaseRpcCommandOptions();
    message.rpcMethod = (_object$rpcMethod = object.rpcMethod) !== null && _object$rpcMethod !== void 0 ? _object$rpcMethod : "";
    message.use = (_object$use = object.use) !== null && _object$use !== void 0 ? _object$use : "";
    message["long"] = (_object$long = object["long"]) !== null && _object$long !== void 0 ? _object$long : "";
    message["short"] = (_object$short = object["short"]) !== null && _object$short !== void 0 ? _object$short : "";
    message.example = (_object$example = object.example) !== null && _object$example !== void 0 ? _object$example : "";
    message.alias = ((_object$alias = object.alias) === null || _object$alias === void 0 ? void 0 : _object$alias.map(function (e) {
      return e;
    })) || [];
    message.suggestFor = ((_object$suggestFor = object.suggestFor) === null || _object$suggestFor === void 0 ? void 0 : _object$suggestFor.map(function (e) {
      return e;
    })) || [];
    message.deprecated = (_object$deprecated = object.deprecated) !== null && _object$deprecated !== void 0 ? _object$deprecated : "";
    message.version = (_object$version = object.version) !== null && _object$version !== void 0 ? _object$version : "";
    message.flagOptions = Object.entries((_object$flagOptions = object.flagOptions) !== null && _object$flagOptions !== void 0 ? _object$flagOptions : {}).reduce(function (acc, _ref13) {
      var _ref14 = (0, _slicedToArray2["default"])(_ref13, 2),
        key = _ref14[0],
        value = _ref14[1];
      if (value !== undefined) {
        acc[key] = FlagOptions.fromPartial(value);
      }
      return acc;
    }, {});
    message.positionalArgs = ((_object$positionalArg = object.positionalArgs) === null || _object$positionalArg === void 0 ? void 0 : _object$positionalArg.map(function (e) {
      return PositionalArgDescriptor.fromPartial(e);
    })) || [];
    message.skip = (_object$skip = object.skip) !== null && _object$skip !== void 0 ? _object$skip : false;
    return message;
  }
};
function createBaseFlagOptions() {
  return {
    name: "",
    shorthand: "",
    usage: "",
    defaultValue: "",
    deprecated: "",
    shorthandDeprecated: "",
    hidden: false
  };
}
var FlagOptions = exports.FlagOptions = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.shorthand !== "") {
      writer.uint32(18).string(message.shorthand);
    }
    if (message.usage !== "") {
      writer.uint32(26).string(message.usage);
    }
    if (message.defaultValue !== "") {
      writer.uint32(34).string(message.defaultValue);
    }
    if (message.deprecated !== "") {
      writer.uint32(50).string(message.deprecated);
    }
    if (message.shorthandDeprecated !== "") {
      writer.uint32(58).string(message.shorthandDeprecated);
    }
    if (message.hidden === true) {
      writer.uint32(64).bool(message.hidden);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseFlagOptions();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.name = reader.string();
          break;
        case 2:
          message.shorthand = reader.string();
          break;
        case 3:
          message.usage = reader.string();
          break;
        case 4:
          message.defaultValue = reader.string();
          break;
        case 6:
          message.deprecated = reader.string();
          break;
        case 7:
          message.shorthandDeprecated = reader.string();
          break;
        case 8:
          message.hidden = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      shorthand: (0, _helpers.isSet)(object.shorthand) ? String(object.shorthand) : "",
      usage: (0, _helpers.isSet)(object.usage) ? String(object.usage) : "",
      defaultValue: (0, _helpers.isSet)(object.defaultValue) ? String(object.defaultValue) : "",
      deprecated: (0, _helpers.isSet)(object.deprecated) ? String(object.deprecated) : "",
      shorthandDeprecated: (0, _helpers.isSet)(object.shorthandDeprecated) ? String(object.shorthandDeprecated) : "",
      hidden: (0, _helpers.isSet)(object.hidden) ? Boolean(object.hidden) : false
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.name !== undefined && (obj.name = message.name);
    message.shorthand !== undefined && (obj.shorthand = message.shorthand);
    message.usage !== undefined && (obj.usage = message.usage);
    message.defaultValue !== undefined && (obj.defaultValue = message.defaultValue);
    message.deprecated !== undefined && (obj.deprecated = message.deprecated);
    message.shorthandDeprecated !== undefined && (obj.shorthandDeprecated = message.shorthandDeprecated);
    message.hidden !== undefined && (obj.hidden = message.hidden);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$name, _object$shorthand, _object$usage, _object$defaultValue, _object$deprecated2, _object$shorthandDepr, _object$hidden;
    var message = createBaseFlagOptions();
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.shorthand = (_object$shorthand = object.shorthand) !== null && _object$shorthand !== void 0 ? _object$shorthand : "";
    message.usage = (_object$usage = object.usage) !== null && _object$usage !== void 0 ? _object$usage : "";
    message.defaultValue = (_object$defaultValue = object.defaultValue) !== null && _object$defaultValue !== void 0 ? _object$defaultValue : "";
    message.deprecated = (_object$deprecated2 = object.deprecated) !== null && _object$deprecated2 !== void 0 ? _object$deprecated2 : "";
    message.shorthandDeprecated = (_object$shorthandDepr = object.shorthandDeprecated) !== null && _object$shorthandDepr !== void 0 ? _object$shorthandDepr : "";
    message.hidden = (_object$hidden = object.hidden) !== null && _object$hidden !== void 0 ? _object$hidden : false;
    return message;
  }
};
function createBasePositionalArgDescriptor() {
  return {
    protoField: "",
    varargs: false
  };
}
var PositionalArgDescriptor = exports.PositionalArgDescriptor = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.protoField !== "") {
      writer.uint32(10).string(message.protoField);
    }
    if (message.varargs === true) {
      writer.uint32(16).bool(message.varargs);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBasePositionalArgDescriptor();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.protoField = reader.string();
          break;
        case 2:
          message.varargs = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      protoField: (0, _helpers.isSet)(object.protoField) ? String(object.protoField) : "",
      varargs: (0, _helpers.isSet)(object.varargs) ? Boolean(object.varargs) : false
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.protoField !== undefined && (obj.protoField = message.protoField);
    message.varargs !== undefined && (obj.varargs = message.varargs);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$protoField, _object$varargs;
    var message = createBasePositionalArgDescriptor();
    message.protoField = (_object$protoField = object.protoField) !== null && _object$protoField !== void 0 ? _object$protoField : "";
    message.varargs = (_object$varargs = object.varargs) !== null && _object$varargs !== void 0 ? _object$varargs : false;
    return message;
  }
};