// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';

var Path = require("path");
var Yaml = require("yaml");
var IO$OptolithClient = require("../../System/IO.bs.js");

var Parser = {};

function readUnivYaml(name) {
  return IO$OptolithClient.readFile(Path.join(".", "app", "Database", "univ", name + ".yaml"));
}

function getUnivStaticData(param) {
  return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                  readUnivYaml("Advantages"),
                  readUnivYaml("AnimistForces"),
                  readUnivYaml("BlessedTraditions"),
                  readUnivYaml("Blessings"),
                  readUnivYaml("Cantrips"),
                  readUnivYaml("CombatTechniques")
                ]), (function (param) {
                var combatTechniques = param[5];
                var cantrips = param[4];
                var blessings = param[3];
                var blessedTraditions = param[2];
                var animistForces = param[1];
                var advantages = param[0];
                return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                readUnivYaml("Cultures"),
                                readUnivYaml("Curses"),
                                readUnivYaml("Disadvantages"),
                                readUnivYaml("DominationRituals"),
                                readUnivYaml("ElvenMagicalSongs"),
                                readUnivYaml("Equipment")
                              ]), (function (param) {
                              var items = param[5];
                              var elvenMagicalSongs = param[4];
                              var dominationRituals = param[3];
                              var disadvantages = param[2];
                              var curses = param[1];
                              var cultures = param[0];
                              return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                              readUnivYaml("EquipmentPackages"),
                                              readUnivYaml("ExperienceLevels"),
                                              readUnivYaml("FocusRules"),
                                              readUnivYaml("GeodeRituals"),
                                              readUnivYaml("LiturgicalChantEnhancements"),
                                              readUnivYaml("LiturgicalChants")
                                            ]), (function (param) {
                                            var liturgicalChants = param[5];
                                            var liturgicalChantEnhancements = param[4];
                                            var geodeRituals = param[3];
                                            var focusRules = param[2];
                                            var experienceLevels = param[1];
                                            var equipmentPackages = param[0];
                                            return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                            readUnivYaml("MagicalDances"),
                                                            readUnivYaml("MagicalMelodies"),
                                                            readUnivYaml("MagicalTraditions"),
                                                            readUnivYaml("Professions"),
                                                            readUnivYaml("ProfessionVariants"),
                                                            readUnivYaml("Races")
                                                          ]), (function (param) {
                                                          var races = param[5];
                                                          var professionVariants = param[4];
                                                          var professions = param[3];
                                                          var magicalTraditions = param[2];
                                                          var magicalMelodies = param[1];
                                                          var magicalDances = param[0];
                                                          return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                                          readUnivYaml("RaceVariants"),
                                                                          readUnivYaml("RogueSpells"),
                                                                          readUnivYaml("Skills"),
                                                                          readUnivYaml("SpecialAbilities"),
                                                                          readUnivYaml("SpellEnhancements"),
                                                                          readUnivYaml("Spells")
                                                                        ]), (function (param) {
                                                                        var spells = param[5];
                                                                        var spellEnhancements = param[4];
                                                                        var specialAbilities = param[3];
                                                                        var skills = param[2];
                                                                        var rogueSpells = param[1];
                                                                        var raceVariants = param[0];
                                                                        return IO$OptolithClient.Functor.$less$amp$great(Promise.all([
                                                                                        readUnivYaml("ZibiljaRituals"),
                                                                                        readUnivYaml("Patrons")
                                                                                      ]), (function (param) {
                                                                                      return {
                                                                                              advantages: Yaml.parse(advantages),
                                                                                              animistForces: Yaml.parse(animistForces),
                                                                                              blessedTraditions: Yaml.parse(blessedTraditions),
                                                                                              blessings: Yaml.parse(blessings),
                                                                                              cantrips: Yaml.parse(cantrips),
                                                                                              combatTechniques: Yaml.parse(combatTechniques),
                                                                                              cultures: Yaml.parse(cultures),
                                                                                              curses: Yaml.parse(curses),
                                                                                              disadvantages: Yaml.parse(disadvantages),
                                                                                              dominationRituals: Yaml.parse(dominationRituals),
                                                                                              elvenMagicalSongs: Yaml.parse(elvenMagicalSongs),
                                                                                              items: Yaml.parse(items),
                                                                                              equipmentPackages: Yaml.parse(equipmentPackages),
                                                                                              experienceLevels: Yaml.parse(experienceLevels),
                                                                                              focusRules: Yaml.parse(focusRules),
                                                                                              geodeRituals: Yaml.parse(geodeRituals),
                                                                                              liturgicalChantEnhancements: Yaml.parse(liturgicalChantEnhancements),
                                                                                              liturgicalChants: Yaml.parse(liturgicalChants),
                                                                                              magicalDances: Yaml.parse(magicalDances),
                                                                                              magicalMelodies: Yaml.parse(magicalMelodies),
                                                                                              magicalTraditions: Yaml.parse(magicalTraditions),
                                                                                              patrons: Yaml.parse(param[1]),
                                                                                              professions: Yaml.parse(professions),
                                                                                              professionVariants: Yaml.parse(professionVariants),
                                                                                              races: Yaml.parse(races),
                                                                                              raceVariants: Yaml.parse(raceVariants),
                                                                                              rogueSpells: Yaml.parse(rogueSpells),
                                                                                              skills: Yaml.parse(skills),
                                                                                              specialAbilities: Yaml.parse(specialAbilities),
                                                                                              spellEnhancements: Yaml.parse(spellEnhancements),
                                                                                              spells: Yaml.parse(spells),
                                                                                              zibiljaRituals: Yaml.parse(param[0])
                                                                                            };
                                                                                    }));
                                                                      }));
                                                        }));
                                          }));
                            }));
              }));
}

function readL10nYaml(locale, name) {
  return IO$OptolithClient.readFile(Path.join(".", "app", "Database", locale, name + ".yaml"));
}

function getLocaleSpecificStaticData(locale) {
  return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                  readL10nYaml(locale, "Advantages"),
                  readL10nYaml(locale, "AnimistForces"),
                  readL10nYaml(locale, "ArcaneBardTraditions"),
                  readL10nYaml(locale, "ArcaneDancerTraditions"),
                  readL10nYaml(locale, "ArmorTypes"),
                  readL10nYaml(locale, "Aspects")
                ]), (function (param) {
                var aspects = param[5];
                var armorTypes = param[4];
                var arcaneDancerTraditions = param[3];
                var arcaneBardTraditions = param[2];
                var animistForces = param[1];
                var advantages = param[0];
                return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                readL10nYaml(locale, "Attributes"),
                                readL10nYaml(locale, "BlessedTraditions"),
                                readL10nYaml(locale, "Blessings"),
                                readL10nYaml(locale, "Books"),
                                readL10nYaml(locale, "Brews"),
                                readL10nYaml(locale, "Cantrips")
                              ]), (function (param) {
                              var cantrips = param[5];
                              var brews = param[4];
                              var books = param[3];
                              var blessings = param[2];
                              var blessedTraditions = param[1];
                              var attributes = param[0];
                              return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                              readL10nYaml(locale, "CombatSpecialAbilityGroups"),
                                              readL10nYaml(locale, "CombatTechniqueGroups"),
                                              readL10nYaml(locale, "CombatTechniques"),
                                              readL10nYaml(locale, "Conditions"),
                                              readL10nYaml(locale, "Cultures"),
                                              readL10nYaml(locale, "Curses")
                                            ]), (function (param) {
                                            var curses = param[5];
                                            var cultures = param[4];
                                            var conditions = param[3];
                                            var combatTechniques = param[2];
                                            var combatTechniqueGroups = param[1];
                                            var combatSpecialAbilityGroups = param[0];
                                            return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                            readL10nYaml(locale, "DerivedCharacteristics"),
                                                            readL10nYaml(locale, "Disadvantages"),
                                                            readL10nYaml(locale, "DominationRituals"),
                                                            readL10nYaml(locale, "ElvenMagicalSongs"),
                                                            readL10nYaml(locale, "Equipment"),
                                                            readL10nYaml(locale, "EquipmentGroups")
                                                          ]), (function (param) {
                                                          var equipmentGroups = param[5];
                                                          var items = param[4];
                                                          var elvenMagicalSongs = param[3];
                                                          var dominationRituals = param[2];
                                                          var disadvantages = param[1];
                                                          var derivedCharacteristics = param[0];
                                                          return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                                          readL10nYaml(locale, "EquipmentPackages"),
                                                                          readL10nYaml(locale, "ExperienceLevels"),
                                                                          readL10nYaml(locale, "EyeColors"),
                                                                          readL10nYaml(locale, "FocusRules"),
                                                                          readL10nYaml(locale, "GeodeRituals"),
                                                                          readL10nYaml(locale, "HairColors")
                                                                        ]), (function (param) {
                                                                        var hairColors = param[5];
                                                                        var geodeRituals = param[4];
                                                                        var focusRules = param[3];
                                                                        var eyeColors = param[2];
                                                                        var experienceLevels = param[1];
                                                                        var equipmentPackages = param[0];
                                                                        return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                                                        readL10nYaml(locale, "LiturgicalChantEnhancements"),
                                                                                        readL10nYaml(locale, "LiturgicalChantGroups"),
                                                                                        readL10nYaml(locale, "LiturgicalChants"),
                                                                                        readL10nYaml(locale, "MagicalDances"),
                                                                                        readL10nYaml(locale, "MagicalMelodies"),
                                                                                        readL10nYaml(locale, "MagicalTraditions")
                                                                                      ]), (function (param) {
                                                                                      var magicalTraditions = param[5];
                                                                                      var magicalMelodies = param[4];
                                                                                      var magicalDances = param[3];
                                                                                      var liturgicalChants = param[2];
                                                                                      var liturgicalChantGroups = param[1];
                                                                                      var liturgicalChantEnhancements = param[0];
                                                                                      return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                                                                      readL10nYaml(locale, "OptionalRules"),
                                                                                                      readL10nYaml(locale, "Pacts"),
                                                                                                      readL10nYaml(locale, "Professions"),
                                                                                                      readL10nYaml(locale, "ProfessionVariants"),
                                                                                                      readL10nYaml(locale, "Properties"),
                                                                                                      readL10nYaml(locale, "Races")
                                                                                                    ]), (function (param) {
                                                                                                    var races = param[5];
                                                                                                    var properties = param[4];
                                                                                                    var professionVariants = param[3];
                                                                                                    var professions = param[2];
                                                                                                    var pacts = param[1];
                                                                                                    var optionalRules = param[0];
                                                                                                    return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                                                                                    readL10nYaml(locale, "RaceVariants"),
                                                                                                                    readL10nYaml(locale, "Reaches"),
                                                                                                                    readL10nYaml(locale, "RogueSpells"),
                                                                                                                    readL10nYaml(locale, "SkillGroups"),
                                                                                                                    readL10nYaml(locale, "Skills"),
                                                                                                                    readL10nYaml(locale, "SocialStatuses")
                                                                                                                  ]), (function (param) {
                                                                                                                  var socialStatuses = param[5];
                                                                                                                  var skills = param[4];
                                                                                                                  var skillGroups = param[3];
                                                                                                                  var rogueSpells = param[2];
                                                                                                                  var reaches = param[1];
                                                                                                                  var raceVariants = param[0];
                                                                                                                  return IO$OptolithClient.Monad.$great$great$eq(Promise.all([
                                                                                                                                  readL10nYaml(locale, "SpecialAbilities"),
                                                                                                                                  readL10nYaml(locale, "SpecialAbilityGroups"),
                                                                                                                                  readL10nYaml(locale, "SpellEnhancements"),
                                                                                                                                  readL10nYaml(locale, "SpellGroups"),
                                                                                                                                  readL10nYaml(locale, "Spells"),
                                                                                                                                  readL10nYaml(locale, "States")
                                                                                                                                ]), (function (param) {
                                                                                                                                var states = param[5];
                                                                                                                                var spells = param[4];
                                                                                                                                var spellGroups = param[3];
                                                                                                                                var spellEnhancements = param[2];
                                                                                                                                var specialAbilityGroups = param[1];
                                                                                                                                var specialAbilities = param[0];
                                                                                                                                return IO$OptolithClient.Functor.$less$amp$great(Promise.all([
                                                                                                                                                readL10nYaml(locale, "Subjects"),
                                                                                                                                                readL10nYaml(locale, "Tribes"),
                                                                                                                                                readL10nYaml(locale, "UI"),
                                                                                                                                                readL10nYaml(locale, "ZibiljaRituals"),
                                                                                                                                                readL10nYaml(locale, "Patrons")
                                                                                                                                              ]), (function (param) {
                                                                                                                                              return {
                                                                                                                                                      advantages: Yaml.parse(advantages),
                                                                                                                                                      animistForces: Yaml.parse(animistForces),
                                                                                                                                                      arcaneBardTraditions: Yaml.parse(arcaneBardTraditions),
                                                                                                                                                      arcaneDancerTraditions: Yaml.parse(arcaneDancerTraditions),
                                                                                                                                                      armorTypes: Yaml.parse(armorTypes),
                                                                                                                                                      aspects: Yaml.parse(aspects),
                                                                                                                                                      attributes: Yaml.parse(attributes),
                                                                                                                                                      blessedTraditions: Yaml.parse(blessedTraditions),
                                                                                                                                                      blessings: Yaml.parse(blessings),
                                                                                                                                                      books: Yaml.parse(books),
                                                                                                                                                      brews: Yaml.parse(brews),
                                                                                                                                                      cantrips: Yaml.parse(cantrips),
                                                                                                                                                      combatSpecialAbilityGroups: Yaml.parse(combatSpecialAbilityGroups),
                                                                                                                                                      combatTechniqueGroups: Yaml.parse(combatTechniqueGroups),
                                                                                                                                                      combatTechniques: Yaml.parse(combatTechniques),
                                                                                                                                                      conditions: Yaml.parse(conditions),
                                                                                                                                                      cultures: Yaml.parse(cultures),
                                                                                                                                                      curses: Yaml.parse(curses),
                                                                                                                                                      derivedCharacteristics: Yaml.parse(derivedCharacteristics),
                                                                                                                                                      disadvantages: Yaml.parse(disadvantages),
                                                                                                                                                      dominationRituals: Yaml.parse(dominationRituals),
                                                                                                                                                      elvenMagicalSongs: Yaml.parse(elvenMagicalSongs),
                                                                                                                                                      equipmentGroups: Yaml.parse(equipmentGroups),
                                                                                                                                                      equipmentPackages: Yaml.parse(equipmentPackages),
                                                                                                                                                      experienceLevels: Yaml.parse(experienceLevels),
                                                                                                                                                      eyeColors: Yaml.parse(eyeColors),
                                                                                                                                                      focusRules: Yaml.parse(focusRules),
                                                                                                                                                      geodeRituals: Yaml.parse(geodeRituals),
                                                                                                                                                      hairColors: Yaml.parse(hairColors),
                                                                                                                                                      items: Yaml.parse(items),
                                                                                                                                                      liturgicalChantEnhancements: Yaml.parse(liturgicalChantEnhancements),
                                                                                                                                                      liturgicalChantGroups: Yaml.parse(liturgicalChantGroups),
                                                                                                                                                      liturgicalChants: Yaml.parse(liturgicalChants),
                                                                                                                                                      magicalDances: Yaml.parse(magicalDances),
                                                                                                                                                      magicalMelodies: Yaml.parse(magicalMelodies),
                                                                                                                                                      magicalTraditions: Yaml.parse(magicalTraditions),
                                                                                                                                                      optionalRules: Yaml.parse(optionalRules),
                                                                                                                                                      pacts: Yaml.parse(pacts),
                                                                                                                                                      patrons: Yaml.parse(param[4]),
                                                                                                                                                      professions: Yaml.parse(professions),
                                                                                                                                                      professionVariants: Yaml.parse(professionVariants),
                                                                                                                                                      properties: Yaml.parse(properties),
                                                                                                                                                      races: Yaml.parse(races),
                                                                                                                                                      raceVariants: Yaml.parse(raceVariants),
                                                                                                                                                      reaches: Yaml.parse(reaches),
                                                                                                                                                      rogueSpells: Yaml.parse(rogueSpells),
                                                                                                                                                      skillGroups: Yaml.parse(skillGroups),
                                                                                                                                                      skills: Yaml.parse(skills),
                                                                                                                                                      socialStatuses: Yaml.parse(socialStatuses),
                                                                                                                                                      specialAbilities: Yaml.parse(specialAbilities),
                                                                                                                                                      specialAbilityGroups: Yaml.parse(specialAbilityGroups),
                                                                                                                                                      spellEnhancements: Yaml.parse(spellEnhancements),
                                                                                                                                                      spellGroups: Yaml.parse(spellGroups),
                                                                                                                                                      spells: Yaml.parse(spells),
                                                                                                                                                      states: Yaml.parse(states),
                                                                                                                                                      subjects: Yaml.parse(param[0]),
                                                                                                                                                      tribes: Yaml.parse(param[1]),
                                                                                                                                                      ui: Yaml.parse(param[2]),
                                                                                                                                                      zibiljaRituals: Yaml.parse(param[3])
                                                                                                                                                    };
                                                                                                                                            }));
                                                                                                                              }));
                                                                                                                }));
                                                                                                  }));
                                                                                    }));
                                                                      }));
                                                        }));
                                          }));
                            }));
              }));
}

function getStaticData(locale) {
  return IO$OptolithClient.Functor.$less$amp$great(Promise.all([
                  getUnivStaticData(undefined),
                  getLocaleSpecificStaticData(locale)
                ]), (function (param) {
                var l10n = param[1];
                var univ = param[0];
                return {
                        advantagesL10n: l10n.advantages,
                        advantagesUniv: univ.advantages,
                        animistForcesL10n: l10n.animistForces,
                        animistForcesUniv: univ.animistForces,
                        arcaneBardTraditionsL10n: l10n.arcaneBardTraditions,
                        arcaneDancerTraditionsL10n: l10n.arcaneDancerTraditions,
                        armorTypesL10n: l10n.armorTypes,
                        aspectsL10n: l10n.aspects,
                        attributesL10n: l10n.attributes,
                        blessedTraditionsL10n: l10n.blessedTraditions,
                        blessedTraditionsUniv: univ.blessedTraditions,
                        blessingsL10n: l10n.blessings,
                        blessingsUniv: univ.blessings,
                        booksL10n: l10n.books,
                        brewsL10n: l10n.brews,
                        cantripsL10n: l10n.cantrips,
                        cantripsUniv: univ.cantrips,
                        combatSpecialAbilityGroupsL10n: l10n.combatSpecialAbilityGroups,
                        combatTechniqueGroupsL10n: l10n.combatTechniqueGroups,
                        combatTechniquesL10n: l10n.combatTechniques,
                        combatTechniquesUniv: univ.combatTechniques,
                        conditionsL10n: l10n.conditions,
                        culturesL10n: l10n.cultures,
                        culturesUniv: univ.cultures,
                        cursesL10n: l10n.curses,
                        cursesUniv: univ.curses,
                        derivedCharacteristicsL10n: l10n.derivedCharacteristics,
                        disadvantagesL10n: l10n.disadvantages,
                        disadvantagesUniv: univ.disadvantages,
                        dominationRitualsL10n: l10n.dominationRituals,
                        dominationRitualsUniv: univ.dominationRituals,
                        elvenMagicalSongsL10n: l10n.elvenMagicalSongs,
                        elvenMagicalSongsUniv: univ.elvenMagicalSongs,
                        equipmentL10n: l10n.items,
                        equipmentUniv: univ.items,
                        equipmentGroupsL10n: l10n.equipmentGroups,
                        equipmentPackagesL10n: l10n.equipmentPackages,
                        equipmentPackagesUniv: univ.equipmentPackages,
                        experienceLevelsL10n: l10n.experienceLevels,
                        experienceLevelsUniv: univ.experienceLevels,
                        eyeColorsL10n: l10n.eyeColors,
                        focusRulesL10n: l10n.focusRules,
                        focusRulesUniv: univ.focusRules,
                        geodeRitualsL10n: l10n.geodeRituals,
                        geodeRitualsUniv: univ.geodeRituals,
                        hairColorsL10n: l10n.hairColors,
                        liturgicalChantEnhancementsL10n: l10n.liturgicalChantEnhancements,
                        liturgicalChantEnhancementsUniv: univ.liturgicalChantEnhancements,
                        liturgicalChantGroupsL10n: l10n.liturgicalChantGroups,
                        liturgicalChantsL10n: l10n.liturgicalChants,
                        liturgicalChantsUniv: univ.liturgicalChants,
                        magicalDancesL10n: l10n.magicalDances,
                        magicalDancesUniv: univ.magicalDances,
                        magicalMelodiesL10n: l10n.magicalMelodies,
                        magicalMelodiesUniv: univ.magicalMelodies,
                        magicalTraditionsL10n: l10n.magicalTraditions,
                        magicalTraditionsUniv: univ.magicalTraditions,
                        optionalRulesL10n: l10n.optionalRules,
                        pactsL10n: l10n.pacts,
                        patronsL10n: l10n.patrons,
                        patronsUniv: univ.patrons,
                        professionsL10n: l10n.professions,
                        professionsUniv: univ.professions,
                        professionVariantsL10n: l10n.professionVariants,
                        professionVariantsUniv: univ.professionVariants,
                        propertiesL10n: l10n.properties,
                        racesL10n: l10n.races,
                        racesUniv: univ.races,
                        raceVariantsL10n: l10n.raceVariants,
                        raceVariantsUniv: univ.raceVariants,
                        reachesL10n: l10n.reaches,
                        rogueSpellsL10n: l10n.rogueSpells,
                        rogueSpellsUniv: univ.rogueSpells,
                        skillGroupsL10n: l10n.skillGroups,
                        skillsL10n: l10n.skills,
                        skillsUniv: univ.skills,
                        socialStatusesL10n: l10n.socialStatuses,
                        specialAbilitiesL10n: l10n.specialAbilities,
                        specialAbilitiesUniv: univ.specialAbilities,
                        specialAbilityGroupsL10n: l10n.specialAbilityGroups,
                        spellEnhancementsL10n: l10n.spellEnhancements,
                        spellEnhancementsUniv: univ.spellEnhancements,
                        spellGroupsL10n: l10n.spellGroups,
                        spellsL10n: l10n.spells,
                        spellsUniv: univ.spells,
                        statesL10n: l10n.states,
                        subjectsL10n: l10n.subjects,
                        tribesL10n: l10n.tribes,
                        uiL10n: l10n.ui,
                        zibiljaRitualsL10n: l10n.zibiljaRituals,
                        zibiljaRitualsUniv: univ.zibiljaRituals
                      };
              }));
}

exports.Parser = Parser;
exports.readUnivYaml = readUnivYaml;
exports.getUnivStaticData = getUnivStaticData;
exports.readL10nYaml = readL10nYaml;
exports.getLocaleSpecificStaticData = getLocaleSpecificStaticData;
exports.getStaticData = getStaticData;
/* path Not a pure module */
