import * as pkmn from '@pkmn/sets';
import { Dex } from './dex';
// eslint-disable-next-line no-var
var teamGeneratorFactory;
export const Teams = new class Teams {
    pack(team) {
        return new pkmn.Team(team || []).pack();
    }
    unpack(buf) {
        return pkmn.Teams.unpackTeam(buf)?.team || null;
    }
    export(team, options) {
        return new pkmn.Team(team).export();
    }
    exportSet(set) {
        return pkmn.Sets.exportSet(set);
    }
    import(buf) {
        return pkmn.Teams.importTeam(buf, Dex)?.team || null;
    }
    // BUG: SSB3's Easter egg requires we return any here instead of TeamGenerator. *sigh* :(
    getGenerator(format, seed = null) {
        if (!teamGeneratorFactory) {
            throw new Error('getTeamGenerator maybe not be used unless a TeamGeneratorFactory has been set');
        }
        return teamGeneratorFactory.getTeamGenerator(format, seed);
    }
    setGeneratorFactory(factory) {
        teamGeneratorFactory = factory;
        return this;
    }
    generate(format, options = null) {
        return this.getGenerator(format, options?.seed).getTeam(options || undefined);
    }
};
export default Teams;
//# sourceMappingURL=teams.mjs.map