"use strict";
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 (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.leaderboard = void 0;
/**
 * Generated by the protoc-gen-ts.  DO NOT EDIT!
 * compiler version: 3.19.1
 * source: leaderboard.proto
 * git: https://github.com/thesayyn/protoc-gen-ts */
const dependency_1 = __importStar(require("./common"));
const pb_1 = __importStar(require("google-protobuf"));
const grpc_1 = __importStar(require("@grpc/grpc-js"));
var leaderboard;
(function (leaderboard) {
    var __Element_one_of_decls, __RankedElement_one_of_decls, __RankRange_one_of_decls, __ScoreRange_one_of_decls, __DeleteLeaderboardRequest_one_of_decls, __GetLeaderboardLengthRequest_one_of_decls, __GetLeaderboardLengthResponse_one_of_decls, __UpsertElementsRequest_one_of_decls, __GetByRankRequest_one_of_decls, __GetByRankResponse_one_of_decls, __GetRankRequest_one_of_decls, __GetRankResponse_one_of_decls, __RemoveElementsRequest_one_of_decls, __GetByScoreRequest_one_of_decls, __GetByScoreResponse_one_of_decls, __GetCompetitionRankRequest_one_of_decls, __GetCompetitionRankResponse_one_of_decls;
    let _Order;
    (function (_Order) {
        _Order[_Order["ASCENDING"] = 0] = "ASCENDING";
        _Order[_Order["DESCENDING"] = 1] = "DESCENDING";
    })(_Order = leaderboard._Order || (leaderboard._Order = {}));
    class _Element extends pb_1.Message {
        constructor(data) {
            super();
            __Element_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __Element_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("id" in data && data.id != undefined) {
                    this.id = data.id;
                }
                if ("score" in data && data.score != undefined) {
                    this.score = data.score;
                }
            }
        }
        get id() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0);
        }
        set id(value) {
            pb_1.Message.setField(this, 1, value);
        }
        get score() {
            return pb_1.Message.getFieldWithDefault(this, 3, 0);
        }
        set score(value) {
            pb_1.Message.setField(this, 3, value);
        }
        static fromObject(data) {
            const message = new _Element({});
            if (data.id != null) {
                message.id = data.id;
            }
            if (data.score != null) {
                message.score = data.score;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.id != null) {
                data.id = this.id;
            }
            if (this.score != null) {
                data.score = this.score;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.id != 0)
                writer.writeUint32(1, this.id);
            if (this.score != 0)
                writer.writeDouble(3, this.score);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _Element();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.id = reader.readUint32();
                        break;
                    case 3:
                        message.score = reader.readDouble();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _Element.deserialize(bytes);
        }
    }
    __Element_one_of_decls = new WeakMap();
    leaderboard._Element = _Element;
    class _RankedElement extends pb_1.Message {
        constructor(data) {
            super();
            __RankedElement_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __RankedElement_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("id" in data && data.id != undefined) {
                    this.id = data.id;
                }
                if ("rank" in data && data.rank != undefined) {
                    this.rank = data.rank;
                }
                if ("score" in data && data.score != undefined) {
                    this.score = data.score;
                }
            }
        }
        get id() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0);
        }
        set id(value) {
            pb_1.Message.setField(this, 1, value);
        }
        get rank() {
            return pb_1.Message.getFieldWithDefault(this, 3, 0);
        }
        set rank(value) {
            pb_1.Message.setField(this, 3, value);
        }
        get score() {
            return pb_1.Message.getFieldWithDefault(this, 4, 0);
        }
        set score(value) {
            pb_1.Message.setField(this, 4, value);
        }
        static fromObject(data) {
            const message = new _RankedElement({});
            if (data.id != null) {
                message.id = data.id;
            }
            if (data.rank != null) {
                message.rank = data.rank;
            }
            if (data.score != null) {
                message.score = data.score;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.id != null) {
                data.id = this.id;
            }
            if (this.rank != null) {
                data.rank = this.rank;
            }
            if (this.score != null) {
                data.score = this.score;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.id != 0)
                writer.writeUint32(1, this.id);
            if (this.rank != 0)
                writer.writeUint32(3, this.rank);
            if (this.score != 0)
                writer.writeDouble(4, this.score);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _RankedElement();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.id = reader.readUint32();
                        break;
                    case 3:
                        message.rank = reader.readUint32();
                        break;
                    case 4:
                        message.score = reader.readDouble();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _RankedElement.deserialize(bytes);
        }
    }
    __RankedElement_one_of_decls = new WeakMap();
    leaderboard._RankedElement = _RankedElement;
    class _RankRange extends pb_1.Message {
        constructor(data) {
            super();
            __RankRange_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __RankRange_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("start_inclusive" in data && data.start_inclusive != undefined) {
                    this.start_inclusive = data.start_inclusive;
                }
                if ("end_exclusive" in data && data.end_exclusive != undefined) {
                    this.end_exclusive = data.end_exclusive;
                }
            }
        }
        get start_inclusive() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0);
        }
        set start_inclusive(value) {
            pb_1.Message.setField(this, 1, value);
        }
        get end_exclusive() {
            return pb_1.Message.getFieldWithDefault(this, 2, 0);
        }
        set end_exclusive(value) {
            pb_1.Message.setField(this, 2, value);
        }
        static fromObject(data) {
            const message = new _RankRange({});
            if (data.start_inclusive != null) {
                message.start_inclusive = data.start_inclusive;
            }
            if (data.end_exclusive != null) {
                message.end_exclusive = data.end_exclusive;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.start_inclusive != null) {
                data.start_inclusive = this.start_inclusive;
            }
            if (this.end_exclusive != null) {
                data.end_exclusive = this.end_exclusive;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.start_inclusive != 0)
                writer.writeUint32(1, this.start_inclusive);
            if (this.end_exclusive != 0)
                writer.writeUint32(2, this.end_exclusive);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _RankRange();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.start_inclusive = reader.readUint32();
                        break;
                    case 2:
                        message.end_exclusive = reader.readUint32();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _RankRange.deserialize(bytes);
        }
    }
    __RankRange_one_of_decls = new WeakMap();
    leaderboard._RankRange = _RankRange;
    class _ScoreRange extends pb_1.Message {
        constructor(data) {
            super();
            __ScoreRange_one_of_decls.set(this, [[1, 5], [3, 6]]);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __ScoreRange_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("unbounded_min" in data && data.unbounded_min != undefined) {
                    this.unbounded_min = data.unbounded_min;
                }
                if ("min_inclusive" in data && data.min_inclusive != undefined) {
                    this.min_inclusive = data.min_inclusive;
                }
                if ("unbounded_max" in data && data.unbounded_max != undefined) {
                    this.unbounded_max = data.unbounded_max;
                }
                if ("max_exclusive" in data && data.max_exclusive != undefined) {
                    this.max_exclusive = data.max_exclusive;
                }
            }
        }
        get unbounded_min() {
            return pb_1.Message.getWrapperField(this, dependency_1.common._Unbounded, 1);
        }
        set unbounded_min(value) {
            pb_1.Message.setOneofWrapperField(this, 1, __classPrivateFieldGet(this, __ScoreRange_one_of_decls, "f")[0], value);
        }
        get has_unbounded_min() {
            return pb_1.Message.getField(this, 1) != null;
        }
        get min_inclusive() {
            return pb_1.Message.getFieldWithDefault(this, 5, 0);
        }
        set min_inclusive(value) {
            pb_1.Message.setOneofField(this, 5, __classPrivateFieldGet(this, __ScoreRange_one_of_decls, "f")[0], value);
        }
        get has_min_inclusive() {
            return pb_1.Message.getField(this, 5) != null;
        }
        get unbounded_max() {
            return pb_1.Message.getWrapperField(this, dependency_1.common._Unbounded, 3);
        }
        set unbounded_max(value) {
            pb_1.Message.setOneofWrapperField(this, 3, __classPrivateFieldGet(this, __ScoreRange_one_of_decls, "f")[1], value);
        }
        get has_unbounded_max() {
            return pb_1.Message.getField(this, 3) != null;
        }
        get max_exclusive() {
            return pb_1.Message.getFieldWithDefault(this, 6, 0);
        }
        set max_exclusive(value) {
            pb_1.Message.setOneofField(this, 6, __classPrivateFieldGet(this, __ScoreRange_one_of_decls, "f")[1], value);
        }
        get has_max_exclusive() {
            return pb_1.Message.getField(this, 6) != null;
        }
        get min() {
            const cases = {
                0: "none",
                1: "unbounded_min",
                5: "min_inclusive"
            };
            return cases[pb_1.Message.computeOneofCase(this, [1, 5])];
        }
        get max() {
            const cases = {
                0: "none",
                3: "unbounded_max",
                6: "max_exclusive"
            };
            return cases[pb_1.Message.computeOneofCase(this, [3, 6])];
        }
        static fromObject(data) {
            const message = new _ScoreRange({});
            if (data.unbounded_min != null) {
                message.unbounded_min = dependency_1.common._Unbounded.fromObject(data.unbounded_min);
            }
            if (data.min_inclusive != null) {
                message.min_inclusive = data.min_inclusive;
            }
            if (data.unbounded_max != null) {
                message.unbounded_max = dependency_1.common._Unbounded.fromObject(data.unbounded_max);
            }
            if (data.max_exclusive != null) {
                message.max_exclusive = data.max_exclusive;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.unbounded_min != null) {
                data.unbounded_min = this.unbounded_min.toObject();
            }
            if (this.min_inclusive != null) {
                data.min_inclusive = this.min_inclusive;
            }
            if (this.unbounded_max != null) {
                data.unbounded_max = this.unbounded_max.toObject();
            }
            if (this.max_exclusive != null) {
                data.max_exclusive = this.max_exclusive;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.has_unbounded_min)
                writer.writeMessage(1, this.unbounded_min, () => this.unbounded_min.serialize(writer));
            if (this.has_min_inclusive)
                writer.writeDouble(5, this.min_inclusive);
            if (this.has_unbounded_max)
                writer.writeMessage(3, this.unbounded_max, () => this.unbounded_max.serialize(writer));
            if (this.has_max_exclusive)
                writer.writeDouble(6, this.max_exclusive);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _ScoreRange();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.unbounded_min, () => message.unbounded_min = dependency_1.common._Unbounded.deserialize(reader));
                        break;
                    case 5:
                        message.min_inclusive = reader.readDouble();
                        break;
                    case 3:
                        reader.readMessage(message.unbounded_max, () => message.unbounded_max = dependency_1.common._Unbounded.deserialize(reader));
                        break;
                    case 6:
                        message.max_exclusive = reader.readDouble();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _ScoreRange.deserialize(bytes);
        }
    }
    __ScoreRange_one_of_decls = new WeakMap();
    leaderboard._ScoreRange = _ScoreRange;
    class _DeleteLeaderboardRequest extends pb_1.Message {
        constructor(data) {
            super();
            __DeleteLeaderboardRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __DeleteLeaderboardRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 2, value);
        }
        static fromObject(data) {
            const message = new _DeleteLeaderboardRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(2, this.leaderboard);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _DeleteLeaderboardRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 2:
                        message.leaderboard = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _DeleteLeaderboardRequest.deserialize(bytes);
        }
    }
    __DeleteLeaderboardRequest_one_of_decls = new WeakMap();
    leaderboard._DeleteLeaderboardRequest = _DeleteLeaderboardRequest;
    class _GetLeaderboardLengthRequest extends pb_1.Message {
        constructor(data) {
            super();
            __GetLeaderboardLengthRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __GetLeaderboardLengthRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 2, value);
        }
        static fromObject(data) {
            const message = new _GetLeaderboardLengthRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(2, this.leaderboard);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetLeaderboardLengthRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 2:
                        message.leaderboard = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetLeaderboardLengthRequest.deserialize(bytes);
        }
    }
    __GetLeaderboardLengthRequest_one_of_decls = new WeakMap();
    leaderboard._GetLeaderboardLengthRequest = _GetLeaderboardLengthRequest;
    class _GetLeaderboardLengthResponse extends pb_1.Message {
        constructor(data) {
            super();
            __GetLeaderboardLengthResponse_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __GetLeaderboardLengthResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("count" in data && data.count != undefined) {
                    this.count = data.count;
                }
            }
        }
        get count() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0);
        }
        set count(value) {
            pb_1.Message.setField(this, 1, value);
        }
        static fromObject(data) {
            const message = new _GetLeaderboardLengthResponse({});
            if (data.count != null) {
                message.count = data.count;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.count != null) {
                data.count = this.count;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.count != 0)
                writer.writeUint32(1, this.count);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetLeaderboardLengthResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.count = reader.readUint32();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetLeaderboardLengthResponse.deserialize(bytes);
        }
    }
    __GetLeaderboardLengthResponse_one_of_decls = new WeakMap();
    leaderboard._GetLeaderboardLengthResponse = _GetLeaderboardLengthResponse;
    class _UpsertElementsRequest extends pb_1.Message {
        constructor(data) {
            super();
            __UpsertElementsRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], __classPrivateFieldGet(this, __UpsertElementsRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
                if ("elements" in data && data.elements != undefined) {
                    this.elements = data.elements;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get elements() {
            return pb_1.Message.getRepeatedWrapperField(this, _Element, 3);
        }
        set elements(value) {
            pb_1.Message.setRepeatedWrapperField(this, 3, value);
        }
        static fromObject(data) {
            const message = new _UpsertElementsRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            if (data.elements != null) {
                message.elements = data.elements.map(item => _Element.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            if (this.elements != null) {
                data.elements = this.elements.map((item) => item.toObject());
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(2, this.leaderboard);
            if (this.elements.length)
                writer.writeRepeatedMessage(3, this.elements, (item) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _UpsertElementsRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 2:
                        message.leaderboard = reader.readString();
                        break;
                    case 3:
                        reader.readMessage(message.elements, () => pb_1.Message.addToRepeatedWrapperField(message, 3, _Element.deserialize(reader), _Element));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _UpsertElementsRequest.deserialize(bytes);
        }
    }
    __UpsertElementsRequest_one_of_decls = new WeakMap();
    leaderboard._UpsertElementsRequest = _UpsertElementsRequest;
    class _GetByRankRequest extends pb_1.Message {
        constructor(data) {
            super();
            __GetByRankRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __GetByRankRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
                if ("rank_range" in data && data.rank_range != undefined) {
                    this.rank_range = data.rank_range;
                }
                if ("order" in data && data.order != undefined) {
                    this.order = data.order;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get rank_range() {
            return pb_1.Message.getWrapperField(this, _RankRange, 3);
        }
        set rank_range(value) {
            pb_1.Message.setWrapperField(this, 3, value);
        }
        get has_rank_range() {
            return pb_1.Message.getField(this, 3) != null;
        }
        get order() {
            return pb_1.Message.getFieldWithDefault(this, 4, _Order.ASCENDING);
        }
        set order(value) {
            pb_1.Message.setField(this, 4, value);
        }
        static fromObject(data) {
            const message = new _GetByRankRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            if (data.rank_range != null) {
                message.rank_range = _RankRange.fromObject(data.rank_range);
            }
            if (data.order != null) {
                message.order = data.order;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            if (this.rank_range != null) {
                data.rank_range = this.rank_range.toObject();
            }
            if (this.order != null) {
                data.order = this.order;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(2, this.leaderboard);
            if (this.has_rank_range)
                writer.writeMessage(3, this.rank_range, () => this.rank_range.serialize(writer));
            if (this.order != _Order.ASCENDING)
                writer.writeEnum(4, this.order);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetByRankRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 2:
                        message.leaderboard = reader.readString();
                        break;
                    case 3:
                        reader.readMessage(message.rank_range, () => message.rank_range = _RankRange.deserialize(reader));
                        break;
                    case 4:
                        message.order = reader.readEnum();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetByRankRequest.deserialize(bytes);
        }
    }
    __GetByRankRequest_one_of_decls = new WeakMap();
    leaderboard._GetByRankRequest = _GetByRankRequest;
    class _GetByRankResponse extends pb_1.Message {
        constructor(data) {
            super();
            __GetByRankResponse_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], __classPrivateFieldGet(this, __GetByRankResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("elements" in data && data.elements != undefined) {
                    this.elements = data.elements;
                }
            }
        }
        get elements() {
            return pb_1.Message.getRepeatedWrapperField(this, _RankedElement, 1);
        }
        set elements(value) {
            pb_1.Message.setRepeatedWrapperField(this, 1, value);
        }
        static fromObject(data) {
            const message = new _GetByRankResponse({});
            if (data.elements != null) {
                message.elements = data.elements.map(item => _RankedElement.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.elements != null) {
                data.elements = this.elements.map((item) => item.toObject());
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.elements.length)
                writer.writeRepeatedMessage(1, this.elements, (item) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetByRankResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.elements, () => pb_1.Message.addToRepeatedWrapperField(message, 1, _RankedElement.deserialize(reader), _RankedElement));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetByRankResponse.deserialize(bytes);
        }
    }
    __GetByRankResponse_one_of_decls = new WeakMap();
    leaderboard._GetByRankResponse = _GetByRankResponse;
    class _GetRankRequest extends pb_1.Message {
        constructor(data) {
            super();
            __GetRankRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], __classPrivateFieldGet(this, __GetRankRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
                if ("ids" in data && data.ids != undefined) {
                    this.ids = data.ids;
                }
                if ("order" in data && data.order != undefined) {
                    this.order = data.order;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get ids() {
            return pb_1.Message.getFieldWithDefault(this, 3, []);
        }
        set ids(value) {
            pb_1.Message.setField(this, 3, value);
        }
        get order() {
            return pb_1.Message.getFieldWithDefault(this, 4, _Order.ASCENDING);
        }
        set order(value) {
            pb_1.Message.setField(this, 4, value);
        }
        static fromObject(data) {
            const message = new _GetRankRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            if (data.ids != null) {
                message.ids = data.ids;
            }
            if (data.order != null) {
                message.order = data.order;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            if (this.ids != null) {
                data.ids = this.ids;
            }
            if (this.order != null) {
                data.order = this.order;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(2, this.leaderboard);
            if (this.ids.length)
                writer.writePackedUint32(3, this.ids);
            if (this.order != _Order.ASCENDING)
                writer.writeEnum(4, this.order);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetRankRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 2:
                        message.leaderboard = reader.readString();
                        break;
                    case 3:
                        message.ids = reader.readPackedUint32();
                        break;
                    case 4:
                        message.order = reader.readEnum();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetRankRequest.deserialize(bytes);
        }
    }
    __GetRankRequest_one_of_decls = new WeakMap();
    leaderboard._GetRankRequest = _GetRankRequest;
    class _GetRankResponse extends pb_1.Message {
        constructor(data) {
            super();
            __GetRankResponse_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], __classPrivateFieldGet(this, __GetRankResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("elements" in data && data.elements != undefined) {
                    this.elements = data.elements;
                }
            }
        }
        get elements() {
            return pb_1.Message.getRepeatedWrapperField(this, _RankedElement, 1);
        }
        set elements(value) {
            pb_1.Message.setRepeatedWrapperField(this, 1, value);
        }
        static fromObject(data) {
            const message = new _GetRankResponse({});
            if (data.elements != null) {
                message.elements = data.elements.map(item => _RankedElement.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.elements != null) {
                data.elements = this.elements.map((item) => item.toObject());
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.elements.length)
                writer.writeRepeatedMessage(1, this.elements, (item) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetRankResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.elements, () => pb_1.Message.addToRepeatedWrapperField(message, 1, _RankedElement.deserialize(reader), _RankedElement));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetRankResponse.deserialize(bytes);
        }
    }
    __GetRankResponse_one_of_decls = new WeakMap();
    leaderboard._GetRankResponse = _GetRankResponse;
    class _RemoveElementsRequest extends pb_1.Message {
        constructor(data) {
            super();
            __RemoveElementsRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], __classPrivateFieldGet(this, __RemoveElementsRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
                if ("ids" in data && data.ids != undefined) {
                    this.ids = data.ids;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get ids() {
            return pb_1.Message.getFieldWithDefault(this, 3, []);
        }
        set ids(value) {
            pb_1.Message.setField(this, 3, value);
        }
        static fromObject(data) {
            const message = new _RemoveElementsRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            if (data.ids != null) {
                message.ids = data.ids;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            if (this.ids != null) {
                data.ids = this.ids;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(2, this.leaderboard);
            if (this.ids.length)
                writer.writePackedUint32(3, this.ids);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _RemoveElementsRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 2:
                        message.leaderboard = reader.readString();
                        break;
                    case 3:
                        message.ids = reader.readPackedUint32();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _RemoveElementsRequest.deserialize(bytes);
        }
    }
    __RemoveElementsRequest_one_of_decls = new WeakMap();
    leaderboard._RemoveElementsRequest = _RemoveElementsRequest;
    class _GetByScoreRequest extends pb_1.Message {
        constructor(data) {
            super();
            __GetByScoreRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __GetByScoreRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
                if ("score_range" in data && data.score_range != undefined) {
                    this.score_range = data.score_range;
                }
                if ("offset" in data && data.offset != undefined) {
                    this.offset = data.offset;
                }
                if ("limit_elements" in data && data.limit_elements != undefined) {
                    this.limit_elements = data.limit_elements;
                }
                if ("order" in data && data.order != undefined) {
                    this.order = data.order;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get score_range() {
            return pb_1.Message.getWrapperField(this, _ScoreRange, 3);
        }
        set score_range(value) {
            pb_1.Message.setWrapperField(this, 3, value);
        }
        get has_score_range() {
            return pb_1.Message.getField(this, 3) != null;
        }
        get offset() {
            return pb_1.Message.getFieldWithDefault(this, 4, 0);
        }
        set offset(value) {
            pb_1.Message.setField(this, 4, value);
        }
        get limit_elements() {
            return pb_1.Message.getFieldWithDefault(this, 5, 0);
        }
        set limit_elements(value) {
            pb_1.Message.setField(this, 5, value);
        }
        get order() {
            return pb_1.Message.getFieldWithDefault(this, 6, _Order.ASCENDING);
        }
        set order(value) {
            pb_1.Message.setField(this, 6, value);
        }
        static fromObject(data) {
            const message = new _GetByScoreRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            if (data.score_range != null) {
                message.score_range = _ScoreRange.fromObject(data.score_range);
            }
            if (data.offset != null) {
                message.offset = data.offset;
            }
            if (data.limit_elements != null) {
                message.limit_elements = data.limit_elements;
            }
            if (data.order != null) {
                message.order = data.order;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            if (this.score_range != null) {
                data.score_range = this.score_range.toObject();
            }
            if (this.offset != null) {
                data.offset = this.offset;
            }
            if (this.limit_elements != null) {
                data.limit_elements = this.limit_elements;
            }
            if (this.order != null) {
                data.order = this.order;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(2, this.leaderboard);
            if (this.has_score_range)
                writer.writeMessage(3, this.score_range, () => this.score_range.serialize(writer));
            if (this.offset != 0)
                writer.writeUint32(4, this.offset);
            if (this.limit_elements != 0)
                writer.writeUint32(5, this.limit_elements);
            if (this.order != _Order.ASCENDING)
                writer.writeEnum(6, this.order);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetByScoreRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 2:
                        message.leaderboard = reader.readString();
                        break;
                    case 3:
                        reader.readMessage(message.score_range, () => message.score_range = _ScoreRange.deserialize(reader));
                        break;
                    case 4:
                        message.offset = reader.readUint32();
                        break;
                    case 5:
                        message.limit_elements = reader.readUint32();
                        break;
                    case 6:
                        message.order = reader.readEnum();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetByScoreRequest.deserialize(bytes);
        }
    }
    __GetByScoreRequest_one_of_decls = new WeakMap();
    leaderboard._GetByScoreRequest = _GetByScoreRequest;
    class _GetByScoreResponse extends pb_1.Message {
        constructor(data) {
            super();
            __GetByScoreResponse_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], __classPrivateFieldGet(this, __GetByScoreResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("elements" in data && data.elements != undefined) {
                    this.elements = data.elements;
                }
            }
        }
        get elements() {
            return pb_1.Message.getRepeatedWrapperField(this, _RankedElement, 1);
        }
        set elements(value) {
            pb_1.Message.setRepeatedWrapperField(this, 1, value);
        }
        static fromObject(data) {
            const message = new _GetByScoreResponse({});
            if (data.elements != null) {
                message.elements = data.elements.map(item => _RankedElement.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.elements != null) {
                data.elements = this.elements.map((item) => item.toObject());
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.elements.length)
                writer.writeRepeatedMessage(1, this.elements, (item) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetByScoreResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.elements, () => pb_1.Message.addToRepeatedWrapperField(message, 1, _RankedElement.deserialize(reader), _RankedElement));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetByScoreResponse.deserialize(bytes);
        }
    }
    __GetByScoreResponse_one_of_decls = new WeakMap();
    leaderboard._GetByScoreResponse = _GetByScoreResponse;
    class _GetCompetitionRankRequest extends pb_1.Message {
        constructor(data) {
            super();
            __GetCompetitionRankRequest_one_of_decls.set(this, [[3]]);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], __classPrivateFieldGet(this, __GetCompetitionRankRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("leaderboard" in data && data.leaderboard != undefined) {
                    this.leaderboard = data.leaderboard;
                }
                if ("ids" in data && data.ids != undefined) {
                    this.ids = data.ids;
                }
                if ("order" in data && data.order != undefined) {
                    this.order = data.order;
                }
            }
        }
        get leaderboard() {
            return pb_1.Message.getFieldWithDefault(this, 1, "");
        }
        set leaderboard(value) {
            pb_1.Message.setField(this, 1, value);
        }
        get ids() {
            return pb_1.Message.getFieldWithDefault(this, 2, []);
        }
        set ids(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get order() {
            return pb_1.Message.getFieldWithDefault(this, 3, _Order.ASCENDING);
        }
        set order(value) {
            pb_1.Message.setOneofField(this, 3, __classPrivateFieldGet(this, __GetCompetitionRankRequest_one_of_decls, "f")[0], value);
        }
        get has_order() {
            return pb_1.Message.getField(this, 3) != null;
        }
        get _order() {
            const cases = {
                0: "none",
                3: "order"
            };
            return cases[pb_1.Message.computeOneofCase(this, [3])];
        }
        static fromObject(data) {
            const message = new _GetCompetitionRankRequest({});
            if (data.leaderboard != null) {
                message.leaderboard = data.leaderboard;
            }
            if (data.ids != null) {
                message.ids = data.ids;
            }
            if (data.order != null) {
                message.order = data.order;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.leaderboard != null) {
                data.leaderboard = this.leaderboard;
            }
            if (this.ids != null) {
                data.ids = this.ids;
            }
            if (this.order != null) {
                data.order = this.order;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.leaderboard.length)
                writer.writeString(1, this.leaderboard);
            if (this.ids.length)
                writer.writePackedUint32(2, this.ids);
            if (this.has_order)
                writer.writeEnum(3, this.order);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetCompetitionRankRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.leaderboard = reader.readString();
                        break;
                    case 2:
                        message.ids = reader.readPackedUint32();
                        break;
                    case 3:
                        message.order = reader.readEnum();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetCompetitionRankRequest.deserialize(bytes);
        }
    }
    __GetCompetitionRankRequest_one_of_decls = new WeakMap();
    leaderboard._GetCompetitionRankRequest = _GetCompetitionRankRequest;
    class _GetCompetitionRankResponse extends pb_1.Message {
        constructor(data) {
            super();
            __GetCompetitionRankResponse_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], __classPrivateFieldGet(this, __GetCompetitionRankResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("elements" in data && data.elements != undefined) {
                    this.elements = data.elements;
                }
            }
        }
        get elements() {
            return pb_1.Message.getRepeatedWrapperField(this, _RankedElement, 1);
        }
        set elements(value) {
            pb_1.Message.setRepeatedWrapperField(this, 1, value);
        }
        static fromObject(data) {
            const message = new _GetCompetitionRankResponse({});
            if (data.elements != null) {
                message.elements = data.elements.map(item => _RankedElement.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.elements != null) {
                data.elements = this.elements.map((item) => item.toObject());
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.elements.length)
                writer.writeRepeatedMessage(1, this.elements, (item) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GetCompetitionRankResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.elements, () => pb_1.Message.addToRepeatedWrapperField(message, 1, _RankedElement.deserialize(reader), _RankedElement));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GetCompetitionRankResponse.deserialize(bytes);
        }
    }
    __GetCompetitionRankResponse_one_of_decls = new WeakMap();
    leaderboard._GetCompetitionRankResponse = _GetCompetitionRankResponse;
    class UnimplementedLeaderboardService {
    }
    UnimplementedLeaderboardService.definition = {
        DeleteLeaderboard: {
            path: "/leaderboard.Leaderboard/DeleteLeaderboard",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _DeleteLeaderboardRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => dependency_1.common._Empty.deserialize(new Uint8Array(bytes))
        },
        UpsertElements: {
            path: "/leaderboard.Leaderboard/UpsertElements",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _UpsertElementsRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => dependency_1.common._Empty.deserialize(new Uint8Array(bytes))
        },
        RemoveElements: {
            path: "/leaderboard.Leaderboard/RemoveElements",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _RemoveElementsRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => dependency_1.common._Empty.deserialize(new Uint8Array(bytes))
        },
        GetLeaderboardLength: {
            path: "/leaderboard.Leaderboard/GetLeaderboardLength",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _GetLeaderboardLengthRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _GetLeaderboardLengthResponse.deserialize(new Uint8Array(bytes))
        },
        GetByRank: {
            path: "/leaderboard.Leaderboard/GetByRank",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _GetByRankRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _GetByRankResponse.deserialize(new Uint8Array(bytes))
        },
        GetRank: {
            path: "/leaderboard.Leaderboard/GetRank",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _GetRankRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _GetRankResponse.deserialize(new Uint8Array(bytes))
        },
        GetByScore: {
            path: "/leaderboard.Leaderboard/GetByScore",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _GetByScoreRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _GetByScoreResponse.deserialize(new Uint8Array(bytes))
        },
        GetCompetitionRank: {
            path: "/leaderboard.Leaderboard/GetCompetitionRank",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _GetCompetitionRankRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _GetCompetitionRankResponse.deserialize(new Uint8Array(bytes))
        }
    };
    leaderboard.UnimplementedLeaderboardService = UnimplementedLeaderboardService;
    class LeaderboardClient extends grpc_1.makeGenericClientConstructor(UnimplementedLeaderboardService.definition, "Leaderboard", {}) {
        constructor(address, credentials, options) {
            super(address, credentials, options);
            this.DeleteLeaderboard = (message, metadata, options, callback) => {
                return super.DeleteLeaderboard(message, metadata, options, callback);
            };
            this.UpsertElements = (message, metadata, options, callback) => {
                return super.UpsertElements(message, metadata, options, callback);
            };
            this.RemoveElements = (message, metadata, options, callback) => {
                return super.RemoveElements(message, metadata, options, callback);
            };
            this.GetLeaderboardLength = (message, metadata, options, callback) => {
                return super.GetLeaderboardLength(message, metadata, options, callback);
            };
            this.GetByRank = (message, metadata, options, callback) => {
                return super.GetByRank(message, metadata, options, callback);
            };
            this.GetRank = (message, metadata, options, callback) => {
                return super.GetRank(message, metadata, options, callback);
            };
            this.GetByScore = (message, metadata, options, callback) => {
                return super.GetByScore(message, metadata, options, callback);
            };
            this.GetCompetitionRank = (message, metadata, options, callback) => {
                return super.GetCompetitionRank(message, metadata, options, callback);
            };
        }
    }
    leaderboard.LeaderboardClient = LeaderboardClient;
})(leaderboard = exports.leaderboard || (exports.leaderboard = {}));
